fix package list component 33/106933/1
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>
Thu, 30 Apr 2020 15:34:14 +0000 (17:34 +0200)
committerShaabanEltanany <shaaban.eltanany.ext@orange.com>
Thu, 30 Apr 2020 15:34:14 +0000 (17:34 +0200)
Issue-ID: CCSDK-2320
Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: I005dff22beeac0a0ce0fdd3ef31315c35cb501d6

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
cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.store.ts

index 91c7f5b..9db3ce1 100644 (file)
@@ -30,7 +30,7 @@
                             <!-- <img class="icon-deployed" src="/assets/img/icon-deploy.svg"> -->
                             <p class="packageName" tooltip="{{bluePrint.artifactName}}" placement="bottom">
                                 {{bluePrint.artifactName}}</p>
-                            <span class="package-version">V 1.0.2</span>
+                            <span class="package-version">{{bluePrint.artifactVersion}}</span>
                         </a>
 
                     </div>
@@ -55,7 +55,7 @@
                                     </a>
                                 </li>
                                 <li class="action-archive">
-                                    <a href="#">
+                                    <a (click)="downloadPackage(bluePrint.artifactName,bluePrint.artifactVersion)">
                                         <i class="icon-download" aria-hidden="true"></i>
                                         Download
                                     </a>
@@ -75,7 +75,7 @@
                     <div class="col">
                         <p class="mb-0 mt-1">Last modified {{ bluePrint.createdDate | date:'short' }}
                         </p>
-                        <p class="mb-2">By {{bluePrint.updatedBy}}</p>
+<!--                        <p class="mb-2">By {{bluePrint.updatedBy}}</p>-->
                         <p class="package-desc" [delay]="300"
                             tooltip="DESCRIPTION:
                             The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from de Finibus Bonorum et Malorum by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham."
 
         </div>
     </div>
-</div>
\ No newline at end of file
+</div>
index b7bc05f..352f33b 100644 (file)
@@ -1,7 +1,9 @@
-import { Component, OnInit } from '@angular/core';
-import { BlueprintModel } from '../../model/BluePrint.model';
-import { PackagesStore } from '../../packages.store';
-import { Router } from '@angular/router';
+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';
 
 @Component({
     selector: 'app-packages-list',
@@ -13,7 +15,8 @@ export class PackageListComponent implements OnInit {
     viewedPackages: BlueprintModel[] = [];
 
 
-    constructor(private packagesStore: PackagesStore, private router: Router) {
+    constructor(private packagesStore: PackagesStore, private router: Router
+              , private configurationDashboardService: ConfigurationDashboardService) {
         console.log('PackageListComponent');
         this.packagesStore.state$.subscribe(state => {
             console.log(state);
@@ -30,7 +33,15 @@ export class PackageListComponent implements OnInit {
     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');
+        });
+    }
 }
index b1f730f..863adfb 100644 (file)
@@ -31,7 +31,7 @@ import {Observable, of} from 'rxjs';
 })
 export class PackagesStore extends Store<PackagesDashboardState> {
     // TDOD fixed for now as there is no requirement to change it from UI
-    public pageSize = 5;
+    public pageSize = 15;
     private bluePrintContent: BluePrintPage = new BluePrintPage();
 
     constructor(private packagesServiceList: PackagesApiService) {