From 08cd0a90cd5630cb17e69211209bfccb5e1f576e Mon Sep 17 00:00:00 2001 From: Konstantinos Triantafyllou Date: Fri, 18 Dec 2020 11:01:58 +0000 Subject: [PATCH] [Monitor Dashboard | Trunk]: 1. Number Indicator form arrows on jsonpath. 2. Add warning message on logoUrl. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@60162 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../edit-stakeholder.component.ts | 33 +++++++++++++++---- src/app/topic/indicators.component.html | 2 +- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/app/general/edit-stakeholder/edit-stakeholder.component.ts b/src/app/general/edit-stakeholder/edit-stakeholder.component.ts index 72a1392..218cde3 100644 --- a/src/app/general/edit-stakeholder/edit-stakeholder.component.ts +++ b/src/app/general/edit-stakeholder/edit-stakeholder.component.ts @@ -74,11 +74,11 @@ declare var UIkit; -
+
-
- Note: Prefer urls like "https://example.com/my-secure-image.png" instead - of "http://example.com/my-image.png". +
+ Note: Prefer urls like "https://example.com/my-secure-image.png" + instead of "http://example.com/my-image.png". Browsers may not load non secure content.
@@ -112,6 +112,7 @@ export class EditStakeholderComponent implements OnDestroy { @Input() public disableAlias: boolean = false; public stakeholderFb: FormGroup; + public secure: boolean = false; public stakeholderUtils: StakeholderUtils = new StakeholderUtils(); public defaultStakeholdersOptions: Option[]; public defaultStakeholders: Stakeholder[]; @@ -173,8 +174,28 @@ export class EditStakeholderComponent implements OnDestroy { type: this.fb.control(this.stakeholder.type, Validators.required), topics: this.fb.control(this.stakeholder.topics), isUpload: this.fb.control(this.stakeholder.isUpload), - logoUrl: this.fb.control(this.stakeholder.logoUrl, StringUtils.urlValidator()), + logoUrl: this.fb.control(this.stakeholder.logoUrl), }); + if (this.stakeholder.isUpload) { + this.stakeholderFb.get('logoUrl').clearValidators(); + this.stakeholderFb.get('logoUrl').updateValueAndValidity(); + } else { + this.stakeholderFb.get('logoUrl').setValidators([StringUtils.urlValidator()]); + this.stakeholderFb.get('logoUrl').updateValueAndValidity(); + } + this.subscriptions.push(this.stakeholderFb.get('isUpload').valueChanges.subscribe(value => { + if (value == true) { + this.stakeholderFb.get('logoUrl').clearValidators(); + this.stakeholderFb.updateValueAndValidity(); + } else { + this.stakeholderFb.get('logoUrl').setValidators([StringUtils.urlValidator()]); + this.stakeholderFb.updateValueAndValidity(); + } + })); + this.secure = (!this.stakeholderFb.get('logoUrl').value || this.stakeholderFb.get('logoUrl').value.includes('https://')); + this.subscriptions.push(this.stakeholderFb.get('logoUrl').valueChanges.subscribe(value => { + this.secure = (!value || value.includes('https://')); + })); this.initPhoto(); if (!isDefault) { this.subscriptions.push(this.stakeholderFb.get('type').valueChanges.subscribe(value => { @@ -362,7 +383,7 @@ export class EditStakeholderComponent implements OnDestroy { this.stakeholderFb.get('isUpload').setValue(false); this.stakeholderFb.get('isUpload').markAsDirty(); this.removePhoto(); - this.stakeholderFb.setControl('logoUrl', this.fb.control(null)); + this.stakeholderFb.get('logoUrl').setValue(null); if (this.stakeholder.isUpload) { this.deleteCurrentPhoto = true; } diff --git a/src/app/topic/indicators.component.html b/src/app/topic/indicators.component.html index f015c5f..7909f4d 100644 --- a/src/app/topic/indicators.component.html +++ b/src/app/topic/indicators.component.html @@ -296,7 +296,7 @@ - +