mirror of
https://github.com/OpenBankProject/API-Manager.git
synced 2026-02-06 14:56:47 +00:00
Merge pull request #105 from hongwei1/master
enhanced the error handling and disable the textarea
This commit is contained in:
commit
929d9cd954
@ -114,7 +114,7 @@
|
||||
<a title="API ROOT" href="{{ API_ROOT }}">API ROOT: {{ API_ROOT }}</a> |
|
||||
<a title="Open Bank Project" href="https://openbankproject.com">Open Bank Project</a> |
|
||||
Powered by <a title="TESOBE" href="http://tesobe.com">TESOBE</a> |
|
||||
<small>Copyright © 2016 - 2017</small>
|
||||
<small>Copyright © 2016 - 2020</small>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@ -18,9 +18,11 @@ $(document).ready(function($) {
|
||||
//make sure only create one jsoneditor_div block
|
||||
if(!(jsoneditor_div.css("display") ==="block")){
|
||||
json_editors[json_editor_number] = new JSONEditor(container[0], options, parameters);
|
||||
$(runner).find('textarea[name="parameters"]').prop( "disabled", true );
|
||||
jsoneditor_div.css("display","block");
|
||||
}else{
|
||||
json_editors[json_editor_number] = json_editors[json_editor_number].set(parameters)
|
||||
$(runner).find('textarea[name="parameters"]').prop( "disabled", true );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block page_title %}{{ block.super }} / Users{% endblock page_title %}
|
||||
{% block page_title %}{{ block.super }} / Dynamic Endpoints{% endblock page_title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Dynamic Endpoints</h1>
|
||||
@ -19,7 +19,8 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-2">
|
||||
<div class="form-group" cols="1" rows="1">
|
||||
<a href="" class="dynamic_endpoint_id">{{ dynamic_endpoint.dynamic_endpoint_id }}</a></div>
|
||||
{# <a href="" class="dynamic_endpoint_id">{{ dynamic_endpoint.dynamic_endpoint_id }}</a></div>#}
|
||||
<div class="dynamic_endpoint_id">{{ dynamic_endpoint.dynamic_endpoint_id }}</div></div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
@ -33,10 +33,14 @@ $(document).ready(function($) {
|
||||
bank_id_pattern = $(runner).find('textarea[name="bank_id_pattern"]').val();
|
||||
is_bank_id_exact_match = $(runner).find('.is_bank_id_exact_match').val();
|
||||
parameters = $(runner).find('textarea[name="parameters"]').val();
|
||||
var jsoneditor_id= $(runner).find('.jsoneditor_div')[0].id
|
||||
var json_editor_number = jsoneditor_id.replace("jsoneditor","")
|
||||
parameters_Json_editor = JSON.stringify(json_editors[json_editor_number].get());
|
||||
console.log("parameters_Json_editor:"+parameters_Json_editor)
|
||||
var jsoneditor_id= $(runner).find('.jsoneditor_div')[0].id;
|
||||
var json_editor_number = jsoneditor_id.replace("jsoneditor","");
|
||||
//if the user do not click the `parameters` box, then there is no json_editors here,so we use the parameters directly.
|
||||
if (typeof json_editors[json_editor_number] === 'undefined') {
|
||||
parameters_Json_editor = parameters;
|
||||
} else {
|
||||
parameters_Json_editor = JSON.stringify(json_editors[json_editor_number].get());
|
||||
}
|
||||
$('.runner button.forSave').attr("disabled","disabled");
|
||||
$('.runner button.forDelete').attr("disabled","disabled");
|
||||
$.post('methodrouting/save/method', {
|
||||
@ -45,7 +49,6 @@ $(document).ready(function($) {
|
||||
'connector_name': connector_name,
|
||||
'bank_id_pattern': bank_id_pattern,
|
||||
'is_bank_id_exact_match': is_bank_id_exact_match,
|
||||
'parameters': parameters_Json_editor,
|
||||
'parameters_Json_editor': parameters_Json_editor,
|
||||
}, function (response) {
|
||||
location.reload();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block page_title %}{{ block.super }} / Users{% endblock page_title %}
|
||||
{% block page_title %}{{ block.super }} / Method Routings{% endblock page_title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Method Routing</h1>
|
||||
@ -31,7 +31,8 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-2">
|
||||
<div class="form-group" cols="1" rows="1">
|
||||
<a href="{{ methodSwaggerUrl }}={{ method_routing.method_name }}" class="method_name">{{ method_routing.method_name }}</a></div>
|
||||
{# <a href="{{ methodSwaggerUrl }}={{ method_routing.method_name }}" class="method_name">{{ method_routing.method_name }}</a></div>#}
|
||||
<div class="method_name">{{ method_routing.method_name }}</div></div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-2">
|
||||
<select class="connector_name form-control " }>
|
||||
|
||||
@ -125,16 +125,12 @@ class API(object):
|
||||
def handle_response(self, response):
|
||||
"""Handles the response, e.g. errors or conversion to JSON"""
|
||||
prefix = 'APIError'
|
||||
# if response.status_code == 404:
|
||||
# self.handle_response_404(response, prefix)
|
||||
# elif response.status_code == 500:
|
||||
# self.handle_response_500(response, prefix)
|
||||
# elif response.status_code in [204]:
|
||||
# return response.text
|
||||
# else:
|
||||
data = response.json()
|
||||
if isinstance(data,dict) and 'error' in data:
|
||||
self.handle_response_error(prefix, data['error'])
|
||||
if response.status_code in [204]:
|
||||
return response.text
|
||||
else:
|
||||
data = response.json()
|
||||
if isinstance(data,dict) and 'error' in data:
|
||||
self.handle_response_error(prefix, data['error'])
|
||||
return data
|
||||
|
||||
def start_session(self, session_data):
|
||||
|
||||
@ -58,7 +58,7 @@ class IndexView(LoginRequiredMixin, TemplateView):
|
||||
entitlements = api.get(urlpath)
|
||||
if 'code' in entitlements and entitlements['code'] >= 400:
|
||||
messages.error(self.request, entitlements['message'] +
|
||||
" No Role name will be shown in the 'Filters' dropdown!")
|
||||
". No Role name will be shown in the 'Filters' dropdown!")
|
||||
else:
|
||||
for entitlement in entitlements['list']:
|
||||
role_names.append(entitlement['role_name'])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user