diff --git a/unleash-server/package.json b/unleash-server/package.json index 90f73f1899..5efd66056e 100644 --- a/unleash-server/package.json +++ b/unleash-server/package.json @@ -18,7 +18,7 @@ "private": true, "scripts": { "start": "node server.js", - "start-dev": "NODE_ENV=local supervisor --ignore ./node_modules/ server.js", + "start-dev": "NODE_ENV=local supervisor --ignore ./node_modules/,./public/js server.js", "test": "jshint server.js lib public/scripts test && mocha test test/*", "tdd": "mocha --watch test test/*", "test-bamboo-ci": "mocha test test/*", diff --git a/unleash-server/public/css/unleash.css b/unleash-server/public/css/unleash.css index e69de29bb2..0561c92d59 100644 --- a/unleash-server/public/css/unleash.css +++ b/unleash-server/public/css/unleash.css @@ -0,0 +1,4 @@ +/* .container { */ +/* padding: 0 2em; */ +/* } */ + diff --git a/unleash-server/public/index.html b/unleash-server/public/index.html index e57f906501..c2bbee08eb 100644 --- a/unleash-server/public/index.html +++ b/unleash-server/public/index.html @@ -11,6 +11,10 @@ + + + + @@ -26,19 +30,10 @@
-
-
-
-
-
-
-
-
-
-
+
Loading...
- + diff --git a/unleash-server/public/js/unleash.js b/unleash-server/public/js/unleash.js index e69de29bb2..1c607a7e05 100644 --- a/unleash-server/public/js/unleash.js +++ b/unleash-server/public/js/unleash.js @@ -0,0 +1,116 @@ +/** @jsx React.DOM */ + +// FeatureList +// Feature +// - name +// - status +// - description +// - button-edit +// - button-delete +// - toggle-status +// FeatureForm + +// StrategyList +// Strategy +// StrategyForm + +var FeatureList = React.createClass({ + getInitialState: function() { + return { + features: [] + }; + }, + + componentDidMount: function () { + reqwest("/features").then(this.setFeatures); + }, + + render: function () { + var featureNodes = this.state.features.map(function (feature) { + return ( + + ); + }); + + return ( +
+
+
+ {featureNodes} +
+
+
+ ); + }, + + setFeatures: function (data) { + this.setState({features: data.features}); + } +}); + +var Feature = React.createClass({ + // TODO: validate props? + + handleStatusChange: function (event) { + console.log(event); + }, + + render: function () { + return ( +
+
+
+
+
+
+

{this.props.feature.name}

+

{this.props.feature.description}

+ +
+
+
+
+ +
+
+
+
+

+ +

+
+
+
+
+ +
+
+
+
+ + +
+
+
+
+
+ +
+
+ ); + } +}); + + +React.renderComponent( + FeatureList(null), + document.getElementById('content') +); \ No newline at end of file