From ed4bb5c265e2a40c83cfa87cb4e5ef6d38135ed6 Mon Sep 17 00:00:00 2001 From: Hongwei Date: Fri, 8 Jan 2021 09:59:57 +0100 Subject: [PATCH 1/6] feature/added the example value for the method_routings parameters --- apimanager/methodrouting/views.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apimanager/methodrouting/views.py b/apimanager/methodrouting/views.py index 57986f9..04a37e0 100644 --- a/apimanager/methodrouting/views.py +++ b/apimanager/methodrouting/views.py @@ -43,7 +43,14 @@ class IndexView(LoginRequiredMixin, FormView): error_once_only(self.request, (Exception("Unknown Error. Details:" + str(err)))) else: for i in range(len(method_routings)): - method_routings[i]['parameters'] = json.dumps(method_routings[i]['parameters'], sort_keys=False) + #if the parameters are empty, we provide the example value. + if(str(method_routings[i]['parameters']).find("key") == -1): + method_routings[i]['parameters'] = json.dumps([{ + "key":"url", + "value":"http://mydomain.com/xxx" + }], sort_keys=False) + else: + method_routings[i]['parameters'] = json.dumps(method_routings[i]['parameters'], sort_keys=False) context.update({ 'method_routings': method_routings, From afc06f8df82382f4f37a8d8aa82ae71032bc4349 Mon Sep 17 00:00:00 2001 From: Hongwei Date: Fri, 8 Jan 2021 10:57:40 +0100 Subject: [PATCH 2/6] feature/added the Hyperlink for method-routing field --- .../dynamicendpoints/templates/dynamicendpoints/index.html | 1 - .../methodrouting/templates/methodrouting/index.html | 4 ++-- apimanager/methodrouting/views.py | 7 ++++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apimanager/dynamicendpoints/templates/dynamicendpoints/index.html b/apimanager/dynamicendpoints/templates/dynamicendpoints/index.html index 9350455..23ff31b 100644 --- a/apimanager/dynamicendpoints/templates/dynamicendpoints/index.html +++ b/apimanager/dynamicendpoints/templates/dynamicendpoints/index.html @@ -19,7 +19,6 @@
#}
{{ dynamic_endpoint.dynamic_endpoint_id }}
diff --git a/apimanager/methodrouting/templates/methodrouting/index.html b/apimanager/methodrouting/templates/methodrouting/index.html index 2116595..877af21 100644 --- a/apimanager/methodrouting/templates/methodrouting/index.html +++ b/apimanager/methodrouting/templates/methodrouting/index.html @@ -31,8 +31,8 @@
#} -
{{ method_routing.method_name }}
+ +
-
From 6768374cae9127205cdd21b84ad24be5eeafd76a Mon Sep 17 00:00:00 2001 From: Hongwei Date: Mon, 11 Jan 2021 15:08:40 +0100 Subject: [PATCH 5/6] feature/set the methodrouting parameters jsoneditor to show or not --- .../static/methodrouting/js/methodrouting.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apimanager/methodrouting/static/methodrouting/js/methodrouting.js b/apimanager/methodrouting/static/methodrouting/js/methodrouting.js index 929b75e..955a278 100644 --- a/apimanager/methodrouting/static/methodrouting/js/methodrouting.js +++ b/apimanager/methodrouting/static/methodrouting/js/methodrouting.js @@ -16,11 +16,16 @@ $(document).ready(function($) { parameters = JSON.parse($(runner).find('textarea[name="parameters"]').text()); var jsoneditor_div = $(runner).find('.jsoneditor_div'); //make sure only create one jsoneditor_div block, click once to open and then close the block. - if(!(jsoneditor_div.css("display") ==="block")){ + if (typeof json_editors[json_editor_number] === 'undefined') { json_editors[json_editor_number] = new JSONEditor(container[0], options, parameters); jsoneditor_div.css("display","block"); }else{ - jsoneditor_div.css("display","none"); + // json_editors[json_editor_number] = json_editors[json_editor_number].set(parameters) + if(jsoneditor_div.css("display") ==="block"){ + jsoneditor_div.css("display","none"); + }else{ + jsoneditor_div.css("display","block"); + } } }); From ca48b530cb661420a6a8cdfa7635c79cea7e4181 Mon Sep 17 00:00:00 2001 From: Hongwei Date: Tue, 12 Jan 2021 11:12:50 +0100 Subject: [PATCH 6/6] feature/support multiple methodroutings --- .../templates/methodrouting/index.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apimanager/methodrouting/templates/methodrouting/index.html b/apimanager/methodrouting/templates/methodrouting/index.html index b467a7b..5f30a9d 100644 --- a/apimanager/methodrouting/templates/methodrouting/index.html +++ b/apimanager/methodrouting/templates/methodrouting/index.html @@ -105,10 +105,16 @@ class="method_routing_id">{{ method_routing.method_routing_id }}
-
- saved. - -
+ {% if method_routing.method_routing_id == "" %} +
+ +
+ {% else %} +
+ + +
+ {% endif %}