diff --git a/unleash-server/public/js/unleash.jsx b/unleash-server/public/js/unleash.jsx
index 519a41ac16..cf951ed54a 100644
--- a/unleash-server/public/js/unleash.jsx
+++ b/unleash-server/public/js/unleash.jsx
@@ -5,18 +5,21 @@
// Meny
// FeatureList
// Feature
-// - name
-// - status
-// - description
+// FeatureViewer
+// - props
// - button-edit
// - button-delete
// - toggle-status
+// FeatureEditor
+// - name
+// - status
+// - description
//
// NewFeaturePage
// Meny
// NewFeatureForm
-var FeatureForm = React.createClass({
+var FeatureEditor = React.createClass({
getInitialState: function () {
return {name: '', description: '', strategy: 'Default'};
@@ -84,16 +87,20 @@ var FeatureForm = React.createClass({
@@ -158,6 +165,32 @@ var Feature = React.createClass({
}
});
+var Feature = React.createClass({
+ getInitialState: function() {
+ return { mode: 'view' };
+ },
+
+ onToggleMode: function() {
+ if (this.state.mode === 'view') {
+ this.setState({mode: 'edit'});
+ } else if (this.state.mode === 'edit') {
+ this.setState({mode: 'view'});
+ } else {
+ throw "invalid mode: " + this.state.mode;
+ }
+ },
+
+ render: function() {
+ if (this.state.mode === 'view') {
+ return (
);
+ } else if (this.state.mode === 'edit') {
+ return (
);
+ } else {
+ throw "invalid mode: " + this.state.mode;
+ }
+ }
+});
+
var FeatureList = React.createClass({
getInitialState: function() {
return {
@@ -199,7 +232,7 @@ var FeatureList = React.createClass({
}.bind(this));
},
- createFeature: function (feature, callback) {
+ createFeature: function (feature) {
reqwest({
url: 'features',
method: 'post',
@@ -227,7 +260,6 @@ var FeatureList = React.createClass({