Revision 58694
Added by Konstantinos Triantafyllou almost 4 years ago
indicators.component.ts | ||
---|---|---|
15 | 15 |
import {AlertModal} from "../openaireLibrary/utils/modal/alert"; |
16 | 16 |
import {StatisticsService} from "../utils/services/statistics.service"; |
17 | 17 |
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class"; |
18 |
import {DomSanitizer} from "@angular/platform-browser"; |
|
18 |
import {DomSanitizer, SafeResourceUrl} from "@angular/platform-browser";
|
|
19 | 19 |
import {StakeholderService} from "../services/stakeholder.service"; |
20 | 20 |
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; |
21 | 21 |
import {Subscriber} from "rxjs"; |
... | ... | |
69 | 69 |
* Toggles |
70 | 70 |
*/ |
71 | 71 |
public grid: boolean = true; |
72 |
/** Safe Urls*/ |
|
73 |
public safeUrls: Map<string, SafeResourceUrl> = new Map<string, SafeResourceUrl>([]); |
|
74 |
|
|
72 | 75 |
private subscriptions: any[] = []; |
73 | 76 |
private urlSubscriptions: any[] = []; |
74 | 77 |
@ViewChild('editModal') editModal: AlertModal; |
... | ... | |
224 | 227 |
this.displayCharts.forEach(section => { |
225 | 228 |
section.indicators.forEach(indicator => { |
226 | 229 |
indicator.indicatorPaths.forEach(indicatorPath => { |
227 |
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath); |
|
230 |
let url = this.indicatorUtils.getFullUrl(indicatorPath); |
|
231 |
if (!this.safeUrls.get('url')) { |
|
232 |
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath); |
|
233 |
this.safeUrls.set(url, indicatorPath.safeResourceUrl); |
|
234 |
} |
|
228 | 235 |
}); |
229 | 236 |
}) |
230 | 237 |
}); |
... | ... | |
475 | 482 |
} |
476 | 483 |
this.filterCharts(); |
477 | 484 |
this.indicatorFb = null; |
485 |
UIkit.notification('Section has been successfully saved', { |
|
486 |
status: 'success', |
|
487 |
timeout: 3000, |
|
488 |
pos: 'top-left' |
|
489 |
}); |
|
478 | 490 |
}, error => { |
479 | 491 |
this.indicatorFb = null; |
492 |
UIkit.notification(error.error.message, { |
|
493 |
status: 'danger', |
|
494 |
timeout: 3000, |
|
495 |
pos: 'top-left' |
|
496 |
}); |
|
480 | 497 |
}); |
481 | 498 |
} |
482 | 499 |
|
... | ... | |
549 | 566 |
this.numbers.find(section => section._id === this.section._id).indicators.splice(this.index, 1); |
550 | 567 |
this.filterNumbers(); |
551 | 568 |
} |
569 |
UIkit.notification('Indicator has been successfully deleted', { |
|
570 |
status: 'success', |
|
571 |
timeout: 3000, |
|
572 |
pos: 'top-left' |
|
573 |
}); |
|
574 |
}, error => { |
|
575 |
UIkit.notification(error.error.message, { |
|
576 |
status: 'danger', |
|
577 |
timeout: 3000, |
|
578 |
pos: 'top-left' |
|
579 |
}); |
|
552 | 580 |
}); |
553 | 581 |
} |
554 | 582 |
|
... | ... | |
563 | 591 |
]; |
564 | 592 |
this.stakeholderService.toggleStatus(this.properties.monitorServiceAPIURL, path).subscribe(isActive => { |
565 | 593 |
indicator.isActive = isActive; |
594 |
UIkit.notification('Indicator has been successfully changed to ' + (isActive?'active':'inactive'), { |
|
595 |
status: 'success', |
|
596 |
timeout: 3000, |
|
597 |
pos: 'top-left' |
|
598 |
}); |
|
599 |
}, error => { |
|
600 |
UIkit.notification(error.error.message, { |
|
601 |
status: 'danger', |
|
602 |
timeout: 3000, |
|
603 |
pos: 'top-left' |
|
604 |
}); |
|
566 | 605 |
}); |
567 | 606 |
} |
568 | 607 |
|
... | ... | |
577 | 616 |
]; |
578 | 617 |
this.stakeholderService.toggleAccess(this.properties.monitorServiceAPIURL, path).subscribe(isPublic => { |
579 | 618 |
indicator.isPublic = isPublic; |
619 |
UIkit.notification('Indicator has been successfully changed to ' + (isPublic?'public':'private'), { |
|
620 |
status: 'success', |
|
621 |
timeout: 3000, |
|
622 |
pos: 'top-left' |
|
623 |
}); |
|
624 |
}, error => { |
|
625 |
UIkit.notification(error.error.message, { |
|
626 |
status: 'danger', |
|
627 |
timeout: 3000, |
|
628 |
pos: 'top-left' |
|
629 |
}); |
|
580 | 630 |
}); |
581 | 631 |
} |
582 | 632 |
|
Also available in: Unified diff
[Monitor Dashboard | Trunk]: Add notifications to all levels. Save safeResourceUrl to a map