diff options
author | KrupaNagabhushan <krupa.nagabhushan@est.tech> | 2022-04-04 17:49:50 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-04-08 08:50:48 +0000 |
commit | 881438cf4704590573a27aa2717d7bb3552ab573 (patch) | |
tree | 88afc1315bca6730896856d27d5f448952f9c6f0 | |
parent | f64976e64325073e08dce191d99bb807efd98301 (diff) |
Delete VSP - Onboarding UI support for VSP deletion
Issue-ID: SDC-3952
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Change-Id: Ib7258fe7002f5db03ccec84e935adfe0d217bfad
6 files changed, 54 insertions, 15 deletions
diff --git a/openecomp-ui/resources/scss/modules/_versionsPage.scss b/openecomp-ui/resources/scss/modules/_versionsPage.scss index 0f2e83eec6..bdf1c61249 100644 --- a/openecomp-ui/resources/scss/modules/_versionsPage.scss +++ b/openecomp-ui/resources/scss/modules/_versionsPage.scss @@ -64,6 +64,9 @@ justify-content: flex-end; margin-bottom: 10px; align-self: center; + .deprecate-btn { + margin-left: 10px; + } .svg-icon-wrapper { &:hover { fill: $light-blue; diff --git a/openecomp-ui/src/sdc-app/common/helpers/ItemsHelper.js b/openecomp-ui/src/sdc-app/common/helpers/ItemsHelper.js index bbca87fec5..3ac3efd4b1 100644 --- a/openecomp-ui/src/sdc-app/common/helpers/ItemsHelper.js +++ b/openecomp-ui/src/sdc-app/common/helpers/ItemsHelper.js @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js index 90bf9f9f08..6d74bad7a4 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js @@ -715,6 +715,10 @@ const SoftwareProductActionHelper = { } }, + softwareProductDelete(itemId) { + return RestAPIUtil.destroy(`${baseUrl()}/${itemId}`); + }, + setIsValidityData(dispatch, { isValidityData }) { dispatch({ type: actionTypes.softwareProductEditor.IS_VALIDITY_DATA_CHANGED, diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js index bbf45338f5..61c0d0a88f 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js @@ -98,7 +98,9 @@ export const mapActionsToProps = ( }, onArchive: () => VersionsPageActionHelper.archiveItem(dispatch, itemId), onRestore: () => - VersionsPageActionHelper.restoreItemFromArchive(dispatch, itemId) + VersionsPageActionHelper.restoreItemFromArchive(dispatch, itemId), + onDelete: () => + VersionsPageActionHelper.deleteItemFromArchive(dispatch, itemId) }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx index 6be05658f8..95c7530063 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx @@ -21,22 +21,36 @@ import SVGIcon from 'onap-ui-react/lib/components/SVGIcon.js'; import { Button } from 'onap-ui-react'; import i18n from 'nfvo-utils/i18n/i18n.js'; -const ArchiveRestoreButton = ({ depricateAction, title, isArchived }) => ( +const ArchiveRestoreButton = ({ + deprecateAction, + title, + isArchived, + deleteAction +}) => ( <div className="deprecate-btn-wrapper"> + , {isArchived ? ( - <Button - data-test-id="deprecate-action-btn" - className="depricate-btn" - onClick={depricateAction}> - {title} - </Button> + <div> + <Button + data-test-id="deprecate-action-btn" + className="deprecate-btn" + onClick={deprecateAction}> + {title} + </Button> + <Button + data-test-id="delete-action-btn" + className="deprecate-btn" + onClick={deleteAction}> + {i18n('DELETE')} + </Button> + </div> ) : ( <SVGIcon data-test-id="deprecate-action-btn" name="archiveBox" title={i18n('Archive')} color="secondary" - onClick={depricateAction} + onClick={deprecateAction} /> )} </div> @@ -50,6 +64,7 @@ const VersionPageTitle = ({ itemName, isArchived, onRestore, + onDelete, onArchive, isCollaborator }) => { @@ -62,9 +77,10 @@ const VersionPageTitle = ({ {isCollaborator && ( <ArchiveRestoreButton isArchived={isArchived} - depricateAction={ + deprecateAction={ isArchived ? () => onRestore() : () => onArchive() } + deleteAction={isArchived ? () => onDelete() : null} title={i18n(isArchived ? 'RESTORE' : 'ARCHIVE')} /> )} @@ -95,7 +111,8 @@ class VersionsPage extends React.Component { isManual, isArchived, onArchive, - onRestore + onRestore, + onDelete } = this.props; const depricatedTitle = isArchived ? i18n('(Archived)') : ''; return ( @@ -106,6 +123,7 @@ class VersionsPage extends React.Component { onArchive={onArchive} isArchived={isArchived} onRestore={onRestore} + onDelete={onDelete} isCollaborator={isCollaborator} /> <PermissionsView diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js index 8087dceca0..6ade7ff251 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js @@ -14,8 +14,7 @@ * permissions and limitations under the License. */ import ItemsHelper from '../../common/helpers/ItemsHelper.js'; -import { actionTypes } from './VersionsPageConstants.js'; -import { itemTypes } from './VersionsPageConstants.js'; +import { actionTypes, itemTypes } from './VersionsPageConstants.js'; import { modalContentMapper } from 'sdc-app/common/modal/ModalContentMapper.js'; import { actionTypes as modalActionTypes } from 'nfvo-components/modal/GlobalModalConstants.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; @@ -26,6 +25,7 @@ import { onboardingActions } from 'sdc-app/onboarding/OnboardingConstants.js'; import { notificationActions } from 'nfvo-components/notification/NotificationsConstants.js'; +import SoftwareProductActionHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper'; const VersionsPageActionHelper = { fetchVersions(dispatch, { itemType, itemId }) { @@ -112,6 +112,18 @@ const VersionsPageActionHelper = { message: i18n('Item successfully restored') }) ); + }, + + async deleteItemFromArchive(dispatch, itemId) { + await SoftwareProductActionHelper.softwareProductDelete(itemId); + await ScreensHelper.loadScreen(dispatch, { + screen: enums.SCREEN.ONBOARDING_CATALOG + }); + dispatch( + notificationActions.showSuccess({ + message: i18n('Item successfully deleted') + }) + ); } }; |