diff options
author | 2023-02-10 18:41:01 +0000 | |
---|---|---|
committer | 2023-03-10 11:25:05 +0000 | |
commit | d03be99cba81d17bfb8681c18acf212eec9549ea (patch) | |
tree | 8838525a2bdf1caba2d441741534e94f95e6ae60 /catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts | |
parent | 4ec39782a9f8fe7188f38fc39953f277a8284618 (diff) |
Provide input name when declaring service property as input
Issue-ID: SDC-4385
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Change-Id: I2b71e04b97ba69195380d2aa29d9d98a3bd5e981
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts index a1e4f415be..2592227afa 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts @@ -70,6 +70,7 @@ import {Observable} from "rxjs"; import {TranslateService} from "../../shared/translator/translate.service"; import {ToscaFunction} from "../../../models/tosca-function"; import {SubPropertyToscaFunction} from "../../../models/sub-property-tosca-function"; +import {DeclareInputComponent} from "./declare-input/declare-input.component"; const SERVICE_SELF_TITLE = "SELF"; @Component({ @@ -728,7 +729,7 @@ export class PropertiesAssignmentComponent { } /*** DECLARE PROPERTIES/INPUTS ***/ - declareProperties = (): void => { + declareInputFromProperties = (inputName:string): void => { console.debug("==>" + this.constructor.name + ": declareProperties"); let selectedComponentInstancesProperties: InstanceBePropertiesMap = new InstanceBePropertiesMap(); @@ -743,6 +744,9 @@ export class PropertiesAssignmentComponent { if (!this.isInput(selectedInstanceData.originType)) { // convert Property FE model -> Property BE model, extract only checked selectedComponentInstancesProperties[instanceId] = this.propertiesService.getCheckedProperties(this.instanceFePropertiesMap[instanceId]); + if (inputName) { + selectedComponentInstancesProperties[instanceId][0].inputName = inputName; + } } else { selectedComponentInstancesInputs[instanceId] = this.propertiesService.getCheckedProperties(this.instanceFePropertiesMap[instanceId]); } @@ -801,6 +805,37 @@ export class PropertiesAssignmentComponent { }, error => {}); //ignore error }; + private openAddInputNameAndDeclareInputModal = (): void => { + const modalTitle = this.translateService.translate('ADD_INPUT_NAME_TO_DECLARE'); + const modalButtons = []; + const modal = this.modalService.createCustomModal(new ModalModel( + 'sm', + modalTitle, + null, + modalButtons, + null /* type */ + )); + modalButtons.push(new ButtonModel(this.translateService.translate('MODAL_SAVE'), 'blue', + () => { + const inputName: string = modal.instance.dynamicContent.instance.inputNameForm.value; + if (inputName) { + this.declareInputFromProperties(inputName); + } else { + this.notification.warning({ + message: 'Failed to set input name', + title: 'Warning' + }); + } + this.modalService.closeCurrentModal(); + } + )); + modalButtons.push(new ButtonModel(this.translateService.translate('MODAL_CANCEL'), 'outline grey', () => { + this.modalService.closeCurrentModal(); + })); + this.modalService.addDynamicContentToModal(modal, DeclareInputComponent, {}); + modal.instance.open(); + } + declareListProperties = (): void => { // get selected properties let selectedComponentInstancesProperties: InstanceBePropertiesMap = new InstanceBePropertiesMap(); |