diff options
author | Ahmed <ahmed.eldeeb.ext@orange.com> | 2020-02-26 17:47:04 +0200 |
---|---|---|
committer | KAPIL SINGAL <ks220y@att.com> | 2020-02-26 17:08:55 +0000 |
commit | 71f6d98f1003dc9acc212e4132f03bb21c0b73c8 (patch) | |
tree | 8ffa7ce953617c621a81422861d01aacc10eb182 /cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/package.store.ts | |
parent | f627cd4269989b22edfcac044ea3a764fbc3ee68 (diff) |
adding view package tabs
Issue-ID: CCSDK-2120
Signed-off-by: ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com>
Change-Id: I21af8c2b193b3fec4e5bc59e44b7a3b852f3b784
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/package.store.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/package.store.ts | 34 |
1 files changed, 19 insertions, 15 deletions
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 cf2d42db7..4669ef12d 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 @@ -19,11 +19,11 @@ limitations under the License. ============LICENSE_END============================================ */ -import {Injectable} from '@angular/core'; -import {Store} from '../../../../common/core/stores/Store'; -import {ConfigurationDashboardService} from './configuration-dashboard.service'; -import {PackageDashboardState} from '../model/package-dashboard.state'; -import {BlueprintURLs} from '../../../../common/constants/app-constants'; +import { Injectable } from '@angular/core'; +import { Store } from '../../../../common/core/stores/Store'; +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({ @@ -38,23 +38,20 @@ export class PackageStore extends Store<PackageDashboardState> { } getPagedPackages(id: string) { - this.configurationDashboardService.getBluePrintModel(id).subscribe( - (bluePrintDetailModels) => { - this.setState({ - ...this.state, - configuration: bluePrintDetailModels[0] - }); - }); + return this.configurationDashboardService.getBluePrintModel(id); } public downloadResource(path: string) { + console.log('download resource xx'); this.configurationDashboardService.downloadResource(BlueprintURLs.download + path).subscribe(response => { - const blob = new Blob([response], {type: 'application/octet-stream'}); + console.log('try to download '); + const blob = new Blob([response], { type: 'application/octet-stream' }); this.zipFile.loadAsync(blob).then((zip) => { Object.keys(zip.files).forEach((filename) => { + console.log(filename); zip.files[filename].async('string').then((fileData) => { if (fileData) { - if (filename.includes('scripts/')) { + if (filename.includes('Scripts/')) { this.setScripts(filename, fileData); } else if (filename.includes('templates/')) { this.setTemplates(filename, fileData); @@ -68,10 +65,17 @@ export class PackageStore extends Store<PackageDashboardState> { }); } + setConfiguration(bluePrintDetailModels) { + this.setState({ + ...this.state, + configuration: bluePrintDetailModels[0] + }); + } + private setScripts(filename: string, fileData: any) { this.setState({ ...this.state, - scripts: this.state.scripts.setScripts(name, fileData) + scripts: this.state.scripts.setScripts(filename, fileData) }); } |