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 {OrganizationsDeletedByInferenceService} from './deletedByInference.service'; |
11 |
import {ResultLandingInfo} from "../../../utils/entities/resultLandingInfo"; |
|
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: 'organizationsDeletedByInference', |
... | ... | |
48 | 48 |
public routerHelper:RouterHelper = new RouterHelper(); |
49 | 49 |
public errorCodes:ErrorCodes = new ErrorCodes(); |
50 | 50 |
|
51 |
sub: any;
|
|
51 |
subscriptions = [];
|
|
52 | 52 |
properties:EnvProperties; |
53 | 53 |
|
54 | 54 |
constructor ( private element: ElementRef, |
55 | 55 |
private _deletedByInferenceService: OrganizationsDeletedByInferenceService, |
56 |
private route: ActivatedRoute, |
|
57 |
private _router: Router) { |
|
56 |
private route: ActivatedRoute) { |
|
58 | 57 |
} |
59 | 58 |
|
60 | 59 |
ngOnInit() { |
61 |
this.route.data |
|
60 |
this.subscriptions.push(this.route.data
|
|
62 | 61 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
63 | 62 |
this.properties = data.envSpecific; |
64 | 63 |
|
65 |
}); |
|
66 |
this.sub = this.route.queryParams.subscribe(data => {
|
|
64 |
}));
|
|
65 |
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
|
67 | 66 |
this.errorCodes = new ErrorCodes(); |
68 | 67 |
this.status = this.errorCodes.LOADING; |
69 | 68 |
|
70 | 69 |
this.getDeletedByInference(); |
70 |
})); |
|
71 |
} |
|
72 |
|
|
73 |
ngOnDestroy() { |
|
74 |
this.subscriptions.forEach(subscription => { |
|
75 |
if (subscription instanceof Subscriber) { |
|
76 |
subscription.unsubscribe(); |
|
77 |
} |
|
71 | 78 |
}); |
72 | 79 |
} |
73 |
|
|
74 |
ngOnDestroy() {} |
|
75 |
|
|
76 | 80 |
getDeletedByInference() { |
77 | 81 |
this.results = []; |
78 | 82 |
this.status = this.errorCodes.LOADING; |
79 | 83 |
|
80 |
this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe( |
|
84 |
this.subscriptions.push(this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe(
|
|
81 | 85 |
data => { |
82 | 86 |
this.results = data; |
83 | 87 |
this.status = this.errorCodes.DONE; |
... | ... | |
91 | 95 |
this.status = this.errorCodes.NOT_AVAILABLE; |
92 | 96 |
} |
93 | 97 |
} |
94 |
); |
|
98 |
));
|
|
95 | 99 |
} |
96 | 100 |
|
97 | 101 |
public getResultPreview(result: OrganizationInfo): 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())