diff options
author | andre.schmid <andre.schmid@est.tech> | 2022-04-11 15:58:59 +0100 |
---|---|---|
committer | andre.schmid <andre.schmid@est.tech> | 2022-04-11 16:37:09 +0100 |
commit | 8164e4d316b3d4ffdd0ba2aa599bbc0f9b454598 (patch) | |
tree | c191a0dcd4db8d78370ee2617ab9c7e9637e2c7c /openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js | |
parent | 10999e8145661c2a27a9e9c1876ee4dc915e2b80 (diff) |
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 <andre.schmid@est.tech>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js')
-rw-r--r-- | openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js index 6ade7ff251..506d5947c0 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js @@ -26,6 +26,7 @@ import { } from 'sdc-app/onboarding/OnboardingConstants.js'; import { notificationActions } from 'nfvo-components/notification/NotificationsConstants.js'; import SoftwareProductActionHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper'; +import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper'; const VersionsPageActionHelper = { fetchVersions(dispatch, { itemType, itemId }) { @@ -114,14 +115,28 @@ const VersionsPageActionHelper = { ); }, - async deleteItemFromArchive(dispatch, itemId) { - await SoftwareProductActionHelper.softwareProductDelete(itemId); + async deleteArchivedItem(dispatch, itemId, itemType) { + let successMsgCode; + if (itemType === itemTypes.LICENSE_MODEL) { + await LicenseModelActionHelper.deleteLicenseModel(itemId); + successMsgCode = 'vlm.delete.success'; + } else if (itemType === itemTypes.SOFTWARE_PRODUCT) { + await SoftwareProductActionHelper.softwareProductDelete(itemId); + successMsgCode = 'vsp.delete.success'; + } else { + console.error( + `Invalid item type "${itemType}". Expecting one of ${ + itemTypes.LICENSE_MODEL + } or ${itemTypes.SOFTWARE_PRODUCT}` + ); + return; + } await ScreensHelper.loadScreen(dispatch, { screen: enums.SCREEN.ONBOARDING_CATALOG }); dispatch( notificationActions.showSuccess({ - message: i18n('Item successfully deleted') + message: i18n(successMsgCode) }) ); } |