From 28e1705b9ca5e404abf2a386ea05f189584a5a6e Mon Sep 17 00:00:00 2001 From: Gard Rimestad Date: Wed, 12 Nov 2014 13:47:21 +0100 Subject: [PATCH] Populate strategies in feature form --- public/js/components/feature/FeatureForm.jsx | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/public/js/components/feature/FeatureForm.jsx b/public/js/components/feature/FeatureForm.jsx index 023c88a29e..b1af41b323 100644 --- a/public/js/components/feature/FeatureForm.jsx +++ b/public/js/components/feature/FeatureForm.jsx @@ -1,7 +1,28 @@ var React = require('react'); +var strategyStore = require('../../stores/StrategyStore'); var FeatureForm = React.createClass({ + getInitialState: function() { + return {strategyOptions: []}; + }, + + componentDidMount: function() { + strategyStore.getStrategies().then(this.handleStrategyResponse); + }, + + handleStrategyResponse: function(response) { + var strategyNames = response.strategies.map(function(strategy) { + return strategy.name; + }); + + this.setState({strategyOptions: strategyNames}); + }, + render: function() { + var strategyNodes = this.state.strategyOptions.map(function(name) { + return ; + }); + return (
@@ -29,7 +50,7 @@ var FeatureForm = React.createClass({ ref="strategy" className="" defaultValue="default"> - + {strategyNodes}