blob: 5e52880f0ae47a6a6a03bc328822c56f9eee5f17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import { Component, Input, OnChanges } from '@angular/core';
import _ from 'lodash';
import { OsdService } from '~/app/shared/api/osd.service';
import { Permission } from '~/app/shared/models/permissions';
import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
@Component({
selector: 'cd-osd-details',
templateUrl: './osd-details.component.html',
styleUrls: ['./osd-details.component.scss']
})
export class OsdDetailsComponent implements OnChanges {
@Input()
selection: any;
osd: {
id?: number;
details?: any;
tree?: any;
};
grafanaPermission: Permission;
constructor(private osdService: OsdService, private authStorageService: AuthStorageService) {
this.grafanaPermission = this.authStorageService.getPermissions().grafana;
}
ngOnChanges() {
if (this.osd?.id !== this.selection?.id) {
this.osd = this.selection;
}
if (_.isNumber(this.osd?.id)) {
this.refresh();
}
}
refresh() {
this.osdService.getDetails(this.osd.id).subscribe((data) => {
this.osd.details = data;
});
}
}
|