[Monitor Dashboard | Trunk]: Fix a bug with indicator edit form. Change hr -> Chart Settings

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57889 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantinos Triantafyllou 2019-12-15 22:02:39 +00:00
parent 498019914b
commit 79d00f7f35
2 changed files with 15 additions and 6 deletions

View File

@ -253,7 +253,9 @@
label="Chart Size">
</div>
</div>
<hr class="uk-margin-large-top uk-margin-large-bottom">
<h5 class="uk-text-bold uk-margin-top uk-margin-bottom">
Chart Settings
</h5>
<div *ngIf="indicatorPaths" formArrayName="indicatorPaths">
<div *ngFor="let indicatorPath of indicatorPaths.controls; let i=index"
[formGroup]="indicatorPath">
@ -297,7 +299,7 @@
</div>
<div *ngIf="indicator && indicator.indicatorPaths[i] && indicator.indicatorPaths[i].safeResourceUrl"
class="uk-margin-medium-top uk-position-relative">
<div *ngIf="hasDifference(i) && !indicatorPath.invalid"
<div *ngIf="(hasDifference(i)) && !indicatorPath.invalid"
class="uk-width-1-1 uk-height-medium refresh-iframe">
<div class="uk-position-relative uk-height-1-1">
<div class="uk-position-center md-color-white uk-text-center clickable"

View File

@ -290,9 +290,9 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}
));
let index = this.indicatorPaths.length - 1;
this.urlSubscriptions.push(this.indicatorPaths.at(index).valueChanges.subscribe(value => {
if (this.indicatorPaths.at(index).valid) {
let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.statisticsService.getChartSource(value.url), value.url);
this.urlSubscriptions.push(this.indicatorPaths.at(index).get('url').valueChanges.subscribe(value => {
if (this.indicatorPaths.at(index).get('url').valid) {
let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.statisticsService.getChartSource(value), value);
let parameters = this.getParametersAsFormArray(indicatorPath);
(this.indicatorPaths.at(index) as FormGroup).setControl('parameters', parameters);
if (!this.indicator.indicatorPaths[index]) {
@ -420,7 +420,14 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}
hasDifference(index: number): boolean {
return this.indicator.indicatorPaths[index].safeResourceUrl.toString() !==
let hasDifference = false;
this.indicatorPaths.at(index).value.parameters.forEach((parameter) => {
if(parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
hasDifference = true;
return;
}
});
return hasDifference || this.indicator.indicatorPaths[index].safeResourceUrl.toString() !==
this.getSecureUrlByStakeHolder(this.indicator.indicatorPaths[index]).toString();
}