diff options
author | zhaoxiangjun666 <xjzhaop@isoftstone.com> | 2020-09-10 14:01:50 +0800 |
---|---|---|
committer | zhaoxiangjun666 <xjzhaop@isoftstone.com> | 2020-09-21 20:39:48 +0800 |
commit | a8d3e1b8c759c21227690a425552a245da883e97 (patch) | |
tree | 4e9731f7e7c4df8088187e7501a0d9a8a516f215 /catalog-ui/src/app/services/components | |
parent | 591810df468a8e2c59569e701f514bff61203940 (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/services/components')
-rw-r--r-- | catalog-ui/src/app/services/components/component-service.ts | 38 |
1 files changed, 31 insertions, 7 deletions
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<ComponentMetadata> ; validateName(newName:string, subtype?:string):ng.IPromise<IValidate>; createComponent(component:Component):ng.IPromise<Component>; + //importComponent + importComponent(component: Component): ng.IPromise<Component>; addOrUpdateArtifact(componentId:string, artifact:ArtifactModel):ng.IPromise<ArtifactModel>; deleteArtifact(componentId:string, artifact:string, artifactLabel):ng.IPromise<ArtifactModel>; addProperty(componentId:string, property:PropertyModel):ng.IPromise<PropertyModel>; @@ -48,7 +50,7 @@ export interface IComponentService { createComponentInstance(componentId:string, componentInstance:ComponentInstance):ng.IPromise<ComponentInstance>; updateComponentInstance(componentId:string, componentInstance:ComponentInstance):ng.IPromise<ComponentInstance>; updateMultipleComponentInstances(componentId:string, instances:Array<ComponentInstance>):ng.IPromise< Array<ComponentInstance>>; - downloadArtifact(componentId:string, artifactId:string):ng.IPromise<IFileDownload>; + downloadArtifact(componentId: string, artifactId: string, vendorName?: string): ng.IPromise<IFileDownload>; uploadInstanceEnvFile(componentId:string, instanceId:string, artifact:ArtifactModel):ng.IPromise<ArtifactModel>; downloadInstanceArtifact(componentId:string, instanceId:string, artifactId:string):ng.IPromise<IFileDownload>; deleteComponentInstance(componentId:string, componentInstanceId:string):ng.IPromise<ComponentInstance>; @@ -206,6 +208,20 @@ export class ComponentService implements IComponentService { }); return deferred.promise; }; + + public importComponent = (component: Component): ng.IPromise<Component> => { + component.vendorName = "xfr"; + component.vendorRelease = "xfr"; + let deferred = this.$q.defer<Component>(); + 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<IValidate> => { let deferred = this.$q.defer<IValidate>(); @@ -244,13 +260,21 @@ export class ComponentService implements IComponentService { return deferred.promise; }; - public downloadArtifact = (componentId:string, artifactId:string):ng.IPromise<IFileDownload> => { + public downloadArtifact = (componentId: string, artifactId: string, vendorName?: string): ng.IPromise<IFileDownload> => { let deferred = this.$q.defer<IFileDownload>(); - 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; }; |