diff --git a/frontend/src/component/feature/feature-component.jsx b/frontend/src/component/feature/feature-list-item-component.jsx
similarity index 97%
rename from frontend/src/component/feature/feature-component.jsx
rename to frontend/src/component/feature/feature-list-item-component.jsx
index b76e745075..a8f1dcacab 100644
--- a/frontend/src/component/feature/feature-component.jsx
+++ b/frontend/src/component/feature/feature-list-item-component.jsx
@@ -1,11 +1,9 @@
import React, { PropTypes } from 'react';
import { Link } from 'react-router';
-import { Chip, Switch, Icon, Tooltip, IconButton, ChipContact } from 'react-mdl';
+import { Chip, Switch, Icon, IconButton } from 'react-mdl';
import percentLib from 'percent';
import Progress from './progress';
-
-
import style from './feature.scss';
const Feature = ({
diff --git a/frontend/src/component/feature/form-edit-container.jsx b/frontend/src/component/feature/form-edit-container.jsx
index c5b4848314..44a7b62fce 100644
--- a/frontend/src/component/feature/form-edit-container.jsx
+++ b/frontend/src/component/feature/form-edit-container.jsx
@@ -3,7 +3,7 @@ import { hashHistory } from 'react-router';
import { requestUpdateFeatureToggle } from '../../store/feature-actions';
import { createMapper, createActions } from '../input-helpers';
-import EditAndView from './view-and-edit';
+import FormComponent from './form';
const ID = 'edit-feature-toggle';
function getId (props) {
@@ -59,4 +59,4 @@ const actions = createActions({
prepare,
});
-export default connect(mapStateToProps, actions)(EditAndView);
+export default connect(mapStateToProps, actions)(FormComponent);
diff --git a/frontend/src/component/feature/form-edit-wrap.jsx b/frontend/src/component/feature/form-edit-wrap.jsx
deleted file mode 100644
index 793b0c45ff..0000000000
--- a/frontend/src/component/feature/form-edit-wrap.jsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import React, { PropTypes } from 'react';
-
-import { connect } from 'react-redux';
-import EditFeatureToggle from './form-edit-container.jsx';
-import { fetchFeatureToggles } from '../../store/feature-actions';
-
-class EditFeatureToggleWrapper extends React.Component {
-
- static propTypes () {
- return {
- featureToggleName: PropTypes.string.isRequired,
- features: PropTypes.array.isRequired,
- fetchFeatureToggles: PropTypes.array.isRequired,
- };
- }
-
- componentWillMount () {
- if (this.props.features.length === 0) {
- this.props.fetchFeatureToggles();
- }
- }
-
- render () {
- const { features, featureToggleName } = this.props;
-
- const featureToggle = features.find(toggle => toggle.name === featureToggleName);
-
- if (featureToggle) {
- return ;
- } else if (features.length === 0 ) {
- return Loading;
- } else {
- return Could not find {this.props.featureToggleName};
- }
- }
-}
-
-
-export default connect((state) => ({
- features: state.features.toJS(),
-}), { fetchFeatureToggles })(EditFeatureToggleWrapper);
diff --git a/frontend/src/component/feature/list-component.jsx b/frontend/src/component/feature/list-component.jsx
index 7e00c59116..08852e3938 100644
--- a/frontend/src/component/feature/list-component.jsx
+++ b/frontend/src/component/feature/list-component.jsx
@@ -1,5 +1,5 @@
import React, { PropTypes } from 'react';
-import Feature from './feature-component';
+import Feature from './feature-list-item-component';
import { Link } from 'react-router';
import { Icon, Chip, ChipContact, IconButton, FABButton, Textfield, Menu, MenuItem } from 'react-mdl';
diff --git a/frontend/src/component/feature/list-container.jsx b/frontend/src/component/feature/list-container.jsx
index cbd0165ef7..b064609d3f 100644
--- a/frontend/src/component/feature/list-container.jsx
+++ b/frontend/src/component/feature/list-container.jsx
@@ -49,7 +49,7 @@ const mapStateToProps = (state) => {
));
} else if (settings.sort === 'metrics') {
const target = settings.showLastHour ? featureMetrics.lastHour : featureMetrics.lastMinute;
-
+
features = features.sort((a, b) => {
if (!target[a.name]) { return 1; }
if (!target[b.name]) { return -1; }
diff --git a/frontend/src/component/feature/progress.scss b/frontend/src/component/feature/progress-styles.scss
similarity index 100%
rename from frontend/src/component/feature/progress.scss
rename to frontend/src/component/feature/progress-styles.scss
diff --git a/frontend/src/component/feature/progress.jsx b/frontend/src/component/feature/progress.jsx
index d374b1c90f..59386daeb3 100644
--- a/frontend/src/component/feature/progress.jsx
+++ b/frontend/src/component/feature/progress.jsx
@@ -1,5 +1,5 @@
import React, { PropTypes, Component } from 'react';
-import styles from './progress.scss';
+import styles from './progress-styles.scss';
class Progress extends Component {
constructor (props) {
diff --git a/frontend/src/component/feature/view-and-edit.jsx b/frontend/src/component/feature/view-and-edit.jsx
deleted file mode 100644
index d58b4ef832..0000000000
--- a/frontend/src/component/feature/view-and-edit.jsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import React, { PropTypes } from 'react';
-
-import FormComponent from './form';
-
-
-const Render = (props) => {
- return (
-
-
{props.featureToggle.name}
-
-
add metrics
-
add apps
-
add instances
-
-
-
Edit
-
-
- );
-};
-
-export default Render;
diff --git a/frontend/src/component/feature/view-edit-container.jsx b/frontend/src/component/feature/view-edit-container.jsx
new file mode 100644
index 0000000000..f57402d60d
--- /dev/null
+++ b/frontend/src/component/feature/view-edit-container.jsx
@@ -0,0 +1,121 @@
+import React, { PropTypes } from 'react';
+import { Grid, Cell, Icon } 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 { fetchFeatureMetrics } from '../../store/feature-metrics-actions';
+
+
+
+// import { toggleFeature, fetchFeatureToggles, removeFeatureToggle } from '../../store/feature-actions';
+
+
+class EditFeatureToggleWrapper extends React.Component {
+
+ static propTypes () {
+ return {
+ featureToggleName: PropTypes.string.isRequired,
+ features: PropTypes.array.isRequired,
+ fetchFeatureToggles: PropTypes.array.isRequired,
+ };
+ }
+
+ componentWillMount () {
+ if (this.props.features.length === 0) {
+ this.props.fetchFeatureToggles();
+ }
+ this.props.fetchFeatureMetrics();
+ setInterval(() => {
+ this.props.fetchFeatureMetrics();
+ }, 5000);
+ }
+
+ render () {
+ const {
+ features,
+ featureToggleName,
+ metrics = {
+ lastHour: { yes: 0, no: 0, isFallback: true },
+ lastMinute: { yes: 0, no: 0, isFallback: true },
+ },
+ } = 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 featureToggle = features.find(toggle => toggle.name === featureToggleName);
+
+ if (!featureToggle) {
+ if (features.length === 0 ) {
+ return Loading;
+ }
+ 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
+ |
+
+
+
+
+
+
+
+ );
+ }
+}
+
+function getMetricsForToggle (state, toggleName) {
+ if (!toggleName) {
+ return;
+ }
+ if (state.featureMetrics.hasIn(['lastHour', toggleName])) {
+ return {
+ lastHour: state.featureMetrics.getIn(['lastHour', toggleName]),
+ lastMinute: state.featureMetrics.getIn(['lastMinute', toggleName]),
+ };
+ }
+}
+
+
+export default connect((state, props) => ({
+ features: state.features.toJS(),
+ metrics: getMetricsForToggle(state, props.featureToggleName),
+}), {
+ fetchFeatureMetrics,
+ fetchFeatureToggles,
+})(EditFeatureToggleWrapper);
diff --git a/frontend/src/page/features/edit.js b/frontend/src/page/features/edit.js
index 3700ea861a..5f0cd3a4b3 100644
--- a/frontend/src/page/features/edit.js
+++ b/frontend/src/page/features/edit.js
@@ -1,5 +1,5 @@
import React, { Component, PropTypes } from 'react';
-import EditFeatureToggleForm from '../../component/feature/form-edit-wrap';
+import EditFeatureToggleForm from '../../component/feature/view-edit-container';
export default class Features extends Component {
static propTypes () {