Project

General

Profile

« Previous | Next » 

Revision 59185

[Monitor|Dashboard]

Filters: add co-funded filter

View differences:

modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/monitor/monitor.component.html
231 231
      <div class="uk-grid uk-grid-small uk-text-small" uk-grid>
232 232
        <ng-container *ngTemplateOutlet="selected_filters_pills; context: {margin:false}"></ng-container>
233 233
      </div>
234
      <div class="uk-margin-small-top"><i  class="uk-text-muted uk-text-small"> If any of the filters cannot be
235
        applied to a chart, it will appear faded.</i></div>
234
      <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>
236 235
      <ul class="uk-list uk-list-divider  uk-margin-medium">
237 236
        <li>
238 237
          <range-filter   [filter]="periodFilter" yearMin="2000" yearMax="2020" [mandatoryRange]="true"
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/monitor/monitor.component.ts
115 115
                      values:[{name: "EC|FP7", id: "ec__________::EC::FP7", selected:  false, number: 0}, {name: "EC|H2020", id: "ec__________::EC::H2020", selected:  false, number: 0}]
116 116
                      ,filterOperator: "or", valueIsExact: true, filterType: "radio", radioValue:""});
117 117
                  }
118
                  if(this.stakeholder.type == "funder"){
119
                    // this.filters.push({title: "Co-funded research outcomes",filterId: "co-funded",originalFilterId: "co-funded", countSelectedValues: 0,
120
                    //   values:[{name: "true", id: "co-funded", selected:  false, number: 0}, {name: "false", id: "no-co-funded", selected:  false, number: 0}]
121
                    //   ,filterOperator: "or", valueIsExact: true, filterType: "radio", radioValue:""});
122
                    this.filters.push({title: "Co-funded",filterId: "co-funded",originalFilterId: "co-funded", countSelectedValues: 0,
123
                      values:[{name: "Co-funded research outcomes", id: "co-funded-results", selected:  false, number: 0}]
124
                      ,filterOperator: "or", valueIsExact: true, filterType: "checkbox", radioValue:""});
125
                  }
118 126
                  this.initializeFilters();
119 127
                  if(stakeholder.isActive && (stakeholder.isPublic || this.isPublicOrIsMember(stakeholder.isPublic))) {
120 128
                    this.seoService.createLinkForCanonicalURL(url, false);
......
333 341
    }
334 342
    return null;
335 343
  }
344
  private getCoFunded(){
345
    if (this.queryParams["co-funded"] && this.filters.length > 0){
346
      return this.queryParams["co-funded"] && this.queryParams["co-funded"]=="co-funded-results";
347
    }
348
    return false;
349
  }
336 350
    clearPeriodFilter(){
337 351
    if(this.periodFilter.selectedFromValue || this.periodFilter.selectedToValue){
338 352
      this.periodFilter.selectedFromValue = "";
......
350 364
    this.activeSubCategory.numbers.forEach((section, i) => {
351 365
      section.indicators.forEach((number, j) => {
352 366
        if (number.isActive && this.isPublicOrIsMember(number.isPublic)) {
353
          let url =this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, number.indicatorPaths[0], this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue);
367
          let url =this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, number.indicatorPaths[0], this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue, this.getCoFunded());
354 368
          const pair = JSON.stringify([number.indicatorPaths[0].source, url]);
355 369
          const indexes = urls.get(pair) ? urls.get(pair) : [];
356 370
          indexes.push([i, j]);
......
387 401

  
388 402
  public getUrlByStakeHolder(indicatorPath: IndicatorPath) {
389 403
    return this.sanitizer.bypassSecurityTrustResourceUrl(
390
      this.statisticsService.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, indicatorPath,  this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue)));
404
      this.statisticsService.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, indicatorPath,  this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue, this.getCoFunded())));
391 405
  }
392 406

  
393 407
  public setActiveChart(i: number, j: number, type: string) {
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/indicator-utils.ts
296 296
    }
297 297
    return indicatorPath.url + encodeURIComponent(replacedUrl);
298 298
  }
299
  public getFullUrlWithFilters(stakeholder:Stakeholder, indicatorPath: IndicatorPath, fundingL0: string = null, startYear: string = null, endYear: string = null, isNumber:boolean=false): string {
299
  public getFullUrlWithFilters(stakeholder:Stakeholder, indicatorPath: IndicatorPath, fundingL0: string = null, startYear: string = null, endYear: string = null, coFunded:boolean=false): string {
300 300
    indicatorPath.filtersApplied = 0;
301 301
    let replacedUrl = indicatorPath.chartObject?indicatorPath.chartObject:indicatorPath.url;
302 302
    if (indicatorPath.parameters) {
......
342 342
        indicatorPath.filtersApplied += filterResults.filtersApplied;
343 343
      }
344 344
    }
345
    if (coFunded ) {
346
      if(indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
347
        let filterResults = this.addFilter(replacedUrl, 'co-funded', endYear);
348
        replacedUrl = filterResults.url;
349
        indicatorPath.filtersApplied += filterResults.filtersApplied;
350
      }
351
    }
345 352

  
346 353
    //For numbers
347 354
    if (replacedUrl.indexOf(ChartHelper.prefix + 'index_id' + ChartHelper.suffix) != -1) {

Also available in: Unified diff