summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/home
diff options
context:
space:
mode:
authorzhaoxiangjun666 <xjzhaop@isoftstone.com>2020-09-10 14:01:50 +0800
committerzhaoxiangjun666 <xjzhaop@isoftstone.com>2020-09-21 20:39:48 +0800
commita8d3e1b8c759c21227690a425552a245da883e97 (patch)
tree4e9731f7e7c4df8088187e7501a0d9a8a516f215 /catalog-ui/src/app/ng2/pages/home
parent591810df468a8e2c59569e701f514bff61203940 (diff)
Support for Test Topology Auto Design- Service Import
Add some test code and use lombok in catalog-model Test Topology Auto Design (NFV Testing Automatic Platform) Delete useless test code and add test code for new function Issue-ID: SDC-3179 Issue-ID: SDC-3085 Signed-off-by: zhaoxiangjun666 <xjzhaop@isoftstone.com> Change-Id: I7f555633a00848c273014caa18ea0e30d0b22113
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/home')
-rw-r--r--catalog-ui/src/app/ng2/pages/home/home.component.html10
-rw-r--r--catalog-ui/src/app/ng2/pages/home/home.component.ts18
2 files changed, 28 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/pages/home/home.component.html b/catalog-ui/src/app/ng2/pages/home/home.component.html
index 1c8c2b4373..3bdf54e694 100644
--- a/catalog-ui/src/app/ng2/pages/home/home.component.html
+++ b/catalog-ui/src/app/ng2/pages/home/home.component.html
@@ -48,6 +48,16 @@
(fileUpload)="onImportVf($event)"
[convertToBase64]="true"
></sdc-button-file-opener>
+ <sdc-button-file-opener
+ *ngIf="roles[user.role].dashboard.showCreateNew"
+ size="medium"
+ type="secondary"
+ text="Import Service Csar"
+ testId="importServicebutton"
+ [extensions]="sdcConfig.csarFileExtension"
+ (fileUpload)="onImportService($event)"
+ [convertToBase64]="true"
+ ></sdc-button-file-opener>
</div>
</div>
</div>
diff --git a/catalog-ui/src/app/ng2/pages/home/home.component.ts b/catalog-ui/src/app/ng2/pages/home/home.component.ts
index 1b69eba929..77fd3b5ae4 100644
--- a/catalog-ui/src/app/ng2/pages/home/home.component.ts
+++ b/catalog-ui/src/app/ng2/pages/home/home.component.ts
@@ -138,6 +138,24 @@ export class HomeComponent implements OnInit {
}
}
+ public onImportService(file: any): void {
+ if (file && file.filename) {
+ // Check that the file has valid extension.
+ const fileExtension: string = file.filename.split(".").pop();
+ if (this.sdcConfig.csarFileExtension.indexOf(fileExtension.toLowerCase()) !== -1) {
+ this.$state.go('workspace.general', {
+ type: ComponentType.SERVICE.toLowerCase(),
+ importedFile: file,
+ serviceType: 'Service'
+ });
+ } else {
+ const title: string = this.translateService.translate('NEW_SERVICE_RESOURCE_ERROR_VALID_CSAR_EXTENSIONS_TITLE');
+ const message: string = this.translateService.translate('NEW_SERVICE_RESOURCE_ERROR_VALID_CSAR_EXTENSIONS', {extensions: this.sdcConfig.csarFileExtension});
+ this.modalService.openWarningModal(title, message, 'error-invalid-csar-ext');
+ }
+ }
+ };
+
public openCreateModal(componentType: string, importedFile: any): void {
if (importedFile) {
this.initEntities(true); // Return from import