aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard
diff options
context:
space:
mode:
authorshaaban Altanany <shaaban.eltanany.ext@orange.com>2020-02-26 10:05:02 +0200
committershaaban Altanany <shaaban.eltanany.ext@orange.com>2020-02-26 15:34:55 +0200
commitac31d2159014a84de91b6c7baeb29adf90284c10 (patch)
tree318eec8bed0c51529d4d746dede6fb8e2737bc2b /cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard
parentc99df5dd491c9f18044ec483e696739080e80950 (diff)
add view feature and decompress zip file
-decompress package zip file -getting content and file names Issue-ID: CCSDK-2120 Signed-off-by: shaaban Altanany <shaaban.eltanany.ext@orange.com> Change-Id: If930b257a9dd7b8e094958aad006ff3769810cb3
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts16
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.service.ts8
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/package.store.ts45
3 files changed, 49 insertions, 20 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts
index b08ea3e4f..a25f43444 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts
@@ -2,7 +2,6 @@ import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PackageStore} from './package.store';
import {BluePrintDetailModel} from '../model/BluePrint.detail.model';
-import {CBAPackage} from '../package-creation/mapping-models/CBAPacakge.model';
@Component({
@@ -17,21 +16,20 @@ export class ConfigurationDashboardComponent implements OnInit {
const id = this.route.snapshot.paramMap.get('id');
this.configurationStore.getPagedPackages(id);
+
+
+ }
+
+ ngOnInit() {
this.configurationStore.state$.subscribe(
el => {
- const cbaPackage = new CBAPackage();
-
if (el && el.configuration) {
this.viewedPackage = el.configuration;
+ this.configurationStore.downloadResource(
+ this.viewedPackage.artifactName + '/' + this.viewedPackage.artifactVersion);
}
}
);
-
-
- }
-
- ngOnInit() {
-
}
}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.service.ts
index ab280fd10..566339db8 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.service.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.service.ts
@@ -9,8 +9,6 @@ import {BluePrintDetailModel} from '../model/BluePrint.detail.model';
providedIn: 'root'
})
export class ConfigurationDashboardService {
-
-
constructor(private api: ApiService<BluePrintDetailModel>) {
}
@@ -18,4 +16,10 @@ export class ConfigurationDashboardService {
getBluePrintModel(id: string): Observable<BluePrintDetailModel> {
return this.api.getOne(BlueprintURLs.getOneBlueprint + '/' + id);
}
+
+
+ public downloadResource(id: string) {
+ return this.api.getCustomized(id, {responseType: 'blob'});
+ }
+
}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/package.store.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/package.store.ts
index efbaef8bd..cf2d42db7 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/package.store.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/package.store.ts
@@ -21,16 +21,17 @@ limitations under the License.
import {Injectable} from '@angular/core';
import {Store} from '../../../../common/core/stores/Store';
-import {BluePrintDetailModel} from '../model/BluePrint.detail.model';
import {ConfigurationDashboardService} from './configuration-dashboard.service';
import {PackageDashboardState} from '../model/package-dashboard.state';
-
+import {BlueprintURLs} from '../../../../common/constants/app-constants';
+import * as JSZip from 'jszip';
@Injectable({
providedIn: 'root'
})
export class PackageStore extends Store<PackageDashboardState> {
+ private zipFile: JSZip = new JSZip();
constructor(private configurationDashboardService: ConfigurationDashboardService) {
super(new PackageDashboardState());
@@ -44,15 +45,41 @@ export class PackageStore extends Store<PackageDashboardState> {
configuration: bluePrintDetailModels[0]
});
});
- /* bluePrintDetailModels.forEach(
- bluePrintDetailModel => {
- this.setState({
- ...this.state,
- configuration: bluePrintDetailModel
- });
- });*/
+ }
+
+ public downloadResource(path: string) {
+ this.configurationDashboardService.downloadResource(BlueprintURLs.download + path).subscribe(response => {
+ const blob = new Blob([response], {type: 'application/octet-stream'});
+ this.zipFile.loadAsync(blob).then((zip) => {
+ Object.keys(zip.files).forEach((filename) => {
+ zip.files[filename].async('string').then((fileData) => {
+ if (fileData) {
+ if (filename.includes('scripts/')) {
+ this.setScripts(filename, fileData);
+ } else if (filename.includes('templates/')) {
+ this.setTemplates(filename, fileData);
+ } else if (filename.includes('definitions/')) {
+ this.setImports(filename, fileData);
+ }
+ }
+ });
+ });
+ });
+ });
+ }
+
+ private setScripts(filename: string, fileData: any) {
+ this.setState({
+ ...this.state,
+ scripts: this.state.scripts.setScripts(name, fileData)
+ });
+ }
+ private setImports(filename: string, fileData: any) {
}
+ private setTemplates(filename: string, fileData: any) {
+
+ }
}