mirror of
https://github.com/OpenBankProject/API-Manager.git
synced 2026-02-06 18:36:51 +00:00
generate the jsoneditor for all method roughings
This commit is contained in:
parent
00d629edb6
commit
fdd80d8783
@ -9,11 +9,6 @@
|
||||
#config .null { color: magenta; }
|
||||
#config .key { color: red; }
|
||||
|
||||
#jsoneditor {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
/* custom bold styling for non-default JSON schema values */
|
||||
.jsoneditor-is-not-default {
|
||||
font-weight: bold;
|
||||
|
||||
@ -1,62 +1,66 @@
|
||||
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"
|
||||
$(document).ready(function($) {
|
||||
const schema = {};
|
||||
var json = [
|
||||
{
|
||||
key: 'url',
|
||||
value: 'http://localhost:8080'
|
||||
},
|
||||
{
|
||||
"key":"outBoundMapping",
|
||||
"value":{
|
||||
"cc":{
|
||||
"cId":"outboundAdapterCallContext.correlationId"
|
||||
},
|
||||
"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"
|
||||
"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);
|
||||
const options = {
|
||||
mode: 'code',
|
||||
modes: ['code', 'text', 'tree', 'preview']
|
||||
};
|
||||
|
||||
var jsoneditorNumber = $('.jsoneditor_div').length
|
||||
for (var step = 0; step < jsoneditorNumber; step++) {
|
||||
var container = $("#"+"jsoneditor"+step);
|
||||
new JSONEditor(container[0], options, json);
|
||||
}
|
||||
|
||||
// // get json
|
||||
// const updatedJson = editor.get()
|
||||
|
||||
$(document).ready(function($) {
|
||||
$('.parameters').click(function() {
|
||||
var row = $(this).parent().parent();
|
||||
row.find('.jsoneditor_div').css("display","block");
|
||||
});
|
||||
|
||||
$('.runner button.forSave').click(function() {
|
||||
var t = $(this);
|
||||
var runner = $(this).parent().parent().parent();
|
||||
@ -80,6 +84,7 @@ $(document).ready(function($) {
|
||||
}, function (response) {
|
||||
location.reload();
|
||||
});
|
||||
runner.find('jsoneditor_div').css("display","none");
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@ -2,15 +2,13 @@
|
||||
{% load static %}
|
||||
{% block page_title %}{{ block.super }} / Users{% endblock page_title %}
|
||||
|
||||
{% block extracss %}
|
||||
<link href="{% static 'methodrouting/css/methodrouting.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'methodrouting/css/jsoneditor.min.css' %}" rel="stylesheet">
|
||||
{% endblock extracss %}
|
||||
{% block extrajs %}
|
||||
<script type="text/javascript" src="{% static 'methodrouting/js/jsoneditor.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'methodrouting/js/methodrouting.js' %}"></script>
|
||||
{% endblock extrajs %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>Method Routing</h1>
|
||||
<div id="jsoneditor"></div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-2">
|
||||
<label class="form-group">Method Name:</label> <br>
|
||||
@ -91,7 +89,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-2">
|
||||
<textarea cols="40" rows="1" class="form-control"
|
||||
<textarea cols="40" rows="1" class="form-control parameters"
|
||||
name="parameters">{{ method_routing.parameters }}</textarea>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-2">
|
||||
@ -104,13 +102,18 @@
|
||||
<button class="btn btn-primary btn-red forDelete">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-sm-12">
|
||||
<div id="jsoneditor{{forloop.counter0}}" style="display: none" class ="jsoneditor_div"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block extrajs %}
|
||||
<script type="text/javascript" src="{% static 'methodrouting/js/jsoneditor.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'methodrouting/js/methodrouting.js' %}"></script>
|
||||
{% endblock extrajs %}
|
||||
|
||||
|
||||
{% block extracss %}
|
||||
<link href="{% static 'methodrouting/css/jsoneditor.min.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'methodrouting/css/methodrouting.css' %}" rel="stylesheet">
|
||||
{% endblock extracss %}
|
||||
Loading…
Reference in New Issue
Block a user