* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
};
public getComponent = (id:string):ng.IPromise<Component> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Component>();
this.restangular.one(id).get().then((response:Component) => {
let component:Component = this.createComponentObject(response);
//console.log("Component Loaded successfully : ", component);
};
private updateService = (component:Component):ng.IPromise<Component> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Component>();
this.restangular.one(component.uniqueId).one("metadata").customPUT(JSON.stringify(component)).then((response:Component) => {
let component:Component = this.createComponentObject(response);
deferred.resolve(component);
};
private updateResource = (component:Component):ng.IPromise<Component> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Component>();
this.restangular.one(component.uniqueId).customPUT(JSON.stringify(component)).then((response:Component) => {
let component:Component = this.createComponentObject(response);
deferred.resolve(component);
};
private updateResourceMetadata = (component:Component):ng.IPromise<Component> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Component>();
this.restangular.one(component.uniqueId).one('metadata').customPUT(JSON.stringify(component)).then((response:Component) => {
let component:Component = this.createComponentObject(response);
deferred.resolve(component);
* @returns {IPromise<T>}
*/
private updateResourceWithPayload = (resource:Resource):ng.IPromise<Component> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Component>();
resource.payloadData = resource.importedFile.base64;
resource.payloadName = resource.importedFile.filename;
};
public createComponent = (component:Component):ng.IPromise<Component> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Component>();
let headerObj = this.getHeaderMd5(component);
this.restangular.customPOST(JSON.stringify(component), '', {}, headerObj).then((response:Component) => {
let component:Component = this.createComponentObject(response);
};
public validateName = (newName:string, subtype?:string):ng.IPromise<IValidate> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<IValidate>();
this.restangular.one("validate-name").one(newName).get({'subtype': subtype}).then((response:any) => {
deferred.resolve(response.plain());
}, (err)=> {
};
public changeLifecycleState = (component:Component, state:string, userRemarks:any):ng.IPromise<ComponentMetadata> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ComponentMetadata>();
this.restangular.one(component.uniqueId).one(state).customPOST(userRemarks).then((response:ComponentMetadata) => {
this.sharingService.addUuidValue(response.uniqueId, response.uuid);
let component:ComponentMetadata = new ComponentMetadata().deserialize(response);
}, (err)=> {
deferred.reject(err);
});
-
return deferred.promise;
};
// ------------------------------------------------ Artifacts API --------------------------------------------------//
public addOrUpdateArtifact = (componentId:string, artifact:ArtifactModel):ng.IPromise<ArtifactModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ArtifactModel>();
let headerObj = {};
if (artifact.payloadData) {
headerObj = this.getHeaderMd5(artifact);
};
public downloadArtifact = (componentId:string, artifactId:string):ng.IPromise<IFileDownload> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<IFileDownload>();
this.restangular.one(componentId).one("artifacts").one(artifactId).get().then((response:any) => {
deferred.resolve(response.plain());
}, (err)=> {
};
public deleteArtifact = (componentId:string, artifactId:string, artifactLabel:string):ng.IPromise<ArtifactModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ArtifactModel>();
this.restangular.one(componentId).one("artifacts").one(artifactId).remove({'operation': artifactLabel}).then((response:ArtifactModel) => {
deferred.resolve(response);
}, (err)=> {
};
public getArtifactByGroupType = (componentId:string, artifactGroupType:string):ng.IPromise<ArtifactGroupModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ArtifactGroupModel>();
this.restangular.one(componentId).one("artifactsByType").one(artifactGroupType).get().then((response:any) => {
var artifacts:ArtifactGroupModel = new ArtifactGroupModel(response.plain());
deferred.resolve(artifacts);
};
public getComponentInstanceArtifactsByGroupType = (componentId:string, componentInstanceId:string, artifactGroupType:string):ng.IPromise<ArtifactGroupModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ArtifactGroupModel>();
this.restangular.one(componentId).one("resourceInstances").one(componentInstanceId).one("artifactsByType").one(artifactGroupType).get().then((response:any) => {
var artifacts:ArtifactGroupModel = new ArtifactGroupModel(response.plain());
deferred.resolve(artifacts);
// ------------------------------------------------ Properties API --------------------------------------------------//
public addProperty = (componentId:string, property:PropertyModel):ng.IPromise<PropertyModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<PropertyModel>();
this.restangular.one(componentId).one("properties").customPOST(property.convertToServerObject()).then((response:any) => {
let property:PropertyModel = new PropertyModel(response[Object.keys(response)[0]]);
deferred.resolve(property);
};
public updateProperty = (componentId:string, property:PropertyModel):ng.IPromise<PropertyModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<PropertyModel>();
this.restangular.one(componentId).one("properties").one(property.uniqueId).customPUT(property.convertToServerObject()).then((response:any) => {
let property:PropertyModel = new PropertyModel(response[Object.keys(response)[0]]);
deferred.resolve(property);
};
public deleteProperty = (componentId:string, propertyId:string):ng.IPromise<PropertyModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<PropertyModel>();
this.restangular.one(componentId).one("properties").one(propertyId).remove().then((response:any) => {
deferred.resolve(response);
}, (err)=> {
// ------------------------------------------------ Attributes API --------------------------------------------------//
public addAttribute = (componentId:string, attribute:AttributeModel):ng.IPromise<AttributeModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<AttributeModel>();
this.restangular.one(componentId).one("attributes").customPOST(attribute.convertToServerObject()).then((response:any) => {
let attribute:AttributeModel = new AttributeModel(response);
deferred.resolve(attribute);
};
public updateAttribute = (componentId:string, attribute:AttributeModel):ng.IPromise<AttributeModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<AttributeModel>();
this.restangular.one(componentId).one("attributes").one(attribute.uniqueId).customPUT(attribute.convertToServerObject()).then((response:any) => {
let attribute:AttributeModel = new AttributeModel(response);
deferred.resolve(attribute);
};
public deleteAttribute = (componentId:string, attributeId:string):ng.IPromise<AttributeModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<AttributeModel>();
this.restangular.one(componentId).one("attributes").one(attributeId).remove().then((response:any) => {
deferred.resolve(response);
}, (err)=> {
// ------------------------------------------------ Component Instances API --------------------------------------------------//
public createComponentInstance = (componentId:string, componentInstance:ComponentInstance):ng.IPromise<ComponentInstance> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ComponentInstance>();
this.restangular.one(componentId).one("resourceInstance").customPOST(JSON.stringify(componentInstance)).then((response:any) => {
let componentInstance:ComponentInstance = ComponentInstanceFactory.createComponentInstance(response);
console.log("Component Instance created", componentInstance);
};
public updateComponentInstance = (componentId:string, componentInstance:ComponentInstance):ng.IPromise<ComponentInstance> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ComponentInstance>();
this.restangular.one(componentId).one("resourceInstance").one(componentInstance.uniqueId).customPOST(JSON.stringify(componentInstance)).then((response:any) => {
let componentInstance:ComponentInstance = ComponentInstanceFactory.createComponentInstance(response);
console.log("Component Instance was updated", componentInstance);
};
public updateMultipleComponentInstances = (componentId:string, instances:Array<ComponentInstance>):ng.IPromise<Array<ComponentInstance>> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Array<ComponentInstance>>();
this.restangular.one(componentId).one("resourceInstance/multipleComponentInstance").customPOST(JSON.stringify(instances)).then((response:any) => {
console.log("Multiple Component Instances was updated", response);
let updateInstances:Array<ComponentInstance> = new Array<ComponentInstance>();
};
public deleteComponentInstance = (componentId:string, componentInstanceId:string):ng.IPromise<ComponentInstance> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ComponentInstance>();
this.restangular.one(componentId).one("resourceInstance").one(componentInstanceId).remove().then(() => {
console.log("Component Instance was deleted");
deferred.resolve();
};
public checkResourceInstanceVersionChange = (componentId:string, componentInstanceId:string, componentUid:string):ng.IPromise<ComponentInstance> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ComponentInstance>();
this.restangular.one(componentId).one("resourceInstance").one(componentInstanceId).one(componentUid).one("checkForwardingPathOnVersionChange").get().then((response:any) => {
deferred.resolve(response);
}, err => {
};
public changeResourceInstanceVersion = (componentId:string, componentInstanceId:string, componentUid:string):ng.IPromise<ComponentInstance> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ComponentInstance>();
this.restangular.one(componentId).one("resourceInstance").one(componentInstanceId).one("changeVersion").customPOST({'componentUid': componentUid}).then((response:any) => {
let componentInstance:ComponentInstance = ComponentInstanceFactory.createComponentInstance(response);
deferred.resolve(componentInstance);
};
public downloadInstanceArtifact = (componentId:string, instanceId:string, artifactId:string):ng.IPromise<IFileDownload> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<IFileDownload>();
this.restangular.one(componentId).one("resourceInstances").one(instanceId).one("artifacts").one(artifactId).get().then((response:any) => {
deferred.resolve(response.plain());
}, (err)=> {
};
public updateInstanceArtifact = (componentId:string, instanceId:string, artifact:ArtifactModel):ng.IPromise<ArtifactModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ArtifactModel>();
let headerObj = {};
if (artifact.payloadData) {
headerObj = this.getHeaderMd5(artifact);
};
public addInstanceArtifact = (componentId:string, instanceId:string, artifact:ArtifactModel):ng.IPromise<ArtifactModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ArtifactModel>();
let headerObj = {};
if (artifact.payloadData) {
headerObj = this.getHeaderMd5(artifact);
};
public deleteInstanceArtifact = (componentId:string, instanceId:string, artifactId:string, artifactLabel:string):ng.IPromise<ArtifactModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ArtifactModel>();
this.restangular.one(componentId).one("resourceInstance").one(instanceId).one("artifacts").one(artifactId).remove({'operation': artifactLabel}).then((response:ArtifactModel) => {
deferred.resolve(response);
}, (err)=> {
};
public uploadInstanceEnvFile = (componentId:string, instanceId:string, artifact:ArtifactModel):ng.IPromise<ArtifactModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<ArtifactModel>();
let headerObj = {};
if (artifact.payloadData) {
headerObj = this.getHeaderMd5(artifact);
};
public updateInstanceAttribute = (componentId:string, attribute:AttributeModel):ng.IPromise<AttributeModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<AttributeModel>();
let instanceId = attribute.resourceInstanceUniqueId;
this.restangular.one(componentId).one("resourceInstance").one(instanceId).one("attribute").customPOST(JSON.stringify(attribute)).then((response:any) => {
let newAttribute = new AttributeModel(response);
};
public createRelation = (componentId:string, link:RelationshipModel):ng.IPromise<RelationshipModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<RelationshipModel>();
const linkPayload:RelationshipModel = new RelationshipModel(link);
linkPayload.relationships.forEach((rel) => {
delete rel.capability;
};
public deleteRelation = (componentId:string, link:RelationshipModel):ng.IPromise<RelationshipModel> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<RelationshipModel>();
const linkPayload:RelationshipModel = new RelationshipModel(link);
linkPayload.relationships.forEach((rel) => {
delete rel.capability;
};
public getModuleForDisplay = (componentId:string, moduleId:string):ng.IPromise<DisplayModule> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<DisplayModule>();
this.restangular.one(componentId).one("groups").one(moduleId).get().then((response:any) => {
console.log("module loaded successfully: ", response);
let module:DisplayModule = new DisplayModule(response);
return deferred.promise;
};
- public getComponentInstanceModule = (componentId:string, componentInstanceId:string, moduleId:string):ng.IPromise<Module> => {
- let deferred = this.$q.defer();
+ public getComponentInstanceModule = (componentId:string, componentInstanceId:string, moduleId:string):ng.IPromise<DisplayModule> => {
+ let deferred = this.$q.defer<DisplayModule>();
this.restangular.one(componentId).one("resourceInstance").one(componentInstanceId).one("groupInstance").one(moduleId).get().then((response:any) => {
console.log("module loaded successfully: ", response);
let module:DisplayModule = new DisplayModule(response);
};
public getComponentInstancesFilteredByInputsAndProperties = (componentId:string, searchText?:string):ng.IPromise<Array<ComponentInstance>> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Array<ComponentInstance>>();
this.restangular.one(componentId).one("componentInstances").get({'searchText': searchText}).then((response:any) => {
console.log("component instances return successfully: ", response);
let componentInstances:Array<ComponentInstance> = CommonUtils.initComponentInstances(response);
public getComponentInstanceInputs = (componentId:string, instanceId:string, originComponentUid):ng.IPromise<Array<InputModel>> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Array<InputModel>>();
this.restangular.one(componentId).one("componentInstances").one(instanceId).one(originComponentUid).one("inputs").get().then((response:any) => {
console.log("component instance input return successfully: ", response);
let inputsArray:Array<InputModel> = new Array<InputModel>();
public getComponentInputs = (componentId:string):ng.IPromise<Array<InputModel>> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Array<InputModel>>();
this.restangular.one(componentId).one("inputs").get().then((response:any) => {
console.log("component inputs return successfully: ", response);
let inputsArray:Array<InputModel> = new Array<InputModel>();
public getComponentInstanceInputProperties = (componentId:string, instanceId:string, inputId:string):ng.IPromise<Array<PropertyModel>> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Array<PropertyModel>>();
this.restangular.one(componentId).one("componentInstances").one(instanceId).one(inputId).one("properties").get().then((response:any) => {
console.log("component instance input properties return successfully: ", response);
let propertiesArray:Array<PropertyModel> = new Array<PropertyModel>();
public getComponentInstanceProperties = (componentId:string, instanceId:string):ng.IPromise<Array<PropertyModel>> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Array<PropertyModel>>();
this.restangular.one(componentId).one("componentInstances").one(instanceId).one("properties").get().then((response:any) => {
console.log("component instance properties return successfully: ", response);
let propertiesArray:Array<PropertyModel> = new Array<PropertyModel>();
public updateGroupMetadata = (componentId:string, group:Module):ng.IPromise<Module> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Module>();
this.restangular.one(componentId).one("groups").one(group.uniqueId).one("metadata").customPUT(JSON.stringify(group)).then((response:Module) => {
console.log("group metadata updated successfully: ", response);
let updatedGroup:Module = new Module(response);
};
public getComponentInputInputsAndProperties = (serviceId:string, inputId:string):ng.IPromise<InputsAndProperties> => {
- let defer = this.$q.defer<any>();
+ let defer = this.$q.defer<InputsAndProperties>();
this.restangular.one(serviceId).one("inputs").one(inputId).get().then((response:InputsAndProperties) => {
let inputsArray:Array<InputModel> = new Array<InputModel>();
};
createInputsFromInstancesInputsProperties = (resourceId:string, instancePropertyMap:InstancesInputsPropertiesMap):ng.IPromise<Array<PropertyModel>> => {
- let defer = this.$q.defer<any>();
+ let defer = this.$q.defer<Array<PropertyModel>>();
this.restangular.one(resourceId).one("create/properties").customPOST(instancePropertyMap).then((response:any) => {
let inputsArray:Array<PropertyModel> = new Array<PropertyModel>();
_.forEach(response, (inputObj:PropertyModel) => {
};
createInputsFromInstancesInputs = (serviceId:string, instancesMap:InstancesInputsPropertiesMap):ng.IPromise<Array<InputModel>> => {
- let defer = this.$q.defer<any>();
+ let defer = this.$q.defer<Array<InputModel>>();
this.restangular.one(serviceId).one("create/inputs").customPOST(instancesMap).then((response:any) => {
let inputsArray:Array<InputModel> = new Array<InputModel>();
_.forEach(response, (inputObj:InputModel) => {
};
deleteComponentInput = (serviceId:string, inputId:string):ng.IPromise<InputModel> => {
- let defer = this.$q.defer();
+ let defer = this.$q.defer<InputModel>();
this.restangular.one(serviceId).one("delete").one(inputId).one("input").remove().then((response:any) => {
let inputToDelete = new InputModel(response);
defer.resolve(inputToDelete);