diff options
author | franciscovila <javier.paradela.vila@est.tech> | 2023-09-19 08:58:36 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-10-06 14:08:46 +0000 |
commit | ee6e389e64b55615800a81ce43a41fa3e7ff93ce (patch) | |
tree | f9728396bcf7773d535ac61db51acf51e5432d92 /catalog-ui | |
parent | 7918aa981a4c015a1cc5cd8a63a1fc381ac9f2cc (diff) |
Fail to import service with node filter using 'in_range'
Issue-ID: SDC-4628
Signed-off-by: franciscovila <javier.paradela.vila@est.tech>
Change-Id: Ibf6edbdfbb51c32256a707acd17a0def217e1bb9
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); |