From e962a38f0b2bdc32d41944fb09cb7a4087dd5189 Mon Sep 17 00:00:00 2001 From: Corinne Krych Date: Wed, 14 Mar 2018 10:32:13 +0100 Subject: [PATCH] feat(archive): make revive available from archive view details --- frontend/src/component/archive/view-container.js | 4 ++-- .../component/feature/feature-list-item-component.jsx | 10 +++++++++- frontend/src/component/feature/view-component.jsx | 11 ++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/frontend/src/component/archive/view-container.js b/frontend/src/component/archive/view-container.js index f7517c9629..6457722619 100644 --- a/frontend/src/component/archive/view-container.js +++ b/frontend/src/component/archive/view-container.js @@ -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); diff --git a/frontend/src/component/feature/feature-list-item-component.jsx b/frontend/src/component/feature/feature-list-item-component.jsx index 20f2ff0eb4..774ad70469 100644 --- a/frontend/src/component/feature/feature-list-item-component.jsx +++ b/frontend/src/component/feature/feature-list-item-component.jsx @@ -54,7 +54,15 @@ const Feature = ({ ) : ( // display archive, toggleFeature is undefined - + + toggleFeature(name)} + checked={enabled} + /> + )} {toggleFeature ? ( // display feature list, toggleFeature is available diff --git a/frontend/src/component/feature/view-component.jsx b/frontend/src/component/feature/view-component.jsx index 3e5a052407..31ad0d01d8 100644 --- a/frontend/src/component/feature/view-component.jsx +++ b/frontend/src/component/feature/view-component.jsx @@ -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 ) : ( - + )}