blob: 4d0e108cf9b55cfd89d1bea2d94aba099822935f (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import { Component, OnInit } from '@angular/core';
import { BlueprintModel } from '../../model/BluePrint.model';
import { PackagesStore } from '../../packages.store';
import { Router } from '@angular/router';
import { ConfigurationDashboardService } from '../../configuration-dashboard/configuration-dashboard.service';
import { saveAs } from 'file-saver';
import { NgxUiLoaderService } from 'ngx-ui-loader';
import { TourService } from 'ngx-tour-md-menu';
@Component({
selector: 'app-packages-list',
templateUrl: './package-list.component.html',
styleUrls: ['./package-list.component.css']
})
export class PackageListComponent implements OnInit {
viewedPackages: BlueprintModel[] = [];
constructor(
private packagesStore: PackagesStore,
private router: Router,
private configurationDashboardService: ConfigurationDashboardService,
private ngxLoader: NgxUiLoaderService,
private tourService: TourService,
) {
console.log('PackageListComponent');
this.packagesStore.state$.subscribe(state => {
console.log(state);
if (state.filteredPackages) {
this.viewedPackages = state.filteredPackages.content;
}
});
}
ngOnInit() {
this.packagesStore.getAll();
}
view(id) {
this.router.navigate(['/packages/package', id]);
}
testDispatch(bluePrint: BlueprintModel) {
console.log(bluePrint.id);
}
downloadPackage(artifactName: string, artifactVersion: string) {
this.configurationDashboardService.downloadResource(artifactName + '/' + artifactVersion).subscribe(response => {
const blob = new Blob([response], { type: 'application/octet-stream' });
saveAs(blob, artifactName + '-' + artifactVersion + '-CBA.zip');
});
}
}
|