From 43ffce5d0d30872446c51afaf786d5cfad4378be Mon Sep 17 00:00:00 2001 From: imamSidero Date: Tue, 24 Jan 2023 16:03:54 +0000 Subject: Provide add/edit constraints capability to inputs in properties page Providing the capability to add or edit constraints to inputs in properies of a service Issue-ID: SDC-4346 Signed-off-by: Imam hussain Change-Id: I56261441022751a191fe057aafa4c681c8db96c5 --- .../logic/inputs-table/inputs-table.component.html | 2 +- .../logic/inputs-table/inputs-table.component.ts | 44 +++++++++++++++++++++- 2 files changed, 43 insertions(+), 3 deletions(-) (limited to 'catalog-ui/src/app/ng2/components') diff --git a/catalog-ui/src/app/ng2/components/logic/inputs-table/inputs-table.component.html b/catalog-ui/src/app/ng2/components/logic/inputs-table/inputs-table.component.html index 7c83c55ae6..1389c21bcd 100644 --- a/catalog-ui/src/app/ng2/components/logic/inputs-table/inputs-table.component.html +++ b/catalog-ui/src/app/ng2/components/logic/inputs-table/inputs-table.component.html @@ -44,7 +44,7 @@
- {{input.name}} + {{input.name}}
= new EventEmitter(); @Input() fePropertiesMap: InstanceFePropertiesMap; + @Input() componentInstancePropertyMap: PropertiesGroup; + @Input() parentComponent: ComponentData; @ViewChildren('metadataViewChildren') public metadataViewChildren: QueryList; @@ -84,7 +87,7 @@ export class InputsTableComponent { }; - constructor(private modalService: ModalService, private dataTypeService: DataTypeService){ + constructor(private modalService: ModalService, private dataTypeService: DataTypeService, private modalsHandler: ModalsHandler){ var x = 5 } @@ -175,6 +178,43 @@ export class InputsTableComponent { return false; } + public updateProperty = (inputProperty: InputFEModel): void => { + let modelProperty : PropertyModel = this.createPropertyModel(inputProperty); + if (inputProperty.instanceUniqueId != null && this.componentInstancePropertyMap != null && modelProperty.constraints == null) { + this.componentInstancePropertyMap[inputProperty.instanceUniqueId].forEach(tempProperty => { + modelProperty.constraints = tempProperty.constraints; + }); + } + this.modalsHandler.newOpenEditPropertyModal(modelProperty, [],true, 'component', modelProperty.resourceInstanceUniqueId, this.parentComponent, inputProperty); + } + + private createPropertyModel(inputproperty: InputFEModel){ + let propertyModel = new PropertyModel(); + propertyModel.constraints = inputproperty.constraints; + propertyModel.defaultValue = inputproperty.defaultValue; + propertyModel.definition = inputproperty.definition; + propertyModel.description = inputproperty.description; + propertyModel.name = inputproperty.name; + propertyModel.parentUniqueId = inputproperty.parentUniqueId; + propertyModel.password = inputproperty.password; + propertyModel.required = inputproperty.required; + propertyModel.schema = inputproperty.schema; + propertyModel.schemaType = inputproperty.schemaType; + propertyModel.type = inputproperty.type; + propertyModel.uniqueId = inputproperty.uniqueId; + propertyModel.value = inputproperty.value; + propertyModel.getInputValues = inputproperty.getInputValues; + propertyModel.parentPropertyType = inputproperty.parentPropertyType; + propertyModel.subPropertyInputPath = inputproperty.subPropertyInputPath; + propertyModel.getPolicyValues = inputproperty.getPolicyValues; + propertyModel.inputPath = inputproperty.inputPath; + propertyModel.metadata = inputproperty.metadata; + propertyModel.subPropertyToscaFunctions = inputproperty.subPropertyToscaFunctions; + propertyModel.ownerId = inputproperty.ownerId; + propertyModel.propertyView = true; + return propertyModel; + } + } -- cgit 1.2.3-korg