Revision 60772
Added by Konstantinos Triantafyllou about 3 years ago
advancedSearchDataProviders.component.ts | ||
---|---|---|
1 |
import {Component, Input, ViewChild} from '@angular/core';
|
|
1 |
import {Component, OnInit} from '@angular/core';
|
|
2 | 2 |
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; |
3 |
import {ActivatedRoute} from "@angular/router"; |
|
4 | 3 |
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; |
5 | 4 |
import {PiwikHelper} from "../../utils/piwikHelper"; |
6 |
import {Subscriber} from "rxjs"; |
|
7 | 5 |
import {properties} from "../../../environments/environment"; |
8 | 6 |
|
9 |
|
|
10 | 7 |
@Component({ |
11 |
selector: 'openaire-advanced-search-dataprovider', |
|
12 |
template: ` |
|
13 |
<search-dataproviders [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false"> |
|
8 |
selector: 'openaire-advanced-search-dataprovider', |
|
9 |
template: ` |
|
10 |
<search-dataproviders [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" |
|
11 |
[hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false"> |
|
14 | 12 |
</search-dataproviders> |
15 |
|
|
16 |
` |
|
17 |
}) |
|
18 |
|
|
19 |
export class OpenaireAdvancedSearchDataProvidersComponent { |
|
20 |
connectCommunityId:string; |
|
13 |
` |
|
14 |
}) |
|
15 |
export class OpenaireAdvancedSearchDataProvidersComponent implements OnInit { |
|
16 |
communityId: string; |
|
21 | 17 |
piwikSiteId = null; |
22 | 18 |
customFilter: SearchCustomFilter = null; |
23 |
constructor ( private route: ActivatedRoute) { |
|
19 |
|
|
20 |
constructor() { |
|
24 | 21 |
} |
25 |
sub; |
|
26 |
ngOnDestroy() { |
|
27 |
if (this.sub instanceof Subscriber) { |
|
28 |
this.sub.unsubscribe(); |
|
22 |
|
|
23 |
ngOnInit() { |
|
24 |
let communityId = ConnectHelper.getCommunityFromDomain(properties.domain); |
|
25 |
if (communityId) { |
|
26 |
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment); |
|
27 |
this.communityId = communityId; |
|
28 |
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, ""); |
|
29 |
this.customFilter.isHiddenFilter = false; |
|
29 | 30 |
} |
30 | 31 |
} |
31 |
ngOnInit() { |
|
32 |
|
|
33 |
|
|
34 |
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain); |
|
35 |
|
|
36 |
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment); |
|
37 |
|
|
38 |
if(communityId){ |
|
39 |
this.connectCommunityId = communityId; |
|
40 |
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, ""); |
|
41 |
this.customFilter.isHiddenFilter = false; |
|
42 |
} else{ |
|
43 |
this.sub = this.route.queryParams.subscribe(params => { |
|
44 |
|
|
45 |
if(params['communityId'] && params['communityId']!=""){ |
|
46 |
this.connectCommunityId = params['communityId']; |
|
47 |
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId, properties.environment); |
|
48 |
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, ""); |
|
49 |
this.customFilter.isHiddenFilter = false; |
|
50 |
} |
|
51 |
}); |
|
52 |
} |
|
53 |
|
|
54 |
} |
|
55 | 32 |
} |
Also available in: Unified diff
[Connect | Trunk]: Delete properties resolver. Delete query param community id