[Monitor|Trunk]
-edit numbers: - create url: parse the index id properly - save url: keep only the path from url - set stat-tool the default option - hide other options for non admins - set default json paths for stats-tool -search link: pass the stakeholder filter in parameters git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59920 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
f54486f752
commit
086992a91b
|
@ -249,7 +249,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
if(this.isPublicOrIsMember(this.stakeholder.visibility)) {
|
||||
this.specialSideBarMenuItem = new MenuItem("search", "Search research outcomes", "", this.properties.searchLinkToResults, false, [], null, {})
|
||||
this.specialSideBarMenuItem = new MenuItem("search", "Search research outcomes", "", this.properties.searchLinkToResults, false, [], null, this.createSearchParameters());
|
||||
this.specialSideBarMenuItem.icon = '<span uk-icon="search"></span>';
|
||||
}else{
|
||||
this.specialSideBarMenuItem =null;
|
||||
|
|
|
@ -155,7 +155,6 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
this.subscriptions.push(subscription);
|
||||
} else {
|
||||
console.debug(" stakeholder is already available")
|
||||
this.initializeFilters();
|
||||
this.setView(params);
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<div *ngIf="numberSections">
|
||||
<h6 class="uk-text-bold">Number Indicators</h6>
|
||||
<ng-template ngFor [ngForOf]="displayNumbers" let-number let-i="index">
|
||||
<div [id]="'number-' + number._id" [class.section]="isAdministrator"
|
||||
class="uk-grid-match uk-grid-small uk-grid uk-margin-top"
|
||||
<div [id]="'number-' + number._id"
|
||||
class="uk-grid-match uk-grid-small uk-grid uk-margin-top section"
|
||||
uk-sortable="group: number" uk-grid>
|
||||
<div class="tools disable-sortable uk-sortable-nodrag">
|
||||
<div *ngIf="isAdministrator" class="actions">
|
||||
<div class="actions">
|
||||
<a [class.uk-disabled]="editing" class="" (click)="createSection(i, 'number')"
|
||||
title="Create a new section">
|
||||
<icon name="add"></icon>
|
||||
|
@ -63,8 +63,8 @@
|
|||
{{'Make ' + v.label.toLowerCase()}}</a>
|
||||
</li>
|
||||
</ng-template>
|
||||
<hr *ngIf="isAdministrator && !indicator.defaultId" class="uk-nav-divider">
|
||||
<li *ngIf="isAdministrator && !indicator.defaultId && !editing"><a
|
||||
<hr *ngIf="isCurator && !indicator.defaultId" class="uk-nav-divider">
|
||||
<li *ngIf="isCurator && !indicator.defaultId && !editing"><a
|
||||
(click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete</a>
|
||||
<!-- <ng-container *ngIf="!stakeholder.defaultId">-->
|
||||
<!-- <a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete from all profiles</a>-->
|
||||
|
@ -107,9 +107,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<div *ngIf="isAdministrator">
|
||||
<ng-container *ngTemplateOutlet="new_section; context:{type: 'number'}"></ng-container>
|
||||
</div>
|
||||
<ng-container *ngTemplateOutlet="new_section; context:{type: 'number'}"></ng-container>
|
||||
</div>
|
||||
<div *ngIf="chartSections" class="uk-margin-large-top">
|
||||
<h6 class="uk-text-bold">Chart Indicators</h6>
|
||||
|
@ -243,7 +241,7 @@
|
|||
[formInput]="numberIndicatorFb.get('description')"
|
||||
label="Description" type="textarea">
|
||||
</div>
|
||||
<div dashboard-input *ngIf="isAdministrator || indicator.defaultId" class="uk-width-1-1"
|
||||
<div dashboard-input *ngIf="isCurator || indicator.defaultId" class="uk-width-1-1"
|
||||
[formInput]="numberIndicatorFb.get('additionalDescription')"
|
||||
label="Additional information" type="textarea">
|
||||
</div>
|
||||
|
@ -267,7 +265,8 @@
|
|||
</div>
|
||||
<div class="uk-width-1-1">
|
||||
<div dashboard-input [formInput]="indicatorPath.get('source')" label="Source"
|
||||
type="select" [options]="indicatorUtils.sourceTypes">
|
||||
type="select"
|
||||
[options]="isAdministrator?indicatorUtils.allSourceTypes:indicatorUtils.sourceTypes">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -345,7 +344,7 @@
|
|||
[formInput]="chartIndicatorFb.get('description')"
|
||||
label="Description" type="textarea">
|
||||
</div>
|
||||
<div dashboard-input *ngIf="isAdministrator || indicator.defaultId" class="uk-width-1-1"
|
||||
<div dashboard-input *ngIf="isCurator || indicator.defaultId" class="uk-width-1-1"
|
||||
[formInput]="chartIndicatorFb.get('additionalDescription')"
|
||||
label="Additional information" type="textarea">
|
||||
</div>
|
||||
|
|
|
@ -488,7 +488,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
return this.statisticsService.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath));
|
||||
}
|
||||
|
||||
public addNumberIndicatorPath(url: string = '', parameters: FormArray = new FormArray([]), source: string = 'search', jsonPath: FormArray = new FormArray([])) {
|
||||
public addNumberIndicatorPath(url: string = '', parameters: FormArray = new FormArray([]), source: string = 'stats-tool', jsonPath: FormArray = new FormArray([])) {
|
||||
if (jsonPath.length === 0) {
|
||||
jsonPath.push(this.fb.control('', Validators.required));
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.subscriptions.push(this.numberIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => {
|
||||
this.numberIndicatorPaths.at(index).get('result').setValue(null);
|
||||
if (this.numberIndicatorPaths.at(index).get('url').valid) {
|
||||
let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.statisticsService.getNumberSource(value), value, this.stakeholder, this.numberIndicatorPaths.at(index).get('jsonPath').value);
|
||||
let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.statisticsService.getNumberSource(value), value, this.stakeholder, this.numberIndicatorPaths.at(index).get('jsonPath').value, this.statisticsService.numberSources.get(this.statisticsService.getNumberSource(value)));
|
||||
if ((indicatorPath.chartObject && Object.keys(indicatorPath.parameters).indexOf("index_id") == -1 && Object.keys(indicatorPath.parameters).indexOf("index_name") == -1 && Object.keys(indicatorPath.parameters).indexOf("index_shortName") == -1)
|
||||
|| (!indicatorPath.chartObject && indicatorPath.url.indexOf("index_id") == -1 && indicatorPath.url.indexOf("index_name") == -1 && (indicatorPath.url).indexOf("index_shortName") == -1)) {
|
||||
// default profile
|
||||
|
@ -528,6 +528,15 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
if (indicatorPath.source) {
|
||||
this.numberIndicatorPaths.at(index).get('source').setValue(indicatorPath.source);
|
||||
}
|
||||
if(indicatorPath.jsonPath.length > 1 && this.getJsonPath(index).length ==1 ) {
|
||||
let paths = indicatorPath.jsonPath;
|
||||
for (let i = 0; i < paths.length; i++) {
|
||||
if (i == this.getJsonPath(index).length) {
|
||||
this.getJsonPath(index).push(this.fb.control('', Validators.required));
|
||||
}
|
||||
}
|
||||
this.getJsonPath(index).setValue(paths)
|
||||
}
|
||||
} else {
|
||||
this.urlParameterizedMessage = null;
|
||||
}
|
||||
|
@ -830,9 +839,11 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
}
|
||||
|
||||
public get isAdministrator(): boolean {
|
||||
return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user);
|
||||
return Session.isPortalAdministrator(this.user);
|
||||
}
|
||||
public get isCurator(): boolean {
|
||||
return this.isAdministrator || Session.isMonitorCurator(this.user);
|
||||
}
|
||||
|
||||
refreshIndicator() {
|
||||
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.chartIndicatorFb.value, this.indicator.indicatorPaths, 'chart', true);
|
||||
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
||||
|
|
|
@ -176,13 +176,15 @@ export class IndicatorUtils {
|
|||
{value: 'large', label: 'Large'}
|
||||
];
|
||||
|
||||
sourceTypes: Option[] = [
|
||||
allSourceTypes: Option[] = [
|
||||
{value: 'search', label: 'Search'},
|
||||
{value: 'statistics', label: 'Statistics'},
|
||||
{value: 'metrics', label: 'Metrics'},
|
||||
{value: 'stats-tool', label: 'Statistics tool'}
|
||||
];
|
||||
|
||||
sourceTypes: Option[] = [
|
||||
{value: 'stats-tool', label: 'Statistics tool'}
|
||||
];
|
||||
isPublic: Option[] = [
|
||||
{icon: 'public', value: true, label: 'Public'},
|
||||
{icon: 'lock', value: false, label: 'Private'},
|
||||
|
@ -296,15 +298,15 @@ export class IndicatorUtils {
|
|||
}
|
||||
|
||||
}
|
||||
//For numbers
|
||||
//For numbers (e.g from stats-api , search service, etc)
|
||||
if(indicatorPath.url.indexOf(ChartHelper.prefix + 'index_id' + ChartHelper.suffix) !=- 1){
|
||||
indicatorPath.url = replacedUrl.split(ChartHelper.prefix + 'index_id' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_id))
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + 'index_id' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_id))
|
||||
}
|
||||
if(indicatorPath.url.indexOf(ChartHelper.prefix + 'index_name' + ChartHelper.suffix) !=- 1){
|
||||
indicatorPath.url = replacedUrl.split(ChartHelper.prefix + 'index_name' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_name))
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + 'index_name' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_name))
|
||||
}
|
||||
if(indicatorPath.url.indexOf(ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix) !=- 1){
|
||||
indicatorPath.url = replacedUrl.split(ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_shortName))
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_shortName))
|
||||
}
|
||||
return (indicatorPath.chartObject?indicatorPath.url + encodeURIComponent(replacedUrl):replacedUrl);
|
||||
}
|
||||
|
@ -427,7 +429,6 @@ export class IndicatorUtils {
|
|||
// console.debug("Field Params length:" + paramFields.length)
|
||||
// console.debug(paramFields)
|
||||
// console.debug("Parameters length:" + queries["query"]["parameters"].length)
|
||||
console.debug("Parameters length:" + queries["query"]["parameters"].length)
|
||||
|
||||
if((paramFields.length + 2) == queries["query"]["parameters"].length || (paramFields.length*2 + 4) == queries["query"]["parameters"].length){
|
||||
filterApplied = true;
|
||||
|
@ -531,7 +532,7 @@ export class IndicatorUtils {
|
|||
});
|
||||
return indicator;
|
||||
}
|
||||
generateIndicatorByNumberUrl(source: SourceType, url: string, stakeholder:Stakeholder, jsonPath = []): IndicatorPath {
|
||||
generateIndicatorByNumberUrl(source: SourceType, url: string, stakeholder:Stakeholder, jsonPath = [], sourceServices:string[] =[] ): IndicatorPath {
|
||||
let indicatorPath = new IndicatorPath(null, source, url, null, jsonPath);
|
||||
if (source === 'stats-tool') {
|
||||
indicatorPath.url = url.split("json=")[0] + "json=";
|
||||
|
@ -541,8 +542,14 @@ export class IndicatorUtils {
|
|||
this.parameterizeDefaultQuery(chart, indicatorPath, stakeholder);
|
||||
this.extractStakeHolders(chart, indicatorPath, stakeholder);
|
||||
indicatorPath.chartObject = JSON.stringify(chart);
|
||||
indicatorPath.jsonPath = ["data","0","0","0"];
|
||||
// this.addResultFilters(chart, indicatorPath);
|
||||
}else {
|
||||
for( let service of sourceServices){
|
||||
if(url.indexOf(service)!=-1){
|
||||
url = url.split(service)[1] ;
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (url.indexOf(encodeURIComponent(stakeholder.index_id)) !== -1) {
|
||||
url = url.split(encodeURIComponent(stakeholder.index_id)).join(ChartHelper.prefix + "index_id" + ChartHelper.suffix);
|
||||
|
|
Loading…
Reference in New Issue