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