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:
parent
6b08647403
commit
e962a38f0b
@ -1,6 +1,5 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { fetchArchive } from './../../store/archive-actions';
|
import { fetchArchive, revive } from './../../store/archive-actions';
|
||||||
|
|
||||||
import ViewToggleComponent from './../feature/view-component';
|
import ViewToggleComponent from './../feature/view-component';
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
@ -14,5 +13,6 @@ export default connect(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
fetchArchive,
|
fetchArchive,
|
||||||
|
revive,
|
||||||
}
|
}
|
||||||
)(ViewToggleComponent);
|
)(ViewToggleComponent);
|
||||||
|
@ -54,7 +54,15 @@ const Feature = ({
|
|||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
// display archive, toggleFeature is undefined
|
// 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(' ')}>
|
<span className={['mdl-list__item-primary-content', styles.listItemLink].join(' ')}>
|
||||||
{toggleFeature ? ( // display feature list, toggleFeature is available
|
{toggleFeature ? ( // display feature list, toggleFeature is available
|
||||||
|
@ -8,6 +8,7 @@ import MetricComponent from './metric-container';
|
|||||||
import EditFeatureToggle from './form/form-update-feature-container';
|
import EditFeatureToggle from './form/form-update-feature-container';
|
||||||
import ViewFeatureToggle from './form/form-view-feature-container';
|
import ViewFeatureToggle from './form/form-view-feature-container';
|
||||||
import { styles as commonStyles } from '../common';
|
import { styles as commonStyles } from '../common';
|
||||||
|
import {revive} from '../../store/archive-actions';
|
||||||
|
|
||||||
const TABS = {
|
const TABS = {
|
||||||
strategies: 0,
|
strategies: 0,
|
||||||
@ -28,6 +29,7 @@ export default class ViewFeatureToggleComponent extends React.Component {
|
|||||||
features: PropTypes.array.isRequired,
|
features: PropTypes.array.isRequired,
|
||||||
toggleFeature: PropTypes.func,
|
toggleFeature: PropTypes.func,
|
||||||
removeFeatureToggle: PropTypes.func,
|
removeFeatureToggle: PropTypes.func,
|
||||||
|
revive: PropTypes.func,
|
||||||
fetchArchive: PropTypes.func,
|
fetchArchive: PropTypes.func,
|
||||||
fetchFeatureToggles: PropTypes.func,
|
fetchFeatureToggles: PropTypes.func,
|
||||||
editFeatureToggle: PropTypes.func,
|
editFeatureToggle: PropTypes.func,
|
||||||
@ -69,6 +71,7 @@ export default class ViewFeatureToggleComponent extends React.Component {
|
|||||||
featureToggle,
|
featureToggle,
|
||||||
features,
|
features,
|
||||||
activeTab,
|
activeTab,
|
||||||
|
revive,
|
||||||
// setValue,
|
// setValue,
|
||||||
featureToggleName,
|
featureToggleName,
|
||||||
toggleFeature,
|
toggleFeature,
|
||||||
@ -106,6 +109,10 @@ export default class ViewFeatureToggleComponent extends React.Component {
|
|||||||
hashHistory.push('/features');
|
hashHistory.push('/features');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const reviveToggle = () => {
|
||||||
|
revive(featureToggle.name);
|
||||||
|
hashHistory.push('/features');
|
||||||
|
};
|
||||||
const updateFeatureToggle = () => {
|
const updateFeatureToggle = () => {
|
||||||
let feature = { ...featureToggle };
|
let feature = { ...featureToggle };
|
||||||
if (Array.isArray(feature.strategies)) {
|
if (Array.isArray(feature.strategies)) {
|
||||||
@ -183,7 +190,9 @@ export default class ViewFeatureToggleComponent extends React.Component {
|
|||||||
Archive
|
Archive
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<span />
|
<Button onClick={reviveToggle} style={{ flexShrink: 0 }}>
|
||||||
|
Revive
|
||||||
|
</Button>
|
||||||
)}
|
)}
|
||||||
</CardActions>
|
</CardActions>
|
||||||
<hr />
|
<hr />
|
||||||
|
Loading…
Reference in New Issue
Block a user