designer view from packages dashboard 27/114227/1
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>
Sun, 25 Oct 2020 07:33:06 +0000 (09:33 +0200)
committerShaabanEltanany <shaaban.eltanany.ext@orange.com>
Sun, 25 Oct 2020 07:33:06 +0000 (09:33 +0200)
-delete package with id

Issue-ID: CCSDK-2483
Issue-ID: CCSDK-2942

Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: I517fb265b991a522a987bbfb628ec877cbb53db7

cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html
cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts

index 0bb4f1f..0b03f4d 100644 (file)
@@ -63,7 +63,7 @@
                                     </a>
                                 </li>
                                 <li class="action-delete">
-                                    <a href="#">
+                                    <a (click)="deletePackage(bluePrint.id)">
                                         <i class="icon-delete-sm" aria-hidden="true"></i>
                                         Delete
                                     </a>
                                     class="icon-btn-card-config" aria-hidden="true"></i>Configuration</button>
                         </div>
                         <div class="col">
-                            <button type="button" class="btn btn-card-topology"><i class="icon-btn-card-topology"
+                            <button type="button" (click)="viewDesigner(bluePrint.id)" class="btn btn-card-topology"><i class="icon-btn-card-topology"
                                     aria-hidden="true"></i>Designer Mode
                             </button>
                         </div>
 
 
 <app-import-package></app-import-package>
+
index 4d0e108..44c4a71 100644 (file)
@@ -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);
+        });
+
+    }
 }