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 --- .../app/services/components/component-service.ts | 38 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'catalog-ui/src/app/services') diff --git a/catalog-ui/src/app/services/components/component-service.ts b/catalog-ui/src/app/services/components/component-service.ts index c7ab975e6e..bece12d4f0 100644 --- a/catalog-ui/src/app/services/components/component-service.ts +++ b/catalog-ui/src/app/services/components/component-service.ts @@ -32,6 +32,8 @@ export interface IComponentService { changeLifecycleState(component:Component, state:string, userRemarks:any):ng.IPromise ; validateName(newName:string, subtype?:string):ng.IPromise; createComponent(component:Component):ng.IPromise; + //importComponent + importComponent(component: Component): ng.IPromise; addOrUpdateArtifact(componentId:string, artifact:ArtifactModel):ng.IPromise; deleteArtifact(componentId:string, artifact:string, artifactLabel):ng.IPromise; addProperty(componentId:string, property:PropertyModel):ng.IPromise; @@ -48,7 +50,7 @@ export interface IComponentService { createComponentInstance(componentId:string, componentInstance:ComponentInstance):ng.IPromise; updateComponentInstance(componentId:string, componentInstance:ComponentInstance):ng.IPromise; updateMultipleComponentInstances(componentId:string, instances:Array):ng.IPromise< Array>; - downloadArtifact(componentId:string, artifactId:string):ng.IPromise; + downloadArtifact(componentId: string, artifactId: string, vendorName?: string): ng.IPromise; uploadInstanceEnvFile(componentId:string, instanceId:string, artifact:ArtifactModel):ng.IPromise; downloadInstanceArtifact(componentId:string, instanceId:string, artifactId:string):ng.IPromise; deleteComponentInstance(componentId:string, componentInstanceId:string):ng.IPromise; @@ -206,6 +208,20 @@ export class ComponentService implements IComponentService { }); return deferred.promise; }; + + public importComponent = (component: Component): ng.IPromise => { + component.vendorName = "xfr"; + component.vendorRelease = "xfr"; + let deferred = this.$q.defer(); + let headerObj = this.getHeaderMd5(component); + this.restangular.customPOST(JSON.stringify(component), 'importService', {}, headerObj).then((response: Component) => { + let component: Component = this.createComponentObject(response); + deferred.resolve(component); + }, (err) => { + deferred.reject(err); + }); + return deferred.promise; + }; public validateName = (newName:string, subtype?:string):ng.IPromise => { let deferred = this.$q.defer(); @@ -244,13 +260,21 @@ export class ComponentService implements IComponentService { return deferred.promise; }; - public downloadArtifact = (componentId:string, artifactId:string):ng.IPromise => { + public downloadArtifact = (componentId: string, artifactId: string, vendorName?: string): ng.IPromise => { let deferred = this.$q.defer(); - this.restangular.one(componentId).one("artifacts").one(artifactId).get().then((response:any) => { - deferred.resolve(response.plain()); - }, (err)=> { - deferred.reject(err); - }); + if(vendorName === 'IsService'){ + this.restangular.one('importService').one(componentId).one("artifacts").one(artifactId).get().then((response: any) => { + deferred.resolve(response.plain()); + }, (err) => { + deferred.reject(err); + }); + }else{ + this.restangular.one(componentId).one("artifacts").one(artifactId).get().then((response: any) => { + deferred.resolve(response.plain()); + }, (err) => { + deferred.reject(err); + }); + } return deferred.promise; }; -- cgit 1.2.3-korg