From 2ff6fb3cea9fb67e4c337d3a8a293e05dfcbed9d Mon Sep 17 00:00:00 2001 From: ShaabanEltanany Date: Sun, 25 Oct 2020 09:33:06 +0200 Subject: designer view from packages dashboard -delete package with id Issue-ID: CCSDK-2483 Issue-ID: CCSDK-2942 Signed-off-by: ShaabanEltanany Change-Id: I517fb265b991a522a987bbfb628ec877cbb53db7 --- .../package-list/package-list.component.html | 5 +-- .../package-list/package-list.component.ts | 36 ++++++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) (limited to 'cds-ui/designer-client/src') diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html index 0bb4f1f41..0b03f4dde 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html @@ -63,7 +63,7 @@
  • - + Delete @@ -111,7 +111,7 @@ class="icon-btn-card-config" aria-hidden="true">Configuration
    -
    @@ -125,3 +125,4 @@ + diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts index 4d0e108cf..44c4a7168 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts @@ -1,11 +1,12 @@ -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'; +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'; +import {ToastrService} from 'ngx-toastr'; @Component({ selector: 'app-packages-list', @@ -23,11 +24,11 @@ export class PackageListComponent implements OnInit { private configurationDashboardService: ConfigurationDashboardService, private ngxLoader: NgxUiLoaderService, private tourService: TourService, + private toastService: ToastrService ) { console.log('PackageListComponent'); - this.packagesStore.state$.subscribe(state => { console.log(state); if (state.filteredPackages) { @@ -51,8 +52,23 @@ export class PackageListComponent implements OnInit { downloadPackage(artifactName: string, artifactVersion: string) { this.configurationDashboardService.downloadResource(artifactName + '/' + artifactVersion).subscribe(response => { - const blob = new Blob([response], { type: 'application/octet-stream' }); + const blob = new Blob([response], {type: 'application/octet-stream'}); saveAs(blob, artifactName + '-' + artifactVersion + '-CBA.zip'); }); } + + viewDesigner(id: string) { + this.router.navigate(['/packages/designer', id]); + } + + deletePackage(id: string) { + this.configurationDashboardService.deletePackage(id).subscribe(res => { + this.toastService.info('package deleted successfully '); + this.router.navigate(['/packages']); + this.packagesStore.getAll(); + }, err => { + this.toastService.error('error deleting package' + err.message); + }); + + } } -- cgit 1.2.3-korg