[Monitor|Dashboard]

Filters: add co-funded filter



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59185 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Argiro Kokogiannaki 2020-07-28 15:56:48 +00:00
parent 1c08f50c75
commit 098af07766
3 changed files with 25 additions and 5 deletions

View File

@ -231,8 +231,7 @@
<div class="uk-grid uk-grid-small uk-text-small" uk-grid> <div class="uk-grid uk-grid-small uk-text-small" uk-grid>
<ng-container *ngTemplateOutlet="selected_filters_pills; context: {margin:false}"></ng-container> <ng-container *ngTemplateOutlet="selected_filters_pills; context: {margin:false}"></ng-container>
</div> </div>
<div class="uk-margin-small-top"><i class="uk-text-muted uk-text-small"> If any of the filters cannot be <div class="uk-margin-small-top"><i class="uk-text-muted uk-text-small"> If your filter selection cannot be applied to a chart, that chart will appear grayed-out.</i></div>
applied to a chart, it will appear faded.</i></div>
<ul class="uk-list uk-list-divider uk-margin-medium"> <ul class="uk-list uk-list-divider uk-margin-medium">
<li> <li>
<range-filter [filter]="periodFilter" yearMin="2000" yearMax="2020" [mandatoryRange]="true" <range-filter [filter]="periodFilter" yearMin="2000" yearMax="2020" [mandatoryRange]="true"

View File

@ -115,6 +115,14 @@ export class MonitorComponent implements OnInit, OnDestroy {
values:[{name: "EC|FP7", id: "ec__________::EC::FP7", selected: false, number: 0}, {name: "EC|H2020", id: "ec__________::EC::H2020", selected: false, number: 0}] values:[{name: "EC|FP7", id: "ec__________::EC::FP7", selected: false, number: 0}, {name: "EC|H2020", id: "ec__________::EC::H2020", selected: false, number: 0}]
,filterOperator: "or", valueIsExact: true, filterType: "radio", radioValue:""}); ,filterOperator: "or", valueIsExact: true, filterType: "radio", radioValue:""});
} }
if(this.stakeholder.type == "funder"){
// this.filters.push({title: "Co-funded research outcomes",filterId: "co-funded",originalFilterId: "co-funded", countSelectedValues: 0,
// values:[{name: "true", id: "co-funded", selected: false, number: 0}, {name: "false", id: "no-co-funded", selected: false, number: 0}]
// ,filterOperator: "or", valueIsExact: true, filterType: "radio", radioValue:""});
this.filters.push({title: "Co-funded",filterId: "co-funded",originalFilterId: "co-funded", countSelectedValues: 0,
values:[{name: "Co-funded research outcomes", id: "co-funded-results", selected: false, number: 0}]
,filterOperator: "or", valueIsExact: true, filterType: "checkbox", radioValue:""});
}
this.initializeFilters(); this.initializeFilters();
if(stakeholder.isActive && (stakeholder.isPublic || this.isPublicOrIsMember(stakeholder.isPublic))) { if(stakeholder.isActive && (stakeholder.isPublic || this.isPublicOrIsMember(stakeholder.isPublic))) {
this.seoService.createLinkForCanonicalURL(url, false); this.seoService.createLinkForCanonicalURL(url, false);
@ -332,6 +340,12 @@ export class MonitorComponent implements OnInit, OnDestroy {
return this.queryParams["relfundinglevel0_id"].split("::")[this.queryParams["relfundinglevel0_id"].split("::").length -1]; return this.queryParams["relfundinglevel0_id"].split("::")[this.queryParams["relfundinglevel0_id"].split("::").length -1];
} }
return null; return null;
}
private getCoFunded(){
if (this.queryParams["co-funded"] && this.filters.length > 0){
return this.queryParams["co-funded"] && this.queryParams["co-funded"]=="co-funded-results";
}
return false;
} }
clearPeriodFilter(){ clearPeriodFilter(){
if(this.periodFilter.selectedFromValue || this.periodFilter.selectedToValue){ if(this.periodFilter.selectedFromValue || this.periodFilter.selectedToValue){
@ -350,7 +364,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
this.activeSubCategory.numbers.forEach((section, i) => { this.activeSubCategory.numbers.forEach((section, i) => {
section.indicators.forEach((number, j) => { section.indicators.forEach((number, j) => {
if (number.isActive && this.isPublicOrIsMember(number.isPublic)) { if (number.isActive && this.isPublicOrIsMember(number.isPublic)) {
let url =this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, number.indicatorPaths[0], this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue); let url =this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, number.indicatorPaths[0], this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue, this.getCoFunded());
const pair = JSON.stringify([number.indicatorPaths[0].source, url]); const pair = JSON.stringify([number.indicatorPaths[0].source, url]);
const indexes = urls.get(pair) ? urls.get(pair) : []; const indexes = urls.get(pair) ? urls.get(pair) : [];
indexes.push([i, j]); indexes.push([i, j]);
@ -387,7 +401,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
public getUrlByStakeHolder(indicatorPath: IndicatorPath) { public getUrlByStakeHolder(indicatorPath: IndicatorPath) {
return this.sanitizer.bypassSecurityTrustResourceUrl( return this.sanitizer.bypassSecurityTrustResourceUrl(
this.statisticsService.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, indicatorPath, this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue))); this.statisticsService.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, indicatorPath, this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue, this.getCoFunded())));
} }
public setActiveChart(i: number, j: number, type: string) { public setActiveChart(i: number, j: number, type: string) {

View File

@ -296,7 +296,7 @@ export class IndicatorUtils {
} }
return indicatorPath.url + encodeURIComponent(replacedUrl); return indicatorPath.url + encodeURIComponent(replacedUrl);
} }
public getFullUrlWithFilters(stakeholder:Stakeholder, indicatorPath: IndicatorPath, fundingL0: string = null, startYear: string = null, endYear: string = null, isNumber:boolean=false): string { public getFullUrlWithFilters(stakeholder:Stakeholder, indicatorPath: IndicatorPath, fundingL0: string = null, startYear: string = null, endYear: string = null, coFunded:boolean=false): string {
indicatorPath.filtersApplied = 0; indicatorPath.filtersApplied = 0;
let replacedUrl = indicatorPath.chartObject?indicatorPath.chartObject:indicatorPath.url; let replacedUrl = indicatorPath.chartObject?indicatorPath.chartObject:indicatorPath.url;
if (indicatorPath.parameters) { if (indicatorPath.parameters) {
@ -342,6 +342,13 @@ export class IndicatorUtils {
indicatorPath.filtersApplied += filterResults.filtersApplied; indicatorPath.filtersApplied += filterResults.filtersApplied;
} }
} }
if (coFunded ) {
if(indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
let filterResults = this.addFilter(replacedUrl, 'co-funded', endYear);
replacedUrl = filterResults.url;
indicatorPath.filtersApplied += filterResults.filtersApplied;
}
}
//For numbers //For numbers
if (replacedUrl.indexOf(ChartHelper.prefix + 'index_id' + ChartHelper.suffix) != -1) { if (replacedUrl.indexOf(ChartHelper.prefix + 'index_id' + ChartHelper.suffix) != -1) {