[MonitorDashboard | Trunk]: Keep chart Url for edit of indicator.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57883 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
f9f411970b
commit
d7a84cb3aa
|
@ -1,13 +1,5 @@
|
||||||
import {ChangeDetectorRef, Component, OnDestroy, OnInit} from '@angular/core';
|
import {ChangeDetectorRef, Component, OnDestroy, OnInit} from '@angular/core';
|
||||||
import {
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
ActivatedRoute,
|
|
||||||
NavigationEnd,
|
|
||||||
NavigationError,
|
|
||||||
NavigationStart,
|
|
||||||
RouteConfigLoadEnd,
|
|
||||||
Router
|
|
||||||
} from '@angular/router';
|
|
||||||
|
|
||||||
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
||||||
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
|
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
|
||||||
import {Session, User} from './openaireLibrary/login/utils/helper.class';
|
import {Session, User} from './openaireLibrary/login/utils/helper.class';
|
||||||
|
@ -109,7 +101,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
((this.properties.environment == "beta") ? "https://beta.admin.connect.openaire.eu" : "https://admin.explore.openaire.eu") + "/dashboard?communityId=openaire", "", true, [], [], {}))
|
((this.properties.environment == "beta") ? "https://beta.admin.connect.openaire.eu" : "https://admin.explore.openaire.eu") + "/dashboard?communityId=openaire", "", true, [], [], {}))
|
||||||
|
|
||||||
}
|
}
|
||||||
if(this.user) {
|
if (this.user) {
|
||||||
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@
|
||||||
<div class="disable-sortable"
|
<div class="disable-sortable"
|
||||||
[class.uk-width-1-3@m]="grid"
|
[class.uk-width-1-3@m]="grid"
|
||||||
[class.uk-width-1-1@m]="!grid">
|
[class.uk-width-1-1@m]="!grid">
|
||||||
<div class="md-card clickable uk-sortable-nodrag" (click)="createIndicatorOpen()">
|
<div class="md-card clickable uk-sortable-nodrag" (click)="editChartIndicatorOpen()">
|
||||||
<div class="md-card-toolbar">
|
<div class="md-card-toolbar">
|
||||||
<div class="md-card-toolbar-heading-text"
|
<div class="md-card-toolbar-heading-text"
|
||||||
[class.uk-flex-middle]="!grid"
|
[class.uk-flex-middle]="!grid"
|
||||||
|
@ -252,14 +252,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr class="uk-margin-large-top uk-margin-large-bottom">
|
<hr class="uk-margin-large-top uk-margin-large-bottom">
|
||||||
<div *ngIf="urls" formArrayName="urls">
|
|
||||||
<div dashboard-input class="uk-form-row" *ngFor="let chartUrl of urls.controls;"
|
|
||||||
[formInput]="chartUrl"
|
|
||||||
label="Chart Url"></div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="indicatorPaths" formArrayName="indicatorPaths">
|
<div *ngIf="indicatorPaths" formArrayName="indicatorPaths">
|
||||||
<div *ngFor="let indicatorPath of indicatorPaths.controls; let i=index"
|
<div *ngFor="let indicatorPath of indicatorPaths.controls; let i=index"
|
||||||
[formGroup]="indicatorPath">
|
[formGroup]="indicatorPath">
|
||||||
|
<div dashboard-input class="uk-form-row"
|
||||||
|
[formInput]="indicatorPath.get('url')"
|
||||||
|
label="Chart Url"></div>
|
||||||
<div formArrayName="parameters">
|
<div formArrayName="parameters">
|
||||||
<div *ngIf="getParameter(i, 'title')" class="uk-form-row">
|
<div *ngIf="getParameter(i, 'title')" class="uk-form-row">
|
||||||
<div dashboard-input
|
<div dashboard-input
|
||||||
|
@ -295,7 +293,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="indicator.indicatorPaths[i].safeResourceUrl"
|
<div *ngIf="indicator && indicator.indicatorPaths[i] && indicator.indicatorPaths[i].safeResourceUrl"
|
||||||
class="uk-margin-medium-top uk-position-relative">
|
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">
|
class="uk-width-1-1 uk-height-medium refresh-iframe">
|
||||||
|
|
|
@ -54,6 +54,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
*/
|
*/
|
||||||
public grid: boolean = true;
|
public grid: boolean = true;
|
||||||
private subscriptions: any[] = [];
|
private subscriptions: any[] = [];
|
||||||
|
private urlSubscriptions: any[] = [];
|
||||||
@ViewChild('editIndicatorModal') editIndicatorModal: AlertModal;
|
@ViewChild('editIndicatorModal') editIndicatorModal: AlertModal;
|
||||||
@ViewChild('deleteIndicatorModal') deleteIndicatorModal: AlertModal;
|
@ViewChild('deleteIndicatorModal') deleteIndicatorModal: AlertModal;
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
this.subscriptions.forEach(value => {
|
this.subscriptions.forEach(value => {
|
||||||
if (value instanceof Subscriber) {
|
if (value instanceof Subscriber) {
|
||||||
value.unsubscribe();
|
value.unsubscribe();
|
||||||
} else if(value instanceof Function){
|
} else if (value instanceof Function) {
|
||||||
value();
|
value();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -88,7 +89,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
reordered.push(items.item(i).id);
|
reordered.push(items.item(i).id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.reorderIndicators(list.current.id , reordered);
|
this.reorderIndicators(list.current.id, reordered);
|
||||||
};
|
};
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'moved', '#chart', callback));
|
this.subscriptions.push(UIkit.util.on(document, 'moved', '#chart', callback));
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'moved', '#number', callback));
|
this.subscriptions.push(UIkit.util.on(document, 'moved', '#number', callback));
|
||||||
|
@ -97,7 +98,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (this.canEdit) {
|
if (this.canEdit) {
|
||||||
if(changes.topicIndex || changes.categoryIndex || changes.subcategoryIndex) {
|
if (changes.topicIndex || changes.categoryIndex || changes.subcategoryIndex) {
|
||||||
this.buildFilters();
|
this.buildFilters();
|
||||||
}
|
}
|
||||||
this.filterCharts();
|
this.filterCharts();
|
||||||
|
@ -124,16 +125,16 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
status: this.fb.control('all'),
|
status: this.fb.control('all'),
|
||||||
keyword: this.fb.control('')
|
keyword: this.fb.control('')
|
||||||
});
|
});
|
||||||
this.subscriptions.push(this.filters.get('chartType').valueChanges.subscribe( value => {
|
this.subscriptions.push(this.filters.get('chartType').valueChanges.subscribe(value => {
|
||||||
this.onChartTypeChange(value);
|
this.onChartTypeChange(value);
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(this.filters.get('privacy').valueChanges.subscribe( value => {
|
this.subscriptions.push(this.filters.get('privacy').valueChanges.subscribe(value => {
|
||||||
this.onPrivacyChange(value);
|
this.onPrivacyChange(value);
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(this.filters.get('status').valueChanges.subscribe( value => {
|
this.subscriptions.push(this.filters.get('status').valueChanges.subscribe(value => {
|
||||||
this.onStatusChange(value);
|
this.onStatusChange(value);
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(this.filters.get('keyword').valueChanges.subscribe( value => {
|
this.subscriptions.push(this.filters.get('keyword').valueChanges.subscribe(value => {
|
||||||
this.onKeywordChange(value);
|
this.onKeywordChange(value);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -159,7 +160,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
}
|
}
|
||||||
|
|
||||||
onPrivacyChange(value) {
|
onPrivacyChange(value) {
|
||||||
console.log(this.numbers);
|
|
||||||
this.displayCharts = this.filterPrivacy(this.charts, value);
|
this.displayCharts = this.filterPrivacy(this.charts, value);
|
||||||
this.displayNumbers = this.filterPrivacy(this.numbers, value);
|
this.displayNumbers = this.filterPrivacy(this.numbers, value);
|
||||||
}
|
}
|
||||||
|
@ -243,10 +243,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex];
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
public get urls(): FormArray {
|
|
||||||
return this.indicatorFb.get('urls') as FormArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get indicatorPaths(): FormArray {
|
public get indicatorPaths(): FormArray {
|
||||||
return this.indicatorFb.get('indicatorPaths') as FormArray;
|
return this.indicatorFb.get('indicatorPaths') as FormArray;
|
||||||
}
|
}
|
||||||
|
@ -259,67 +255,45 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
return this.getParameters(index).controls.filter(control => control.value.key === key)[0] as FormControl;
|
return this.getParameters(index).controls.filter(control => control.value.key === key)[0] as FormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
private getSecureUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
||||||
return this.sanitizer.bypassSecurityTrustResourceUrl(
|
return this.sanitizer.bypassSecurityTrustResourceUrl(
|
||||||
this.statisticsService.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(indicatorPath)));
|
this.statisticsService.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(indicatorPath)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public addUrl() {
|
private getUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
||||||
this.urls.push(this.fb.control('', [Validators.required,
|
return this.statisticsService.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(indicatorPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
public addIndicatorPath(value: string = '', parameters: FormArray = new FormArray([])) {
|
||||||
|
this.indicatorPaths.push(this.fb.group({
|
||||||
|
url: this.fb.control(value, [Validators.required,
|
||||||
Validators.pattern('https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.' +
|
Validators.pattern('https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.' +
|
||||||
'[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.' +
|
'[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.' +
|
||||||
'[a-zA-Z0-9]+\.[^\s]{2,}')])
|
'[a-zA-Z0-9]+\.[^\s]{2,}')]),
|
||||||
|
parameters: parameters
|
||||||
|
}
|
||||||
|
));
|
||||||
|
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);
|
||||||
|
let parameters = this.getParametersAsFormArray(indicatorPath);
|
||||||
|
(this.indicatorPaths.at(index) as FormGroup).setControl('parameters', parameters);
|
||||||
|
if (!this.indicator.indicatorPaths[index]) {
|
||||||
|
this.indicator.indicatorPaths[index] = indicatorPath;
|
||||||
|
this.indicator.indicatorPaths[index].safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
||||||
|
} else {
|
||||||
|
indicatorPath.safeResourceUrl = this.indicator.indicatorPaths[index].safeResourceUrl;
|
||||||
|
this.indicator.indicatorPaths[index] = indicatorPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public createIndicatorOpen() {
|
private getParametersAsFormArray(indicatorPath: IndicatorPath): FormArray {
|
||||||
this.indicator = null;
|
|
||||||
this.indicatorFb = this.fb.group({
|
|
||||||
id: this.fb.control(null),
|
|
||||||
name: this.fb.control('', Validators.required),
|
|
||||||
description: this.fb.control(''),
|
|
||||||
isPublic: this.fb.control(false),
|
|
||||||
isActive: this.fb.control(false),
|
|
||||||
urls: this.fb.array([]),
|
|
||||||
width: this.fb.control('small', Validators.required),
|
|
||||||
});
|
|
||||||
this.addUrl();
|
|
||||||
this.editIndicatorModal.alertTitle = 'Create a new chart Indicator';
|
|
||||||
this.editIndicatorModal.cancelButtonText = 'Cancel';
|
|
||||||
this.editIndicatorModal.okButtonText = 'Next';
|
|
||||||
this.editIndicatorModal.okButtonLeft = false;
|
|
||||||
this.editIndicatorModal.alertMessage = false;
|
|
||||||
this.editIndicatorModal.stayOpen = true;
|
|
||||||
this.editIndicatorModal.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
public createChartIndicator() {
|
|
||||||
this.indicator = new Indicator(
|
|
||||||
this.indicatorFb.value.name,
|
|
||||||
this.indicatorFb.value.description,
|
|
||||||
'chart',
|
|
||||||
this.indicatorFb.value.width,
|
|
||||||
this.indicatorFb.value.isActive,
|
|
||||||
this.indicatorFb.value.isPublic,
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
this.indicatorFb.value.urls.forEach(url => {
|
|
||||||
this.indicator.indicatorPaths.push(
|
|
||||||
this.indicatorUtils.generateIndicatorByChartUrl(this.statisticsService.getChartSource(url), url));
|
|
||||||
});
|
|
||||||
this.editChartIndicatorOpen();
|
|
||||||
}
|
|
||||||
|
|
||||||
public editChartIndicatorOpen(id = null) {
|
|
||||||
this.index = (id)?this.charts.findIndex(value => value._id === id):-1;
|
|
||||||
if (this.index !== -1) {
|
|
||||||
this.indicator = HelperFunctions.copy(this.charts[this.index]);
|
|
||||||
}
|
|
||||||
let indicatorPaths = this.fb.array([]);
|
|
||||||
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
|
||||||
let parameters = this.fb.array([]);
|
let parameters = this.fb.array([]);
|
||||||
if (indicatorPath.parameters) {
|
if (indicatorPath.parameters) {
|
||||||
console.info(indicatorPath.parameters);
|
|
||||||
Object.keys(indicatorPath.parameters).forEach(key => {
|
Object.keys(indicatorPath.parameters).forEach(key => {
|
||||||
if (this.indicatorUtils.ignoredParameters.indexOf(key) === -1) {
|
if (this.indicatorUtils.ignoredParameters.indexOf(key) === -1) {
|
||||||
if (this.indicatorUtils.parametersValidators.has(key)) {
|
if (this.indicatorUtils.parametersValidators.has(key)) {
|
||||||
|
@ -336,37 +310,58 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
indicatorPaths.push(this.fb.group({
|
return parameters;
|
||||||
parameters: parameters
|
}
|
||||||
}));
|
|
||||||
|
public editChartIndicatorOpen(id = null) {
|
||||||
|
this.urlSubscriptions.forEach(value => {
|
||||||
|
if(value instanceof Subscriber) {
|
||||||
|
value.unsubscribe();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
this.index = (id) ? this.charts.findIndex(value => value._id === id) : -1;
|
||||||
|
if (this.index !== -1) {
|
||||||
|
this.indicator = HelperFunctions.copy(this.charts[this.index]);
|
||||||
this.indicatorFb = this.fb.group({
|
this.indicatorFb = this.fb.group({
|
||||||
id: this.fb.control(this.indicator._id),
|
id: this.fb.control(this.indicator._id),
|
||||||
name: this.fb.control(this.indicator.name/*, Validators.required*/),
|
name: this.fb.control(this.indicator.name/*, Validators.required*/),
|
||||||
description: this.fb.control(this.indicator.description),
|
description: this.fb.control(this.indicator.description),
|
||||||
isPublic: this.fb.control(this.indicator.isPublic),
|
isPublic: this.fb.control(this.indicator.isPublic),
|
||||||
isActive: this.fb.control(this.indicator.isActive),
|
isActive: this.fb.control(this.indicator.isActive),
|
||||||
indicatorPaths: indicatorPaths,
|
indicatorPaths: this.fb.array([]),
|
||||||
width: this.fb.control(this.indicator.width),
|
width: this.fb.control(this.indicator.width),
|
||||||
});
|
});
|
||||||
if(this.index === -1) {
|
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
||||||
this.editIndicatorModal.okButtonText = 'Save';
|
this.addIndicatorPath(this.getUrlByStakeHolder(indicatorPath), this.getParametersAsFormArray(indicatorPath));
|
||||||
this.editIndicatorModal.stayOpen = false;
|
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath)
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
this.indicator = new Indicator('', '', 'chart', 'small', false, false, []);
|
||||||
|
this.indicatorFb = this.fb.group({
|
||||||
|
id: this.fb.control(null),
|
||||||
|
name: this.fb.control(''),
|
||||||
|
description: this.fb.control(''),
|
||||||
|
isPublic: this.fb.control(false),
|
||||||
|
isActive: this.fb.control(false),
|
||||||
|
indicatorPaths: this.fb.array([]),
|
||||||
|
width: this.fb.control('small', Validators.required),
|
||||||
|
});
|
||||||
|
this.addIndicatorPath();
|
||||||
|
}
|
||||||
this.editIndicatorModal.cancelButtonText = 'Cancel';
|
this.editIndicatorModal.cancelButtonText = 'Cancel';
|
||||||
this.editIndicatorModal.okButtonText = 'Save Changes';
|
|
||||||
this.editIndicatorModal.okButtonLeft = false;
|
this.editIndicatorModal.okButtonLeft = false;
|
||||||
this.editIndicatorModal.alertMessage = false;
|
this.editIndicatorModal.alertMessage = false;
|
||||||
this.editIndicatorModal.open();
|
if (this.index === -1) {
|
||||||
|
this.editIndicatorModal.alertTitle = 'Create a new chart Indicator';
|
||||||
|
this.editIndicatorModal.okButtonText = 'Save';
|
||||||
|
} else {
|
||||||
|
this.editIndicatorModal.okButtonText = 'Save Changes';
|
||||||
}
|
}
|
||||||
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
this.editIndicatorModal.open();
|
||||||
indicatorPath.safeResourceUrl = this.getUrlByStakeHolder(indicatorPath)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saveIndicator() {
|
saveIndicator() {
|
||||||
if(this.indicator) {
|
if (this.indicator.type === 'chart') {
|
||||||
if(this.indicator.type === 'chart') {
|
|
||||||
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.indicatorFb.value, this.indicator.indicatorPaths);
|
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.indicatorFb.value, this.indicator.indicatorPaths);
|
||||||
}
|
}
|
||||||
let path = [
|
let path = [
|
||||||
|
@ -387,9 +382,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
}, error => {
|
}, error => {
|
||||||
this.indicatorFb = null;
|
this.indicatorFb = null;
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
this.createChartIndicator();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reorderIndicators(type: string, indicatorIds: string[]) {
|
reorderIndicators(type: string, indicatorIds: string[]) {
|
||||||
|
@ -412,25 +404,19 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
}
|
}
|
||||||
|
|
||||||
hasDifference(index: number): boolean {
|
hasDifference(index: number): boolean {
|
||||||
let hasDifference = false;
|
return this.indicator.indicatorPaths[index].safeResourceUrl.toString() !==
|
||||||
this.indicatorPaths.at(index).value.parameters.forEach((parameter) => {
|
this.getSecureUrlByStakeHolder(this.indicator.indicatorPaths[index]).toString();
|
||||||
if(parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
|
|
||||||
hasDifference = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return hasDifference;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshIndicator() {
|
refreshIndicator() {
|
||||||
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.indicatorFb.value, this.indicator.indicatorPaths);
|
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.indicatorFb.value, this.indicator.indicatorPaths);
|
||||||
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
||||||
indicatorPath.safeResourceUrl = this.getUrlByStakeHolder(indicatorPath)
|
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteIndicatorOpen(id: string, type: string = 'chart') {
|
deleteIndicatorOpen(id: string, type: string = 'chart') {
|
||||||
if(type === 'chart') {
|
if (type === 'chart') {
|
||||||
this.indicator = this.charts.find(value => value._id == id);
|
this.indicator = this.charts.find(value => value._id == id);
|
||||||
} else {
|
} else {
|
||||||
this.indicator = this.numbers.find(value => value._id == id);
|
this.indicator = this.numbers.find(value => value._id == id);
|
||||||
|
@ -450,8 +436,8 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id,
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id,
|
||||||
this.indicator._id
|
this.indicator._id
|
||||||
];
|
];
|
||||||
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe( () => {
|
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(() => {
|
||||||
if(this.indicator.type === 'chart') {
|
if (this.indicator.type === 'chart') {
|
||||||
this.charts.splice(this.index, 1);
|
this.charts.splice(this.index, 1);
|
||||||
} else {
|
} else {
|
||||||
this.numbers.splice(this.index, 1);
|
this.numbers.splice(this.index, 1);
|
||||||
|
|
Loading…
Reference in New Issue