mirror of
https://github.com/OpenBankProject/API-Manager.git
synced 2026-02-06 17:06:45 +00:00
get the value from the json_editor and save it in backend
This commit is contained in:
parent
31a70b5f9e
commit
00d629edb6
@ -1,51 +0,0 @@
|
||||
const schema = {};
|
||||
const json = [
|
||||
{
|
||||
key: 'url',
|
||||
value: 'http://localhost:8080'
|
||||
},
|
||||
{
|
||||
"key":"outBoundMapping",
|
||||
"value":{
|
||||
"cc":{
|
||||
"cId":"outboundAdapterCallContext.correlationId"
|
||||
},
|
||||
"bankId":"bankId.value + 'helloworld'",
|
||||
"originalJson":"$root"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key":"inBoundMapping",
|
||||
"value":{
|
||||
"inboundAdapterCallContext$default":{
|
||||
"correlationId":"correlation_id_value",
|
||||
"sessionId":"session_id_value"
|
||||
},
|
||||
"status$default":{
|
||||
"errorCode":"",
|
||||
"backendMessages":[]
|
||||
},
|
||||
"data":{
|
||||
"bankId":{
|
||||
"value":"result.bank_id"
|
||||
},
|
||||
"shortName":"result.name",
|
||||
"fullName":"'full: ' + result.name",
|
||||
"logoUrl":"result.logo",
|
||||
"websiteUrl":"result.website",
|
||||
"bankRoutingScheme[0]":"result.routing.routing_scheme",
|
||||
"bankRoutingAddress[0]":"result.routing.routing_address",
|
||||
"swiftBic":"result.swift_bic",
|
||||
"nationalIdentifier":"result.national"
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
const options = {
|
||||
mode: 'code',
|
||||
modes: ['code', 'text', 'tree', 'preview']
|
||||
};
|
||||
|
||||
// create the editor
|
||||
const container = document.getElementById('jsoneditor');
|
||||
const editor = new JSONEditor(container, options, json);
|
||||
@ -1,3 +1,61 @@
|
||||
const schema = {};
|
||||
var json = [
|
||||
{
|
||||
key: 'url',
|
||||
value: 'http://localhost:8080'
|
||||
},
|
||||
{
|
||||
"key":"outBoundMapping",
|
||||
"value":{
|
||||
"cc":{
|
||||
"cId":"outboundAdapterCallContext.correlationId"
|
||||
},
|
||||
"bankId":"bankId.value + 'helloworld'",
|
||||
"originalJson":"$root"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key":"inBoundMapping",
|
||||
"value":{
|
||||
"inboundAdapterCallContext$default":{
|
||||
"correlationId":"correlation_id_value",
|
||||
"sessionId":"session_id_value"
|
||||
},
|
||||
"status$default":{
|
||||
"errorCode":"",
|
||||
"backendMessages":[]
|
||||
},
|
||||
"data":{
|
||||
"bankId":{
|
||||
"value":"result.bank_id"
|
||||
},
|
||||
"shortName":"result.name",
|
||||
"fullName":"'full: ' + result.name",
|
||||
"logoUrl":"result.logo",
|
||||
"websiteUrl":"result.website",
|
||||
"bankRoutingScheme[0]":"result.routing.routing_scheme",
|
||||
"bankRoutingAddress[0]":"result.routing.routing_address",
|
||||
"swiftBic":"result.swift_bic",
|
||||
"nationalIdentifier":"result.national"
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
const options = {
|
||||
mode: 'code',
|
||||
modes: ['code', 'text', 'tree', 'preview']
|
||||
};
|
||||
// get json
|
||||
function getJSON() {
|
||||
var json = editor.get();
|
||||
alert(JSON.stringify(json, null, 2));
|
||||
}
|
||||
// create the editor
|
||||
const container = document.getElementById('jsoneditor');
|
||||
const editor = new JSONEditor(container, options, json);
|
||||
// // get json
|
||||
// const updatedJson = editor.get()
|
||||
|
||||
$(document).ready(function($) {
|
||||
$('.runner button.forSave').click(function() {
|
||||
var t = $(this);
|
||||
@ -8,6 +66,7 @@ $(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();
|
||||
parameters_Json_editor = JSON.stringify(editor.get());
|
||||
$('.runner button.forSave').attr("disabled","disabled");
|
||||
$('.runner button.forDelete').attr("disabled","disabled");
|
||||
$.post('methodrouting/save/method', {
|
||||
@ -16,7 +75,8 @@ $(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
|
||||
'parameters': parameters,
|
||||
'parameters_Json_editor': parameters_Json_editor,
|
||||
}, function (response) {
|
||||
location.reload();
|
||||
});
|
||||
|
||||
@ -111,7 +111,6 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block extrajs %}
|
||||
<script type="text/javascript" src="{% static 'methodrouting/js/methodrouting.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'methodrouting/js/jsoneditor.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'methodrouting/js/jsoneditorobp.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'methodrouting/js/methodrouting.js' %}"></script>
|
||||
{% endblock extrajs %}
|
||||
@ -56,13 +56,13 @@ def methodrouting_save(request):
|
||||
is_bank_id_exact_match = request.POST.get('is_bank_id_exact_match')
|
||||
parameters = request.POST.get('parameters')
|
||||
method_routing_id = request.POST.get('method_routing_id')
|
||||
|
||||
parameters_Json_editor = request.POST.get('parameters_Json_editor')
|
||||
payload = {
|
||||
'method_name' : method_name,
|
||||
'connector_name': connector_name,
|
||||
'is_bank_id_exact_match': (is_bank_id_exact_match=="True"),
|
||||
'bank_id_pattern':bank_id_pattern,
|
||||
'parameters':eval(parameters),
|
||||
'parameters':eval(parameters_Json_editor),
|
||||
'method_routing_id':method_routing_id
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user