diff options
Diffstat (limited to 'catalog-ui')
2 files changed, 19 insertions, 6 deletions
diff --git a/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.ts b/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.ts index a0588c0daa..e5f1f6f918 100644 --- a/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.ts +++ b/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.ts @@ -34,6 +34,7 @@ import {CustomToscaFunction} from "../../../../models/default-custom-functions"; export enum SourceType { STATIC = 'static', + SEVERAL = 'several', TOSCA_FUNCTION = 'tosca_function', TOSCA_FUNCTION_LIST = 'tosca_function_list' } diff --git a/catalog-ui/src/app/ng2/pages/service-dependencies-editor/service-dependencies-editor.component.ts b/catalog-ui/src/app/ng2/pages/service-dependencies-editor/service-dependencies-editor.component.ts index fdaf2f3573..26fd59e794 100644 --- a/catalog-ui/src/app/ng2/pages/service-dependencies-editor/service-dependencies-editor.component.ts +++ b/catalog-ui/src/app/ng2/pages/service-dependencies-editor/service-dependencies-editor.component.ts @@ -223,7 +223,8 @@ export class ServiceDependenciesEditorComponent implements OnInit { } private initSelectedSourceType(): void { - if (!this.currentRule.sourceType || this.currentRule.sourceType === SourceType.STATIC) { + if (!this.currentRule.sourceType || this.currentRule.sourceType === SourceType.STATIC + || (this.currentRule.sourceType === SourceType.SEVERAL && !ToscaFunctionHelper.convertObjectToToscaFunction(this.currentRule.value[0]))) { this.selectedSourceType = SourceType.STATIC; } else { if (!this.isValidValuesOperator() && !this.isRangeType() && !this.isInRangeOperator()) { @@ -309,11 +310,22 @@ export class ServiceDependenciesEditorComponent implements OnInit { } else if (ToscaFunctionHelper.isValueToscaFunction(this.currentRule.value)) { newProperty.toscaFunction = ToscaFunctionHelper.convertObjectToToscaFunction(this.currentRule.value); newProperty.value = newProperty.toscaFunction.buildValueString(); - } else if (Array.isArray(this.currentRule.value) && - typeof this.currentRule.value[0] === "object") { - this.validValuesToscaFunctionList = this.currentRule.value; - this.rangeToscaFunctionList = this.currentRule.value; - newProperty.toscaFunction = this.currentRule.value; + } else if (Array.isArray(this.currentRule.value)) { + if (typeof this.currentRule.value[0] === 'object') { + this.rangeToscaFunctionList = []; + this.validValuesToscaFunctionList = []; + this.currentRule.value.forEach(val => { + this.rangeToscaFunctionList.push(ToscaFunctionHelper.convertObjectToToscaFunction(val)); + this.validValuesToscaFunctionList.push(ToscaFunctionHelper.convertObjectToToscaFunction(val)); + }); + newProperty.toscaFunction = this.currentRule.value; + newProperty.value = this.currentRule.value; + } + else { + this.validValuesToscaFunctionList = this.currentRule.value; + this.rangeToscaFunctionList = this.currentRule.value; + newProperty.toscaFunction = this.currentRule.value; + } } else { newProperty.value = JSON.stringify(this.currentRule.value); this.propertiesUtils.initValueObjectRef(newProperty); |