justify-content: flex-end;
margin-bottom: 10px;
align-self: center;
+ .deprecate-btn {
+ margin-left: 10px;
+ }
.svg-icon-wrapper {
&:hover {
fill: $light-blue;
* 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.
}
},
+ softwareProductDelete(itemId) {
+ return RestAPIUtil.destroy(`${baseUrl()}/${itemId}`);
+ },
+
setIsValidityData(dispatch, { isValidityData }) {
dispatch({
type: actionTypes.softwareProductEditor.IS_VALIDITY_DATA_CHANGED,
},
onArchive: () => VersionsPageActionHelper.archiveItem(dispatch, itemId),
onRestore: () =>
- VersionsPageActionHelper.restoreItemFromArchive(dispatch, itemId)
+ VersionsPageActionHelper.restoreItemFromArchive(dispatch, itemId),
+ onDelete: () =>
+ VersionsPageActionHelper.deleteItemFromArchive(dispatch, itemId)
};
};
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>
itemName,
isArchived,
onRestore,
+ onDelete,
onArchive,
isCollaborator
}) => {
{isCollaborator && (
<ArchiveRestoreButton
isArchived={isArchived}
- depricateAction={
+ deprecateAction={
isArchived ? () => onRestore() : () => onArchive()
}
+ deleteAction={isArchived ? () => onDelete() : null}
title={i18n(isArchived ? 'RESTORE' : 'ARCHIVE')}
/>
)}
isManual,
isArchived,
onArchive,
- onRestore
+ onRestore,
+ onDelete
} = this.props;
const depricatedTitle = isArchived ? i18n('(Archived)') : '';
return (
onArchive={onArchive}
isArchived={isArchived}
onRestore={onRestore}
+ onDelete={onDelete}
isCollaborator={isCollaborator}
/>
<PermissionsView
* 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';
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 }) {
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')
+ })
+ );
}
};