diff --git a/unleash-server/public/js/unleash.js b/unleash-server/public/js/unleash.js
index 1c607a7e05..dd99726ce6 100644
--- a/unleash-server/public/js/unleash.js
+++ b/unleash-server/public/js/unleash.js
@@ -22,15 +22,39 @@ var FeatureList = React.createClass({
},
componentDidMount: function () {
- reqwest("/features").then(this.setFeatures);
+ reqwest('/features').then(this.setFeatures);
+ },
+
+ setFeatures: function (data) {
+ this.setState({features: data.features});
+ },
+
+ updateFeature: function (feature) {
+ var newFeatures = this.state.features;
+ newFeatures.forEach(function(f){
+ if(f.name === feature.name) {
+ f = feature;
+ }
+ });
+
+ reqwest({
+ url: 'features/' + feature.name,
+ method: 'post',
+ type: 'json',
+ data: feature
+ }).then(function() {
+ this.setState({features: newFeatures});
+ }.bind(this), function() {
+ alert("update failed");
+ }.bind(this));
},
render: function () {
var featureNodes = this.state.features.map(function (feature) {
return (
-