1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

feat(archive): make revive available from archive view details

This commit is contained in:
Corinne Krych 2018-03-14 10:32:13 +01:00
parent 6b08647403
commit e962a38f0b
3 changed files with 21 additions and 4 deletions

View File

@ -1,6 +1,5 @@
import { connect } from 'react-redux';
import { fetchArchive } from './../../store/archive-actions';
import { fetchArchive, revive } from './../../store/archive-actions';
import ViewToggleComponent from './../feature/view-component';
export default connect(
@ -14,5 +13,6 @@ export default connect(
}),
{
fetchArchive,
revive,
}
)(ViewToggleComponent);

View File

@ -54,7 +54,15 @@ const Feature = ({
</span>
) : (
// display archive, toggleFeature is undefined
<span />
<span className={styles.listItemToggle}>
<Switch
disabled
title={`Toggle ${name}`}
key="left-actions"
onChange={() => toggleFeature(name)}
checked={enabled}
/>
</span>
)}
<span className={['mdl-list__item-primary-content', styles.listItemLink].join(' ')}>
{toggleFeature ? ( // display feature list, toggleFeature is available

View File

@ -8,6 +8,7 @@ import MetricComponent from './metric-container';
import EditFeatureToggle from './form/form-update-feature-container';
import ViewFeatureToggle from './form/form-view-feature-container';
import { styles as commonStyles } from '../common';
import {revive} from '../../store/archive-actions';
const TABS = {
strategies: 0,
@ -28,6 +29,7 @@ export default class ViewFeatureToggleComponent extends React.Component {
features: PropTypes.array.isRequired,
toggleFeature: PropTypes.func,
removeFeatureToggle: PropTypes.func,
revive: PropTypes.func,
fetchArchive: PropTypes.func,
fetchFeatureToggles: PropTypes.func,
editFeatureToggle: PropTypes.func,
@ -69,6 +71,7 @@ export default class ViewFeatureToggleComponent extends React.Component {
featureToggle,
features,
activeTab,
revive,
// setValue,
featureToggleName,
toggleFeature,
@ -106,6 +109,10 @@ export default class ViewFeatureToggleComponent extends React.Component {
hashHistory.push('/features');
}
};
const reviveToggle = () => {
revive(featureToggle.name);
hashHistory.push('/features');
};
const updateFeatureToggle = () => {
let feature = { ...featureToggle };
if (Array.isArray(feature.strategies)) {
@ -183,7 +190,9 @@ export default class ViewFeatureToggleComponent extends React.Component {
Archive
</Button>
) : (
<span />
<Button onClick={reviveToggle} style={{ flexShrink: 0 }}>
Revive
</Button>
)}
</CardActions>
<hr />