diff --git a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggleUI.jsx b/packages/unleash-frontend-next/src/component/feature/AddFeatureToggleUI.jsx
index 88239b25c2..1aff600bd3 100644
--- a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggleUI.jsx
+++ b/packages/unleash-frontend-next/src/component/feature/AddFeatureToggleUI.jsx
@@ -3,72 +3,81 @@ import { Input, Switch, Button } from 'react-toolbox';
import AddFeatureToggleStrategy from './AddFeatureToggleStrategy';
import ConfiguredStrategies from './ConfiguredStrategies';
-class AddFeatureToggleUI extends React.Component {
- static propTypes () {
- return {
- strategies: PropTypes.array.required,
- featureToggle: PropTypes.object,
- updateField: PropTypes.func.required,
- addStrategy: PropTypes.func.required,
- removeStrategy: PropTypes.func.required,
- onSubmit: PropTypes.func.required,
- onCancel: PropTypes.func.required,
- editmode: PropTypes.bool,
- };
- }
+const AddFeatureToggleUI = ({
+ strategies,
+ featureToggle,
+ updateField,
+ addStrategy,
+ removeStrategy,
+ onSubmit,
+ onCancel,
+ editmode,
+}) => {
+ const {
+ name, // eslint-disable-line
+ description,
+ enabled,
+ } = featureToggle;
+ const configuredStrategies = featureToggle.strategies;
- render () {
- const configuredStrategies = this.props.featureToggle.strategies;
-
- return (
-
- );
- }
-}
+
+
+
+
+ Activation strategies
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+AddFeatureToggleUI.propTypes = {
+ strategies: PropTypes.array.required,
+ featureToggle: PropTypes.object,
+ updateField: PropTypes.func.required,
+ addStrategy: PropTypes.func.required,
+ removeStrategy: PropTypes.func.required,
+ onSubmit: PropTypes.func.required,
+ onCancel: PropTypes.func.required,
+ editmode: PropTypes.bool,
+};
export default AddFeatureToggleUI;
diff --git a/packages/unleash-frontend-next/src/component/feature/EditFeatureToggle.jsx b/packages/unleash-frontend-next/src/component/feature/EditFeatureToggle.jsx
index 9c5fe4fdfa..a96693670f 100644
--- a/packages/unleash-frontend-next/src/component/feature/EditFeatureToggle.jsx
+++ b/packages/unleash-frontend-next/src/component/feature/EditFeatureToggle.jsx
@@ -2,9 +2,11 @@ import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { editFeatureToggle } from '../../store/feature-actions';
import AddFeatureToggleUI from './AddFeatureToggleUI';
+import { fetchStrategies } from '../../store/strategy-actions';
+
const mapStateToProps = (state, ownProps) => ({
- strategies: state.strategies.toJS(),
+ strategies: state.strategies.get('list').toArray(),
featureToggle: state.features.toJS().find(toggle => toggle.name === ownProps.featureToggleName) || {},
});
@@ -28,6 +30,11 @@ class EditFeatureToggle extends React.Component {
};
}
+ componentDidMount () {
+ // todo fetch feature if missing? (reload of page does not fetch data from url)
+ this.props.fetchStrategies();
+ }
+
static contextTypes = {
router: React.PropTypes.object,
}
@@ -62,20 +69,18 @@ class EditFeatureToggle extends React.Component {
render () {
return (
-
+
);
}
}
-export default connect(mapStateToProps)(EditFeatureToggle);
+export default connect(mapStateToProps, { fetchStrategies })(EditFeatureToggle);
diff --git a/packages/unleash-frontend-next/src/component/feature/Feature.jsx b/packages/unleash-frontend-next/src/component/feature/Feature.jsx
index 1df9a21116..d2dad486e1 100644
--- a/packages/unleash-frontend-next/src/component/feature/Feature.jsx
+++ b/packages/unleash-frontend-next/src/component/feature/Feature.jsx
@@ -1,33 +1,43 @@
-/* eslint no-shadow: ["error", { "allow": ["name"] }]*/
-
import React, { PropTypes } from 'react';
-import { Switch, FontIcon } from 'react-toolbox';
-import { Link } from 'react-router';
-const Feature = ({ onClick, name, enabled, strategies, onFeatureRemove }) => (
-
- |
-
-
- {name}
-
- |
- {strategies.map(s => s.name).join(', ')} |
-
-
-
-
-
- |
-
-);
+import { Link } from 'react-router';
+import FontIcon from 'react-toolbox/lib/font_icon';
+import Switch from 'react-toolbox/lib/switch';
+import { ListItem } from 'react-toolbox/lib/list';
+
+import style from './feature.scss';
+
+const Feature = ({ feature, onFeatureClick, onFeatureRemove }) => {
+ const { name, description, enabled, strategies } = feature; // eslint-disable-line no-shadow
+
+ const actions = [
+ strategies.map(s => s.name).join(', '),
+
+
+ ,
+ onFeatureRemove(name)} />,
+ ];
+
+ const leftActions = [
+ onFeatureClick(feature)} checked={enabled} />,
+ ];
+
+ return (
+
+ {name}
+ }
+ legend={(description && description.substring(0, 100)) || '-'}
+ />
+ );
+};
Feature.propTypes = {
- onClick: PropTypes.func.isRequired,
- onFeatureRemove: PropTypes.func.isRequired,
- enabled: PropTypes.bool.isRequired,
- strategies: PropTypes.array.isRequired,
- name: PropTypes.string.isRequired,
+ feature: PropTypes.object,
+ onFeatureClick: PropTypes.func,
+ onFeatureRemove: PropTypes.func,
};
export default Feature;
diff --git a/packages/unleash-frontend-next/src/component/feature/FeatureList.jsx b/packages/unleash-frontend-next/src/component/feature/FeatureList.jsx
index 636dc846e1..489a800b59 100644
--- a/packages/unleash-frontend-next/src/component/feature/FeatureList.jsx
+++ b/packages/unleash-frontend-next/src/component/feature/FeatureList.jsx
@@ -1,11 +1,8 @@
import React, { PropTypes } from 'react';
import Feature from './Feature';
-import style from './table.scss';
+import { List, ListItem, ListSubHeader, ListDivider } from 'react-toolbox/lib/list';
export default class FeatureList extends React.Component {
- constructor () {
- super();
- }
static propTypes () {
return {
@@ -16,35 +13,28 @@ export default class FeatureList extends React.Component {
};
}
+ static contextTypes = {
+ router: React.PropTypes.object,
+ }
+
componentDidMount () {
this.props.fetchFeatureToggles();
}
render () {
- const onFeatureClick = this.props.onFeatureClick;
- const onFeatureRemove = this.props.onFeatureRemove;
- const features = this.props.features.map(featureToggle =>
- onFeatureClick(featureToggle)}
- onFeatureRemove={() => onFeatureRemove(featureToggle.name)}
- />
- );
+ const { features, onFeatureClick, onFeatureRemove } = this.props;
return (
-
-
-
- Enabled |
- Feature Toggle |
- Strategies |
- Actions |
-
-
-
- {features}
-
-
+
+
+ {features.map(feature =>
+
+ )}
+
+ this.context.router.push('/features/create')}
+ caption="Add" legend="new feature toggle" leftIcon="add" />
+
);
}
}
diff --git a/packages/unleash-frontend-next/src/component/feature/FeatureListContainer.jsx b/packages/unleash-frontend-next/src/component/feature/FeatureListContainer.jsx
index f30b4493ca..5011d635ff 100644
--- a/packages/unleash-frontend-next/src/component/feature/FeatureListContainer.jsx
+++ b/packages/unleash-frontend-next/src/component/feature/FeatureListContainer.jsx
@@ -4,7 +4,6 @@ import FeatureList from './FeatureList';
const mapStateToProps = (state) => ({
features: state.features.toJS(),
- strategies: state.strategies.toJS(),
});
const mapDispatchToProps = {
diff --git a/packages/unleash-frontend-next/src/component/feature/feature.scss b/packages/unleash-frontend-next/src/component/feature/feature.scss
new file mode 100644
index 0000000000..2f99d5281c
--- /dev/null
+++ b/packages/unleash-frontend-next/src/component/feature/feature.scss
@@ -0,0 +1,8 @@
+.link {
+ color: #212121;
+}
+
+.action {
+ color: #aaa !important;
+ cursor: pointer;
+}
diff --git a/packages/unleash-frontend-next/src/component/feature/table.scss b/packages/unleash-frontend-next/src/component/feature/table.scss
deleted file mode 100644
index 14294804d7..0000000000
--- a/packages/unleash-frontend-next/src/component/feature/table.scss
+++ /dev/null
@@ -1,12 +0,0 @@
-.ztable tbody tr:nth-child(odd) {
- background-color: #efefef;
-}
-.ztable {
- margin: 10px;
- border-collapse: separate;
- border-spacing: 0;
-}
-
-.ztable td, th {
- padding: 4px 10px;
-}
\ No newline at end of file
diff --git a/packages/unleash-frontend-next/src/page/features/create.js b/packages/unleash-frontend-next/src/page/features/create.js
index e843f069f3..8f825d29f5 100644
--- a/packages/unleash-frontend-next/src/page/features/create.js
+++ b/packages/unleash-frontend-next/src/page/features/create.js
@@ -1,13 +1,11 @@
-import React, { Component } from 'react';
+import React from 'react';
import AddFeatureToggle from '../../component/feature/AddFeatureToggle';
-export default class Features extends Component {
- render () {
- return (
-
-
Create Feature Toggle
-
-
- );
- }
-};
+const render = () => (
+
+
Create feature toggle
+
+
+);
+
+export default render;
diff --git a/packages/unleash-frontend-next/src/page/features/edit.js b/packages/unleash-frontend-next/src/page/features/edit.js
index 2be257fa54..c26d3685b6 100644
--- a/packages/unleash-frontend-next/src/page/features/edit.js
+++ b/packages/unleash-frontend-next/src/page/features/edit.js
@@ -8,14 +8,10 @@ export default class Features extends Component {
};
}
- static contextTypes = {
- router: React.PropTypes.object,
- }
-
render () {
return (
-
Edit Feature Toggle
+ Edit feature toggle
);
diff --git a/packages/unleash-frontend-next/src/page/features/index.js b/packages/unleash-frontend-next/src/page/features/index.js
index ba112f4df8..06c0dffbc4 100644
--- a/packages/unleash-frontend-next/src/page/features/index.js
+++ b/packages/unleash-frontend-next/src/page/features/index.js
@@ -1,21 +1,8 @@
-import React, { Component } from 'react';
+import React from 'react';
import FeatureListContainer from '../../component/feature/FeatureListContainer';
-import { Button } from 'react-toolbox';
+
+const render = () => ();
+
+export default render;
-export default class Features extends Component {
- static contextTypes = {
- router: React.PropTypes.object,
- }
-
- render () {
- const createHref = this.context.router.createHref('/features/create');
- return (
-
-
Feature Toggles
-
-
-
- );
- }
-};
diff --git a/packages/unleash-frontend-next/src/page/history/index.js b/packages/unleash-frontend-next/src/page/history/index.js
index 8c0a48cb1f..e67cd04672 100644
--- a/packages/unleash-frontend-next/src/page/history/index.js
+++ b/packages/unleash-frontend-next/src/page/history/index.js
@@ -4,7 +4,7 @@ export default class EventHisotry extends Component {
render () {
return (
-
Event history
+ Event history
);
}