[angular-16-irish-monitor]: Fix name of export file of indicators. Fix manageStakeholders if an error is occurred.

This commit is contained in:
Konstantinos Triantafyllou 2024-01-10 14:21:12 +02:00
parent ae4b3b7b95
commit c5759235e4
4 changed files with 158 additions and 139 deletions

View File

@ -4,20 +4,23 @@
<div *ngIf="isCurator()" class="uk-margin-remove-bottom uk-margin-medium-top"> <div *ngIf="isCurator()" class="uk-margin-remove-bottom uk-margin-medium-top">
<slider-tabs [type]="'dynamic'" (activeEmitter)="tab = $event"> <slider-tabs [type]="'dynamic'" (activeEmitter)="tab = $event">
<slider-tab tabTitle="All" [tabId]="'all'" [active]="tab === 'all'"></slider-tab> <slider-tab tabTitle="All" [tabId]="'all'" [active]="tab === 'all'"></slider-tab>
<slider-tab tabTitle="Profile templates" [tabId]="'templates'" [active]="tab === 'templates'"></slider-tab> <slider-tab tabTitle="Profile templates" [tabId]="'templates'"
[active]="tab === 'templates'"></slider-tab>
<slider-tab tabTitle="Profiles" [tabId]="'profiles'" [active]="tab === 'profiles'"></slider-tab> <slider-tab tabTitle="Profiles" [tabId]="'profiles'" [active]="tab === 'profiles'"></slider-tab>
</slider-tabs> </slider-tabs>
</div> </div>
</div> </div>
<div actions> <div actions>
<div class="uk-section-xsmall"> <div class="uk-section-xsmall">
<div class="uk-flex uk-flex-center uk-flex-wrap uk-flex-middle" [ngClass]="properties.dashboard == 'irish' ? 'uk-flex-between@m' : 'uk-flex-right@m'"> <div class="uk-flex uk-flex-center uk-flex-wrap uk-flex-middle"
[ngClass]="properties.dashboard == 'irish' ? 'uk-flex-between@m' : 'uk-flex-right@m'">
<div *ngIf="properties.dashboard == 'irish'" class="uk-width-medium uk-margin-small-bottom"> <div *ngIf="properties.dashboard == 'irish'" class="uk-width-medium uk-margin-small-bottom">
<div input type="select" placeholder="Type" <div input type="select" placeholder="Type"
[options]="typeOptions" [formInput]="filters.get('type')"> [options]="typeOptions" [formInput]="filters.get('type')">
</div> </div>
</div> </div>
<div search-input [searchControl]="filters.get('keyword')" [expandable]="true" placeholder="Search Profiles" searchInputClass="outer" <div search-input [searchControl]="filters.get('keyword')" [expandable]="true"
placeholder="Search Profiles" searchInputClass="outer"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1 uk-flex uk-flex-right"></div> class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1 uk-flex uk-flex-right"></div>
</div> </div>
</div> </div>
@ -31,18 +34,23 @@
<div *ngIf="tab != 'profiles' && isCurator()" class="uk-section"> <div *ngIf="tab != 'profiles' && isCurator()" class="uk-section">
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-small-bottom"> <div class="uk-flex uk-flex-middle uk-flex-between uk-margin-small-bottom">
<h4 class="uk-margin-remove">Profile Templates</h4> <h4 class="uk-margin-remove">Profile Templates</h4>
<paging-no-load *ngIf="displayDefaultStakeholders.length > pageSize" <paging-no-load *ngIf="displayDefaultStakeholders?.length > pageSize"
(pageChange)="updateCurrentTemplatesPage($event)" (pageChange)="updateCurrentTemplatesPage($event)"
[currentPage]="currentTemplatesPage" [size]="pageSize" [currentPage]="currentTemplatesPage" [size]="pageSize"
[totalResults]="displayDefaultStakeholders.length"> [totalResults]="displayDefaultStakeholders.length">
</paging-no-load> </paging-no-load>
</div> </div>
<div class="uk-grid uk-child-width-1-3@l uk-child-width-1-2@m uk-child-width-1-1 uk-grid-match" uk-grid> <div class="uk-grid uk-child-width-1-3@l uk-child-width-1-2@m uk-child-width-1-1 uk-grid-match"
<ng-template ngFor [ngForOf]="displayDefaultStakeholders.slice((currentTemplatesPage-1)*pageSize, currentTemplatesPage*pageSize)" let-stakeholder> uk-grid>
<ng-container *ngTemplateOutlet="stakeholderBox; context: {stakeholder:stakeholder}"></ng-container> <ng-template ngFor
[ngForOf]="displayDefaultStakeholders.slice((currentTemplatesPage-1)*pageSize, currentTemplatesPage*pageSize)"
let-stakeholder>
<ng-container
*ngTemplateOutlet="stakeholderBox; context: {stakeholder:stakeholder}"></ng-container>
</ng-template> </ng-template>
<div *ngIf="!loading && isCurator()"> <div *ngIf="!loading && isCurator()">
<ng-container *ngTemplateOutlet="newBox; context: {text:'Create a new default profile.', isDefault:true}"></ng-container> <ng-container
*ngTemplateOutlet="newBox; context: {text:'Create a new default profile.', isDefault:true}"></ng-container>
</div> </div>
</div> </div>
</div> </div>
@ -54,15 +62,19 @@
<div *ngIf="tab != 'templates' && isManager()" class="uk-section"> <div *ngIf="tab != 'templates' && isManager()" class="uk-section">
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-small-bottom"> <div class="uk-flex uk-flex-middle uk-flex-between uk-margin-small-bottom">
<h4 class="uk-margin-remove">Profiles</h4> <h4 class="uk-margin-remove">Profiles</h4>
<paging-no-load *ngIf="displayStakeholders.length > pageSize" <paging-no-load *ngIf="displayStakeholders?.length > pageSize"
(pageChange)="updateCurrentPage($event)" (pageChange)="updateCurrentPage($event)"
[currentPage]="currentPage" [size]="pageSize" [currentPage]="currentPage" [size]="pageSize"
[totalResults]="displayStakeholders.length"> [totalResults]="displayStakeholders.length">
</paging-no-load> </paging-no-load>
</div> </div>
<div class="uk-grid uk-grid-match uk-child-width-1-3@l uk-child-width-1-2@m uk-child-width-1-1" uk-grid> <div class="uk-grid uk-grid-match uk-child-width-1-3@l uk-child-width-1-2@m uk-child-width-1-1"
<ng-template ngFor [ngForOf]="displayStakeholders.slice((currentPage-1)*pageSize, currentPage*pageSize)" let-stakeholder> uk-grid>
<ng-container *ngTemplateOutlet="stakeholderBox; context: {stakeholder:stakeholder}"></ng-container> <ng-template ngFor
[ngForOf]="displayStakeholders.slice((currentPage-1)*pageSize, currentPage*pageSize)"
let-stakeholder>
<ng-container
*ngTemplateOutlet="stakeholderBox; context: {stakeholder:stakeholder}"></ng-container>
</ng-template> </ng-template>
<div *ngIf="!loading && isCurator()"> <div *ngIf="!loading && isCurator()">
<ng-container *ngTemplateOutlet="newBox; context: {text:'Create a new profile by selecting the type ('+typesAsString+') and ' + <ng-container *ngTemplateOutlet="newBox; context: {text:'Create a new profile by selecting the type ('+typesAsString+') and ' +
@ -79,10 +91,12 @@
<div class="uk-card uk-card-default uk-card-body uk-position-relative" [ngClass]="stakeholder.type"> <div class="uk-card uk-card-default uk-card-body uk-position-relative" [ngClass]="stakeholder.type">
<div class="uk-position-top-right uk-margin-small-right uk-margin-small-top"> <div class="uk-position-top-right uk-margin-small-right uk-margin-small-top">
<a class="uk-link-reset uk-flex uk-flex-middle"> <a class="uk-link-reset uk-flex uk-flex-middle">
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(stakeholder.visibility)" ratio="0.6"></icon> <icon *ngIf="showVisibility" [flex]="true"
[name]="stakeholderUtils.visibilityIcon.get(stakeholder.visibility)" ratio="0.6"></icon>
<icon [flex]="true" name="more_vert"></icon> <icon [flex]="true" name="more_vert"></icon>
</a> </a>
<div #element class="uk-dropdown" uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0;"> <div #element class="uk-dropdown"
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0;">
<ul class="uk-nav uk-dropdown-nav"> <ul class="uk-nav uk-dropdown-nav">
<li> <li>
<a (click)="editStakeholder(stakeholder, !stakeholder.defaultId); hide(element)">Edit</a> <a (click)="editStakeholder(stakeholder, !stakeholder.defaultId); hide(element)">Edit</a>
@ -97,7 +111,8 @@
<div class="uk-flex uk-flex-middle"> <div class="uk-flex uk-flex-middle">
<icon [flex]="true" [name]="v.icon" ratio="0.6"></icon> <icon [flex]="true" [name]="v.icon" ratio="0.6"></icon>
<span class="uk-margin-small-left uk-width-expand">{{v.label}}</span> <span class="uk-margin-small-left uk-width-expand">{{v.label}}</span>
<icon *ngIf="stakeholder.visibility === v.value" [flex]="true" name="done" class="uk-text-secondary" ratio="0.8"></icon> <icon *ngIf="stakeholder.visibility === v.value" [flex]="true" name="done"
class="uk-text-secondary" ratio="0.8"></icon>
</div> </div>
</a> </a>
</li> </li>
@ -124,7 +139,8 @@
</ng-template> </ng-template>
<ng-template #newBox let-text="text" let-isDefault="isDefault"> <ng-template #newBox let-text="text" let-isDefault="isDefault">
<ng-container *ngIf="!loading"> <ng-container *ngIf="!loading">
<div class="uk-card uk-card-default uk-text-center uk-card-body clickable" (click)="editStakeholder(null, isDefault)"> <div class="uk-card uk-card-default uk-text-center uk-card-body clickable"
(click)="editStakeholder(null, isDefault)">
<div class="uk-text-small uk-text-muted"> <div class="uk-text-small uk-text-muted">
{{text}} {{text}}
</div> </div>
@ -137,7 +153,8 @@
</ng-container> </ng-container>
</ng-template> </ng-template>
<modal-alert #editStakeholderModal [large]="true" classTitle="uk-background-primary uk-light" <modal-alert #editStakeholderModal [large]="true" classTitle="uk-background-primary uk-light"
(alertOutput)="editStakeholderComponent.save(callback)" (cancelOutput)="editStakeholderComponent.removePhoto()" (alertOutput)="editStakeholderComponent.save(callback)"
(cancelOutput)="editStakeholderComponent.removePhoto()"
[okDisabled]="editStakeholderComponent.disabled"> [okDisabled]="editStakeholderComponent.disabled">
<div class="uk-height-large uk-position-relative" *ngIf="editStakeholderComponent.loading"> <div class="uk-height-large uk-position-relative" *ngIf="editStakeholderComponent.loading">
<loading class="uk-position-center"></loading> <loading class="uk-position-center"></loading>

View File

@ -40,8 +40,8 @@ export class ManageStakeholdersComponent extends StakeholderBaseComponent implem
/** /**
* Filtered Stakeholders * Filtered Stakeholders
*/ */
public displayDefaultStakeholders: Stakeholder[]; public displayDefaultStakeholders: Stakeholder[] = [];
public displayStakeholders: Stakeholder[]; public displayStakeholders: Stakeholder[] = [];
/** /**
* Top filters * Top filters
*/ */

View File

@ -1372,7 +1372,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
let topic = this.stakeholder ? this.stakeholder.topics[this.topicIndex] : null; let topic = this.stakeholder ? this.stakeholder.topics[this.topicIndex] : null;
let category = topic ? topic.categories[this.categoryIndex] : null; let category = topic ? topic.categories[this.categoryIndex] : null;
let subCategory = category ? category.subCategories[this.subcategoryIndex] : null; let subCategory = category ? category.subCategories[subcategoryIndex] : null;
var jsonFileUrl = window.URL.createObjectURL(new Blob([JSON.stringify(indicators)], {type: 'application/json'})); var jsonFileUrl = window.URL.createObjectURL(new Blob([JSON.stringify(indicators)], {type: 'application/json'}));
var a = window.document.createElement('a'); var a = window.document.createElement('a');

View File

@ -8,7 +8,9 @@ import {StakeholderService} from "../../monitor/services/stakeholder.service";
import {Observable, zip} from "rxjs"; import {Observable, zip} from "rxjs";
@Injectable() @Injectable({
providedIn: 'root'
})
export class AdminDashboardGuard { export class AdminDashboardGuard {
constructor(private router: Router, constructor(private router: Router,