From 7119cc4b469f1046deb470a8f34333f46d09992a Mon Sep 17 00:00:00 2001 From: illya Date: Wed, 7 Sep 2016 04:10:14 +0300 Subject: [PATCH 01/21] hide export tab for not admins or owners --- apis/client/view/header/header.html | 6 +++++- apis/client/view/view.html | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apis/client/view/header/header.html b/apis/client/view/header/header.html index 4461924e7d..b85941f809 100644 --- a/apis/client/view/header/header.html +++ b/apis/client/view/header/header.html @@ -63,14 +63,18 @@

{{_ "viewApiBackendNavigationMenu_backlog" }} + {{ # if currentUser }} + {{ # if apiBackend.currentUserCanEdit }}
  • {{_ "viewApiBackendNavigationMenu_export" }}
  • + {{ / if }} + {{ / if }} {{ # if currentUser }} - {{# if apiBackend.currentUserCanEdit }} + {{ # if apiBackend.currentUserCanEdit }}
  • diff --git a/apis/client/view/view.html b/apis/client/view/view.html index dd601b289a..07f3b5b186 100644 --- a/apis/client/view/view.html +++ b/apis/client/view/view.html @@ -19,9 +19,13 @@ {{> feedbackList apiBackend=apiBackend }} -
    - {{> viewApiBackendExport apiBackend=apiBackend }} -
    + {{ # if currentUser }} + {{# if apiBackend.currentUserCanEdit }} +
    + {{> viewApiBackendExport apiBackend=apiBackend }} +
    + {{ / if }} + {{ / if }}
    {{> apiBacklog apiBackend=apiBackend backlogItems=backlogItems }} From c07c9194f5f30e1be6b67734cc2f71f00cffe817 Mon Sep 17 00:00:00 2001 From: illya Date: Fri, 9 Sep 2016 09:48:01 +0300 Subject: [PATCH 02/21] added missing if --- apis/client/view/header/header.html | 1 + 1 file changed, 1 insertion(+) diff --git a/apis/client/view/header/header.html b/apis/client/view/header/header.html index 7ec24f8384..d8501dabd1 100644 --- a/apis/client/view/header/header.html +++ b/apis/client/view/header/header.html @@ -88,6 +88,7 @@

  • {{/ if }} {{ / if }} + {{ / if }} From 639a17586c61e0013275c8444d9f081ab7c80ca1 Mon Sep 17 00:00:00 2001 From: illya Date: Fri, 9 Sep 2016 10:58:50 +0300 Subject: [PATCH 03/21] changed tab id --- apis/client/view/header/header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apis/client/view/header/header.html b/apis/client/view/header/header.html index 5d59abee49..76d8599d08 100644 --- a/apis/client/view/header/header.html +++ b/apis/client/view/header/header.html @@ -73,7 +73,7 @@

    {{ # if currentUser }} {{ # if api.currentUserCanEdit }}
  • - + {{_ "viewApiBackendNavigationMenu_export" }} From 815f1e6f3dc4ede088aabb21f147a241b735e6c2 Mon Sep 17 00:00:00 2001 From: illya Date: Fri, 9 Sep 2016 11:11:44 +0300 Subject: [PATCH 04/21] added button for proxy export; new layout --- apis/client/export/export.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apis/client/export/export.html b/apis/client/export/export.html index b09e613521..edcd2a7562 100644 --- a/apis/client/export/export.html +++ b/apis/client/export/export.html @@ -6,8 +6,15 @@

    From 0c5f1db2a42226b621723d3236936a61edf28f06 Mon Sep 17 00:00:00 2001 From: illya Date: Thu, 15 Sep 2016 01:26:38 +0300 Subject: [PATCH 05/21] import; subscription to proxy settings --- apis/client/export/export.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apis/client/export/export.js b/apis/client/export/export.js index cd86bea4f2..1449eae74c 100644 --- a/apis/client/export/export.js +++ b/apis/client/export/export.js @@ -1,5 +1,19 @@ +import { Template } from 'meteor/templating'; +import { ProxyBackends } from '/proxy_backends/collection'; + import jsyaml from 'js-yaml'; +Template.viewApiBackendExport.onCreated(function () { + // Get reference to template instance + const instance = this; + + // Get the API Backend ID from the route + instance.apiId = Router.current().params._id; + + // Subscribe to proxy settings for this API + instance.subscribe('apiProxySettings', instance.apiId); +}); + Template.viewApiBackendExport.events({ 'click #exportJSONConfig': function (event, instance) { // Get API Backend from database collection From 56d1be1c2ef732484da5dd8ccbe9f6b71dfabec6 Mon Sep 17 00:00:00 2001 From: illya Date: Thu, 15 Sep 2016 01:26:57 +0300 Subject: [PATCH 06/21] helper to export proxy settings JSON --- apis/client/export/export.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apis/client/export/export.js b/apis/client/export/export.js index 1449eae74c..440128fd95 100644 --- a/apis/client/export/export.js +++ b/apis/client/export/export.js @@ -41,4 +41,19 @@ Template.viewApiBackendExport.events({ // forces "save As" function allow user download file saveAs(file, 'apiConfig.yaml'); }, + 'click #exportJSONProxyConfig': function (event, instance) { + // Get the API Backend ID from the route + const apiId = instance.apiId; + + const proxy = ProxyBackends.findOne({ apiId }); + + // converts JSON object to JSON string and adds indentation + const json = JSON.stringify(proxy, null, '\t'); + + // creates file object with content type of JSON + const file = new Blob([json], { type: 'application/json;charset=utf-8' }); + + // forces "save As" function allow user download file + saveAs(file, 'apiProxyConfig.json'); + }, }); From 9e09d317f3cb5711a603563effa643d5bac7e648 Mon Sep 17 00:00:00 2001 From: illya Date: Thu, 15 Sep 2016 01:28:10 +0300 Subject: [PATCH 07/21] helper to export proxy settings YAML --- apis/client/export/export.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apis/client/export/export.js b/apis/client/export/export.js index 440128fd95..8626824fca 100644 --- a/apis/client/export/export.js +++ b/apis/client/export/export.js @@ -56,4 +56,19 @@ Template.viewApiBackendExport.events({ // forces "save As" function allow user download file saveAs(file, 'apiProxyConfig.json'); }, + 'click #exportYAMLProxyConfig': function (event, instance) { + // Get the API Backend ID from the route + const apiId = instance.apiId; + + const proxy = ProxyBackends.findOne({ apiId }); + + // converts from json to yaml + const yaml = jsyaml.safeDump(proxy); + + // creates file object with content type of YAML + const file = new Blob([yaml], { type: 'application/x-yaml;charset=utf-8' }); + + // forces "save As" function allow user download file + saveAs(file, 'apiConfig.yaml'); + }, }); From 430655fab327d6a65c82db8c85f4f9a0513cbee8 Mon Sep 17 00:00:00 2001 From: illya Date: Thu, 15 Sep 2016 01:29:20 +0300 Subject: [PATCH 08/21] comments --- apis/client/export/export.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apis/client/export/export.js b/apis/client/export/export.js index 8626824fca..989a35d4e5 100644 --- a/apis/client/export/export.js +++ b/apis/client/export/export.js @@ -45,6 +45,7 @@ Template.viewApiBackendExport.events({ // Get the API Backend ID from the route const apiId = instance.apiId; + // Find proxy backends by API id const proxy = ProxyBackends.findOne({ apiId }); // converts JSON object to JSON string and adds indentation @@ -60,6 +61,7 @@ Template.viewApiBackendExport.events({ // Get the API Backend ID from the route const apiId = instance.apiId; + // Find proxy backends by API id const proxy = ProxyBackends.findOne({ apiId }); // converts from json to yaml From 279889f68b2cb156f57035f37b2b73420c233bcf Mon Sep 17 00:00:00 2001 From: illya Date: Thu, 15 Sep 2016 01:34:08 +0300 Subject: [PATCH 09/21] i18n strings --- apis/client/export/export.html | 8 ++++---- core/lib/i18n/en.i18n.json | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apis/client/export/export.html b/apis/client/export/export.html index edcd2a7562..c225d5f078 100644 --- a/apis/client/export/export.html +++ b/apis/client/export/export.html @@ -6,13 +6,13 @@

    -

    Export API configuration

    -

    Export API configuration

    +

    {{_ "view_ApiBackend_Export_API_Title"}}

    +

    {{_ "view_ApiBackend_Export_API_Description"}}

    {{_ "view_ApiBackend_ExportJson"}} {{_ "view_ApiBackend_ExportYaml"}}
    -

    Export proxy configuration

    -

    Export proxy configuration

    +

    {{_ "view_ApiBackend_Export_Proxy_Title"}}

    +

    {{_ "view_ApiBackend_Export_Proxy_Description"}}

    {{_ "view_ApiBackend_ExportJson"}} {{_ "view_ApiBackend_ExportYaml"}}
    diff --git a/core/lib/i18n/en.i18n.json b/core/lib/i18n/en.i18n.json index 4d2d1d56b9..9d3fa1b094 100644 --- a/core/lib/i18n/en.i18n.json +++ b/core/lib/i18n/en.i18n.json @@ -522,6 +522,10 @@ "view_ApiBackend_Details_Title": "Details", "view_ApiBackend_ExportJson": "Export .json", "view_ApiBackend_ExportYaml": "Export .yaml", + "view_ApiBackend_Export_API_Title": "Export API configuration", + "view_ApiBackend_Export_API_Description": "Export API configuration in JSON or YAML format", + "view_ApiBackend_Export_Proxy_Title": "Export proxy configuration", + "view_ApiBackend_Export_Proxy_Description": "Export proxy configuration in JSON or YAML format", "view_ApiBackend_Export_Title": "Export", "view_ApiBackend_Frontend": "Frontend", "view_ApiBackend_Frontend_Prefix": "Frontend prefix", From 4efcf42de41a86691e8de3e37ee073ab7e9a158e Mon Sep 17 00:00:00 2001 From: illya Date: Thu, 15 Sep 2016 11:13:48 +0300 Subject: [PATCH 10/21] updated i18n strings --- apis/client/export/export.html | 18 +++++++++--------- core/lib/i18n/en.i18n.json | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apis/client/export/export.html b/apis/client/export/export.html index c225d5f078..55e9fa6ba2 100644 --- a/apis/client/export/export.html +++ b/apis/client/export/export.html @@ -2,19 +2,19 @@

    - {{_ "view_ApiBackend_Export_Title"}} + {{_ "view_ApiBackendExport_title"}}

    -

    {{_ "view_ApiBackend_Export_API_Title"}}

    -

    {{_ "view_ApiBackend_Export_API_Description"}}

    - {{_ "view_ApiBackend_ExportJson"}} - {{_ "view_ApiBackend_ExportYaml"}} +

    {{_ "view_ApiBackendExport_api_title"}}

    +

    {{_ "view_ApiBackendExport_api_description"}}

    + {{_ "view_ApiBackendExport_json_button"}} + {{_ "view_ApiBackendExport_yaml_button"}}
    -

    {{_ "view_ApiBackend_Export_Proxy_Title"}}

    -

    {{_ "view_ApiBackend_Export_Proxy_Description"}}

    - {{_ "view_ApiBackend_ExportJson"}} - {{_ "view_ApiBackend_ExportYaml"}} +

    {{_ "view_ApiBackendExport_proxy_title"}}

    +

    {{_ "view_ApiBackendExport_proxy_description"}}

    + {{_ "view_ApiBackendExport_json_button"}} + {{_ "view_ApiBackendExport_yaml_button"}}
    diff --git a/core/lib/i18n/en.i18n.json b/core/lib/i18n/en.i18n.json index 9d3fa1b094..6ff98807fb 100644 --- a/core/lib/i18n/en.i18n.json +++ b/core/lib/i18n/en.i18n.json @@ -520,13 +520,13 @@ "view_ApiBackend_Backend": "Backend", "view_ApiBackend_Backend_Prefix": "Backend prefix", "view_ApiBackend_Details_Title": "Details", - "view_ApiBackend_ExportJson": "Export .json", - "view_ApiBackend_ExportYaml": "Export .yaml", - "view_ApiBackend_Export_API_Title": "Export API configuration", - "view_ApiBackend_Export_API_Description": "Export API configuration in JSON or YAML format", - "view_ApiBackend_Export_Proxy_Title": "Export proxy configuration", - "view_ApiBackend_Export_Proxy_Description": "Export proxy configuration in JSON or YAML format", - "view_ApiBackend_Export_Title": "Export", + "view_ApiBackendExport_json_button": "Export .json", + "view_ApiBackendExport_yaml_button": "Export .yaml", + "view_ApiBackendExport_api_title": "Export API configuration", + "view_ApiBackendExport_api_description": "Export API configuration in JSON or YAML format", + "view_ApiBackendExport_proxy_title": "Export proxy configuration", + "view_ApiBackendExport_proxy_description": "Export proxy configuration in JSON or YAML format", + "view_ApiBackendExport_title": "Export", "view_ApiBackend_Frontend": "Frontend", "view_ApiBackend_Frontend_Prefix": "Frontend prefix", "view_ApiBackend_Matchers": "URL Matchers", From 316ddb44cb10743c0d5077aca646a939c042819f Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Thu, 15 Sep 2016 11:34:57 +0300 Subject: [PATCH 11/21] Proper nesting; to improve readability --- apis/client/export/export.html | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/apis/client/export/export.html b/apis/client/export/export.html index 55e9fa6ba2..e30fa7538a 100644 --- a/apis/client/export/export.html +++ b/apis/client/export/export.html @@ -6,15 +6,31 @@

    -

    {{_ "view_ApiBackendExport_api_title"}}

    -

    {{_ "view_ApiBackendExport_api_description"}}

    - {{_ "view_ApiBackendExport_json_button"}} - {{_ "view_ApiBackendExport_yaml_button"}} +

    + {{_ "view_ApiBackendExport_api_title"}} +

    +

    + {{_ "view_ApiBackendExport_api_description"}} +

    + + {{_ "view_ApiBackendExport_json_button"}} + + + {{_ "view_ApiBackendExport_yaml_button"}} +
    -

    {{_ "view_ApiBackendExport_proxy_title"}}

    -

    {{_ "view_ApiBackendExport_proxy_description"}}

    - {{_ "view_ApiBackendExport_json_button"}} - {{_ "view_ApiBackendExport_yaml_button"}} +

    + {{_ "view_ApiBackendExport_proxy_title"}} +

    +

    + {{_ "view_ApiBackendExport_proxy_description"}} +

    + + {{_ "view_ApiBackendExport_json_button"}} + + + {{_ "view_ApiBackendExport_yaml_button"}} +
    From acfa75b40bada29e3e4164e2214bd56ad3c581a4 Mon Sep 17 00:00:00 2001 From: illya Date: Thu, 15 Sep 2016 11:40:20 +0300 Subject: [PATCH 12/21] i18n strings changes --- apis/client/export/export.html | 18 +++++++++--------- core/lib/i18n/en.i18n.json | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apis/client/export/export.html b/apis/client/export/export.html index e30fa7538a..d88d6c46d2 100644 --- a/apis/client/export/export.html +++ b/apis/client/export/export.html @@ -2,34 +2,34 @@

    - {{_ "view_ApiBackendExport_title"}} + {{_ "viewApiBackendExport_title"}}

    - {{_ "view_ApiBackendExport_api_title"}} + {{_ "viewApiBackendExport_api_title"}}

    - {{_ "view_ApiBackendExport_api_description"}} + {{_ "viewApiBackendExport_api_description"}}

    - {{_ "view_ApiBackendExport_json_button"}} + {{_ "viewApiBackendExport_json_button"}} - {{_ "view_ApiBackendExport_yaml_button"}} + {{_ "viewApiBackendExport_yaml_button"}}

    - {{_ "view_ApiBackendExport_proxy_title"}} + {{_ "viewApiBackendExport_proxy_title"}}

    - {{_ "view_ApiBackendExport_proxy_description"}} + {{_ "viewApiBackendExport_proxy_description"}}

    - {{_ "view_ApiBackendExport_json_button"}} + {{_ "viewApiBackendExport_json_button"}} - {{_ "view_ApiBackendExport_yaml_button"}} + {{_ "viewApiBackendExport_yaml_button"}}
    diff --git a/core/lib/i18n/en.i18n.json b/core/lib/i18n/en.i18n.json index 6ff98807fb..d96aefc841 100644 --- a/core/lib/i18n/en.i18n.json +++ b/core/lib/i18n/en.i18n.json @@ -520,13 +520,13 @@ "view_ApiBackend_Backend": "Backend", "view_ApiBackend_Backend_Prefix": "Backend prefix", "view_ApiBackend_Details_Title": "Details", - "view_ApiBackendExport_json_button": "Export .json", - "view_ApiBackendExport_yaml_button": "Export .yaml", - "view_ApiBackendExport_api_title": "Export API configuration", - "view_ApiBackendExport_api_description": "Export API configuration in JSON or YAML format", - "view_ApiBackendExport_proxy_title": "Export proxy configuration", - "view_ApiBackendExport_proxy_description": "Export proxy configuration in JSON or YAML format", - "view_ApiBackendExport_title": "Export", + "viewApiBackendExport_json_button": "Export .json", + "viewApiBackendExport_yaml_button": "Export .yaml", + "viewApiBackendExport_api_title": "Export API configuration", + "viewApiBackendExport_api_description": "Export API configuration in JSON or YAML format", + "viewApiBackendExport_proxy_title": "Export proxy configuration", + "viewApiBackendExport_proxy_description": "Export proxy configuration in JSON or YAML format", + "viewApiBackendExport_title": "Export", "view_ApiBackend_Frontend": "Frontend", "view_ApiBackend_Frontend_Prefix": "Frontend prefix", "view_ApiBackend_Matchers": "URL Matchers", From dbc860c7703c0f4bb6f16074e5e8dfe0f851b077 Mon Sep 17 00:00:00 2001 From: illya Date: Thu, 15 Sep 2016 11:43:17 +0300 Subject: [PATCH 13/21] getting API id from ID from data context --- apis/client/export/export.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apis/client/export/export.js b/apis/client/export/export.js index 989a35d4e5..075ba47ea4 100644 --- a/apis/client/export/export.js +++ b/apis/client/export/export.js @@ -7,11 +7,11 @@ Template.viewApiBackendExport.onCreated(function () { // Get reference to template instance const instance = this; - // Get the API Backend ID from the route - instance.apiId = Router.current().params._id; + // Get the API Backend ID from data context + const apiId = instance.data.api._id; // Subscribe to proxy settings for this API - instance.subscribe('apiProxySettings', instance.apiId); + instance.subscribe('apiProxySettings', apiId); }); Template.viewApiBackendExport.events({ @@ -42,8 +42,8 @@ Template.viewApiBackendExport.events({ saveAs(file, 'apiConfig.yaml'); }, 'click #exportJSONProxyConfig': function (event, instance) { - // Get the API Backend ID from the route - const apiId = instance.apiId; + // Get the API Backend ID from data context + const apiId = instance.data.api._id; // Find proxy backends by API id const proxy = ProxyBackends.findOne({ apiId }); @@ -58,8 +58,8 @@ Template.viewApiBackendExport.events({ saveAs(file, 'apiProxyConfig.json'); }, 'click #exportYAMLProxyConfig': function (event, instance) { - // Get the API Backend ID from the route - const apiId = instance.apiId; + // Get the API Backend ID from data context + const apiId = instance.data.api._id; // Find proxy backends by API id const proxy = ProxyBackends.findOne({ apiId }); From ae387ba351de90db2bc8d7a1cf757b2a4d3abc67 Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Thu, 15 Sep 2016 13:39:10 +0300 Subject: [PATCH 14/21] Normalize api template/i18n usage --- apis/client/export/export.html | 20 ++--- apis/client/export/export.js | 4 +- apis/client/lib/router.js | 2 +- apis/client/view/details/details.html | 6 +- apis/client/view/details/details.js | 4 +- apis/client/view/header/header.html | 20 ++--- apis/client/view/settings/settings.html | 18 ++-- apis/client/view/settings/settings.js | 4 +- apis/client/view/status/status.html | 2 +- apis/client/view/status/status.js | 18 ++-- apis/client/view/view.html | 26 +++--- apis/client/view/view.js | 4 +- catalogue/client/grid/grid.html | 2 +- catalogue/client/table/table.html | 2 +- core/client/lib/router.js | 2 +- core/lib/i18n/en.i18n.json | 84 +++++++++---------- .../filtering/selectpicker/selectpicker.html | 6 +- documentation/client/view/documentation.html | 20 ++--- metadata/client/view/metadata.html | 2 +- metadata/client/view/metadata.js | 4 +- 20 files changed, 125 insertions(+), 125 deletions(-) diff --git a/apis/client/export/export.html b/apis/client/export/export.html index d88d6c46d2..08b2bcd04f 100644 --- a/apis/client/export/export.html +++ b/apis/client/export/export.html @@ -1,35 +1,35 @@ -