mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
Populate strategies in feature form
This commit is contained in:
parent
0f08aa1f0a
commit
28e1705b9c
@ -1,7 +1,28 @@
|
|||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
var strategyStore = require('../../stores/StrategyStore');
|
||||||
|
|
||||||
var FeatureForm = React.createClass({
|
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() {
|
render: function() {
|
||||||
|
var strategyNodes = this.state.strategyOptions.map(function(name) {
|
||||||
|
return <option value={name}>{name}</option>;
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form ref="form" className="bg-blue-xlt">
|
<form ref="form" className="bg-blue-xlt">
|
||||||
<div className="line mal ptl pbl">
|
<div className="line mal ptl pbl">
|
||||||
@ -29,7 +50,7 @@ var FeatureForm = React.createClass({
|
|||||||
ref="strategy"
|
ref="strategy"
|
||||||
className=""
|
className=""
|
||||||
defaultValue="default">
|
defaultValue="default">
|
||||||
<option value="default">default</option>
|
{strategyNodes}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user