Project

General

Profile

« Previous | Next » 

Revision 56644

[Trunk|Library]: Add Helper on search Page, landings and deposit first page.

View differences:

dataset.component.ts
1
import {Component, ViewChild}         from '@angular/core';
2
import {Input}            from '@angular/core';
3
import {ActivatedRoute, Router}       from '@angular/router';
4
import {Title, Meta}                  from '@angular/platform-browser';
1
import {Component, Input} from '@angular/core';
2
import {ActivatedRoute, Router} from '@angular/router';
3
import {Meta, Title} from '@angular/platform-browser';
5 4

  
6
import {Observable}                   from 'rxjs';
5
import {DatasetInfo} from '../../utils/entities/datasetInfo';
6
import {EnvProperties} from '../../utils/properties/env-properties';
7
import {RouterHelper} from '../../utils/routerHelper.class';
7 8

  
8
import {DatasetInfo}                  from '../../utils/entities/datasetInfo';
9
import {EnvProperties}                from '../../utils/properties/env-properties';
10
import {RouterHelper}                 from '../../utils/routerHelper.class';
11

  
12
import {DatasetService}               from './dataset.service';
13
import {PiwikService}                 from '../../utils/piwik/piwik.service';
14
import { SEOService } from '../../sharedComponents/SEO/SEO.service';
9
import {DatasetService} from './dataset.service';
10
import {PiwikService} from '../../utils/piwik/piwik.service';
11
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
15 12
import {HelperFunctions} from "../../utils/HelperFunctions.class";
13
import {HelperService} from "../../utils/helper/helper.service";
16 14

  
17 15

  
18 16
@Component({
19
    selector: 'dataset',
20
    templateUrl: 'dataset.component.html',
17
  selector: 'dataset',
18
  templateUrl: 'dataset.component.html',
21 19
})
22 20

  
23 21
export class DatasetComponent {
24
    @Input() piwikSiteId = null;
25
    public datasetInfo: DatasetInfo;
26
    public datasetId : string ;
22
  @Input() piwikSiteId = null;
23
  @Input() communityId = null;
24
  public datasetInfo: DatasetInfo;
25
  public datasetId: string;
27 26

  
28
    // APP BOX variables
29
    public showAllCollectedFrom: boolean = false;
30
    public showAllDownloadFrom: boolean = false;
31
    public showAllPublishedIn: boolean = false;
27
  // APP BOX variables
28
  public showAllCollectedFrom: boolean = false;
29
  public showAllDownloadFrom: boolean = false;
30
  public showAllPublishedIn: boolean = false;
32 31

  
33
    public thresholdDescription: number = 270;
34
    public showNumDescription: number = 270;
35
    
36
    // Metrics tab variables
37
    public metricsClicked: boolean;
38
    public viewsFrameUrl: string;
39
    public downloadsFrameUrl: string;
40
    public totalViews: number;
41
    public totalDownloads: number;
42
    public pageViews: number;
32
  public thresholdDescription: number = 270;
33
  public showNumDescription: number = 270;
43 34

  
44
    // Custom tab paging variables
45
    public referencesPage: number = 1;
46
    public pageSize: number = 10;
35
  // Metrics tab variables
36
  public metricsClicked: boolean;
37
  public viewsFrameUrl: string;
38
  public downloadsFrameUrl: string;
39
  public totalViews: number;
40
  public totalDownloads: number;
41
  public pageViews: number;
47 42

  
48
    // Active tab variable for responsiveness
49
    public activeTab: string = "References";
43
  // Custom tab paging variables
44
  public referencesPage: number = 1;
45
  public pageSize: number = 10;
50 46

  
51
    // Map counting variable
52
    public relatedResearchResultsNum: number = 0;
47
  // Active tab variable for responsiveness
48
  public activeTab: string = "References";
53 49

  
54
    // Message variables
55
    public warningMessage = "";
56
    public errorMessage = "";
57
    public showLoading: boolean = true;
50
  // Map counting variable
51
  public relatedResearchResultsNum: number = 0;
58 52

  
59
    public routerHelper:RouterHelper = new RouterHelper();
53
  // Message variables
54
  public warningMessage = "";
55
  public errorMessage = "";
56
  public showLoading: boolean = true;
57
  public pageContents = null;
58
  public divContents = null;
60 59

  
61
    private result ;
62
    sub: any; piwiksub: any; infoSub: any;
63
    properties:EnvProperties;
60
  public routerHelper: RouterHelper = new RouterHelper();
64 61

  
65
    constructor (private _datasetService: DatasetService,
66
                 private _piwikService:PiwikService,
67
                 private  route: ActivatedRoute,
68
                 private router: Router,
69
                 private _meta: Meta,
70
                 private _title: Title,
71
                 private _router: Router,
72
               private seoService: SEOService) {
73
    }
62
  private result;
63
  sub: any;
64
  piwiksub: any;
65
  infoSub: any;
66
  properties: EnvProperties;
74 67

  
75
    ngOnInit() {
76
      this.route.data
77
        .subscribe((data: { envSpecific: EnvProperties }) => {
78
           this.properties = data.envSpecific;
79
           this.updateUrl(data.envSpecific.baseLink+this._router.url);
68
  constructor(private _datasetService: DatasetService,
69
              private _piwikService: PiwikService,
70
              private  route: ActivatedRoute,
71
              private router: Router,
72
              private _meta: Meta,
73
              private _title: Title,
74
              private _router: Router,
75
              private seoService: SEOService,
76
              private helper: HelperService) {
77
  }
80 78

  
81
        });
82
      this.sub =  this.route.queryParams.subscribe(params => {
83
          this.datasetInfo = null;
84
          this.updateTitle("Dataset");
85
          this.updateDescription("");
79
  ngOnInit() {
80
    this.route.data
81
      .subscribe((data: { envSpecific: EnvProperties }) => {
82
        this.properties = data.envSpecific;
83
        //this.getDivContents();
84
        this.getPageContents();
85
        this.updateUrl(data.envSpecific.baseLink + this._router.url);
86 86

  
87
            this.datasetId = params['datasetId'];
87
      });
88
    this.sub = this.route.queryParams.subscribe(params => {
89
      this.datasetInfo = null;
90
      this.updateTitle("Dataset");
91
      this.updateDescription("");
88 92

  
89
             if(this.datasetId){
90
                this.getDatasetInfo(this.datasetId);
91
            }else{
92
              this.showLoading = false;
93
                this.warningMessage="No valid research data id";
94
            }
93
      this.datasetId = params['datasetId'];
95 94

  
96
            this.metricsClicked = false;
95
      if (this.datasetId) {
96
        this.getDatasetInfo(this.datasetId);
97
      } else {
98
        this.showLoading = false;
99
        this.warningMessage = "No valid research data id";
100
      }
97 101

  
98
            this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
99
            /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
100
            */
102
      this.metricsClicked = false;
101 103

  
102
            this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
103
            /*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
104
            */
105
            this.scroll();
106
        });
104
      this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.datasetId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
105
      /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
106
      */
107 107

  
108
    }
108
      this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.datasetId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
109
      /*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
110
      */
111
      this.scroll();
112
    });
109 113

  
110
    ngOnDestroy() {
111
      if(this.sub){
112
        this.sub.unsubscribe();
113
      }
114
      if(this.piwiksub){
115
        this.piwiksub.unsubscribe();
116
      }
117
      if(this.infoSub) {
118
        this.infoSub.unsubscribe();
119
      }
114
  }
115

  
116
  private getPageContents() {
117
    this.helper.getPageHelpContents(this.router.url, this.properties, this.communityId).subscribe(contents => {
118
      this.pageContents = contents;
119
    })
120
  }
121

  
122
  private getDivContents() {
123
    this.helper.getDivHelpContents(this.router.url, this.properties, this.communityId).subscribe(contents => {
124
      this.divContents = contents;
125
    })
126
  }
127

  
128
  ngOnDestroy() {
129
    if (this.sub) {
130
      this.sub.unsubscribe();
120 131
    }
132
    if (this.piwiksub) {
133
      this.piwiksub.unsubscribe();
134
    }
135
    if (this.infoSub) {
136
      this.infoSub.unsubscribe();
137
    }
138
  }
121 139

  
122
    private getDatasetInfo(id:string) {
123
        this.warningMessage = '';
124
        this.errorMessage=""
125
        this.showLoading = true;
140
  private getDatasetInfo(id: string) {
141
    this.warningMessage = '';
142
    this.errorMessage = ""
143
    this.showLoading = true;
126 144

  
127
        this.datasetInfo = null;
145
    this.datasetInfo = null;
128 146

  
129
        this.infoSub = this._datasetService.getDatasetInfo(id, this. properties).subscribe(
130
            data => {
131
                this.datasetInfo = data;
132
              this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToDataset + this.datasetInfo.record["result"]["header"]["dri:objIdentifier"]);
133
                /*
134
                if(this.datasetInfo.title.name != undefined && this.datasetInfo.title.name!= ''){
135
                  this.updateTitle(this.datasetInfo.title.name);
136
                  this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name);
137
                }
138
                */
139
                if(this.datasetInfo.title){
140
                  this.updateTitle(this.datasetInfo.title);
141
                  this.updateDescription((this.datasetInfo.description?(this.datasetInfo.description):(","+this.datasetInfo.title)));
142
                }
143
                if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
144
                  this.piwiksub = this._piwikService.trackView(this.properties, this.datasetInfo.title/*.name*/, this.piwikSiteId).subscribe();
145
                }
147
    this.infoSub = this._datasetService.getDatasetInfo(id, this.properties).subscribe(
148
      data => {
149
        this.datasetInfo = data;
150
        this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToDataset + this.datasetInfo.record["result"]["header"]["dri:objIdentifier"]);
151
        /*
152
        if(this.datasetInfo.title.name != undefined && this.datasetInfo.title.name!= ''){
153
          this.updateTitle(this.datasetInfo.title.name);
154
          this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name);
155
        }
156
        */
157
        if (this.datasetInfo.title) {
158
          this.updateTitle(this.datasetInfo.title);
159
          this.updateDescription((this.datasetInfo.description ? (this.datasetInfo.description) : ("," + this.datasetInfo.title)));
160
        }
161
        if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
162
          this.piwiksub = this._piwikService.trackView(this.properties, this.datasetInfo.title/*.name*/, this.piwikSiteId).subscribe();
163
        }
146 164

  
147
                this.result = []
148
                this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: /*this.datasetInfo.title.accessMode*/ this.datasetInfo.accessMode, embargoEndDate: ''};
165
        this.result = []
166
        this.result = {
167
          id: id,
168
          type: "dataset",
169
          source: "openaire",
170
          title: this.datasetInfo.title,
171
          url: '',
172
          result: '',
173
          accessRights: /*this.datasetInfo.title.accessMode*/ this.datasetInfo.accessMode,
174
          embargoEndDate: ''
175
        };
149 176

  
150
                let relatedResearchResultsNum = 0;
151
                if(this.datasetInfo.relatedResearchResults != undefined) {
152
                    this.datasetInfo.relatedResearchResults.forEach(function (value, key, map) {
153
                        relatedResearchResultsNum += value.length;
154
                    });
155
                }
156
                this.relatedResearchResultsNum = relatedResearchResultsNum;
177
        let relatedResearchResultsNum = 0;
178
        if (this.datasetInfo.relatedResearchResults != undefined) {
179
          this.datasetInfo.relatedResearchResults.forEach(function (value, key, map) {
180
            relatedResearchResultsNum += value.length;
181
          });
182
        }
183
        this.relatedResearchResultsNum = relatedResearchResultsNum;
157 184

  
158
                this.showLoading = false;
159
            },
160
            err => {
161
                //console.log(err)
162
                this.handleError("Error getting research data for id: "+this.datasetId, err);
163
                this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToDatasets);
164
                this.errorMessage = 'No research data found';
165
                this.showLoading = false;
166
            }
167
        );
168
    }
185
        this.showLoading = false;
186
      },
187
      err => {
188
        //console.log(err)
189
        this.handleError("Error getting research data for id: " + this.datasetId, err);
190
        this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToDatasets);
191
        this.errorMessage = 'No research data found';
192
        this.showLoading = false;
193
      }
194
    );
195
  }
169 196

  
170
    // showChange($event) {
171
    //     this.showAllReferences=$event.value;
172
    // }
197
  // showChange($event) {
198
  //     this.showAllReferences=$event.value;
199
  // }
173 200

  
174
    public metricsResults($event) {
175
      this.totalViews = $event.totalViews;
176
      this.totalDownloads = $event.totalDownloads;
177
      this.pageViews = $event.pageViews;
178
    }
201
  public metricsResults($event) {
202
    this.totalViews = $event.totalViews;
203
    this.totalDownloads = $event.totalDownloads;
204
    this.pageViews = $event.pageViews;
205
  }
179 206

  
180
    private updateDescription(description:string){
181
      this._meta.updateTag({content:description},"name='description'");
182
      this._meta.updateTag({content:description},"property='og:description'");
183
    }
184
    private updateTitle(title:string){
185
      var _prefix ="OpenAIRE | ";
186
      var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
187
      this._title.setTitle(_title);
188
      this._meta.updateTag({content:_title},"property='og:title'");
189
    }
190
    private updateUrl(url:string){
191
      this._meta.updateTag({content:url},"property='og:url'");
192
    }
207
  private updateDescription(description: string) {
208
    this._meta.updateTag({content: description}, "name='description'");
209
    this._meta.updateTag({content: description}, "property='og:description'");
210
  }
193 211

  
194
    public buildCurationTooltip() {
195
        let tooltipContent: string = "<div class='uk-padding-small uk-light'>";
212
  private updateTitle(title: string) {
213
    var _prefix = "OpenAIRE | ";
214
    var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
215
    this._title.setTitle(_title);
216
    this._meta.updateTag({content: _title}, "property='og:title'");
217
  }
196 218

  
197
        tooltipContent += "<h4>Record in preview</h4>";
198
        tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p></di>";
219
  private updateUrl(url: string) {
220
    this._meta.updateTag({content: url}, "property='og:url'");
221
  }
199 222

  
200
        return tooltipContent;
201
    }
202
    public getKeys( map) {
203
      return Array.from(map.keys());
204
    }
223
  public buildCurationTooltip() {
224
    let tooltipContent: string = "<div class='uk-padding-small uk-light'>";
205 225

  
206
    private handleError(message: string, error) {
207
        console.error("Research Data Landing Page: "+message, error);
208
    }
226
    tooltipContent += "<h4>Record in preview</h4>";
227
    tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p></di>";
209 228

  
210
    public updateReferencesPage($event) {
211
      this.referencesPage = $event.value;
212
    }
229
    return tooltipContent;
230
  }
213 231

  
214
    public totalPages(totalResults: number): number {
215
      let totalPages:any = totalResults/this.pageSize;
216
      if(!(Number.isInteger(totalPages))) {
217
          totalPages = (parseInt(totalPages, this.pageSize) + 1);
218
      }
219
      return totalPages;
232
  public getKeys(map) {
233
    return Array.from(map.keys());
234
  }
235

  
236
  private handleError(message: string, error) {
237
    console.error("Research Data Landing Page: " + message, error);
238
  }
239

  
240
  public updateReferencesPage($event) {
241
    this.referencesPage = $event.value;
242
  }
243

  
244
  public totalPages(totalResults: number): number {
245
    let totalPages: any = totalResults / this.pageSize;
246
    if (!(Number.isInteger(totalPages))) {
247
      totalPages = (parseInt(totalPages, this.pageSize) + 1);
220 248
    }
249
    return totalPages;
250
  }
221 251

  
222
    public scroll() {
223
      HelperFunctions.scroll();
224
    }
225
  isRouteAvailable(routeToCheck:string){
252
  public scroll() {
253
    HelperFunctions.scroll();
254
  }
255

  
256
  isRouteAvailable(routeToCheck: string) {
226 257
    for (let i = 0; i < this.router.config.length; i++) {
227
      let routePath:string = this.router.config[i].path;
228
      if(routePath == routeToCheck){
258
      let routePath: string = this.router.config[i].path;
259
      if (routePath == routeToCheck) {
229 260
        return true;
230 261
      }
231 262
    }

Also available in: Unified diff