aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard
diff options
context:
space:
mode:
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>2020-09-07 12:00:44 +0200
committerShaabanEltanany <shaaban.eltanany.ext@orange.com>2020-09-07 12:00:44 +0200
commitdc16c9e10b9f7f403761fe5f767cf48c2f39d73b (patch)
tree4dc82069dcd55303432d2d692cd7036ac9bb0c1b /cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard
parent953b78a4c0c36d31c944baf93db4ae3d8584d232 (diff)
adding manual enrichment
Issue-ID: CCSDK-2542 Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com> Change-Id: I14eac56b1541a54b7b3e6d3e2c4e34dc667f0c8c
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.html4
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts88
2 files changed, 64 insertions, 28 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html
index f79657af8..9e8ef5d7b 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html
@@ -761,9 +761,9 @@
</nav>
<div class="row mt-4">
<div class="col">
- <div class="tab-content" id="nav-tabContent">
+ <div class="tab-content" id="nav-tabContent" (change)="clickEvent()">
<div class="tab-pane fade show active" id="nav-metadata" role="tabpanel"
- aria-labelledby="nav-metadata-tab" (change)="clickEvent()">
+ aria-labelledby="nav-metadata-tab" >
<app-metadata-tab></app-metadata-tab>
</div>
<div class="tab-pane fade" id="nav-template" role="tabpanel"
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 47e89b39a..029601d67 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
@@ -70,6 +70,7 @@ export class ConfigurationDashboardComponent implements OnInit {
}
} else {
this.metadataClasses = this.metadataClasses.replace('complete', '');
+ this.isSaveEnabled = false;
}
});
@@ -92,27 +93,32 @@ export class ConfigurationDashboardComponent implements OnInit {
bluePrintDetailModels[0].artifactName + '/' + bluePrintDetailModels[0].artifactVersion).subscribe(response => {
const blob = new Blob([response], {type: 'application/octet-stream'});
this.currentBlob = blob;
- 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/')) {
- if (filename.includes('-mapping.')) {
- this.setMapping(filename, fileData);
- } else if (filename.includes('-template.')) {
- this.setTemplates(filename, fileData);
- }
-
- } else if (filename.includes('Definitions/')) {
- this.setImports(filename, fileData, bluePrintDetailModels);
- } else if (filename.includes('TOSCA-Metadata/')) {
- const metaDataTabInfo: MetaDataTabModel = this.getMetaDataTabInfo(fileData);
- this.setMetaData(metaDataTabInfo, bluePrintDetailModels[0]);
+ this.extractBlobToStore(blob, bluePrintDetailModels);
+ });
+ }
+
+ private extractBlobToStore(blob: Blob, bluePrintDetailModels: BluePrintDetailModel) {
+ this.zipFile.loadAsync(blob).then((zip) => {
+ Object.keys(zip.files).forEach((filename) => {
+ zip.files[filename].async('string').then((fileData) => {
+ console.log(filename);
+ if (fileData) {
+ if (filename.includes('Scripts/')) {
+ this.setScripts(filename, fileData);
+ } else if (filename.includes('Templates/')) {
+ if (filename.includes('-mapping.')) {
+ this.setMapping(filename, fileData);
+ } else if (filename.includes('-template.')) {
+ this.setTemplates(filename, fileData);
}
+
+ } else if (filename.includes('Definitions/')) {
+ this.setImports(filename, fileData, bluePrintDetailModels);
+ } else if (filename.includes('TOSCA-Metadata/')) {
+ const metaDataTabInfo: MetaDataTabModel = this.getMetaDataTabInfo(fileData);
+ this.setMetaData(metaDataTabInfo, bluePrintDetailModels[0]);
}
- });
+ }
});
});
});
@@ -239,8 +245,9 @@ export class ConfigurationDashboardComponent implements OnInit {
}
deployCurrentPackage() {
- console.log('happened');
- this.router.navigate(['/packages']);
+ this.collectZipFileFromStore();
+ this.deployPackage();
+
}
goToDesignerMode(id) {
@@ -266,19 +273,21 @@ export class ConfigurationDashboardComponent implements OnInit {
enrichBluePrint() {
+ this.collectZipFileFromStore();
+ this.enrichPackage();
+ }
+
+ private collectZipFileFromStore() {
this.packageCreationStore.state$.subscribe(
cbaPackage => {
FilesContent.clear();
console.log(cbaPackage);
-
let packageCreationModes: PackageCreationModes;
cbaPackage = PackageCreationModes.mapModeType(cbaPackage);
cbaPackage.metaData = PackageCreationModes.setEntryPoint(cbaPackage.metaData);
packageCreationModes = PackageCreationBuilder.getCreationMode(cbaPackage);
packageCreationModes.execute(cbaPackage, this.packageCreationUtils);
this.filesData.push(this.folder.TREE_DATA);
- this.enrichPackage();
-
});
}
@@ -289,8 +298,18 @@ export class ConfigurationDashboardComponent implements OnInit {
this.packageCreationStore.enrichBluePrint(blob).subscribe(response => {
console.log('success');
const blobInfo = new Blob([response], {type: 'application/octet-stream'});
- saveAs(blobInfo, 'test' + '-' + '1.0.0' + '-CBA.zip');
- this.toastService.info('enriched successfully ');
+ this.configurationDashboardService.getPagedPackages(this.id).subscribe(
+ (bluePrintDetailModels) => {
+ if (bluePrintDetailModels) {
+ this.packageCreationStore.clear();
+ this.extractBlobToStore(blob, bluePrintDetailModels);
+ this.isSaveEnabled = true;
+ this.toastService.info('enriched successfully ');
+ }
+ });
+
+ // saveAs(blobInfo, 'test' + '-' + '1.0.0' + '-CBA.zip');
+
});
}, error => {
this.toastService.error('error happened when editing ' + error.message);
@@ -298,6 +317,23 @@ export class ConfigurationDashboardComponent implements OnInit {
});
}
+ private deployPackage() {
+ this.create();
+ this.zipFile.generateAsync({type: 'blob'})
+ .then(blob => {
+ this.packageCreationStore.deployBluePrint(blob).subscribe(response => {
+ console.log('success');
+ console.log(response);
+
+ // saveAs(blobInfo, 'test' + '-' + '1.0.0' + '-CBA.zip');
+
+ });
+ }, error => {
+ this.toastService.error('error happened when deploying ' + error.message);
+ console.log('Error -' + error.message);
+ });
+ }
+
clickEvent() {
this.isSaveEnabled = true;
}