From 8164e4d316b3d4ffdd0ba2aa599bbc0f9b454598 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Mon, 11 Apr 2022 15:58:59 +0100 Subject: Add delete button for archived VLM Adds a delete button for archived VLM in the VLM versions page. Asks for a confirmation before deleting. As VSP and VLM shares the same button, adds also a confirmation before deleting the VSP. Change-Id: I90af23cf3cff15d85292c895fdba7021aaa9649a Issue-ID: SDC-3964 Signed-off-by: andre.schmid --- .../onboarding/versionsPage/VersionsPage.js | 28 ++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js') diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js index 61c0d0a88f..b7d5417e33 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js @@ -20,6 +20,9 @@ import VersionsPageCreationActionHelper from './creation/VersionsPageCreationAct import PermissionsActionHelper from '../permissions/PermissionsActionHelper.js'; import { onboardingMethod as onboardingMethodType } from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; import VersionsPageView from './VersionsPage.jsx'; +import { actionTypes as ModalActionTypes } from 'nfvo-components/modal/GlobalModalConstants'; +import i18n from 'nfvo-utils/i18n/i18n'; +import { itemTypes } from 'sdc-app/onboarding/versionsPage/VersionsPageConstants'; export const mapStateToProps = ({ users: { userInfo }, @@ -99,8 +102,29 @@ export const mapActionsToProps = ( onArchive: () => VersionsPageActionHelper.archiveItem(dispatch, itemId), onRestore: () => VersionsPageActionHelper.restoreItemFromArchive(dispatch, itemId), - onDelete: () => - VersionsPageActionHelper.deleteItemFromArchive(dispatch, itemId) + onDelete: () => { + let confirmMsgCode; + if (itemType === itemTypes.LICENSE_MODEL) { + confirmMsgCode = 'vlm.delete.archived.warning'; + } else if (itemType === itemTypes.SOFTWARE_PRODUCT) { + confirmMsgCode = 'vsp.delete.archived.warning'; + } + dispatch({ + type: ModalActionTypes.GLOBAL_MODAL_WARNING, + data: { + msg: i18n(confirmMsgCode), + confirmationButtonText: i18n('button.proceed.label'), + title: i18n('WARNING'), + + onConfirmed: () => + VersionsPageActionHelper.deleteArchivedItem( + dispatch, + itemId, + itemType + ) + } + }); + } }; }; -- cgit 1.2.3-korg