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