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/models/components/service.ts | |
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/models/components/service.ts')
-rw-r--r-- | catalog-ui/src/app/models/components/service.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/catalog-ui/src/app/models/components/service.ts b/catalog-ui/src/app/models/components/service.ts index 911a43204f..d11a06abdf 100644 --- a/catalog-ui/src/app/models/components/service.ts +++ b/catalog-ui/src/app/models/components/service.ts @@ -27,6 +27,7 @@ import {IServiceService} from "../../services/components/service-service"; import {Component, PropertyModel, DisplayModule, InputsAndProperties, InputModel, InstancesInputsOrPropertiesMapData, InstancesInputsPropertiesMap, Distribution, DistributionComponent, ArtifactGroupModel} from "../../models"; import {ArtifactGroupType} from "../../utils/constants"; +import {FileUploadModel} from "../../directives/file-upload/file-upload"; import {ComponentMetadata} from "../component-metadata"; import {ForwardingPath} from "app/models/forwarding-path"; @@ -42,6 +43,15 @@ export class Service extends Component { public environmentContext:string; public instantiationType:string; public forwardingPaths:{ [key:string]:ForwardingPath } = {}; + public payloadData: string; + public payloadName: string; + public importedFile: FileUploadModel; + + // Onboarding parameters + public csarUUID: string; + public csarVersion: string; + public csarPackageType: string; + public packageId: string; constructor(componentService:IServiceService, $q:ng.IQService, component?:Service) { super(componentService, $q, component); @@ -56,15 +66,40 @@ export class Service extends Component { this.serviceFunction = component.serviceFunction; this.instantiationType = component.instantiationType; this.environmentContext = component.environmentContext; + this.payloadData = component.payloadData ? component.payloadData : undefined; + this.payloadName = component.payloadName ? component.payloadName : undefined; + this.csarUUID = component.csarUUID; + this.csarVersion = component.csarVersion; if (component.categories && component.categories[0]) { this.mainCategory = component.categories[0].name; this.selectedCategory = this.mainCategory; + this.importedFile = component.importedFile; } } this.componentService = componentService; this.iconSprite = "sprite-services-icons"; } + public importComponentOnServer = (): ng.IPromise<Component> => { + let deferred = this.$q.defer<Component>(); + let onSuccess = (component: Service): void => { + this.payloadData = undefined; + this.payloadName = undefined; + deferred.resolve(component); + }; + let onError = (error: any): void => { + deferred.reject(error); + }; + + this.handleTags(); + if (this.importedFile) { + this.payloadData = this.importedFile.base64; + this.payloadName = this.importedFile.filename; + } + this.componentService.importComponent(this).then(onSuccess, onError); + return deferred.promise; + }; + public getDistributionsList = ():ng.IPromise<Array<Distribution>> => { return this.componentService.getDistributionsList(this.uuid); }; |