Project

General

Profile

« Previous | Next » 

Revision 58946

Created the indicator tables for the open science tab of the europe page

View differences:

continent-overview.component.ts
3 3
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
4 4
import { DataService } from '../../services/data.service';
5 5
import { DataHandlerService } from '../../services/data-handler.service';
6
import { EuropeData } from '../../domain/overview-map-data';
6
import {CountryTableData, EuropeData} from '../../domain/overview-map-data';
7 7
import { environment } from '../../../environments/environment';
8 8
import { TreemapHighchartsData } from '../../domain/treemap-highcharts-data';
9
import {Observable} from 'rxjs';
9 10

  
10 11
@Component({
11 12
  selector: 'app-continent-overview',
......
82 83

  
83 84
  greenVsGoldPublicationsChartURL: SafeResourceUrl;
84 85

  
86
  loadingPublicationsAbsoluteTable: boolean = true;
87
  loadingPublicationsPercentageTable: boolean = true;
88
  publicationsTableContentSelection: string = 'affiliated';
89
  publicationsAbsoluteTableData: CountryTableData[];
90
  publicationsPercentageTableData: CountryTableData[];
91

  
85 92
  // Open Science Tab
86 93
  // datasets subtab
87 94
  openScienceDatasetsTabIsInitialised: boolean = false;
......
101 108
  datasetsWithPIDByFunderData: TreemapHighchartsData[];
102 109
  datasetsWithLicenceByFunderData: TreemapHighchartsData[];
103 110

  
111
  loadingDatasetsAbsoluteTable: boolean = true;
112
  loadingDatasetsPercentageTable: boolean = true;
113
  datasetsTableContentSelection: string = 'affiliated';
114
  datasetsAbsoluteTableData: CountryTableData[];
115
  datasetsPercentageTableData: CountryTableData[];
116

  
104 117
  // Open Science Tab
105 118
  // software subtab
106 119
  openScienceSoftwareTabIsInitialised: boolean = false;
......
120 133
  softwareWithPIDByFunderData: TreemapHighchartsData[];
121 134
  softwareWithLicenceByFunderData: TreemapHighchartsData[];
122 135

  
136
  loadingSoftwareAbsoluteTable: boolean = true;
137
  loadingSoftwarePercentageTable: boolean = true;
138
  softwareTableContentSelection: string = 'affiliated';
139
  softwareAbsoluteTableData: CountryTableData[];
140
  softwarePercentageTableData: CountryTableData[];
141

  
123 142
  // Open Science Tab
124 143
  // other research products subtab
125 144
  openScienceOtherTabIsInitialised: boolean = false;
......
139 158
  otherWithPIDByFunderData: TreemapHighchartsData[];
140 159
  otherWithLicenceByFunderData: TreemapHighchartsData[];
141 160

  
161
  loadingOtherAbsoluteTable: boolean = true;
162
  loadingOtherPercentageTable: boolean = true;
163
  otherTableContentSelection: string = 'affiliated';
164
  otherAbsoluteTableData: CountryTableData[];
165
  otherPercentageTableData: CountryTableData[];
166

  
142 167
  constructor(private dataService: DataService,
143 168
              private dataHandlerService: DataHandlerService,
144 169
              private route: ActivatedRoute,
......
368 393
        }
369 394
      );
370 395

  
396
      this.getPublicationsTableData(this.publicationsTableContentSelection);
397

  
371 398
      this.openSciencePubsTabIsInitialised = true;
372 399
    }
373 400
  }
......
404 431
        }
405 432
      );
406 433

  
434
      this.getDatasetsTableData(this.datasetsTableContentSelection);
435

  
407 436
      this.openSciencePubsTabIsInitialised = true;
408 437
    }
409 438
  }
......
440 469
        }
441 470
      );
442 471

  
472
      this.getSoftwareTableData(this.softwareTableContentSelection);
473

  
443 474
      this.openScienceSoftwareTabIsInitialised = true;
444 475
    }
445 476
  }
......
476 507
        }
477 508
      );
478 509

  
510
      this.getOtherTableData(this.otherTableContentSelection);
511

  
479 512
      this.openScienceOtherTabIsInitialised = true;
480 513
    }
481 514
  }
515

  
516
  getContent(type: string, contentSelection: string): void {
517

  
518
    if (type === 'publication') {
519
      this.publicationsTableContentSelection = contentSelection;
520
      this.getPublicationsTableData(this.publicationsTableContentSelection);
521
    } else if (type === 'dataset') {
522
      this.datasetsTableContentSelection = contentSelection;
523
      this.getDatasetsTableData(this.datasetsTableContentSelection);
524
    } else if (type === 'software') {
525
      this.softwareTableContentSelection = contentSelection;
526
      this.getSoftwareTableData(this.softwareTableContentSelection);
527
    } else if (type === 'other') {
528
      this.otherTableContentSelection = contentSelection;
529
      this.getOtherTableData(this.otherTableContentSelection);
530
    }
531
  }
532

  
533
  getPublicationsTableData(contentSelection: string) {
534
    this.loadingPublicationsAbsoluteTable = true;
535
    this.loadingPublicationsPercentageTable = true;
536
    this.dataService.getIndicatorsTableData('publication', contentSelection).subscribe(
537
      rawData => {
538
        this.publicationsAbsoluteTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData);
539
        this.publicationsPercentageTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData);
540
        this.loadingPublicationsAbsoluteTable = false;
541
        this.loadingPublicationsPercentageTable = false;
542
      }, error => {
543
        console.log(error);
544
        this.loadingPublicationsAbsoluteTable = false;
545
        this.loadingPublicationsPercentageTable = false;
546
      }
547
    );
548
  }
549

  
550
  getDatasetsTableData(contentSelection: string) {
551
    this.loadingDatasetsAbsoluteTable = true;
552
    this.loadingDatasetsPercentageTable = true;
553
    this.dataService.getIndicatorsTableData('dataset', contentSelection).subscribe(
554
      rawData => {
555
        this.datasetsAbsoluteTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData);
556
        this.datasetsPercentageTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData);
557
        this.loadingDatasetsAbsoluteTable = false;
558
        this.loadingDatasetsPercentageTable = false;
559
      }, error => {
560
        console.log(error);
561
        this.loadingDatasetsAbsoluteTable = false;
562
        this.loadingDatasetsPercentageTable = false;
563
      }
564
    );
565
  }
566

  
567
  getSoftwareTableData(contentSelection: string) {
568
    this.loadingSoftwareAbsoluteTable = true;
569
    this.loadingSoftwarePercentageTable = true;
570
    this.dataService.getIndicatorsTableData('software', contentSelection).subscribe(
571
      rawData => {
572
        this.softwareAbsoluteTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData);
573
        this.softwarePercentageTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData);
574
        this.loadingSoftwareAbsoluteTable = false;
575
        this.loadingSoftwarePercentageTable = false;
576
      }, error => {
577
        console.log(error);
578
        this.loadingSoftwareAbsoluteTable = false;
579
        this.loadingSoftwarePercentageTable = false;
580
      }
581
    );
582
  }
583

  
584
  getOtherTableData(contentSelection: string) {
585
    this.loadingOtherAbsoluteTable = true;
586
    this.loadingOtherPercentageTable = true;
587
    this.dataService.getIndicatorsTableData('other', contentSelection).subscribe(
588
      rawData => {
589
        this.otherAbsoluteTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData);
590
        this.otherPercentageTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData);
591
        this.loadingOtherAbsoluteTable = false;
592
        this.loadingOtherPercentageTable = false;
593
      }, error => {
594
        console.log(error);
595
        this.loadingOtherAbsoluteTable = false;
596
        this.loadingOtherPercentageTable = false;
597
      }
598
    );
599
  }
600

  
482 601
}

Also available in: Unified diff