Production release March 2024 [EXPLORE] #35
|
@ -271,6 +271,12 @@
|
||||||
[options]="indicatorUtils.formats" type="select">
|
[options]="indicatorUtils.formats" type="select">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="uk-width-1-2@m" formArrayName="parameters">
|
||||||
|
<div *ngIf="getParameter(i, 'statsProfile', 'number') && statsProfiles" input [formInput]="getParameter(i, 'statsProfile', 'number').get('value')"
|
||||||
|
[type]="'select'"
|
||||||
|
[options]="statsProfiles"
|
||||||
|
placeholder="Stats Profile"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div formArrayName="jsonPath" class="uk-width-1-1">
|
<div formArrayName="jsonPath" class="uk-width-1-1">
|
||||||
|
@ -327,6 +333,20 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="hasDifference(i, 'number')"
|
||||||
|
class="uk-width-1-1 uk-height-1-1 refresh-indicator">
|
||||||
|
<div class="uk-position-relative uk-height-1-1">
|
||||||
|
<a class="uk-position-center uk-text-center uk-text-small uk-link-reset"
|
||||||
|
[class.uk-disabled]="numberIndicatorPaths.at(i).get('url').invalid"
|
||||||
|
(click)="refreshIndicator('number')">
|
||||||
|
<div>
|
||||||
|
<icon name="refresh"></icon>
|
||||||
|
</div>
|
||||||
|
<span>Calculate</span>
|
||||||
|
<span *ngIf="numberIndicatorPaths.at(i).get('result').errors?.validating">Calculating...</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -400,6 +420,8 @@
|
||||||
placeholder="Year (From)"></div>
|
placeholder="Year (From)"></div>
|
||||||
<div *ngIf="getParameter(i, 'end_year')" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'end_year').get('value')"
|
<div *ngIf="getParameter(i, 'end_year')" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'end_year').get('value')"
|
||||||
placeholder="Year (To)"></div>
|
placeholder="Year (To)"></div>
|
||||||
|
<div *ngIf="getParameter(i, 'statsProfile') && statsProfiles" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'statsProfile').get('value')"
|
||||||
|
[type]="'select'" [options]="statsProfiles" placeholder="Stats Profile"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="indicator && indicator.indicatorPaths[i] && indicator.indicatorPaths[i].safeResourceUrl"
|
<div *ngIf="indicator && indicator.indicatorPaths[i] && indicator.indicatorPaths[i].safeResourceUrl"
|
||||||
|
|
|
@ -44,6 +44,7 @@ import {NotificationService} from "../../notifications/notification.service";
|
||||||
import {NotificationHandler} from "../../utils/notification-handler";
|
import {NotificationHandler} from "../../utils/notification-handler";
|
||||||
import {IndicatorStakeholderBaseComponent} from "../utils/stakeholder-base.component";
|
import {IndicatorStakeholderBaseComponent} from "../utils/stakeholder-base.component";
|
||||||
import {properties} from "../../../../environments/environment";
|
import {properties} from "../../../../environments/environment";
|
||||||
|
import {StatsProfilesService} from "../utils/services/stats-profiles.service";
|
||||||
|
|
||||||
declare var UIkit;
|
declare var UIkit;
|
||||||
declare var copy;
|
declare var copy;
|
||||||
|
@ -68,6 +69,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
@Input()
|
@Input()
|
||||||
public user: User = null;
|
public user: User = null;
|
||||||
public preview: string;
|
public preview: string;
|
||||||
|
public statsProfiles = [];
|
||||||
public numberIndicatorFb: UntypedFormGroup;
|
public numberIndicatorFb: UntypedFormGroup;
|
||||||
public chartIndicatorFb: UntypedFormGroup;
|
public chartIndicatorFb: UntypedFormGroup;
|
||||||
public chartSections: UntypedFormArray;
|
public chartSections: UntypedFormArray;
|
||||||
|
@ -119,6 +121,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
constructor(private layoutService: LayoutService,
|
constructor(private layoutService: LayoutService,
|
||||||
private stakeholderService: StakeholderService,
|
private stakeholderService: StakeholderService,
|
||||||
private statisticsService: StatisticsService,
|
private statisticsService: StatisticsService,
|
||||||
|
private statsProfileService: StatsProfilesService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: UntypedFormBuilder,
|
private fb: UntypedFormBuilder,
|
||||||
protected _router: Router,
|
protected _router: Router,
|
||||||
|
@ -137,7 +140,16 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.setCharts();
|
this.setCharts();
|
||||||
this.setNumbers();
|
this.setNumbers();
|
||||||
this.initReorder();
|
this.initReorder();
|
||||||
})
|
});
|
||||||
|
if (this.isCurator) {
|
||||||
|
this.subscriptions.push(this.statsProfileService.getStatsProfiles().subscribe(statsProfiles => {
|
||||||
|
this.statsProfiles = [null].concat(statsProfiles);
|
||||||
|
}, error => {
|
||||||
|
this.statsProfiles = [];
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
this.statsProfiles = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
@ -400,7 +412,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.getJsonPath(index).disable();
|
this.getJsonPath(index).disable();
|
||||||
}
|
}
|
||||||
indicatorPath.get('result').setErrors({validating: true});
|
indicatorPath.get('result').setErrors({validating: true});
|
||||||
this.subscriptions.push(this.statisticsService.getNumbers(null, indicatorPath.get('url').value).subscribe(response => {
|
this.subscriptions.push(this.statisticsService.getNumbers(indicatorPath.get('source').value, this.indicatorUtils.getFullUrl(this.stakeholder, this.indicator.indicatorPaths[index])).subscribe(response => {
|
||||||
let result = JSON.parse(JSON.stringify(response));
|
let result = JSON.parse(JSON.stringify(response));
|
||||||
this.getJsonPath(index).controls.forEach(jsonPath => {
|
this.getJsonPath(index).controls.forEach(jsonPath => {
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -448,12 +460,16 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
return this.section.indicators[this.index].indicatorPaths[index].jsonPath;
|
return this.section.indicators[this.index].indicatorPaths[index].jsonPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getParameters(index: number): UntypedFormArray {
|
public getParameters(index: number, type: IndicatorType = 'chart'): UntypedFormArray {
|
||||||
|
if(type === 'chart') {
|
||||||
return this.chartIndicatorPaths.at(index).get('parameters') as UntypedFormArray;
|
return this.chartIndicatorPaths.at(index).get('parameters') as UntypedFormArray;
|
||||||
|
} else {
|
||||||
|
return this.numberIndicatorPaths.at(index).get('parameters') as UntypedFormArray;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getParameter(index: number, key: string): UntypedFormControl {
|
public getParameter(index: number, key: string, type: IndicatorType = 'chart'): UntypedFormControl {
|
||||||
return this.getParameters(index).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;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSecureUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
private getSecureUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
||||||
|
@ -474,6 +490,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
jsonPath: jsonPath,
|
jsonPath: jsonPath,
|
||||||
result: this.fb.control(0, Validators.required),
|
result: this.fb.control(0, Validators.required),
|
||||||
source: this.fb.control(source, Validators.required),
|
source: this.fb.control(source, Validators.required),
|
||||||
|
parameters: parameters,
|
||||||
format: this.fb.control(format, Validators.required)
|
format: this.fb.control(format, Validators.required)
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
@ -506,6 +523,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
if (indicatorPath.source) {
|
if (indicatorPath.source) {
|
||||||
this.numberIndicatorPaths.at(index).get('source').setValue(indicatorPath.source);
|
this.numberIndicatorPaths.at(index).get('source').setValue(indicatorPath.source);
|
||||||
}
|
}
|
||||||
|
(this.numberIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', this.getParametersAsFormArray(indicatorPath));
|
||||||
if (indicatorPath.jsonPath.length > 1 && this.getJsonPath(index).length == 1) {
|
if (indicatorPath.jsonPath.length > 1 && this.getJsonPath(index).length == 1) {
|
||||||
let paths = indicatorPath.jsonPath;
|
let paths = indicatorPath.jsonPath;
|
||||||
for (let i = 0; i < paths.length; i++) {
|
for (let i = 0; i < paths.length; i++) {
|
||||||
|
@ -568,8 +586,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}
|
}
|
||||||
this.checkForSchemaEnhancements(this.chartIndicatorPaths.at(index).get('url').value);
|
this.checkForSchemaEnhancements(this.chartIndicatorPaths.at(index).get('url').value);
|
||||||
(this.chartIndicatorPaths.at(index) as UntypedFormGroup).get('type').setValue(indicatorPath.type);
|
(this.chartIndicatorPaths.at(index) as UntypedFormGroup).get('type').setValue(indicatorPath.type);
|
||||||
let parameters = this.getParametersAsFormArray(indicatorPath);
|
(this.chartIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', this.getParametersAsFormArray(indicatorPath));
|
||||||
(this.chartIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', parameters);
|
|
||||||
if (!this.indicator.indicatorPaths[index]) {
|
if (!this.indicator.indicatorPaths[index]) {
|
||||||
this.indicator.indicatorPaths[index] = indicatorPath;
|
this.indicator.indicatorPaths[index] = indicatorPath;
|
||||||
this.indicator.indicatorPaths[index].safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
this.indicator.indicatorPaths[index].safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
||||||
|
@ -642,7 +659,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
defaultId: this.fb.control(this.indicator.defaultId)
|
defaultId: this.fb.control(this.indicator.defaultId)
|
||||||
});
|
});
|
||||||
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
||||||
this.addNumberIndicatorPath(this.indicatorUtils.getNumberUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)), indicatorPath.parameters, indicatorPath.source, this.getJsonPathAsFormArray(indicatorPath), indicatorPath.format);
|
this.addNumberIndicatorPath(this.indicatorUtils.getNumberUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)), this.getParametersAsFormArray(indicatorPath), indicatorPath.source, this.getJsonPathAsFormArray(indicatorPath), indicatorPath.format);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.indicator = new Indicator('', '', '', 'number', 'small', 'small', "PUBLIC", []);
|
this.indicator = new Indicator('', '', '', 'number', 'small', 'small', "PUBLIC", []);
|
||||||
|
@ -754,11 +771,11 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.editing = true;
|
this.editing = true;
|
||||||
if (this.indicator.type === 'chart') {
|
if (this.indicator.type === 'chart') {
|
||||||
this.chartIndicatorFb.get('description').enable();
|
this.chartIndicatorFb.get('description').enable();
|
||||||
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.chartIndicatorFb.value, this.indicator.indicatorPaths, this.indicator.type, true);
|
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.chartIndicatorFb.value, this.indicator.indicatorPaths, this.indicator.type);
|
||||||
this.section = this.charts.find(section => section._id === this.section._id);
|
this.section = this.charts.find(section => section._id === this.section._id);
|
||||||
} else {
|
} else {
|
||||||
this.numberIndicatorFb.get('description').enable();
|
this.numberIndicatorFb.get('description').enable();
|
||||||
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.numberIndicatorFb.value, this.indicator.indicatorPaths, this.indicator.type, false);
|
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.numberIndicatorFb.value, this.indicator.indicatorPaths, this.indicator.type);
|
||||||
this.section = this.numbers.find(section => section._id === this.section._id);
|
this.section = this.numbers.find(section => section._id === this.section._id);
|
||||||
}
|
}
|
||||||
let path = [
|
let path = [
|
||||||
|
@ -917,9 +934,10 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
hasDifference(index: number): boolean {
|
hasDifference(index: number, type: IndicatorType = 'chart'): boolean {
|
||||||
let hasDifference = false;
|
let hasDifference = false;
|
||||||
this.chartIndicatorPaths.at(index).value.parameters.forEach((parameter) => {
|
if(type === 'chart') {
|
||||||
|
this.chartIndicatorPaths.at(index).value.parameters.forEach(parameter => {
|
||||||
if (parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
|
if (parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
|
||||||
hasDifference = true;
|
hasDifference = true;
|
||||||
return;
|
return;
|
||||||
|
@ -927,6 +945,16 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
});
|
});
|
||||||
return hasDifference || this.indicator.indicatorPaths[index].safeResourceUrl.toString() !==
|
return hasDifference || this.indicator.indicatorPaths[index].safeResourceUrl.toString() !==
|
||||||
this.getSecureUrlByStakeHolder(this.indicator.indicatorPaths[index]).toString();
|
this.getSecureUrlByStakeHolder(this.indicator.indicatorPaths[index]).toString();
|
||||||
|
} else if(type === 'number') {
|
||||||
|
let indicatorPath = this.numberIndicatorPaths.at(index).value;
|
||||||
|
indicatorPath.parameters.forEach(parameter => {
|
||||||
|
if (parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
|
||||||
|
hasDifference = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return hasDifference;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get isAdministrator(): boolean {
|
public get isAdministrator(): boolean {
|
||||||
|
@ -937,11 +965,18 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
return this.isAdministrator || Session.isCurator(this.stakeholder.type, this.user);
|
return this.isAdministrator || Session.isCurator(this.stakeholder.type, this.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshIndicator() {
|
refreshIndicator(type: IndicatorType = 'chart') {
|
||||||
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.chartIndicatorFb.value, this.indicator.indicatorPaths, 'chart', true);
|
if(type === 'chart') {
|
||||||
|
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.chartIndicatorFb.value, this.indicator.indicatorPaths, 'chart');
|
||||||
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
||||||
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
||||||
});
|
});
|
||||||
|
} else if(type === 'number') {
|
||||||
|
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.numberIndicatorFb.value, this.indicator.indicatorPaths, 'number');
|
||||||
|
this.indicator.indicatorPaths.forEach((indicatorPath, index) => {
|
||||||
|
this.validateJsonPath(index);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteIndicatorOpen(section: Section, indicatorId: string, type: string, childrenAction: string = null) {
|
deleteIndicatorOpen(section: Section, indicatorId: string, type: string, childrenAction: string = null) {
|
||||||
|
|
|
@ -317,8 +317,9 @@ export class IndicatorUtils {
|
||||||
|
|
||||||
public getFullUrl(stakeholder: Stakeholder, indicatorPath: IndicatorPath, fundingL0: string = null, startYear: string = null, endYear: string = null): string {
|
public getFullUrl(stakeholder: Stakeholder, indicatorPath: IndicatorPath, fundingL0: string = null, startYear: string = null, endYear: string = null): string {
|
||||||
let replacedUrl = indicatorPath.chartObject ? indicatorPath.chartObject : indicatorPath.url;
|
let replacedUrl = indicatorPath.chartObject ? indicatorPath.chartObject : indicatorPath.url;
|
||||||
if(indicatorPath.statsProfile) {
|
if (indicatorPath.parameters.statsProfile) {
|
||||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix).join(indicatorPath.statsProfile)
|
console.log(indicatorPath.parameters.statsProfile)
|
||||||
|
replacedUrl = replacedUrl.split(ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix).join(indicatorPath.parameters.statsProfile)
|
||||||
} else if (stakeholder.statsProfile) {
|
} else if (stakeholder.statsProfile) {
|
||||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix).join(stakeholder.statsProfile)
|
replacedUrl = replacedUrl.split(ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix).join(stakeholder.statsProfile)
|
||||||
}
|
}
|
||||||
|
@ -398,8 +399,8 @@ export class IndicatorUtils {
|
||||||
let filterSubtitleText = [];
|
let filterSubtitleText = [];
|
||||||
indicatorPath.filtersApplied = 0;
|
indicatorPath.filtersApplied = 0;
|
||||||
let replacedUrl = indicatorPath.chartObject ? indicatorPath.chartObject : indicatorPath.url;
|
let replacedUrl = indicatorPath.chartObject ? indicatorPath.chartObject : indicatorPath.url;
|
||||||
if(indicatorPath.statsProfile) {
|
if (indicatorPath.parameters.statsProfile) {
|
||||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix).join(indicatorPath.statsProfile)
|
replacedUrl = replacedUrl.split(ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix).join(indicatorPath.parameters.statsProfile)
|
||||||
} else if (stakeholder.statsProfile) {
|
} else if (stakeholder.statsProfile) {
|
||||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix).join(stakeholder.statsProfile)
|
replacedUrl = replacedUrl.split(ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix).join(stakeholder.statsProfile)
|
||||||
}
|
}
|
||||||
|
@ -639,21 +640,19 @@ export class IndicatorUtils {
|
||||||
return values.length > 1;
|
return values.length > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
generateIndicatorByForm(form: any, indicatorPaths: IndicatorPath[], type: IndicatorType, addParameters: boolean = true): Indicator {
|
generateIndicatorByForm(form: any, indicatorPaths: IndicatorPath[], type: IndicatorType): Indicator {
|
||||||
let indicator: Indicator = new Indicator(form.name, form.description, form.additionalDescription, type,
|
let indicator: Indicator = new Indicator(form.name, form.description, form.additionalDescription, type,
|
||||||
form.width, form.height, form.visibility, indicatorPaths, form.defaultId);
|
form.width, form.height, form.visibility, indicatorPaths, form.defaultId);
|
||||||
indicator._id = form._id;
|
indicator._id = form._id;
|
||||||
form.indicatorPaths.forEach((indicatorPath, index) => {
|
form.indicatorPaths.forEach((indicatorPath, index) => {
|
||||||
indicator.indicatorPaths[index].type = indicatorPath.type;
|
indicator.indicatorPaths[index].type = indicatorPath.type;
|
||||||
indicator.indicatorPaths[index].format = indicatorPath.format;
|
indicator.indicatorPaths[index].format = indicatorPath.format;
|
||||||
if (addParameters) {
|
|
||||||
indicatorPath.parameters.forEach(parameter => {
|
indicatorPath.parameters.forEach(parameter => {
|
||||||
indicator.indicatorPaths[index].parameters[parameter.key] = parameter.value;
|
indicator.indicatorPaths[index].parameters[parameter.key] = parameter.value;
|
||||||
if (parameter.key === 'type') {
|
if (parameter.key === 'type') {
|
||||||
indicator.indicatorPaths[index].type = parameter.value;
|
indicator.indicatorPaths[index].type = parameter.value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return indicator;
|
return indicator;
|
||||||
}
|
}
|
||||||
|
@ -667,6 +666,7 @@ export class IndicatorUtils {
|
||||||
let chart = JSON.parse(indicatorPath.chartObject);
|
let chart = JSON.parse(indicatorPath.chartObject);
|
||||||
this.parameterizeDefaultQuery(chart, indicatorPath, stakeholder);
|
this.parameterizeDefaultQuery(chart, indicatorPath, stakeholder);
|
||||||
this.extractStakeHolders(chart, indicatorPath, stakeholder);
|
this.extractStakeHolders(chart, indicatorPath, stakeholder);
|
||||||
|
this.addProfile(indicatorPath);
|
||||||
indicatorPath.chartObject = JSON.stringify(chart);
|
indicatorPath.chartObject = JSON.stringify(chart);
|
||||||
if (!jsonPath || jsonPath.length == 0 || (jsonPath.length == 1 && jsonPath[0] == "")) {
|
if (!jsonPath || jsonPath.length == 0 || (jsonPath.length == 1 && jsonPath[0] == "")) {
|
||||||
indicatorPath.jsonPath = ["data", "0", "0", "0"];
|
indicatorPath.jsonPath = ["data", "0", "0", "0"];
|
||||||
|
@ -726,6 +726,7 @@ export class IndicatorUtils {
|
||||||
this.extractStakeHolders(chart, indicatorPath, stakeholder);
|
this.extractStakeHolders(chart, indicatorPath, stakeholder);
|
||||||
this.extractStartYear(chart, indicatorPath);
|
this.extractStartYear(chart, indicatorPath);
|
||||||
this.extractEndYear(chart, indicatorPath);
|
this.extractEndYear(chart, indicatorPath);
|
||||||
|
this.addProfile(indicatorPath);
|
||||||
indicatorPath.chartObject = JSON.stringify(chart);
|
indicatorPath.chartObject = JSON.stringify(chart);
|
||||||
}
|
}
|
||||||
} else if (source === 'old') {
|
} else if (source === 'old') {
|
||||||
|
@ -869,6 +870,7 @@ export class IndicatorUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private extractDatasource(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) {
|
private extractDatasource(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) {
|
||||||
// works for .datasource.name and .HostedBy datasource
|
// works for .datasource.name and .HostedBy datasource
|
||||||
// and .datasource.id
|
// and .datasource.id
|
||||||
|
@ -895,6 +897,7 @@ export class IndicatorUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private extractResearcher(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) {
|
private extractResearcher(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) {
|
||||||
// works for .orcid
|
// works for .orcid
|
||||||
if (stakeholder.type != "researcher") {
|
if (stakeholder.type != "researcher") {
|
||||||
|
@ -919,6 +922,7 @@ export class IndicatorUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private replaceIndexValues(currentValue, stakeholder, parameters) {
|
private replaceIndexValues(currentValue, stakeholder, parameters) {
|
||||||
if (currentValue == stakeholder.index_name) {
|
if (currentValue == stakeholder.index_name) {
|
||||||
parameters["index_name"] = stakeholder.index_name;
|
parameters["index_name"] = stakeholder.index_name;
|
||||||
|
@ -932,6 +936,7 @@ export class IndicatorUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private extractStartYear(obj, indicatorPath: IndicatorPath) {
|
private extractStartYear(obj, indicatorPath: IndicatorPath) {
|
||||||
let start_year;
|
let start_year;
|
||||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||||
|
@ -968,6 +973,10 @@ export class IndicatorUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private addProfile(indicatorPath: IndicatorPath) {
|
||||||
|
indicatorPath.parameters['statsProfile'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
private parameterizeDefaultQuery(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) {
|
private parameterizeDefaultQuery(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) {
|
||||||
let name = "";
|
let name = "";
|
||||||
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
|
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
|
||||||
|
|
|
@ -210,7 +210,6 @@ export class IndicatorPath {
|
||||||
parameters: any;
|
parameters: any;
|
||||||
filters: any;
|
filters: any;
|
||||||
filtersApplied: number = 0;
|
filtersApplied: number = 0;
|
||||||
statsProfile: string;
|
|
||||||
format: Format;
|
format: Format;
|
||||||
|
|
||||||
constructor(type: IndicatorPathType, source: SourceType, url: string, chartObject: string, jsonPath: string[], format: Format = 'NUMBER') {
|
constructor(type: IndicatorPathType, source: SourceType, url: string, chartObject: string, jsonPath: string[], format: Format = 'NUMBER') {
|
||||||
|
|
|
@ -336,7 +336,12 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
|
||||||
@Input()
|
@Input()
|
||||||
set options(options: (Option | string | number) []) {
|
set options(options: (Option | string | number) []) {
|
||||||
this.optionsArray = options.map(option => {
|
this.optionsArray = options.map(option => {
|
||||||
if (typeof option === 'string' || typeof option === 'number') {
|
if(option === null) {
|
||||||
|
return {
|
||||||
|
label: this.noValueSelected,
|
||||||
|
value: ''
|
||||||
|
};
|
||||||
|
} else if (typeof option === 'string' || typeof option === 'number') {
|
||||||
return {
|
return {
|
||||||
label: option.toString(),
|
label: option.toString(),
|
||||||
value: option
|
value: option
|
||||||
|
|
Loading…
Reference in New Issue