diff options
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 +} |