Enable setting policy properties to a TOSCA function value expression in the property assignment view
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Issue-ID: SDC-4122
Change-Id: Idd6b08c31995f5f421213075a3981f58edca2f9c
* Select Tosca function value from defined values
*/
selectToscaFunctionAndValues = (): void => {
* Select Tosca function value from defined values
*/
selectToscaFunctionAndValues = (): void => {
- const selectedInstanceData: ComponentInstance | GroupInstance = this.getSelectedInstance();
+ const selectedInstanceData: ComponentInstance | GroupInstance | PolicyInstance = this.getSelectedInstance();
if (!selectedInstanceData) {
return;
}
this.openToscaGetFunctionModal();
}
if (!selectedInstanceData) {
return;
}
this.openToscaGetFunctionModal();
}
- private getSelectedInstance(): ComponentInstance | GroupInstance {
+ private getSelectedInstance(): ComponentInstance | GroupInstance | PolicyInstance {
const instancesIds = this.keysPipe.transform(this.instanceFePropertiesMap, []);
const instanceId: string = instancesIds[0];
const instancesIds = this.keysPipe.transform(this.instanceFePropertiesMap, []);
const instanceId: string = instancesIds[0];
- return <ComponentInstance | GroupInstance> this.instances.find(instance => instance.uniqueId == instanceId && instance instanceof ComponentInstance || instance instanceof GroupInstance);
+ return <ComponentInstance | GroupInstance | PolicyInstance> this.instances.find(instance =>
+ instance.uniqueId == instanceId && instance instanceof ComponentInstance || instance instanceof GroupInstance || instance instanceof PolicyInstance);
}
private buildCheckedInstanceProperty(): PropertyBEModel {
}
private buildCheckedInstanceProperty(): PropertyBEModel {
this.updateInstanceProperty(checkedInstanceProperty);
} else if (this.selectedInstanceData instanceof GroupInstance) {
this.updateGroupInstanceProperty(checkedInstanceProperty);
this.updateInstanceProperty(checkedInstanceProperty);
} else if (this.selectedInstanceData instanceof GroupInstance) {
this.updateGroupInstanceProperty(checkedInstanceProperty);
+ } else if (this.selectedInstanceData instanceof PolicyInstance) {
+ this.updatePolicyInstanceProperty(checkedInstanceProperty);
this.updateInstanceProperty(checkedProperty);
} else if (this.selectedInstanceData instanceof GroupInstance) {
this.updateGroupInstanceProperty(checkedProperty);
this.updateInstanceProperty(checkedProperty);
} else if (this.selectedInstanceData instanceof GroupInstance) {
this.updateGroupInstanceProperty(checkedProperty);
+ } else if (this.selectedInstanceData instanceof PolicyInstance) {
+ this.updatePolicyInstanceProperty(checkedProperty);
+ updatePolicyInstanceProperty(instanceProperty: PropertyBEModel) {
+ this.loadingProperties = true;
+ this.componentInstanceServiceNg2.updateComponentPolicyInstanceProperties(this.component.componentType, this.component.uniqueId,
+ this.selectedInstanceData.uniqueId, [instanceProperty])
+ .subscribe(() => {
+ this.changeSelectedInstance(this.getSelectedInstance());
+ }, (error) => {
+ this.loadingProperties = false;
+ console.error(error);
+ }, () => {
+ this.loadingProperties = false;
+ });
+ }
+
/*** DECLARE PROPERTIES/INPUTS ***/
declareProperties = (): void => {
console.debug("==>" + this.constructor.name + ": declareProperties");
/*** DECLARE PROPERTIES/INPUTS ***/
declareProperties = (): void => {
console.debug("==>" + this.constructor.name + ": declareProperties");