Revision 59816
Added by Argiro Kokogiannaki over 3 years ago
linkingGeneric.component.ts | ||
---|---|---|
9 | 9 |
import {HelperFunctions} from "../../utils/HelperFunctions.class"; |
10 | 10 |
import {HelperService} from "../../utils/helper/helper.service"; |
11 | 11 |
import {PiwikService} from "../../utils/piwik/piwik.service"; |
12 |
import {Subscriber} from "rxjs"; |
|
12 | 13 |
|
13 | 14 |
declare var UIkit:any; |
14 | 15 |
|
... | ... | |
36 | 37 |
// show linkToEntities /values: result, project, context |
37 | 38 |
|
38 | 39 |
@Input() sources:ClaimEntity[] =[]; |
39 |
sub:any =null; |
|
40 | 40 |
properties:EnvProperties; |
41 | 41 |
@Input() localStoragePrefix:string = "linking_"; |
42 | 42 |
url=null; |
... | ... | |
48 | 48 |
private _meta: Meta, private _title: Title, private _piwikService:PiwikService, |
49 | 49 |
private seoService: SEOService, private helper: HelperService ) { |
50 | 50 |
} |
51 |
subscriptions = []; |
|
52 |
|
|
51 | 53 |
ngOnInit() { |
52 | 54 |
this.showOptions.show = 'source'; |
53 | 55 |
if(this.inlineEntity){ |
... | ... | |
55 | 57 |
this.showOptions.basketShowLinksTo = true; |
56 | 58 |
this.showOptions.show = this.showOptions.linkTo; |
57 | 59 |
} |
58 |
this.route.data |
|
60 |
this.subscriptions.push(this.route.data
|
|
59 | 61 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
60 | 62 |
this.properties = data.envSpecific; |
61 | 63 |
this.url = this.properties.domain + this.properties.baseLink+this._router.url; |
... | ... | |
68 | 70 |
this.seoService.createLinkForCanonicalURL(this.url, false); |
69 | 71 |
|
70 | 72 |
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ |
71 |
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
|
|
73 |
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe());
|
|
72 | 74 |
} |
73 | 75 |
|
74 | 76 |
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { |
75 | 77 |
this.pageContents = contents; |
76 | 78 |
}) |
77 | 79 |
|
78 |
}); |
|
80 |
}));
|
|
79 | 81 |
if( typeof localStorage !== 'undefined') { |
80 | 82 |
this.localStoragePrefix +=(this.communityId?this.communityId+"_":""); |
81 | 83 |
if(localStorage.getItem(this.localStoragePrefix + "results")){ |
... | ... | |
89 | 91 |
} |
90 | 92 |
|
91 | 93 |
ngOnDestroy() { |
92 |
if(this.piwiksub){ |
|
93 |
this.piwiksub.unsubscribe(); |
|
94 |
} |
|
94 |
this.subscriptions.forEach(subscription => { |
|
95 |
if (subscription instanceof Subscriber) { |
|
96 |
subscription.unsubscribe(); |
|
97 |
} |
|
98 |
}); |
|
95 | 99 |
} |
96 | 100 |
|
97 | 101 |
openSelectionModal() { |
Also available in: Unified diff
[Library|Trunk]
code clean up:
-remove app.* files from library
-remove unused imports, code, files (Old search pages for results, dataproviders, map search page, etc)
-remove Freeguard from modules
-unsubscribe all subscriptions
-Services: configuration, isvocabularies, user management: unsubscribe from app component or the component that uses them (clearSubscriptions())
-Fetchers: unsubscribe from the component that uses them (clearSubscriptions())