Production release June 2024 [Monitor Dashboard, Irish Monitor] #45
|
@ -1,5 +1,5 @@
|
||||||
import {Component, OnInit, QueryList, ViewChildren} from "@angular/core";
|
import {Component, OnInit, QueryList, ViewChildren} from "@angular/core";
|
||||||
import {ManageStakeholders} from "../../monitor/entities/stakeholder";
|
import {ManageStakeholders, StakeholderType} from "../../monitor/entities/stakeholder";
|
||||||
import {Session} from "../../login/utils/helper.class";
|
import {Session} from "../../login/utils/helper.class";
|
||||||
import {StakeholderBaseComponent} from "../utils/stakeholder-base.component";
|
import {StakeholderBaseComponent} from "../utils/stakeholder-base.component";
|
||||||
import {StakeholderService} from "../../monitor/services/stakeholder.service";
|
import {StakeholderService} from "../../monitor/services/stakeholder.service";
|
||||||
|
@ -75,7 +75,7 @@ export class ManageAllComponent extends StakeholderBaseComponent implements OnIn
|
||||||
* Filters
|
* Filters
|
||||||
*/
|
*/
|
||||||
public keyword: string;
|
public keyword: string;
|
||||||
public type: string = 'all';
|
public type: StakeholderType | 'all' = 'all';
|
||||||
public types: Option[] = [{value: 'all', label: 'All'}].concat(this.stakeholderUtils.types);
|
public types: Option[] = [{value: 'all', label: 'All'}].concat(this.stakeholderUtils.types);
|
||||||
@ViewChildren(ManageStakeholdersComponent) manageStakeholdersList: QueryList<ManageStakeholdersComponent>;
|
@ViewChildren(ManageStakeholdersComponent) manageStakeholdersList: QueryList<ManageStakeholdersComponent>;
|
||||||
|
|
||||||
|
|
|
@ -565,12 +565,9 @@
|
||||||
<div *ngIf="getParameter(i, 'yAxisTitle')" input class="uk-width-1-3@s"
|
<div *ngIf="getParameter(i, 'yAxisTitle')" input class="uk-width-1-3@s"
|
||||||
[formInput]="getParameter(i, 'yAxisTitle').get('value')"
|
[formInput]="getParameter(i, 'yAxisTitle').get('value')"
|
||||||
placeholder="Y-Axis Title"></div>
|
placeholder="Y-Axis Title"></div>
|
||||||
<div *ngIf="getParameter(i, 'data_title_0')" input class="uk-width-1-3@s"
|
<div *ngFor="let dataTitle of dataTitles(i); let j=index" input class="uk-width-1-3@s"
|
||||||
[formInput]="getParameter(i, 'data_title_0').get('value')"
|
[formInput]="getParameter(i, dataTitle).get('value')"
|
||||||
placeholder="Data Title"></div>
|
[placeholder]="'Data Title ' + (j + 1)"></div>
|
||||||
<div *ngIf="getParameter(i, 'data_title_1')" input class="uk-width-1-3@s"
|
|
||||||
[formInput]="getParameter(i, 'data_title_1').get('value')"
|
|
||||||
placeholder="Data Title"></div>
|
|
||||||
<div *ngIf="getParameter(i, 'start_year')" input class="uk-width-1-3@s"
|
<div *ngIf="getParameter(i, 'start_year')" input class="uk-width-1-3@s"
|
||||||
[formInput]="getParameter(i, 'start_year').get('value')"
|
[formInput]="getParameter(i, 'start_year').get('value')"
|
||||||
placeholder="Year (From)"></div>
|
placeholder="Year (From)"></div>
|
||||||
|
|
|
@ -380,26 +380,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getNumberClassBySize(size: IndicatorSize) {
|
|
||||||
if (size === 'small') {
|
|
||||||
return 'uk-width-medium@m uk-width-1-1';
|
|
||||||
} else if (size === 'medium') {
|
|
||||||
return 'uk-width-1-4@l uk-width-1-2@m uk-width-1-1';
|
|
||||||
} else {
|
|
||||||
return 'uk-width-1-2@l uk-width-1-1@m uk-width-1-1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public getChartClassBySize(size: IndicatorSize) {
|
|
||||||
if (size === 'small') {
|
|
||||||
return 'uk-width-1-3@xl uk-width-1-2@m uk-width-1-1';
|
|
||||||
} else if (size === 'medium') {
|
|
||||||
return 'uk-width-1-2@l uk-width-1-1';
|
|
||||||
} else {
|
|
||||||
return 'uk-width-1-1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public addJsonPath(index: number) {
|
public addJsonPath(index: number) {
|
||||||
if (index == 0 && this.getJsonPath(index).getRawValue()[index].indexOf(",") != -1) {
|
if (index == 0 && this.getJsonPath(index).getRawValue()[index].indexOf(",") != -1) {
|
||||||
//if in the first path there are more than one paths comma separated, split them and autogenerate the forms
|
//if in the first path there are more than one paths comma separated, split them and autogenerate the forms
|
||||||
|
@ -487,6 +467,19 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
return this.getParameters(index, type).controls.filter(control => control.value.key === key)[0] as UntypedFormControl;
|
return this.getParameters(index, type).controls.filter(control => control.value.key === key)[0] as UntypedFormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public dataTitles(index: number): string[] {
|
||||||
|
let formControl: UntypedFormControl;
|
||||||
|
let i = 0;
|
||||||
|
let dataTitles: string[] = [];
|
||||||
|
formControl = this.getParameter(index, 'data_title_' + i);
|
||||||
|
while(formControl != null) {
|
||||||
|
dataTitles.push('data_title_' + i);
|
||||||
|
i++;
|
||||||
|
formControl = this.getParameter(index, 'data_title_' + i);
|
||||||
|
}
|
||||||
|
return dataTitles;
|
||||||
|
}
|
||||||
|
|
||||||
private getSecureUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
private getSecureUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
||||||
return this.sanitizer.bypassSecurityTrustResourceUrl(
|
return this.sanitizer.bypassSecurityTrustResourceUrl(
|
||||||
this.indicatorUtils.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)));
|
this.indicatorUtils.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)));
|
||||||
|
@ -1283,30 +1276,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
migrateFromOldImportJsonFile(charts) {
|
|
||||||
// first section contains numbers
|
|
||||||
// second contains charts
|
|
||||||
let hasNumbers = false;
|
|
||||||
for (let chart of charts) {
|
|
||||||
if (chart['type'] == 'number') {
|
|
||||||
hasNumbers = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let chartsSection = (hasNumbers ? 1 : 0); // no numbers: first sections contains charts
|
|
||||||
for (let chart of charts) {
|
|
||||||
if (chart['sectionIndex'] == null) {
|
|
||||||
chart['sectionIndex'] = chart['type'] == 'chart' ? chartsSection : 0;
|
|
||||||
}
|
|
||||||
if (chart.url && chart.jsonPath) {
|
|
||||||
chart.indicatorPaths = [{url: chart.url, jsonPath: chart.jsonPath}];
|
|
||||||
} else if(chart.url) {
|
|
||||||
chart.indicatorPaths = [{url: chart.url}];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return charts;
|
|
||||||
}
|
|
||||||
|
|
||||||
importIndicatorsAndSave(stakeholder: Stakeholder, charts: any[]) {
|
importIndicatorsAndSave(stakeholder: Stakeholder, charts: any[]) {
|
||||||
let sectionsToSave: Section[] = [];
|
let sectionsToSave: Section[] = [];
|
||||||
let countIndicators = 0;
|
let countIndicators = 0;
|
||||||
|
@ -1321,7 +1290,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}
|
}
|
||||||
// name description additionalDescription, height, width, visibility
|
// name description additionalDescription, height, width, visibility
|
||||||
let duplicates = 0;
|
let duplicates = 0;
|
||||||
charts = this.migrateFromOldImportJsonFile(charts);
|
|
||||||
for (let chart of charts) {
|
for (let chart of charts) {
|
||||||
chart.visibility = this.showVisibility ? chart.visibility : this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities);
|
chart.visibility = this.showVisibility ? chart.visibility : this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities);
|
||||||
if (!sectionsToSave[chart['sectionIndex']]) {
|
if (!sectionsToSave[chart['sectionIndex']]) {
|
||||||
|
|
|
@ -2,6 +2,8 @@ import {Directive} from "@angular/core";
|
||||||
import {BaseComponent} from "../../sharedComponents/base/base.component";
|
import {BaseComponent} from "../../sharedComponents/base/base.component";
|
||||||
import {IndicatorUtils, StakeholderUtils} from "./indicator-utils";
|
import {IndicatorUtils, StakeholderUtils} from "./indicator-utils";
|
||||||
import {ConnectHelper} from "../../connect/connectHelper";
|
import {ConnectHelper} from "../../connect/connectHelper";
|
||||||
|
import {IndicatorSize} from "../../monitor/entities/stakeholder";
|
||||||
|
import {statsToolParser} from "./cache-indicators/cache-indicators";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export abstract class StakeholderBaseComponent extends BaseComponent {
|
export abstract class StakeholderBaseComponent extends BaseComponent {
|
||||||
|
@ -51,4 +53,24 @@ export abstract class StakeholderBaseComponent extends BaseComponent {
|
||||||
export abstract class IndicatorStakeholderBaseComponent extends StakeholderBaseComponent {
|
export abstract class IndicatorStakeholderBaseComponent extends StakeholderBaseComponent {
|
||||||
|
|
||||||
indicatorUtils: IndicatorUtils = new IndicatorUtils();
|
indicatorUtils: IndicatorUtils = new IndicatorUtils();
|
||||||
|
|
||||||
|
public getNumberClassBySize(size: IndicatorSize): string {
|
||||||
|
if (size === 'small') {
|
||||||
|
return 'uk-width-medium';
|
||||||
|
} else if (size === 'medium') {
|
||||||
|
return 'uk-width-large';
|
||||||
|
} else {
|
||||||
|
return 'uk-width-1-2@m uk-width-1-1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public getChartClassBySize(size: IndicatorSize): string {
|
||||||
|
if (size === 'small') {
|
||||||
|
return 'uk-width-1-3@xl uk-width-1-2@m uk-width-1-1';
|
||||||
|
} else if (size === 'medium') {
|
||||||
|
return 'uk-width-1-2@l uk-width-1-1';
|
||||||
|
} else {
|
||||||
|
return 'uk-width-1-1';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ export class BrowseStakeholderBaseComponent<T> extends StakeholderBaseComponent
|
||||||
parameters = {};
|
parameters = {};
|
||||||
keywordControl: FormControl;
|
keywordControl: FormControl;
|
||||||
hasPublications: boolean = true;
|
hasPublications: boolean = true;
|
||||||
|
hasOpenAccess: boolean = true;
|
||||||
|
|
||||||
/* Services */
|
/* Services */
|
||||||
protected layoutService: LayoutService;
|
protected layoutService: LayoutService;
|
||||||
|
|
|
@ -386,26 +386,6 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
|
||||||
return indicators.filter(indicator => this.hasPermission(indicator.visibility)).length;
|
return indicators.filter(indicator => this.hasPermission(indicator.visibility)).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getNumberClassBySize(size: IndicatorSize) {
|
|
||||||
if (size === 'small') {
|
|
||||||
return 'uk-width-medium@m uk-width-1-1';
|
|
||||||
} else if (size === 'medium') {
|
|
||||||
return 'uk-width-1-4@l uk-width-1-2@m uk-width-1-1';
|
|
||||||
} else {
|
|
||||||
return 'uk-width-1-2@l uk-width-1-1@m uk-width-1-1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public getChartClassBySize(size: IndicatorSize): string {
|
|
||||||
if (size === 'small') {
|
|
||||||
return 'uk-width-1-3@xl uk-width-1-2@m uk-width-1-1';
|
|
||||||
} else if (size === 'medium') {
|
|
||||||
return 'uk-width-1-2@l uk-width-1-1';
|
|
||||||
} else {
|
|
||||||
return 'uk-width-1-1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public printReport() {
|
public printReport() {
|
||||||
window.print();
|
window.print();
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ export class StakeholderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
getStakeholders(url: string, type: string = null, defaultId: string = null): Observable<(Stakeholder & StakeholderInfo)[]> {
|
getStakeholders(url: string, type: string = null, defaultId: string = null): Observable<(Stakeholder & StakeholderInfo)[]> {
|
||||||
return this.http.get<Stakeholder[]>(url + '/stakeholder' + ((type) ? ('?type=' + type) : '') + ((!type && defaultId) ? ('?defaultId=' + defaultId) : ''), CustomOptions.registryOptions()).pipe(map(stakeholders => {
|
return this.http.get<Stakeholder[]>(url + '/stakeholder' + ((type) ? ('?type=' + type) : (defaultId?'?defaultId=' + defaultId:'')) + ((type && defaultId) ? ('&defaultId=' + defaultId) : ''), CustomOptions.registryOptions()).pipe(map(stakeholders => {
|
||||||
return HelperFunctions.copy(Stakeholder.checkIsUpload(stakeholders));
|
return HelperFunctions.copy(Stakeholder.checkIsUpload(stakeholders));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue