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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
import { Component, OnInit } from '@angular/core';
import {AuthModule} from 'globunet-angular/core';
import {SoftwareProfileService} from '../../api/software-profile.service';
import {OgCommonService} from '../../service/og-common.service';
import {TranslateService} from '@ngx-translate/core';
import {SoftwareComponentService} from '../../api/software-component.service';
import {OgSweetAlertService} from '../../service/og-sweet-alert.service';
import {ToasterService} from '../../service/toaster.service';
import {SoftwareTypeService} from '../../api/software-type.service';
@Component({
selector: 'app-software',
templateUrl: './software.component.html',
styleUrls: ['./software.component.css']
})
export class SoftwareComponent implements OnInit {
public softwareProfileGroups: any[] = [];
public softwareComponentsGroups: any[][];
public softwareComponents: any[] = [];
public softwareTypes: any[] = [];
constructor(private authModule: AuthModule,
private ogSweetAlert: OgSweetAlertService,
private toaster: ToasterService,
private softwareComponentService: SoftwareComponentService,
private softwareTypeService: SoftwareTypeService,
private softwareProfileService: SoftwareProfileService,
private OGCommonService: OgCommonService,
private translate: TranslateService) { }
ngOnInit() {
if (this.authModule.getLoggedUser().id !== 0) {
this.softwareProfileService.list().subscribe(
(response) => {
this.softwareProfileGroups = [
this.OGCommonService.createGroups(response, 'profiles')
];
this.softwareProfileGroups[0].name = this.translate.instant('software_profiles');
},
(error) => {
alert(error);
}
);
this.softwareTypeService.list().subscribe(
data => {
this.softwareTypes = data;
},
(error) => {
alert(error);
}
);
this.softwareComponentService.list().subscribe(
data => {
this.softwareComponents = data;
this.softwareComponentsGroups = [
this.OGCommonService.createGroups(this.softwareComponents, 'components')
];
// @ts-ignore
this.softwareComponentsGroups[0].name = this.translate.instant('software_components');
},
error => {
alert(error);
}
);
}
}
}
|