summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client
diff options
context:
space:
mode:
authorKAPIL SINGAL <ks220y@att.com>2020-10-13 13:08:16 +0000
committerGerrit Code Review <gerrit@onap.org>2020-10-13 13:08:16 +0000
commit182d67ef5c4acb5b0a551e604fa4f0d505f6931d (patch)
tree7b2f0c3f8d49b1044513602d919da7624f176e2a /cds-ui/designer-client
parent396e1dd8a2b2c66a04d8a5fd1f54b7bd93fb63ff (diff)
parent54a8e07309b4d8ae7d0c9f6f6535f76d4f8db1f7 (diff)
Merge "add import&deploy feature"
Diffstat (limited to 'cds-ui/designer-client')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts2
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts4
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.html4
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts19
4 files changed, 26 insertions, 3 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts
index adae66244..61de5078b 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts
@@ -43,7 +43,7 @@ export class DesignerCreationMode extends PackageCreationModes {
});
}
- const filenameEntry = 'Definitions/' + cbaPackage.metaData.name + '.json';
+ const filenameEntry = 'Definitions/' + cbaPackage.metaData.name.trim() + '.json';
const vlbDefinition: VlbDefinition = new VlbDefinition();
const metadata: Metadata = new Metadata();
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts
index 232590c62..f44f68887 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts
@@ -42,7 +42,7 @@ export class PackageCreationExtractionService {
if (filename.includes('TOSCA-Metadata/')) {
const metaDataTabInfo: MetaDataTabModel = this.getMetaDataTabInfo(fileData);
- packageName = metaDataTabInfo.name;
+ packageName = metaDataTabInfo.name.trim();
this.setMetaData(metaDataTabInfo);
console.log('found file ' + packageName);
}
@@ -145,7 +145,7 @@ export class PackageCreationExtractionService {
map.set(currentKey, currentValue);
}
metaDataTabModel.entryFileName = map.get(this.toscaMetaDataKeys[3]);
- metaDataTabModel.name = map.get(this.toscaMetaDataKeys[4]);
+ metaDataTabModel.name = map.get(this.toscaMetaDataKeys[4]).trim();
metaDataTabModel.version = map.get(this.toscaMetaDataKeys[5]).trim();
metaDataTabModel.mode = map.get(this.toscaMetaDataKeys[6]);
if (map.get(this.toscaMetaDataKeys[7])) {
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.html
index d578582fd..0632fb47d 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.html
@@ -49,6 +49,10 @@
Import&Save
</button>
<button type="button" class="btn btn-sm btn-primary" [disabled]="uploadedFiles?.length<=0"
+ data-dismiss="modal" (click)="importAndDeploy()">
+ Import&Deploy
+ </button>
+ <button type="button" class="btn btn-sm btn-primary" [disabled]="uploadedFiles?.length<=0"
data-dismiss="modal" (click)="importPackageAndViewIt()">
Import
</button>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts
index 7496338d6..5797d18d5 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts
@@ -123,4 +123,23 @@ export class ImportPackageComponent implements OnInit {
});
});
}
+
+ importAndDeploy() {
+ const file = this.getFile(this.uploadedFiles[this.uploadedFiles.length - 1]);
+ this.zipFile = new JSZip();
+ this.zipFile.loadAsync(file).then(zip => {
+ this.zipFile = zip;
+ console.log(this.zipFile);
+ this.resetTheUploadedFiles();
+ this.zipFile.generateAsync({type: 'blob'}).then(blob => {
+ this.packageCreationService.deploy(blob).subscribe(
+ bluePrintDetailModels => {
+ this.toastService.info('package is imported and deployed successfully ');
+ this.router.navigate(['/packages']);
+ this.packagesStore.getAll();
+ }, error =>
+ this.toastService.error('there is an error happened ' + error));
+ });
+ });
+ }
}