[Monitor Dashboard | Trunk]: Add indicator path remove for loop

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@60234 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantinos Triantafyllou 2021-01-14 10:02:55 +00:00
parent ecba49c727
commit 5db6152749
1 changed files with 81 additions and 86 deletions

View File

@ -454,7 +454,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}
public removeJsonPath(i: number, j: number) {
if(this.getJsonPath(i).enabled) {
if (this.getJsonPath(i).enabled) {
this.getJsonPath(i).removeAt(j);
}
}
@ -475,7 +475,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
setTimeout(() => {
if (this.indicator.defaultId === null) {
this.getJsonPath(index).enable();
if(dirty) {
if (dirty) {
this.getJsonPath(index).markAsDirty();
}
}
@ -542,7 +542,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
source: this.fb.control(source, Validators.required)
}
));
for (let index = 0; index < this.numberIndicatorPaths.length; index++) {
let index = this.numberIndicatorPaths.length - 1;
if (this.numberIndicatorPaths.at(index).get('url').valid) {
this.validateJsonPath(index);
}
@ -604,7 +604,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.numberIndicatorPaths.at(index).get('source').disable();
}
}
}
public addChartIndicatorPath(value: string = '', parameters: FormArray = new FormArray([]), disableUrl: boolean = false, type: string = null) {
this.chartIndicatorPaths.push(this.fb.group({
@ -613,12 +612,10 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
type: this.fb.control(type)
}
));
let index = this.chartIndicatorPaths.length - 1;
if (disableUrl) {
for (let index = 0; index < this.chartIndicatorPaths.length; index++) {
this.chartIndicatorPaths.at(index).get('url').disable();
}
} else {
for (let index = 0; index < this.chartIndicatorPaths.length; index++) {
this.urlSubscriptions.push(this.chartIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => {
if (this.chartIndicatorPaths.at(index).get('url').valid) {
let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.statisticsService.getChartSource(value), value, this.chartIndicatorPaths.at(index).get('type').value, this.stakeholder);
@ -645,9 +642,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
} else {
this.urlParameterizedMessage = null;
}
})
);
}
}));
}
}