Revision 59816
Added by Argiro Kokogiannaki over 3 years ago
deletedByInference.component.ts | ||
---|---|---|
1 |
import {Component, ViewChild} from '@angular/core';
|
|
1 |
import {Component} from '@angular/core'; |
|
2 | 2 |
import {ElementRef, Input} from '@angular/core'; |
3 | 3 |
import {ActivatedRoute, Router} from '@angular/router'; |
4 | 4 |
|
... | ... | |
8 | 8 |
import {ErrorCodes} from '../../../utils/properties/errorCodes'; |
9 | 9 |
|
10 | 10 |
import {DeletedByInferenceService} from './deletedByInference.service'; |
11 |
import {SearchResult} from "../../../utils/entities/searchResult"; |
|
12 | 11 |
import {ResultPreview} from "../../../utils/result-preview/result-preview"; |
13 | 12 |
import {AlertModal} from "../../../utils/modal/alert"; |
13 |
import {Subscriber} from "rxjs"; |
|
14 | 14 |
|
15 | 15 |
@Component({ |
16 | 16 |
selector: 'deletedByInference', |
... | ... | |
49 | 49 |
public routerHelper: RouterHelper = new RouterHelper(); |
50 | 50 |
public errorCodes: ErrorCodes = new ErrorCodes(); |
51 | 51 |
|
52 |
sub: any;
|
|
52 |
subscriptions = [];
|
|
53 | 53 |
properties: EnvProperties; |
54 | 54 |
|
55 | 55 |
constructor(private element: ElementRef, |
... | ... | |
59 | 59 |
} |
60 | 60 |
|
61 | 61 |
ngOnInit() { |
62 |
this.route.data |
|
62 |
this.subscriptions.push(this.route.data
|
|
63 | 63 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
64 | 64 |
this.properties = data.envSpecific; |
65 | 65 |
|
66 |
}); |
|
67 |
this.sub = this.route.queryParams.subscribe(data => {
|
|
66 |
}));
|
|
67 |
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
|
68 | 68 |
this.errorCodes = new ErrorCodes(); |
69 | 69 |
this.status = this.errorCodes.LOADING; |
70 | 70 |
|
71 | 71 |
this.getDeletedByInference(); |
72 |
}); |
|
72 |
}));
|
|
73 | 73 |
} |
74 |
|
|
74 |
|
|
75 | 75 |
ngOnDestroy() { |
76 |
this.subscriptions.forEach(subscription => { |
|
77 |
if (subscription instanceof Subscriber) { |
|
78 |
subscription.unsubscribe(); |
|
79 |
} |
|
80 |
}); |
|
76 | 81 |
} |
77 | 82 |
|
78 | 83 |
getDeletedByInference() { |
79 | 84 |
this.results = []; |
80 | 85 |
this.status = this.errorCodes.LOADING; |
81 |
this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe( |
|
86 |
this.subscriptions.push(this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe(
|
|
82 | 87 |
data => { |
83 | 88 |
this.results = data; |
84 | 89 |
this.status = this.errorCodes.DONE; |
... | ... | |
92 | 97 |
this.status = this.errorCodes.NOT_AVAILABLE; |
93 | 98 |
} |
94 | 99 |
} |
95 |
); |
|
100 |
));
|
|
96 | 101 |
} |
97 | 102 |
|
98 | 103 |
public getResultPreview(result: ResultLandingInfo): ResultPreview { |
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())