Project

General

Profile

« Previous | Next » 

Revision 60774

[Explore | Trunk]: Remove properties resolver subscriptions

View differences:

modules/uoa-services-portal/trunk/explore/src/app/home/home.component.ts
3 3
import {ActivatedRoute, Router} from '@angular/router';
4 4
import {Location} from '@angular/common';
5 5
import "rxjs/add/observable/zip";
6
import {Title, Meta}                  from '@angular/platform-browser';
6
import {Title, Meta} from '@angular/platform-browser';
7 7
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
8
import {  SearchDataprovidersService} from '../openaireLibrary/services/searchDataproviders.service';
9
import {  SearchProjectsService} from '../openaireLibrary/services/searchProjects.service';
10
import {  SearchOrganizationsService} from '../openaireLibrary/services/searchOrganizations.service';
11
import {  RefineFieldResultsService} from '../openaireLibrary/services/refineFieldResults.service';
12
import {  SearchFields} from '../openaireLibrary/utils/properties/searchFields';
13
import {  NumberUtils} from '../openaireLibrary/utils/number-utils.class';
8
import {SearchDataprovidersService} from '../openaireLibrary/services/searchDataproviders.service';
9
import {SearchProjectsService} from '../openaireLibrary/services/searchProjects.service';
10
import {SearchOrganizationsService} from '../openaireLibrary/services/searchOrganizations.service';
11
import {RefineFieldResultsService} from '../openaireLibrary/services/refineFieldResults.service';
12
import {SearchFields} from '../openaireLibrary/utils/properties/searchFields';
13
import {NumberUtils} from '../openaireLibrary/utils/number-utils.class';
14 14

  
15
import {  RouterHelper} from '../openaireLibrary/utils/routerHelper.class';
16
import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
17
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
15
import {RouterHelper} from '../openaireLibrary/utils/routerHelper.class';
16
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
17
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
18 18
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
19
import { SEOService } from '../openaireLibrary/sharedComponents/SEO/SEO.service';
19
import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service';
20 20
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
21 21
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
22 22
import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
23
import {properties} from "../../environments/environment";
23 24

  
24 25
@Component({
25
    selector: 'home',
26
    templateUrl: 'home.component.html',
26
  selector: 'home',
27
  templateUrl: 'home.component.html',
27 28
})
28 29
export class HomeComponent {
29 30
  // MAX 12 logos in every slide
......
106 107
      ]
107 108
    ]
108 109
  };
109

  
110
  
110 111
  public pageTitle = "OpenAIRE";
111
  public keyword:string = "";
112

  
113
  public searchFields:SearchFields = new SearchFields();
114
  public errorCodes:ErrorCodes = new ErrorCodes();
115
  public routerHelper:RouterHelper = new RouterHelper();
116

  
117
  public publicationsSize:any = null;
118
  public datasetsSize:any = null;
119
  public datasetsLinkedSize:any = null;
120
  public softwareLinkedSize:any = null;
112
  public keyword: string = "";
113
  
114
  public searchFields: SearchFields = new SearchFields();
115
  public errorCodes: ErrorCodes = new ErrorCodes();
116
  public routerHelper: RouterHelper = new RouterHelper();
117
  
118
  public publicationsSize: any = null;
119
  public datasetsSize: any = null;
120
  public datasetsLinkedSize: any = null;
121
  public softwareLinkedSize: any = null;
121 122
  public softwareSize: any = null;
122 123
  public otherSize: any = null;
123
  public fundersSize:any = null;
124
  public projectsSize:any = null;
125
  public datasourcesSize:any = null;
126

  
124
  public fundersSize: any = null;
125
  public projectsSize: any = null;
126
  public datasourcesSize: any = null;
127
  
127 128
  private numResults: number = 2;
128

  
129
  showPublications:boolean= false;
130
  showDatasets:boolean= false;
129
  
130
  showPublications: boolean = false;
131
  showDatasets: boolean = false;
131 132
  showSoftware: boolean = false;
132 133
  showOrp: boolean = false;
133
  showProjects:boolean= false;
134
  showDataProviders:boolean= false;
135
  showOrganizations:boolean= false;
136
  properties: EnvProperties;
134
  showProjects: boolean = false;
135
  showDataProviders: boolean = false;
136
  showOrganizations: boolean = false;
137
  properties: EnvProperties = properties;
137 138
  public readMore: boolean = false;
138

  
139
  
139 140
  subs: Subscription[] = [];
140

  
141
  
141 142
  resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
142 143
    filter: null,
143 144
    selected: true,
......
147 148
  selectedEntity = "all";
148 149
  selectedEntitySimpleUrl;
149 150
  selectedEntityAdvancedUrl;
150
  resultTypes:Filter = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Result Types",filterOperator:"or"};
151
  resultTypes: Filter = {
152
    values: [],
153
    filterId: "type",
154
    countSelectedValues: 0,
155
    filterType: 'checkbox',
156
    originalFilterId: "",
157
    valueIsExact: true,
158
    title: "Result Types",
159
    filterOperator: "or"
160
  };
151 161
  public pageContents = null;
152

  
153
  constructor (
162
  
163
  constructor(
154 164
    private route: ActivatedRoute,
155
      private _router: Router,
156
      private _searchResearchResultsService: SearchResearchResultsService,
157
      private _searchDataprovidersService: SearchDataprovidersService,
158
      private _searchProjectsService: SearchProjectsService,
159
      private _searchOrganizationsService: SearchOrganizationsService,
160
      private _refineFieldResultsService:RefineFieldResultsService,
161
      private location: Location, private _piwikService:PiwikService,
162
      private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService,
163
    private helper: HelperService, private router: Router
164
    ) {
165

  
166
          let description = "OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide.";
167
          let title = "OpenAIRE | Find and Share research";
168

  
169
          this._title.setTitle(title);
170
          this._meta.updateTag({content:description},"name='description'");
171
          this._meta.updateTag({content:description},"property='og:description'");
172
          this._meta.updateTag({content:title},"property='og:title'");
173

  
174

  
165
    private _router: Router,
166
    private _searchResearchResultsService: SearchResearchResultsService,
167
    private _searchDataprovidersService: SearchDataprovidersService,
168
    private _searchProjectsService: SearchProjectsService,
169
    private _searchOrganizationsService: SearchOrganizationsService,
170
    private _refineFieldResultsService: RefineFieldResultsService,
171
    private location: Location, private _piwikService: PiwikService,
172
    private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService,
173
    private helper: HelperService
174
  ) {
175
    let description = "OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide.";
176
    let title = "OpenAIRE | Find and Share research";
177
    this._title.setTitle(title);
178
    this._meta.updateTag({content: description}, "name='description'");
179
    this._meta.updateTag({content: description}, "property='og:description'");
180
    this._meta.updateTag({content: title}, "property='og:title'");
175 181
  }
176

  
182
  
177 183
  private getPageContents() {
178 184
    this.subs.push(this.helper.getPageHelpContents(this.properties, 'openaire', this._router.url).subscribe(contents => {
179 185
      this.pageContents = contents;
180 186
    }));
181 187
  }
182

  
188
  
183 189
  public getKeys(obj: {}) {
184 190
    return Object.keys(obj);
185 191
  }
186

  
187
  createRange(number){
192
  
193
  createRange(number) {
188 194
    var items: number[] = [];
189
    for(var i = 1; i <= number; i++){
195
    for (var i = 1; i <= number; i++) {
190 196
      items.push(i);
191 197
    }
192 198
    return items;
193 199
  }
194

  
200
  
195 201
  public ceil(num: number) {
196 202
    return Math.ceil(num);
197 203
  }
198

  
204
  
199 205
  public ngOnInit() {
200
    this.subs.push(this.route.data
201
     .subscribe((data: { envSpecific: EnvProperties }) => {
202
        this.properties = data.envSpecific;
203
        this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink+this._router.url, false);
204
       this.getPageContents();
205

  
206
       if(this.properties!=null){
207
          var url = this.properties.domain + this.properties.baseLink+this._router.url;
208
          this._meta.updateTag({content:url},"property='og:url'");
209
          if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
210
            this.subs.push(this._piwikService.trackView(this.properties, "OpenAIRE").subscribe());
206
    this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this._router.url, false);
207
    this.getPageContents();
208
    if (this.properties != null) {
209
      var url = this.properties.domain + this.properties.baseLink + this._router.url;
210
      this._meta.updateTag({content: url}, "property='og:url'");
211
      if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
212
        this.subs.push(this._piwikService.trackView(this.properties, "OpenAIRE").subscribe());
213
      }
214
      //this.config.getCommunityInformation(this.properties, this.properties.adminToolsCommunity ).subscribe(data => {
215
      this.subs.push(this.config.communityInformationState.subscribe(data => {
216
          if (data) {
217
            var showEntity = {};
218
            for (var i = 0; i < data['entities'].length; i++) {
219
              showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
220
            }
221
            this.showPublications = showEntity["publication"];
222
            this.showDatasets = showEntity["dataset"];
223
            this.showSoftware = showEntity["software"];
224
            this.showOrp = showEntity["orp"];
225
            this.showProjects = showEntity["project"];
226
            this.showDataProviders = showEntity["datasource"];
227
            this.showOrganizations = showEntity["organization"];
228
            if (this.showPublications) {
229
              this.resultTypes.values.push({name: "Publications", id: "publications", selected: true, number: 0});
230
            }
231
            if (this.showDatasets) {
232
              this.resultTypes.values.push({name: "Research data", id: "datasets", selected: true, number: 0});
233
            }
234
            if (this.showSoftware) {
235
              this.resultTypes.values.push({name: "Software", id: "software", selected: true, number: 0});
236
            }
237
            if (this.showOrp) {
238
              this.resultTypes.values.push({name: "Other research products", id: "other", selected: true, number: 0});
239
            }
240
            this.getNumbers();
211 241
          }
212

  
213
          //this.config.getCommunityInformation(this.properties, this.properties.adminToolsCommunity ).subscribe(data => {
214
         this.subs.push(this.config.communityInformationState.subscribe(data => {
215
           if(data) {
216
             var showEntity = {};
217
             for (var i = 0; i < data['entities'].length; i++) {
218

  
219
               showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
220
             }
221
             this.showPublications = showEntity["publication"];
222
             this.showDatasets = showEntity["dataset"];
223
             this.showSoftware = showEntity["software"];
224
             this.showOrp = showEntity["orp"];
225
             this.showProjects = showEntity["project"];
226
             this.showDataProviders = showEntity["datasource"];
227
             this.showOrganizations = showEntity["organization"];
228
             if(this.showPublications){
229
               this.resultTypes.values.push({name: "Publications" , id:"publications",selected:true, number:0});
230
             }
231
             if(this.showDatasets){
232
               this.resultTypes.values.push({name: "Research data" , id:"datasets",selected:true, number:0});
233
             }
234
             if(this.showSoftware){
235
               this.resultTypes.values.push({name: "Software" , id:"software",selected:true, number:0});
236
             }
237
             if(this.showOrp){
238
               this.resultTypes.values.push({name: "Other research products" , id:"other",selected:true, number:0});
239
             }
240
             this.getNumbers();
241
           }
242
         },
243
          error => {
244
            this.handleError("Error getting community information", error);
245
          }
246
        ));
247
       }
248
     }));
242
        },
243
        error => {
244
          this.handleError("Error getting community information", error);
245
        }
246
      ));
247
    }
249 248
  }
249
  
250 250
  public ngOnDestroy() {
251 251
    for (let sub of this.subs) {
252 252
      sub.unsubscribe();
253 253
    }
254 254
  }
255

  
256
   private getNumbers() {
257
     if(this.showPublications){
258
       this.subs.push(this._searchResearchResultsService.numOfSearchResults("publication", "", this.properties).subscribe(
259
               data => {
260
                  if(data && data != null && data > 0 ){
261
                      this.publicationsSize = NumberUtils.roundNumber(data);
262

  
263
                  }
264
               },
265
               err => {
266
         		    //console.log(err);
267
                this.handleError("Error getting number of publications", err);
268
          		 }
269
        ));
270
      }
271
      if(this.showDatasets){
272
        this.subs.push(this._searchResearchResultsService.numOfSearchResults("dataset", "", this.properties).subscribe(
273
             data => {
274
               if(data && data != null && data > 0 ){
275
                   this.datasetsSize = NumberUtils.roundNumber(data);
276
               }
277
             },
278
             err => {
279
                 //console.log(err);
280
                 this.handleError("Error getting number of research data", err);
281
               }
282
         ));
283
        this.subs.push(this._searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties).subscribe(
284
          data => {
285
            if(data && data != null && data > 0 ){
286
              this.datasetsLinkedSize = NumberUtils.roundNumber(data);
287
            }
288
          },
289
          err => {
290
            //console.log(err);
291
            this.handleError("Error getting number of linkedresearch data", err);
255
  
256
  private getNumbers() {
257
    if (this.showPublications) {
258
      this.subs.push(this._searchResearchResultsService.numOfSearchResults("publication", "", this.properties).subscribe(
259
        data => {
260
          if (data && data != null && data > 0) {
261
            this.publicationsSize = NumberUtils.roundNumber(data);
262
            
292 263
          }
293
        ));
294

  
295
       }
296
     if (this.showSoftware) {
297
       this.subs.push(this._searchResearchResultsService.numOfSearchResults("software", "", this.properties).subscribe(
298
         data => {
299
           if (data && data > 0) {
300
             this.softwareSize = NumberUtils.roundNumber(data);
301
           }else{
302
             this.showSoftware = false;
303
           }
304
         },
305
         err => {
306
           this.handleError("Error getting number of software data", err);
307
         }
308
       ));
309
       this.subs.push(this._searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties).subscribe(
310
         data => {
311
           if(data && data != null && data > 0 ){
312
             this.softwareLinkedSize = NumberUtils.roundNumber(data);
313
           }
314
         },
315
         err => {
316
           //console.log(err);
317
           this.handleError("Error getting number of linked software", err);
318
         }
319
       ));
320
     }
321
     if (this.showOrp) {
322
       this.subs.push(this._searchResearchResultsService.numOfSearchResults("other", "", this.properties).subscribe(
323
         data => {
324
           if (data && data > 0) {
325
             this.otherSize = NumberUtils.roundNumber(data);
326
           }else{
327
             this.showOrp = false;
328
           }
329
         },
330
         err => {
331
           this.handleError("Error getting number of software data", err);
332
         }
333
       ));
334
     }
335
       if(this.showProjects){
336
         this.subs.push(this._refineFieldResultsService.getRefineFieldsResultsByEntityName(["funder"],"project", this.properties).subscribe(
337
           data => {
338

  
339

  
340
                if(data[0] && data[0] > 0 ){
341
                  this.projectsSize = NumberUtils.roundNumber(data[0]);
342
                }
343
                if(data[1].length > 0 && data[1][0].filterId == "funder" && data[1][0].values ){
344
                  this.fundersSize = NumberUtils.roundNumber(data[1][0].values.length);
345
                }
346

  
347
           },
348
           err => {
349
               //console.log(err);
350
               this.handleError("Error getting 'funder' field results of projects", err);
264
        },
265
        err => {
266
          //console.log(err);
267
          this.handleError("Error getting number of publications", err);
268
        }
269
      ));
270
    }
271
    if (this.showDatasets) {
272
      this.subs.push(this._searchResearchResultsService.numOfSearchResults("dataset", "", this.properties).subscribe(
273
        data => {
274
          if (data && data != null && data > 0) {
275
            this.datasetsSize = NumberUtils.roundNumber(data);
276
          }
277
        },
278
        err => {
279
          //console.log(err);
280
          this.handleError("Error getting number of research data", err);
281
        }
282
      ));
283
      this.subs.push(this._searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties).subscribe(
284
        data => {
285
          if (data && data != null && data > 0) {
286
            this.datasetsLinkedSize = NumberUtils.roundNumber(data);
287
          }
288
        },
289
        err => {
290
          //console.log(err);
291
          this.handleError("Error getting number of linkedresearch data", err);
292
        }
293
      ));
294
      
295
    }
296
    if (this.showSoftware) {
297
      this.subs.push(this._searchResearchResultsService.numOfSearchResults("software", "", this.properties).subscribe(
298
        data => {
299
          if (data && data > 0) {
300
            this.softwareSize = NumberUtils.roundNumber(data);
301
          } else {
302
            this.showSoftware = false;
303
          }
304
        },
305
        err => {
306
          this.handleError("Error getting number of software data", err);
307
        }
308
      ));
309
      this.subs.push(this._searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties).subscribe(
310
        data => {
311
          if (data && data != null && data > 0) {
312
            this.softwareLinkedSize = NumberUtils.roundNumber(data);
313
          }
314
        },
315
        err => {
316
          //console.log(err);
317
          this.handleError("Error getting number of linked software", err);
318
        }
319
      ));
320
    }
321
    if (this.showOrp) {
322
      this.subs.push(this._searchResearchResultsService.numOfSearchResults("other", "", this.properties).subscribe(
323
        data => {
324
          if (data && data > 0) {
325
            this.otherSize = NumberUtils.roundNumber(data);
326
          } else {
327
            this.showOrp = false;
328
          }
329
        },
330
        err => {
331
          this.handleError("Error getting number of software data", err);
332
        }
333
      ));
334
    }
335
    if (this.showProjects) {
336
      this.subs.push(this._refineFieldResultsService.getRefineFieldsResultsByEntityName(["funder"], "project", this.properties).subscribe(
337
        data => {
338
          
339
          
340
          if (data[0] && data[0] > 0) {
341
            this.projectsSize = NumberUtils.roundNumber(data[0]);
342
          }
343
          if (data[1].length > 0 && data[1][0].filterId == "funder" && data[1][0].values) {
344
            this.fundersSize = NumberUtils.roundNumber(data[1][0].values.length);
345
          }
346
          
347
        },
348
        err => {
349
          //console.log(err);
350
          this.handleError("Error getting 'funder' field results of projects", err);
351 351
        }));
352
      }
353
      if(this.showDataProviders){
354
        this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders("", this.properties).subscribe(
355
           data => {
356
             if(data && data != null && data > 0 ){
357
                 this.datasourcesSize = NumberUtils.roundNumber(data);
358
             }
359

  
360
           },
361
           err => {
362
               //console.log(err);
363
               this.handleError("Error getting number of content providers", err);
364
           }
365
       ));
366
     }
367
   }
368

  
369
   private handleError(message: string, error) {
370
       console.error("Home Page: "+message, error);
371
   }
372
  entityChanged($event){
352
    }
353
    if (this.showDataProviders) {
354
      this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders("", this.properties).subscribe(
355
        data => {
356
          if (data && data != null && data > 0) {
357
            this.datasourcesSize = NumberUtils.roundNumber(data);
358
          }
359
          
360
        },
361
        err => {
362
          //console.log(err);
363
          this.handleError("Error getting number of content providers", err);
364
        }
365
      ));
366
    }
367
  }
368
  
369
  private handleError(message: string, error) {
370
    console.error("Home Page: " + message, error);
371
  }
372
  
373
  entityChanged($event) {
373 374
    this.selectedEntity = $event.entity;
374 375
    this.selectedEntitySimpleUrl = $event.simpleUrl;
375 376
    this.selectedEntityAdvancedUrl = $event.advancedUrl;
376 377
  }
377
  goTo(simple:boolean){
378
    let url = (simple)?this.selectedEntitySimpleUrl:this.selectedEntityAdvancedUrl;
378
  
379
  goTo(simple: boolean) {
380
    let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl;
379 381
    let parameterNames = [];
380 382
    let parameterValues = [];
381 383
    if (this.selectedEntity == "result") {
382 384
      if (this.resultTypes) {
383 385
        let values = [];
384
        for(let value of this.resultTypes.values){
386
        for (let value of this.resultTypes.values) {
385 387
          if (value.selected) {
386 388
            values.push(value.id);
387 389
          }
388 390
        }
389
        if (values.length > 0 && values.length !=4) {
391
        if (values.length > 0 && values.length != 4) {
390 392
          parameterNames.push("type");
391 393
          parameterValues.push(values.join(","));
392 394
        }
......
395 397
          parameterValues.push("" + this.resultsQuickFilter.selected);
396 398
        }
397 399
      }
398
    }else if(this.selectedEntity == "all"){
400
    } else if (this.selectedEntity == "all") {
399 401
      if (this.resultsQuickFilter) {
400 402
        parameterNames.push("qf");
401 403
        parameterValues.push("true");
402 404
      }
403 405
    }
404
    if(this.keyword.length > 0) {
406
    if (this.keyword.length > 0) {
405 407
      parameterNames.push("fv0");
406 408
      parameterValues.push(this.keyword);
407 409
      parameterNames.push("f0");
408 410
      parameterValues.push("q");
409 411
    }
410
    console.log( this.routerHelper.createQueryParams(parameterNames, parameterValues))
412
    console.log(this.routerHelper.createQueryParams(parameterNames, parameterValues))
411 413
    this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
412
   }
414
  }
413 415
}
modules/uoa-services-portal/trunk/explore/src/app/claims/claimsAdmin/claimsAdmin.component.ts
1
import {Component} from '@angular/core';
2
import {ActivatedRoute}                  from '@angular/router';
3
import {EnvProperties}                           from '../../openaireLibrary/utils/properties/env-properties';
4
import {Subscriber} from "rxjs";
1
import {Component, OnInit} from '@angular/core';
2
import {properties} from "../../../environments/environment";
5 3

  
6 4
@Component({
7
    selector: 'openaire-claims-admin',
8
    template: `
5
  selector: 'openaire-claims-admin',
6
  template: `
9 7
    <claims-admin *ngIf="claimsInfoURL && userInfoURL" [claimsInfoURL]=claimsInfoURL [userInfoURL]="userInfoURL">
10 8
    </claims-admin>
11

  
12
    `,
13

  
9
  `,
14 10
})
15
export class OpenaireClaimsAdminComponent {
16

  
17
  claimsInfoURL:string;
11
export class OpenaireClaimsAdminComponent implements OnInit {
12
  claimsInfoURL: string;
18 13
  userInfoURL: string;
19
  sub;
20
 constructor (private route: ActivatedRoute) {
14
  
15
  constructor() {
21 16
  }
22
  ngOnDestroy() {
23
    if (this.sub instanceof Subscriber) {
24
      this.sub.unsubscribe();
25
    }
26
  }
27

  
17
  
28 18
  public ngOnInit() {
29
    this.sub = this.route.data
30
        .subscribe((data: { envSpecific: EnvProperties }) => {
31
           this.claimsInfoURL = data.envSpecific.claimsInformationLink;
32
          this.userInfoURL = data.envSpecific.userInfoUrl;
33
        });
19
    this.claimsInfoURL = properties.claimsInformationLink;
20
    this.userInfoURL = properties.userInfoUrl;
34 21
  }
35 22
}
modules/uoa-services-portal/trunk/explore/src/app/claims/myClaims/myClaims.component.ts
1
import {Component} from '@angular/core';
2
import {ActivatedRoute} from '@angular/router';
3
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
4
import {Subscriber} from "rxjs";
1
import {Component, OnInit} from '@angular/core';
2
import {properties} from "../../../environments/environment";
5 3

  
6 4

  
7

  
8 5
@Component({
9
    selector: 'openaire-my-claims',
10
    template: `
6
  selector: 'openaire-my-claims',
7
  template: `
11 8
    <my-claims *ngIf="userInfoURL && claimsInfoURL" [claimsInfoURL]=claimsInfoURL [userInfoURL]="userInfoURL">
12
</my-claims>
13
`
14

  
9
    </my-claims>
10
  `
11
  
15 12
})
16
 export class OpenaireMyClaimsComponent {
17
  claimsInfoURL:string;
13
export class OpenaireMyClaimsComponent implements OnInit {
14
  claimsInfoURL: string;
18 15
  userInfoURL: string;
19
  sub;
20
  constructor (private route: ActivatedRoute) {
16
  
17
  constructor() {
21 18
  }
22
  ngOnDestroy() {
23
    if (this.sub instanceof Subscriber) {
24
      this.sub.unsubscribe();
25
    }
19
  
20
  public ngOnInit() {
21
    this.claimsInfoURL = properties.claimsInformationLink;
22
    this.userInfoURL = properties.userInfoUrl;
26 23
  }
27
   public ngOnInit() {
28
     this.sub = this.route.data
29
         .subscribe((data: { envSpecific: EnvProperties }) => {
30
            this.claimsInfoURL = data.envSpecific.claimsInformationLink;
31
            this.userInfoURL = data.envSpecific.userInfoUrl;
32
         });
33
   }
34 24
}

Also available in: Unified diff