From a8d3e1b8c759c21227690a425552a245da883e97 Mon Sep 17 00:00:00 2001 From: zhaoxiangjun666 Date: Thu, 10 Sep 2020 14:01:50 +0800 Subject: Support for Test Topology Auto Design- Service Import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Change-Id: I7f555633a00848c273014caa18ea0e30d0b22113 --- .../workspace/tabs/general/general-view-model.ts | 17 +++++++++++++++-- .../app/view-models/workspace/workspace-view-model.ts | 9 ++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'catalog-ui/src/app/view-models') diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts index 87937dd761..e10dc98fac 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts @@ -219,7 +219,7 @@ export class GeneralViewModel { this.$scope.importCsarProgressKey = "importCsarProgressKey"; - this.$scope.browseFileLabel = this.$scope.component.isResource() && (this.$scope.component).resourceType === ResourceType.VF ? 'Upload File:' : 'Upload VFC:'; + this.$scope.browseFileLabel = (this.$scope.component.isResource() && ((this.$scope.component).resourceType === ResourceType.VF || (this.$scope.component).resourceType === 'SRVC')) || this.$scope.component.isService() ? 'Upload File:' : 'Upload VFC:'; this.$scope.progressService = this.progressService; this.$scope.componentCategories = new componentCategories(); this.$scope.componentCategories.selectedCategory = this.$scope.component.selectedCategory; @@ -245,6 +245,15 @@ export class GeneralViewModel { this.$scope.isShowFileBrowse = true; } } else if(this.$scope.component.isService()){ + let service: Service = this.$scope.component; + console.log(service.name + ": " + service.csarUUID); + if (service.importedFile) { // Component has imported file. + this.$scope.isShowFileBrowse = true; + (this.$scope.component).serviceType = 'Service'; + } + if (this.$scope.isEditMode() && service.serviceType == 'Service' && !service.csarUUID) { + this.$scope.isShowFileBrowse = true; + } // Init Instantiation types this.$scope.initInstantiationTypes(); } @@ -497,7 +506,11 @@ export class GeneralViewModel { return; } - const subtype:string = ComponentType.RESOURCE == this.$scope.componentType ? this.$scope.component.getComponentSubType() : undefined; + + let subtype:string = ComponentType.RESOURCE == this.$scope.componentType ? this.$scope.component.getComponentSubType() : undefined; + if (subtype == "SRVC") { + subtype = "VF" + } const onFailed = (response) => { // console.info('onFaild', response); diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts index 11667283b2..e132d53eaf 100644 --- a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts @@ -27,6 +27,7 @@ import { IUserProperties, IAppMenu, Resource, + Service, Component, Plugin, PluginsConfiguration, @@ -431,8 +432,14 @@ export class WorkspaceViewModel { components: this.components }, {inherit: false}); }; + + console.log(this.$scope.component, "this.$scope.component") + if ((this.$scope.component).serviceType == "Service") { + this.ComponentFactory.importComponentOnServer(this.$scope.component).then(onSuccessCreate, onFailed); + } else { + this.ComponentFactory.createComponentOnServer(this.$scope.component).then(onSuccessCreate, onFailed); + } - this.ComponentFactory.createComponentOnServer(this.$scope.component).then(onSuccessCreate, onFailed); }; -- cgit 1.2.3-korg