diff --git a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggle.jsx b/packages/unleash-frontend-next/src/component/feature/AddFeatureToggle.jsx
index d3c5f97183..c2e1375211 100644
--- a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggle.jsx
+++ b/packages/unleash-frontend-next/src/component/feature/AddFeatureToggle.jsx
@@ -3,6 +3,9 @@ import { connect } from 'react-redux';
import { Input, Switch, Button } from 'react-toolbox';
import { createFeatureToggles } from '../../store/feature-actions';
+const mapStateToProps = (state) => ({
+ strategies: state.strategies.toJS(),
+});
class AddFeatureToggle extends React.Component {
constructor () {
@@ -23,6 +26,7 @@ class AddFeatureToggle extends React.Component {
static propTypes () {
return {
dispatch: PropTypes.func.isRequired,
+ strategies: PropTypes.array,
};
}
@@ -51,7 +55,12 @@ class AddFeatureToggle extends React.Component {
renderAddStrategy () {
if (this.state.showAddStrategy) {
- return
Adding strat
;
+ return (
+
+
Adding strat
+
Possible: {this.props.strategies.map(s => s.name).join(', ')}
+
+ );
} else {
return Add strategy..;
}
@@ -101,4 +110,4 @@ class AddFeatureToggle extends React.Component {
}
}
-export default connect()(AddFeatureToggle);
+export default connect(mapStateToProps)(AddFeatureToggle);
diff --git a/packages/unleash-frontend-next/src/component/feature/FeatureListContainer.jsx b/packages/unleash-frontend-next/src/component/feature/FeatureListContainer.jsx
index c7341c5600..7344d56aa3 100644
--- a/packages/unleash-frontend-next/src/component/feature/FeatureListContainer.jsx
+++ b/packages/unleash-frontend-next/src/component/feature/FeatureListContainer.jsx
@@ -4,6 +4,7 @@ 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/store/feature-store.js b/packages/unleash-frontend-next/src/store/feature-store.js
index dc3de3d06b..24a79bdf5f 100644
--- a/packages/unleash-frontend-next/src/store/feature-store.js
+++ b/packages/unleash-frontend-next/src/store/feature-store.js
@@ -1,4 +1,4 @@
-import { List, Map } from 'immutable';
+import { List, Map as $Map } from 'immutable';
import {
@@ -11,17 +11,17 @@ import {
const features = (state = new List([]), action) => {
switch (action.type) {
case ADD_FEATURE_TOGGLE:
- return state.push(new Map(action.featureToggle));
+ return state.push(new $Map(action.featureToggle));
case UPDATE_FEATURE_TOGGLE:
- return state.map(t => {
+ return state.$Map(t => {
if (t.get('name') === action.featureToggle.name) {
- return new Map(action.featureToggle);
+ return new $Map(action.featureToggle);
} else {
return t;
}
});
case RECEIVE_FEATURE_TOGGLES:
- return new List(action.featureToggles.map(t => new Map(t)));
+ return new List(action.featureToggles.$Map(t => new $Map(t)));
default:
return state;
}
diff --git a/packages/unleash-frontend-next/src/store/index.js b/packages/unleash-frontend-next/src/store/index.js
index be388c0c9d..f4cd0f8de7 100644
--- a/packages/unleash-frontend-next/src/store/index.js
+++ b/packages/unleash-frontend-next/src/store/index.js
@@ -1,8 +1,10 @@
import { combineReducers } from 'redux';
import features from './feature-store';
+import strategies from './strategy-store';
const unleashStore = combineReducers({
features,
+ strategies,
});
export default unleashStore;
diff --git a/packages/unleash-frontend-next/src/store/strategy-store.js b/packages/unleash-frontend-next/src/store/strategy-store.js
new file mode 100644
index 0000000000..642ba1d524
--- /dev/null
+++ b/packages/unleash-frontend-next/src/store/strategy-store.js
@@ -0,0 +1,21 @@
+import { List, Map as $Map } from 'immutable';
+
+const init = new List([
+ new $Map({ name: 'default', description: 'Default on/off strategy' }),
+ new $Map(
+ {
+ name: 'ActiveForUserWithEmail',
+ description: 'Active for user with specified email',
+ parametersTemplate: { emails: 'string' },
+ }),
+]);
+
+
+const strategies = (state = init, action) => {
+ switch (action.type) {
+ default:
+ return state;
+ }
+};
+
+export default strategies;