summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/components
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/models/components')
-rw-r--r--catalog-ui/src/app/models/components/component.ts13
-rw-r--r--catalog-ui/src/app/models/components/service.ts35
2 files changed, 46 insertions, 2 deletions
diff --git a/catalog-ui/src/app/models/components/component.ts b/catalog-ui/src/app/models/components/component.ts
index b76d29c8c6..a0706b4157 100644
--- a/catalog-ui/src/app/models/components/component.ts
+++ b/catalog-ui/src/app/models/components/component.ts
@@ -233,6 +233,11 @@ export abstract class Component implements IComponent {
this.handleTags();
return this.componentService.createComponent(this);
};
+
+ public importComponentOnServer = (): ng.IPromise<Component> => {
+ this.handleTags();
+ return this.componentService.importComponent(this);
+ };
public updateComponent = ():ng.IPromise<Component> => {
this.handleTags();
@@ -243,8 +248,12 @@ export abstract class Component implements IComponent {
return this.componentService.validateName(newName, subtype);
};
- public downloadArtifact = (artifactId:string):ng.IPromise<IFileDownload> => {
- return this.componentService.downloadArtifact(this.uniqueId, artifactId);
+ public downloadArtifact = (artifactId: string): ng.IPromise<IFileDownload> => {
+ if(this.vendorName === 'IsService'){
+ return this.componentService.downloadArtifact(this.uniqueId, artifactId, this.vendorName);
+ }else{
+ return this.componentService.downloadArtifact(this.uniqueId, artifactId);
+ }
};
public addOrUpdateArtifact = (artifact:ArtifactModel):ng.IPromise<ArtifactModel> => {
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);
};