1 import { Component, OnInit } from '@angular/core';
2 import { BlueprintModel } from '../../model/BluePrint.model';
3 import { PackagesStore } from '../../packages.store';
4 import { Router } from '@angular/router';
5 import { ConfigurationDashboardService } from '../../configuration-dashboard/configuration-dashboard.service';
6 import { saveAs } from 'file-saver';
7 import { NgxUiLoaderService } from 'ngx-ui-loader';
8 import { TourService } from 'ngx-tour-md-menu';
11 selector: 'app-packages-list',
12 templateUrl: './package-list.component.html',
13 styleUrls: ['./package-list.component.css']
15 export class PackageListComponent implements OnInit {
17 viewedPackages: BlueprintModel[] = [];
21 private packagesStore: PackagesStore,
22 private router: Router,
23 private configurationDashboardService: ConfigurationDashboardService,
24 private ngxLoader: NgxUiLoaderService,
25 private tourService: TourService,
27 console.log('PackageListComponent');
31 this.packagesStore.state$.subscribe(state => {
33 if (state.filteredPackages) {
34 this.viewedPackages = state.filteredPackages.content;
41 this.packagesStore.getAll();
49 this.router.navigate(['/packages/package', id]);
52 testDispatch(bluePrint: BlueprintModel) {
53 console.log(bluePrint.id);
56 downloadPackage(artifactName: string, artifactVersion: string) {
57 this.configurationDashboardService.downloadResource(artifactName + '/' + artifactVersion).subscribe(response => {
58 const blob = new Blob([response], { type: 'application/octet-stream' });
59 saveAs(blob, artifactName + '-' + artifactVersion + '-CBA.zip');