From 02ee6471ee0f9537b86f3d3b08c183cf63febdf5 Mon Sep 17 00:00:00 2001 From: andsandv Date: Thu, 23 Oct 2014 13:54:19 +0200 Subject: [PATCH] Rewrite to use Bootstrap #23 and added JSXHint --- .jshintrc | 6 +- unleash-server/package.json | 108 +++++------ unleash-server/public/css/unleash.css | 4 - unleash-server/public/index.html | 86 ++++++--- .../public/js/{unleash.js => unleash.jsx} | 178 +++++++++--------- unleash-server/public/scripts/hello.js | 1 - 6 files changed, 203 insertions(+), 180 deletions(-) delete mode 100644 unleash-server/public/css/unleash.css rename unleash-server/public/js/{unleash.js => unleash.jsx} (62%) delete mode 100644 unleash-server/public/scripts/hello.js diff --git a/.jshintrc b/.jshintrc index 3c6252a265..ee86d71cff 100644 --- a/.jshintrc +++ b/.jshintrc @@ -11,7 +11,9 @@ "after" : false, "beforeEach": false, "afterEach" : false, - "contain" : false + "contain" : false, + "React" : false, + "reqwest" : false }, "bitwise" : true, @@ -24,7 +26,7 @@ "immed" : true, "indent" : 4, "latedef" : "nofunc", - "newcap" : true, + "newcap" : false, "noarg" : true, "noempty" : true, "nonbsp" : true, diff --git a/unleash-server/package.json b/unleash-server/package.json index f2b3732e89..f6ffa4b786 100644 --- a/unleash-server/package.json +++ b/unleash-server/package.json @@ -1,55 +1,55 @@ { - "name": "unleash-server", - "description": "unleash your features", - "version": "0.0.1", - "keywords": [ - "unleash", - "feature toggle", - "feature", - "toggle" - ], - "repository": { - "type": "git", - "url": "ssh://git@github.com:finn-no/unleash.git" - }, - "bugs": { - "url": "https://github.com/finn-no/unleash/issues" - }, - "private": true, - "scripts": { - "start": "node 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/*", - "db-create": "createdb unleash_${NODE_ENV:-dev}", - "db-drop": "dropdb unleash_${NODE_ENV:-dev}", - "db-migrate-up": "db-migrate --config config/database.json up", - "db-migrate-down": "db-migrate --config config/database.json down", - "db-setup": "npm run db-create; npm run db-migrate-up" - }, - "dependencies": { - "bluebird": "2.2.2", - "body-parser": "1.4.3", - "db-migrate": "^0.7.1", - "errorhandler": "1.1.1", - "express": "4.9.8", - "express-validator": "2.6.0", - "ini": "1.3.0", - "log4js": "0.6.21", - "nconf": "0.6.9", - "pg": "^3.6.1", - "any-db": "2.1.0", - "any-db-pool": "2.1.0", - "any-db-postgres": "2.1.3" - }, - "devDependencies": { - "chai": "1.9.1", - "jshint": "2.5.2", - "mocha": "1.20.1", - "supertest": "0.13.0", - "supervisor": "~0.6.0", - "xmlbuilder": "^2.4.4", - "mockery": "~1.4.0" - } -} + "name": "unleash-server", + "description": "unleash your features", + "version": "0.0.1", + "keywords": [ + "unleash", + "feature toggle", + "feature", + "toggle" + ], + "repository": { + "type": "git", + "url": "ssh://git@github.com:finn-no/unleash.git" + }, + "bugs": { + "url": "https://github.com/finn-no/unleash/issues" + }, + "private": true, + "scripts": { + "start": "node server.js", + "start-dev": "NODE_ENV=local supervisor --ignore ./node_modules/,./public/js server.js", + "test": "jshint server.js lib test && jsxhint public/js/*.jsx && mocha test test/*", + "tdd": "mocha --watch test test/*", + "test-bamboo-ci": "mocha test test/*", + "db-create": "createdb unleash_${NODE_ENV:-dev}", + "db-drop": "dropdb unleash_${NODE_ENV:-dev}", + "db-migrate-up": "db-migrate --config config/database.json up", + "db-migrate-down": "db-migrate --config config/database.json down", + "db-setup": "npm run db-create; npm run db-migrate-up" + }, + "dependencies": { + "bluebird": "2.2.2", + "body-parser": "1.4.3", + "db-migrate": "^0.7.1", + "errorhandler": "1.1.1", + "express": "4.9.8", + "express-validator": "2.6.0", + "ini": "1.3.0", + "log4js": "0.6.21", + "nconf": "0.6.9", + "pg": "^3.6.1", + "any-db": "2.1.0", + "any-db-postgres": "2.1.3" + }, + "devDependencies": { + "chai": "1.9.1", + "jshint": "2.5.2", + "jsxhint": "0.4.15", + "mocha": "1.20.1", + "supertest": "0.13.0", + "supervisor": "~0.6.0", + "xmlbuilder": "^2.4.4", + "mockery": "1.4.0" + } +} \ No newline at end of file diff --git a/unleash-server/public/css/unleash.css b/unleash-server/public/css/unleash.css deleted file mode 100644 index 0561c92d59..0000000000 --- a/unleash-server/public/css/unleash.css +++ /dev/null @@ -1,4 +0,0 @@ -/* .container { */ -/* padding: 0 2em; */ -/* } */ - diff --git a/unleash-server/public/index.html b/unleash-server/public/index.html index c2bbee08eb..d14dfbb049 100644 --- a/unleash-server/public/index.html +++ b/unleash-server/public/index.html @@ -1,39 +1,69 @@ - - + + + + + + Unleash - - - - - unleash - admin - - - + - - - -
-
- -
- -
-
+ +
Loading...
-
- - - + + + + \ No newline at end of file diff --git a/unleash-server/public/js/unleash.js b/unleash-server/public/js/unleash.jsx similarity index 62% rename from unleash-server/public/js/unleash.js rename to unleash-server/public/js/unleash.jsx index cdf75ed521..94498ebb87 100644 --- a/unleash-server/public/js/unleash.js +++ b/unleash-server/public/js/unleash.jsx @@ -1,18 +1,85 @@ /** @jsx React.DOM */ +/* jshint quotmark:false */ -// FeatureList -// Feature -// - name -// - status -// - description -// - button-edit -// - button-delete -// - toggle-status -// FeatureForm +// FeatureListPage +// Meny +// FeatureList +// Feature +// - name +// - status +// - description +// - button-edit +// - button-delete +// - toggle-status +// +// NewFeaturePage +// Meny +// NewFeatureForm -// StrategyList -// Strategy -// StrategyForm +var Feature = React.createClass({ + // TODO: validate props? + handleEnableChange: function(event) { + var feature = this.props.feature; + this.props.updateFeature({ + name: feature.name, + field: 'enabled', + value: event.target.checked + }); + }, + + render: function () { + return ( +
+
+
+
+
+
+

{this.props.feature.name}

+

{this.props.feature.description}

+ +
+
+
+
+ +
+
+
+
+

+ +

+
+
+
+
+ +
+
+
+
+ + +
+
+
+
+
+ +
+
+ ); + } +}); var FeatureList = React.createClass({ getInitialState: function() { @@ -46,7 +113,7 @@ var FeatureList = React.createClass({ }).then(function() { this.setState({features: newFeatures}); }.bind(this), function() { - alert("update failed"); + window.alert('update failed'); }.bind(this)); }, @@ -58,90 +125,19 @@ var FeatureList = React.createClass({ }.bind(this)); return ( -
-
-
- {featureNodes} +
+
+

Features

+
+
+ {featureNodes}
-
); } }); -var Feature = React.createClass({ - // TODO: validate props? -/* - handleStatusChange: function (feature, event) { - console.log(feature); - console.log(event); - }, -*/ - handleEnableChange: function(event) { - var feature = this.props.feature; - this.props.updateFeature({ - name: feature.name, - field: "enabled", - value: event.target.checked - }); - }, - - render: function () { - return ( -
-
-
-
-
-
-

{this.props.feature.name}

-

{this.props.feature.description}

- -
-
-
-
- -
-
-
-
-

- -

-
-
-
-
- -
-
-
-
- - -
-
-
-
-
- -
-
- ); - } -}); - - React.renderComponent( - FeatureList(null), + new FeatureList(null), document.getElementById('content') ); \ No newline at end of file diff --git a/unleash-server/public/scripts/hello.js b/unleash-server/public/scripts/hello.js deleted file mode 100644 index 593ea39e37..0000000000 --- a/unleash-server/public/scripts/hello.js +++ /dev/null @@ -1 +0,0 @@ -//hello world \ No newline at end of file