diff options
author | svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com> | 2018-03-19 12:15:19 +0200 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2018-03-20 07:51:05 +0000 |
commit | 091edfdac90f66d91caff1b93131f99ba74f9aeb (patch) | |
tree | a6a24fc4a295b7f804aeb2a2211e58b38bbf922a /openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx | |
parent | fefa3e408f77289594e47edc878d1bee61fca90b (diff) |
ui support for archive items
Issue-ID: SDC-1088
Change-Id: I836e4896a8ec6bb065f9d2571f514916ccf6759f
Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx')
-rw-r--r-- | openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx index 69a34e0a1c..f8417fafbf 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,26 @@ import VersionList from './components/VersionList.jsx'; import PermissionsView from './components/PermissionsView.jsx'; import Tree from 'nfvo-components/tree/Tree.jsx'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; +import Button from 'sdc-ui/lib/react/Button.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; +import featureToggle from 'sdc-app/features/featureToggle.js'; + +const DepricateButton = ({depricateAction, title}) => ( + <div className='depricate-btn-wrapper'> + <Button data-test-id='depricate-action-btn' className='depricate-btn' onClick={depricateAction}>{title}</Button> + </div> +); + +const FeatureDepricatedButton = featureToggle('ARCHIVE_ITEM')(DepricateButton); + +const VersionPageTitle = ({itemName, depricatedTitle, isArchived, onRestore, onArchive}) => { + return ( + <div className='version-page-header'> + <div className='versions-page-title'>{`${i18n('Available Versions')} - ${itemName} ${depricatedTitle}`}</div> + <FeatureDepricatedButton depricateAction={isArchived ? () => onRestore() : () => onArchive() } title={i18n(isArchived ? 'RESTORE' : 'ARCHIVE')}/> + </div> + ); +}; class VersionsPage extends React.Component { state = { @@ -26,10 +45,16 @@ class VersionsPage extends React.Component { } render() { let { versions, owner, contributors, currentUser, isCollaborator, itemName = '', viewers, onSelectVersion, onNavigateToVersion, - onTreeFullScreen, onManagePermissions, onCreateVersion, selectedVersion, onModalNodeClick, isManual} = this.props; + onTreeFullScreen, onManagePermissions, onCreateVersion, selectedVersion, onModalNodeClick, isManual, isArchived, onArchive, onRestore} = this.props; + const depricatedTitle = isArchived ? i18n('(Archived)') : ''; return ( <div className='versions-page-view'> - <div className='versions-page-title'>{i18n('Available Versions - {itemName}', {itemName: itemName})}</div> + <VersionPageTitle + itemName={itemName} + depricatedTitle={depricatedTitle} + onArchive={onArchive} + isArchived={isArchived} + onRestore={onRestore}/> <PermissionsView owner={owner} contributors={contributors} @@ -65,7 +90,7 @@ class VersionsPage extends React.Component { versions={versions} onSelectVersion={onSelectVersion} onNavigateToVersion={onNavigateToVersion} - onCreateVersion={onCreateVersion} + onCreateVersion={isArchived ? false : onCreateVersion} selectedVersion={selectedVersion} isCollaborator={isCollaborator} /> </div> |