diff --git a/frontend/src/component/feature/view-edit-container.jsx b/frontend/src/component/feature/view-edit-container.jsx index f57402d60d..6f6c5dcb9b 100644 --- a/frontend/src/component/feature/view-edit-container.jsx +++ b/frontend/src/component/feature/view-edit-container.jsx @@ -1,19 +1,14 @@ import React, { PropTypes } from 'react'; -import { Grid, Cell, Icon } from 'react-mdl'; +import { Grid, Cell, Icon, Switch } from 'react-mdl'; import percentLib from 'percent'; import Progress from './progress'; import { connect } from 'react-redux'; import EditFeatureToggle from './form-edit-container.jsx'; -import { fetchFeatureToggles } from '../../store/feature-actions'; +import { fetchFeatureToggles, toggleFeature } from '../../store/feature-actions'; import { fetchFeatureMetrics } from '../../store/feature-metrics-actions'; - - -// import { toggleFeature, fetchFeatureToggles, removeFeatureToggle } from '../../store/feature-actions'; - - class EditFeatureToggleWrapper extends React.Component { static propTypes () { @@ -36,6 +31,7 @@ class EditFeatureToggleWrapper extends React.Component { render () { const { + toggleFeature, features, featureToggleName, metrics = { @@ -44,9 +40,8 @@ class EditFeatureToggleWrapper extends React.Component { }, } = this.props; - const lastHourPercent = percentLib.calc(metrics.lastHour.yes, metrics.lastHour.yes + metrics.lastHour.no, 0); - const lastMinutePercent = percentLib.calc(metrics.lastMinute.yes, metrics.lastMinute.yes + metrics.lastMinute.no, 0); - + const lastHourPercent = 1 * percentLib.calc(metrics.lastHour.yes, metrics.lastHour.yes + metrics.lastHour.no, 0); + const lastMinutePercent = 1 * percentLib.calc(metrics.lastMinute.yes, metrics.lastMinute.yes + metrics.lastMinute.no, 0); const featureToggle = features.find(toggle => toggle.name === featureToggleName); @@ -57,43 +52,47 @@ class EditFeatureToggleWrapper extends React.Component { return Could not find {this.props.featureToggleName}; } - return (
-

{featureToggle.name}

- - - { - metrics.lastMinute.isFallback ? - : -
- -
- } -

Last minute: Yes {metrics.lastMinute.yes}, No: {metrics.lastMinute.no}

-
- - { - metrics.lastHour.isFallback ? - : -
- -
- } -

Last hour: Yes {metrics.lastHour.yes}, No: {metrics.lastHour.no}

-
- -

add apps

-
- -

add instances

-
-
- - - - - +

{featureToggle.name} {featureToggle.enabled ? 'is enabled' : 'is disabled'}

+
+
+ toggleFeature(featureToggle)} checked={featureToggle.enabled}> + Toggle {featureToggle.name} + +
+
+ + + { + metrics.lastMinute.isFallback ? + : +
+ +
+ } +

Last minute: Yes {metrics.lastMinute.yes}, No: {metrics.lastMinute.no}

+
+ + { + metrics.lastHour.isFallback ? + : +
+ +
+ } +

Last hour: Yes {metrics.lastHour.yes}, No: {metrics.lastHour.no}

+
+ +

add apps

+
+ +

add instances

+
+
+
+

Edit

+
); } @@ -118,4 +117,5 @@ export default connect((state, props) => ({ }), { fetchFeatureMetrics, fetchFeatureToggles, + toggleFeature, })(EditFeatureToggleWrapper);