From 3b638c258a9264464dba9968d92f7a174b7858b7 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Thu, 21 May 2015 15:01:38 +0000 Subject: [PATCH 1/8] unify patching project - moved validation into the DB layer - removed old way to set visibility - moved everything into PATCH - updated UI --- package.json | 2 +- plugins/c9.core/api.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 96a17cce..3077dd04 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "c9.ide.language.javascript.tern": "#7aab8b0b6a", "c9.ide.language.javascript.infer": "#cfec494a3c", "c9.ide.language.jsonalyzer": "#c253f093a0", - "c9.ide.collab": "#aeaa248d54", + "c9.ide.collab": "#f0e96dd2cf", "c9.ide.local": "#a9703b630c", "c9.ide.find": "#6cc6d3379d", "c9.ide.find.infiles": "#72582de3cd", diff --git a/plugins/c9.core/api.js b/plugins/c9.core/api.js index 4a29a4b0..65e049f0 100644 --- a/plugins/c9.core/api.js +++ b/plugins/c9.core/api.js @@ -22,7 +22,7 @@ define(function(require, exports, module) { /***** Methods *****/ - var REST_METHODS = ["get", "post", "put", "delete"]; + var REST_METHODS = ["get", "post", "put", "delete", "patch"]; function wrapMethod(urlPrefix, method) { return function(url, options, callback) { @@ -33,7 +33,7 @@ define(function(require, exports, module) { } var headers = options.headers = options.headers || {}; headers.Accept = headers.Accept || "application/json"; - options.method = method; + options.method = method.toUpperCase(); if (!options.timeout) options.timeout = 60000; From 80c7fb29a2a8eb17b22d20512a891ca6fe17df7b Mon Sep 17 00:00:00 2001 From: Lennart kats Date: Thu, 21 May 2015 15:16:43 +0000 Subject: [PATCH 2/8] Add some metrics and analytics to mount plugin --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 96a17cce..2f22404b 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "c9.ide.imgeditor": "#ed89162aa7", "c9.ide.immediate": "#6845a93705", "c9.ide.installer": "#3e6f7a72c9", - "c9.ide.mount": "#896ebf836e", + "c9.ide.mount": "#ccbaa1f75d", "c9.ide.navigate": "#055a1f1a80", "c9.ide.newresource": "#f1f0624768", "c9.ide.openfiles": "#28a4f5af16", From d48c0d5586f6386bcb13537210cb63383e3de1d2 Mon Sep 17 00:00:00 2001 From: Lennart kats Date: Thu, 21 May 2015 15:17:38 +0000 Subject: [PATCH 3/8] Add some analytics to Navigate --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2f22404b..1033b31e 100644 --- a/package.json +++ b/package.json @@ -91,8 +91,8 @@ "c9.ide.imgeditor": "#ed89162aa7", "c9.ide.immediate": "#6845a93705", "c9.ide.installer": "#3e6f7a72c9", - "c9.ide.mount": "#ccbaa1f75d", - "c9.ide.navigate": "#055a1f1a80", + "c9.ide.mount": "#b1bfa23ea5", + "c9.ide.navigate": "#f358997d93", "c9.ide.newresource": "#f1f0624768", "c9.ide.openfiles": "#28a4f5af16", "c9.ide.preview": "#0bd8dd6e8c", From 5bd78f5ecc3e6a1e088f5ccb5ddb9197b5e43bad Mon Sep 17 00:00:00 2001 From: Matthijs van Henten Date: Thu, 21 May 2015 23:41:09 +0000 Subject: [PATCH 4/8] adds a mount feature to frontdoor: mount sections into the existing chain --- node_modules/frontdoor/lib/section.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/node_modules/frontdoor/lib/section.js b/node_modules/frontdoor/lib/section.js index 1e8edbfa..9d482dcc 100644 --- a/node_modules/frontdoor/lib/section.js +++ b/node_modules/frontdoor/lib/section.js @@ -70,6 +70,13 @@ module.exports = function Section(name, description, types) { return section; }; + this.mount = function( name, section ){ + if (!sections[name]) + sections[name] = []; + + sections[name].push(section); + }; + this._rootHandler = function(req, res) { this.handle(req, res, function(err) { if (err) { From 4ffa8c0e8ee5eaac7c53d97f40f3a118dc8de4f8 Mon Sep 17 00:00:00 2001 From: Matthijs van Henten Date: Thu, 21 May 2015 23:42:00 +0000 Subject: [PATCH 5/8] adds a global handler to frontdoor: allow injection of global middlewares --- node_modules/frontdoor/lib/section.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/node_modules/frontdoor/lib/section.js b/node_modules/frontdoor/lib/section.js index 9d482dcc..03bb6f17 100644 --- a/node_modules/frontdoor/lib/section.js +++ b/node_modules/frontdoor/lib/section.js @@ -15,6 +15,7 @@ module.exports = function Section(name, description, types) { var self = this; this.middlewares = []; + this.globals = []; this.errorHandlers = []; this.name = name; @@ -45,10 +46,22 @@ module.exports = function Section(name, description, types) { }); }; + /** + * Insert global middleware(s) for this section: The parent section is + * always an empty container that delegates to it's sub-sections, and + * executes all the middelwares for that section. + * + * This method allows us to inject a "global" middleware that is inserted + * *after* decodeParams and *before* all other middelwares. + */ + this.global = function( middleware ){ + this.globals.push.apply(this.globals, flatten(middleware)); + }; + this.use = function(middleware) { this.middlewares.push.apply(this.middlewares, flatten(middleware)); }; - + this.error = function(middleware) { this.errorHandlers.push.apply(this.errorHandlers, flatten(middleware)); }; @@ -112,7 +125,7 @@ module.exports = function Section(name, description, types) { var method = req.method.toLowerCase(); if (methods.indexOf(method) == -1) return next(); - + var handler = this.match(req, path, method); if (!handler) return next(); @@ -125,6 +138,9 @@ module.exports = function Section(name, description, types) { handler = handler.parent; } + if (this.globals.length) + middleware.splice.apply( middleware, [1, 0].concat( this.globals ) ); + var i = 0; function processNext() { handler = middleware[i++]; From 8ba1a02f2994301eeb7992958b96b211e2bc5f4d Mon Sep 17 00:00:00 2001 From: Matthijs van Henten Date: Fri, 22 May 2015 10:34:11 +0000 Subject: [PATCH 6/8] tidied --- node_modules/frontdoor/lib/section.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node_modules/frontdoor/lib/section.js b/node_modules/frontdoor/lib/section.js index 03bb6f17..1e027ef0 100644 --- a/node_modules/frontdoor/lib/section.js +++ b/node_modules/frontdoor/lib/section.js @@ -83,13 +83,13 @@ module.exports = function Section(name, description, types) { return section; }; - this.mount = function( name, section ){ + this.mount = function(name, section) { if (!sections[name]) sections[name] = []; sections[name].push(section); }; - + this._rootHandler = function(req, res) { this.handle(req, res, function(err) { if (err) { From 04e2571ed47290200e7d52a7e90bf354b55c9645 Mon Sep 17 00:00:00 2001 From: Lennart kats Date: Fri, 22 May 2015 11:43:04 +0000 Subject: [PATCH 7/8] Move metrics into mount plugin --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1033b31e..9d0148af 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "c9.ide.imgeditor": "#ed89162aa7", "c9.ide.immediate": "#6845a93705", "c9.ide.installer": "#3e6f7a72c9", - "c9.ide.mount": "#b1bfa23ea5", + "c9.ide.mount": "#97e035f0fe", "c9.ide.navigate": "#f358997d93", "c9.ide.newresource": "#f1f0624768", "c9.ide.openfiles": "#28a4f5af16", From 2692f1e113fdead5a1ac3c1e7d455815b6614a01 Mon Sep 17 00:00:00 2001 From: Lennart kats Date: Fri, 22 May 2015 11:43:10 +0000 Subject: [PATCH 8/8] Add install event --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9d0148af..2b2dd89c 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "c9.ide.imgeditor": "#ed89162aa7", "c9.ide.immediate": "#6845a93705", "c9.ide.installer": "#3e6f7a72c9", - "c9.ide.mount": "#97e035f0fe", + "c9.ide.mount": "#39bfb225e8", "c9.ide.navigate": "#f358997d93", "c9.ide.newresource": "#f1f0624768", "c9.ide.openfiles": "#28a4f5af16",