From 4543cee0c06a0c73b3c5400a2d004ab9ff5b3f33 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Mon, 29 Aug 2016 13:12:47 +0300 Subject: [PATCH 001/115] Add ProxyBackends collection --- proxy_backends/collection/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 proxy_backends/collection/index.js diff --git a/proxy_backends/collection/index.js b/proxy_backends/collection/index.js new file mode 100644 index 0000000000..eaa8b684f7 --- /dev/null +++ b/proxy_backends/collection/index.js @@ -0,0 +1,3 @@ +const ProxyBackends = new Mongo.Collection('proxyBackends'); + +export { ProxyBackends }; From 5c110dcba3ef4b7a24b38c1e309188955fe1627d Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Mon, 29 Aug 2016 13:52:52 +0300 Subject: [PATCH 002/115] Initial schema structure --- proxy_backends/collection/schema.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 proxy_backends/collection/schema.js diff --git a/proxy_backends/collection/schema.js b/proxy_backends/collection/schema.js new file mode 100644 index 0000000000..8663b1ffe5 --- /dev/null +++ b/proxy_backends/collection/schema.js @@ -0,0 +1,7 @@ +import { ProxyBackends } from './'; + +ProxyBackends.schema = new SimpleSchema({ + +}); + +ProxyBackends.attachSchema(ProxyBackends.schema); From 112a97420a69258ee9fb474f570792fb3ae92d23 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Mon, 29 Aug 2016 14:15:50 +0300 Subject: [PATCH 003/115] Basic schema fields and ApiUmbrellaSchema import --- proxy_backends/collection/schema.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/proxy_backends/collection/schema.js b/proxy_backends/collection/schema.js index 8663b1ffe5..7da7e3c876 100644 --- a/proxy_backends/collection/schema.js +++ b/proxy_backends/collection/schema.js @@ -1,7 +1,14 @@ import { ProxyBackends } from './'; +import { ApiUmbrellaSchema } from './apiUmbrellaSchema'; ProxyBackends.schema = new SimpleSchema({ - + "proxyId": { + type: String + }, + "apiUmbrella": { + type: ApiUmbrellaSchema, + optional: true + } }); ProxyBackends.attachSchema(ProxyBackends.schema); From 0879bd8af929c614f5bb5e6d56d8d6450c457e90 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Mon, 29 Aug 2016 14:16:02 +0300 Subject: [PATCH 004/115] Basic API Umbrella schema --- .../collection/apiUmbrellaSchema.js | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 proxy_backends/collection/apiUmbrellaSchema.js diff --git a/proxy_backends/collection/apiUmbrellaSchema.js b/proxy_backends/collection/apiUmbrellaSchema.js new file mode 100644 index 0000000000..96fe0f96e9 --- /dev/null +++ b/proxy_backends/collection/apiUmbrellaSchema.js @@ -0,0 +1,46 @@ +const ApiUmbrellaSchema = new SimpleSchema({ + "name": { + type: String, + optional: true + }, + "frontend_host": { + type: String, + optional: true + }, + "backend_host": { + type: String, + optional: true + }, + "backend_protocol": { + type: String, + optional: true + }, + "balance_algorithm": { + type: String, + optional: true + }, + "url_matches": { + type: [Object] + optional: true + }, + "url_matches.$.frontend_prefix": { + type: String, + optional: true + }, + "url_matches.$.backend_prefix": { + type: String, + optional: true + }, + "servers": { + type: [Object], + optional: true + }, + "servers.$.host": { + type: String, + optional: true + }, + "servers.$.port": { + type: Number, + optional: true + } +}); From e22adbf9876045b7aa849045e067164572b12bcd Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Mon, 29 Aug 2016 14:16:49 +0300 Subject: [PATCH 005/115] Fix typo --- proxy_backends/collection/apiUmbrellaSchema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy_backends/collection/apiUmbrellaSchema.js b/proxy_backends/collection/apiUmbrellaSchema.js index 96fe0f96e9..79f8170add 100644 --- a/proxy_backends/collection/apiUmbrellaSchema.js +++ b/proxy_backends/collection/apiUmbrellaSchema.js @@ -20,7 +20,7 @@ const ApiUmbrellaSchema = new SimpleSchema({ optional: true }, "url_matches": { - type: [Object] + type: [Object], optional: true }, "url_matches.$.frontend_prefix": { From eb15bcc1037ea17133664948cc943a05c3d6ffd8 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 09:39:47 +0300 Subject: [PATCH 006/115] Cleanup comments --- apis/client/view/view.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apis/client/view/view.html b/apis/client/view/view.html index dd601b289a..f39e664995 100644 --- a/apis/client/view/view.html +++ b/apis/client/view/view.html @@ -9,7 +9,7 @@
{{> documentation apiBackend=apiBackend }} -
+
{{> viewApiBackendMetadata apiBackend=apiBackend }} @@ -17,7 +17,7 @@
{{> feedbackList apiBackend=apiBackend }} -
+
{{> viewApiBackendExport apiBackend=apiBackend }} @@ -25,7 +25,7 @@
{{> apiBacklog apiBackend=apiBackend backlogItems=backlogItems }} -
+
{{ # if currentUser }} {{# if apiBackend.currentUserCanEdit }} From 53cec1773f735257f91ac4b12e21a61a626c6c2d Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 09:44:19 +0300 Subject: [PATCH 007/115] Simplify user conditions --- apis/client/view/header/header.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apis/client/view/header/header.html b/apis/client/view/header/header.html index 4461924e7d..e076021f53 100644 --- a/apis/client/view/header/header.html +++ b/apis/client/view/header/header.html @@ -69,7 +69,7 @@

{{_ "viewApiBackendNavigationMenu_export" }} - {{ # if currentUser }} + {{# if apiBackend.currentUserCanEdit }}
  • @@ -78,7 +78,7 @@

  • {{ / if }} - {{ / if }} + From 4b9ae665628e04f538ec4dd94ccf91cbe7235435 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 09:44:29 +0300 Subject: [PATCH 008/115] Add proxy section --- apis/client/view/view.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apis/client/view/view.html b/apis/client/view/view.html index f39e664995..c618a9c988 100644 --- a/apis/client/view/view.html +++ b/apis/client/view/view.html @@ -27,6 +27,10 @@ {{> apiBacklog apiBackend=apiBackend backlogItems=backlogItems }} +
    + {{> apiProxy apiBackend=apiBackend }} +
    + {{ # if currentUser }} {{# if apiBackend.currentUserCanEdit }}
    From 69088b1d0b358307c7e3ac3bb974094e71481794 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 09:44:35 +0300 Subject: [PATCH 009/115] Initial proxy template --- apis/client/view/proxy/proxy.html | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 apis/client/view/proxy/proxy.html diff --git a/apis/client/view/proxy/proxy.html b/apis/client/view/proxy/proxy.html new file mode 100644 index 0000000000..8fb5af43b8 --- /dev/null +++ b/apis/client/view/proxy/proxy.html @@ -0,0 +1,3 @@ + From 354c2cf9b3bded08a4f229453254367637a993f9 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 09:47:07 +0300 Subject: [PATCH 010/115] Add proxy tab --- apis/client/view/header/header.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apis/client/view/header/header.html b/apis/client/view/header/header.html index e076021f53..e74747b3ad 100644 --- a/apis/client/view/header/header.html +++ b/apis/client/view/header/header.html @@ -77,6 +77,12 @@

    {{_ "viewApiBackendNavigationMenu_settings" }} +
  • + + + {{_ "viewApiBackendNavigationMenu_proxy" }} + +
  • {{ / if }} From a1c84349c0e01c5e6bb8091a6b0f05e90342c40a Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 09:47:15 +0300 Subject: [PATCH 011/115] Add viewApiBackend proxy string --- lib/i18n/en.i18n.json | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/i18n/en.i18n.json b/lib/i18n/en.i18n.json index e8a2c42882..f8d4b6a032 100644 --- a/lib/i18n/en.i18n.json +++ b/lib/i18n/en.i18n.json @@ -480,6 +480,7 @@ "viewApiBackendNavigationMenu_export": "Export", "viewApiBackendNavigationMenu_feedback": "Feedback", "viewApiBackendNavigationMenu_metadata": "Metadata", + "viewApiBackendNavigationMenu_proxy": "Proxy", "viewApiBackendNavigationMenu_settings": "Settings", "viewApiBackendSettings_panelTitleAbout": "About", "viewApiBackendSettings_panelTitleManage": "Manage", From 2316a5c65511135a1005e131b3c81ffae36a1eeb Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 09:58:01 +0300 Subject: [PATCH 012/115] Proxy backend configuration panel --- apis/client/view/proxy/proxy.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apis/client/view/proxy/proxy.html b/apis/client/view/proxy/proxy.html index 8fb5af43b8..1655746880 100644 --- a/apis/client/view/proxy/proxy.html +++ b/apis/client/view/proxy/proxy.html @@ -1,3 +1,13 @@ From fe2ea2e36abb3c7ba4876c03d8767e6f35325663 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 09:58:14 +0300 Subject: [PATCH 013/115] Add apiBackend proxy string --- lib/i18n/en.i18n.json | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/i18n/en.i18n.json b/lib/i18n/en.i18n.json index f8d4b6a032..36ba032e18 100644 --- a/lib/i18n/en.i18n.json +++ b/lib/i18n/en.i18n.json @@ -47,6 +47,7 @@ "apiLogo_resumable_successfully_uploaded": "Logo successfully uploaded!", "api_backend_rating_anonymous": "Please log in to vote.", "apinf_usernotloggedin_error": "Could not find logged in user.", + "apiProxy_headerText": "Proxy backend configuration", "bookmarks_Backend": "Backend host:", "bookmarks_Name": "Name:", "bookmarks_Title": "Your bookmarked APIs", From 9d1d9712d4711ed562f68ed131cec358af1d5382 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 10:05:01 +0300 Subject: [PATCH 014/115] Initial ProxyBackends quickform --- apis/client/view/proxy/proxy.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apis/client/view/proxy/proxy.html b/apis/client/view/proxy/proxy.html index 1655746880..b742eb87d0 100644 --- a/apis/client/view/proxy/proxy.html +++ b/apis/client/view/proxy/proxy.html @@ -7,7 +7,7 @@

    Proxy form

    + {{> quickForm collection=proxyBackendsCollection id="insertProxyBackend" type="insert"}}
    - From 6914bccf6e3aa5238ca2a418d4ef14f33e7df106 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 10:05:23 +0300 Subject: [PATCH 015/115] Add proxyBackendsCollection template helper --- apis/client/view/proxy/proxy.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 apis/client/view/proxy/proxy.js diff --git a/apis/client/view/proxy/proxy.js b/apis/client/view/proxy/proxy.js new file mode 100644 index 0000000000..c76338c45c --- /dev/null +++ b/apis/client/view/proxy/proxy.js @@ -0,0 +1,8 @@ +import { ProxyBackends } from '/proxy_backends/collection'; + +Template.apiProxy.helpers({ + proxyBackendsCollection () { + // Return a reference to ProxyBackends collection, for AutoForm + return ProxyBackends; + } +}); From 7c67aa235970a798a3179e1fab6b69512b06afb3 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 10:13:18 +0300 Subject: [PATCH 016/115] Add esversion 6 support --- .jshintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.jshintrc b/.jshintrc index c4cd181924..8075c0bf38 100644 --- a/.jshintrc +++ b/.jshintrc @@ -9,6 +9,7 @@ // See http://jshint.com/docs/ for more details "maxerr" : 50, // {int} Maximum error before stopping + "esversion" : 6, // Enforcing "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) From d96ec35c218338b651b32bef3f38ebfa4203b391 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 10:13:33 +0300 Subject: [PATCH 017/115] Export ApiUmbrellaSchema --- proxy_backends/collection/apiUmbrellaSchema.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proxy_backends/collection/apiUmbrellaSchema.js b/proxy_backends/collection/apiUmbrellaSchema.js index 79f8170add..487586c095 100644 --- a/proxy_backends/collection/apiUmbrellaSchema.js +++ b/proxy_backends/collection/apiUmbrellaSchema.js @@ -44,3 +44,5 @@ const ApiUmbrellaSchema = new SimpleSchema({ optional: true } }); + +export { ApiUmbrellaSchema }; From 5acf92e4969ddf0c1bde14d0464dcc079dc020c7 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 10:13:53 +0300 Subject: [PATCH 018/115] Cleanup --- apis/client/view/proxy/proxy.html | 1 - 1 file changed, 1 deletion(-) diff --git a/apis/client/view/proxy/proxy.html b/apis/client/view/proxy/proxy.html index b742eb87d0..ee0eaed3f1 100644 --- a/apis/client/view/proxy/proxy.html +++ b/apis/client/view/proxy/proxy.html @@ -6,7 +6,6 @@

    -

    Proxy form

    {{> quickForm collection=proxyBackendsCollection id="insertProxyBackend" type="insert"}}
    From 069dc9b79c6679be33bb05f36cbf928a0a5d3d9d Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 10:46:30 +0300 Subject: [PATCH 019/115] Add quickForm with api/proxy ID fields --- apis/client/view/proxy/proxy.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apis/client/view/proxy/proxy.html b/apis/client/view/proxy/proxy.html index ee0eaed3f1..2db82a87a3 100644 --- a/apis/client/view/proxy/proxy.html +++ b/apis/client/view/proxy/proxy.html @@ -6,7 +6,10 @@

    - {{> quickForm collection=proxyBackendsCollection id="insertProxyBackend" type="insert"}} + {{# autoForm collection=proxyBackendsCollection id="insertProxyBackend" type="insert"}} + {{> afQuickField name="proxyId" }} + {{> afQuickField name="apiId" value=apiBackend._id }} + {{/ autoForm }}
    From caa5fda7a39a8237815f862ac7625e53f069344f Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 30 Aug 2016 10:46:38 +0300 Subject: [PATCH 020/115] Add apiId field --- proxy_backends/collection/schema.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proxy_backends/collection/schema.js b/proxy_backends/collection/schema.js index 7da7e3c876..adc7b45985 100644 --- a/proxy_backends/collection/schema.js +++ b/proxy_backends/collection/schema.js @@ -5,6 +5,9 @@ ProxyBackends.schema = new SimpleSchema({ "proxyId": { type: String }, + "apiId": { + type: String + }, "apiUmbrella": { type: ApiUmbrellaSchema, optional: true From 1e1c36f2925072ed01a83c46c3bdede35d8c0dfe Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Thu, 1 Sep 2016 14:10:23 +0300 Subject: [PATCH 021/115] Add apiUmbrella fields --- apis/client/view/proxy/proxy.html | 1 + 1 file changed, 1 insertion(+) diff --git a/apis/client/view/proxy/proxy.html b/apis/client/view/proxy/proxy.html index 2db82a87a3..c91421103c 100644 --- a/apis/client/view/proxy/proxy.html +++ b/apis/client/view/proxy/proxy.html @@ -9,6 +9,7 @@

    {{# autoForm collection=proxyBackendsCollection id="insertProxyBackend" type="insert"}} {{> afQuickField name="proxyId" }} {{> afQuickField name="apiId" value=apiBackend._id }} + {{> afQuickField name="apiUmbrella" }} {{/ autoForm }} From 15c76c690eaa68ed8a1489f3a77adcd957f06762 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Fri, 2 Sep 2016 13:05:33 +0300 Subject: [PATCH 022/115] Add API Umbrella name field, autopopulate --- apis/client/view/proxy/proxy.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apis/client/view/proxy/proxy.html b/apis/client/view/proxy/proxy.html index c91421103c..094957a27c 100644 --- a/apis/client/view/proxy/proxy.html +++ b/apis/client/view/proxy/proxy.html @@ -9,7 +9,7 @@

    {{# autoForm collection=proxyBackendsCollection id="insertProxyBackend" type="insert"}} {{> afQuickField name="proxyId" }} {{> afQuickField name="apiId" value=apiBackend._id }} - {{> afQuickField name="apiUmbrella" }} + {{> afQuickField name="apiUmbrella.name" value=apiBackend.name }} {{/ autoForm }} From 83ba2aa3d9641c8cdcc8b003bafefcc7ca275ba8 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Fri, 2 Sep 2016 13:58:20 +0300 Subject: [PATCH 023/115] Fix branding route bug --- setup/client/lib/router.js | 17 ++++++++--------- setup/client/modal.html | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/setup/client/lib/router.js b/setup/client/lib/router.js index 3a9a5c26c0..168ecad20c 100644 --- a/setup/client/lib/router.js +++ b/setup/client/lib/router.js @@ -1,9 +1,9 @@ -var requireAdminRole = function () { +const requireAdminRole = function () { if (Meteor.user()) { // Get user ID - var userId = Meteor.user()._id; + const userId = Meteor.user()._id; - var userIsAdmin = Roles.userIsInRole(userId, "admin"); + const userIsAdmin = Roles.userIsInRole(userId, 'admin'); if (userIsAdmin) { // User is authorized to access route @@ -21,13 +21,12 @@ var requireAdminRole = function () { const additionalSetupRequired = function () { if (Meteor.user()) { // Get user ID - var userId = Meteor.user()._id; + const userId = Meteor.user()._id; - var userIsAdmin = Roles.userIsInRole(userId, "admin"); + const userIsAdmin = Roles.userIsInRole(userId, 'admin'); if (userIsAdmin) { - Meteor.call('isInitialSetupComplete', function(error, setupComplete) { - + Meteor.call('isInitialSetupComplete', function (error, setupComplete) { if (!setupComplete) { // Show the setup needed modal Modal.show('setupNeededModal'); @@ -40,6 +39,6 @@ const additionalSetupRequired = function () { }; // check if setup is required before opening any page -Router.onBeforeAction(additionalSetupRequired, {except: ['settings', 'settings.branding']}); +Router.onBeforeAction(additionalSetupRequired, { except: ['settings', 'branding'] }); -Router.onBeforeAction(requireAdminRole, {only: ['settings', 'settings.branding']}); +Router.onBeforeAction(requireAdminRole, { only: ['settings', 'branding'] }); diff --git a/setup/client/modal.html b/setup/client/modal.html index 0336160681..37d6594a53 100644 --- a/setup/client/modal.html +++ b/setup/client/modal.html @@ -16,7 +16,7 @@