diff options
author | 2023-02-09 17:57:56 +0000 | |
---|---|---|
committer | 2023-02-10 09:45:37 +0000 | |
commit | f7dee08d8e56fc023aeb6f12aa2f688978545e01 (patch) | |
tree | 06e6c3a764def525bab0f32514fa397ed23db6e5 /catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts | |
parent | 9c057c26f14de77dff432403941322edaca7ea4e (diff) |
Add support for delete property from non-normative data type
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: I668b1e7f7d00e97b7827d759766e105fdd53ed53
Issue-ID: SDC-4378
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts index 60edd13c2d..f9eaa1332d 100644 --- a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts +++ b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts @@ -32,6 +32,8 @@ import {TranslateService} from "../../../shared/translator/translate.service"; import {AddPropertyComponent, PropertyValidationEvent} from "./add-property/add-property.component"; import {IWorkspaceViewModelScope} from "../../../../view-models/workspace/workspace-view-model"; import {SdcUiServices} from "onap-ui-angular/dist"; +import {PropertyModel} from "../../../../models/properties"; +import {SdcUiCommon, SdcUiComponents} from "onap-ui-angular"; import {ToscaTypeHelper} from "../../../../utils/tosca-type-helper"; @Component({ @@ -249,9 +251,31 @@ export class TypeWorkspacePropertiesComponent implements OnInit { } return null; } + + delete(property: PropertyModel) { + let onOk: Function = (): void => { + this.dataTypeService.deleteProperty(this.dataType.uniqueId, property.uniqueId).subscribe((response) => { + const props = this.properties; + props.splice(props.findIndex(p => p.uniqueId === response), 1); + this.filter(); + }, (error) => { + console.error(error); + }); + }; + let title: string = this.translateService.translate("PROPERTY_VIEW_DELETE_MODAL_TITLE"); + let message: string = this.translateService.translate("PROPERTY_VIEW_DELETE_MODAL_TEXT", {'name': property.name}); + const okButton = { + testId: "OK", + text: "OK", + type: SdcUiCommon.ButtonType.info, + callback: onOk, + closeModal: true + } as SdcUiComponents.ModalButtonComponent; + this.modalServiceSdcUI.openInfoModal(title, message, 'delete-modal', [okButton]); + }; } interface TableHeader { title: string; property: string; -}
\ No newline at end of file +} |