diff --git a/src/app/monitor/monitor.component.html b/src/app/monitor/monitor.component.html index a4c0277..e888805 100644 --- a/src/app/monitor/monitor.component.html +++ b/src/app/monitor/monitor.component.html @@ -1,7 +1,7 @@ - +
@@ -34,7 +33,7 @@
{{number.name}}

- {{numberResults.get(i) | number}} + {{numberResults.get(i) | number}}

@@ -43,7 +42,7 @@
-
@@ -61,11 +60,11 @@
+ [src]="chartsActiveType.get(i).safeResourceUrl" + class="uk-width-1-1 uk-height-medium"> + [src]="chartsActiveType.get(i).safeResourceUrl" + class="uk-width-1-1 uk-height-medium">
diff --git a/src/app/monitor/monitor.component.ts b/src/app/monitor/monitor.component.ts index 760d81f..1fd52cb 100644 --- a/src/app/monitor/monitor.component.ts +++ b/src/app/monitor/monitor.component.ts @@ -48,6 +48,7 @@ export class MonitorComponent implements OnInit, OnDestroy { private statisticsService: StatisticsService, private sidebarOpenService: SidebarOpenService, private seoService: SEOService, + private cdr: ChangeDetectorRef, private sanitizer: DomSanitizer) { this.errorCodes = new ErrorCodes(); this.errorMessages = new ErrorMessagesComponent(); @@ -202,9 +203,11 @@ export class MonitorComponent implements OnInit, OnDestroy { }); this.activeSubCategory.charts.forEach((chart, index) => { if (chart.indicatorPaths.length > 0) { + chart.indicatorPaths[0].safeResourceUrl = this.getUrlByStakeHolder(chart.indicatorPaths[0]); this.chartsActiveType.set(index, chart.indicatorPaths[0]); } }); + this.cdr.detectChanges(); } public getUrlByStakeHolder(indicatorPath: IndicatorPath) { @@ -212,7 +215,9 @@ export class MonitorComponent implements OnInit, OnDestroy { } public setActiveChart(index, type: string) { - this.chartsActiveType.set(index, this.activeSubCategory.charts[index].indicatorPaths.filter(indicatorPath => indicatorPath.type === type)[0]); + let activeChart = this.activeSubCategory.charts[index].indicatorPaths.filter(indicatorPath => indicatorPath.type === type)[0]; + activeChart.safeResourceUrl = this.getUrlByStakeHolder(activeChart); + this.chartsActiveType.set(index, activeChart); } private navigateToError() { diff --git a/src/app/utils/entities/stakeholder.ts b/src/app/utils/entities/stakeholder.ts index 06bd177..4f758db 100644 --- a/src/app/utils/entities/stakeholder.ts +++ b/src/app/utils/entities/stakeholder.ts @@ -1,3 +1,5 @@ +import {SafeResourceUrl} from "@angular/platform-browser"; + export class Stakeholder { id: string; type: string; @@ -336,6 +338,7 @@ export class IndicatorPath { type: string; // for charts is type of chart {table, bar, column, etc} source:string;// for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake} url: string; + safeResourceUrl: SafeResourceUrl; // initialize on front end jsonPath:string[]; constructor(type: string, source:string, url: string, jsonPath:string[]){ this.type = type;