From f7dee08d8e56fc023aeb6f12aa2f688978545e01 Mon Sep 17 00:00:00 2001 From: vasraz Date: Thu, 9 Feb 2023 17:57:56 +0000 Subject: Add support for delete property from non-normative data type Signed-off-by: Vasyl Razinkov Change-Id: I668b1e7f7d00e97b7827d759766e105fdd53ed53 Issue-ID: SDC-4378 --- .../type-workspace-properties.component.html | 9 ++++++-- .../type-workspace-properties.component.ts | 26 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) (limited to 'catalog-ui/src/app/ng2/pages/type-workspace') diff --git a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.html b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.html index e657520ee4..12b2d992a8 100644 --- a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.html +++ b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.html @@ -32,14 +32,15 @@
{{header.title}}
+
{{'PROPERTY_LIST_EMPTY_MESSAGE' | translate}}
-
-
+
+
@@ -54,6 +55,10 @@
{{property.description}}
+
+ +
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 +} -- cgit 1.2.3-korg