Commit bfe38391 authored by Jérome Perrin's avatar Jérome Perrin

make a "widget" for debug json

parent a9f7ce10
...@@ -516,6 +516,10 @@ ...@@ -516,6 +516,10 @@
}); });
} }
function debug_json_widget(input_data, output_data) {
$("#json_output").val(JSON.stringify(input_data, undefined, " "));
$("#json_result").val(JSON.stringify(output_data, undefined, " "));
}
scope.Dream = function (configuration) { scope.Dream = function (configuration) {
var that = jsonPlumb(), var that = jsonPlumb(),
...@@ -851,6 +855,9 @@ ...@@ -851,6 +855,9 @@
if (configuration['Dream-Configuration'].gui.job_gantt){ if (configuration['Dream-Configuration'].gui.job_gantt){
job_gantt_widget(input, result); job_gantt_widget(input, result);
} }
if (configuration['Dream-Configuration'].gui.debug_json){
debug_json_widget(input, result);
}
// hack: make the tabs full width // hack: make the tabs full width
$("#reports li").width((100/$("#reports li:visible").length) - 1 +'%'); $("#reports li").width((100/$("#reports li:visible").length) - 1 +'%');
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
$('#result_zone').hide(); $('#result_zone').hide();
$('#shift_spreadsheet').hide(); $('#shift_spreadsheet').hide();
$("#debug_json").hide();
$("#wip_part_spreadsheet").hide(); $("#wip_part_spreadsheet").hide();
if (configuration['Dream-Configuration'].gui.wip_part_spreadsheet){ if (configuration['Dream-Configuration'].gui.wip_part_spreadsheet){
...@@ -78,9 +77,6 @@ ...@@ -78,9 +77,6 @@
if (configuration['Dream-Configuration'].gui.shift_spreadsheet){ if (configuration['Dream-Configuration'].gui.shift_spreadsheet){
$("#shift_spreadsheet").show(); $("#shift_spreadsheet").show();
} }
if (configuration['Dream-Configuration'].gui.debug_json){
$("#debug_json").show();
}
try { try {
// spreadsheets // spreadsheets
...@@ -124,8 +120,7 @@ ...@@ -124,8 +120,7 @@
dream_instance.updateGeneralProperties(data.general); dream_instance.updateGeneralProperties(data.general);
dream_instance.prepareDialogForGeneralProperties(); dream_instance.prepareDialogForGeneralProperties();
$("#json_output").val(JSON.stringify(dream_instance.getData(),
undefined, " "));
if ($.isEmptyObject(coordinates)) { if ($.isEmptyObject(coordinates)) {
dream_instance.positionGraph(); dream_instance.positionGraph();
} else { } else {
...@@ -145,7 +140,6 @@ ...@@ -145,7 +140,6 @@
} }
// once the data is read, we can subscribe to every changes // once the data is read, we can subscribe to every changes
$.subscribe("Dream.Gui.onDataChange", function (event, data) { $.subscribe("Dream.Gui.onDataChange", function (event, data) {
$("#json_output").val(JSON.stringify(data, undefined, " "));
jio.put({ jio.put({
_id: "dream_demo", _id: "dream_demo",
data: data data: data
...@@ -186,7 +180,6 @@ ...@@ -186,7 +180,6 @@
$('#result_list').empty(); $('#result_list').empty();
$('#error').empty(); $('#error').empty();
if (data['success']) { if (data['success']) {
$("#json_result").val(JSON.stringify(data.data, undefined, " "));
$.each(data.data, function (idx, result) { $.each(data.data, function (idx, result) {
$('#result_list').append('<li class="result"></li>'); $('#result_list').append('<li class="result"></li>');
...@@ -263,7 +256,6 @@ ...@@ -263,7 +256,6 @@
}, },
success: function (data, textStatus, jqXHR) { success: function (data, textStatus, jqXHR) {
form.reset(); form.reset();
$("#json_output").val(JSON.stringify(data));
loadData(data); loadData(data);
} }
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment