Commit 3dd5e51b authored by Jérome Perrin's avatar Jérome Perrin

make UI component really optional

parent 06a082d6
...@@ -268,11 +268,19 @@ ...@@ -268,11 +268,19 @@
$('li.result').removeClass('active'); $('li.result').removeClass('active');
$($('li.result')[idx]).addClass('active'); $($('li.result')[idx]).addClass('active');
var result = JSON.parse($("#json_result").val())[idx]['result']; var result = JSON.parse($("#json_result").val())[idx]['result'];
$("#result_zone").show(); if (configuration['Dream-Configuration'].gui.debug_json){
$("#graph_zone").show(); // TODO: does not work
// if $("#result_zone").show();
$("#job_schedule_spreadsheet").show(); }
$("#job_gantt").show(); if (configuration['Dream-Configuration'].gui.station_utilisation_graph){
$("#graph_zone").show();
}
if (configuration['Dream-Configuration'].gui.job_schedule_spreadsheet){
$("#job_schedule_spreadsheet").show();
}
if (configuration['Dream-Configuration'].gui.job_gantt){
$("#job_gantt").show();
}
// temporary hack // temporary hack
var now = new Date(); var now = new Date();
...@@ -465,16 +473,21 @@ ...@@ -465,16 +473,21 @@
stack: true stack: true
} }
}; };
$.plot("#graph", series, options); if (configuration['Dream-Configuration'].gui.station_utilisation_graph){
// XXX no need to prepare data
$.plot("#graph", series, options);
}
if (spreadsheet_data.length > 1) { if (spreadsheet_data.length > 1) {
var spreadsheet = $('#job_schedule_spreadsheet'); var spreadsheet = $('#job_schedule_spreadsheet');
spreadsheet.show(); if (configuration['Dream-Configuration'].gui.job_schedule_spreadsheet){
spreadsheet.handsontable({ spreadsheet.show();
data: spreadsheet_data, spreadsheet.handsontable({
readOnly: true data: spreadsheet_data,
}); readOnly: true
spreadsheet.find('.htCore').width(spreadsheet.width()); });
spreadsheet.find('.htCore').width(spreadsheet.width());
}
gantt.templates.task_class = function (start, end, obj) { gantt.templates.task_class = function (start, end, obj) {
return obj.parent ? "sub_task" : ""; return obj.parent ? "sub_task" : "";
}; };
...@@ -489,12 +502,14 @@ ...@@ -489,12 +502,14 @@
// //
// gantt_data.data = gantt_data.data.sort(function(a,b) // gantt_data.data = gantt_data.data.sort(function(a,b)
// {return a.name > b.name ? -1 : 1}); // {return a.name > b.name ? -1 : 1});
$('#job_gantt').height(gantt_output_height).show().dhx_gantt({ if (configuration['Dream-Configuration'].gui.job_gantt){
data: gantt_data, $('#job_gantt').height(gantt_output_height).show().dhx_gantt({
scale_unit: 'day', data: gantt_data,
readonly: true, scale_unit: 'day',
step: 7 readonly: true,
}); step: 7
});
}
} }
}; };
return that; return that;
......
...@@ -70,10 +70,15 @@ ...@@ -70,10 +70,15 @@
$('#job_schedule_spreadsheet').hide(); $('#job_schedule_spreadsheet').hide();
$('#shift_spreadsheet').hide(); $('#shift_spreadsheet').hide();
$("#job_gantt").hide(); $("#job_gantt").hide();
$("#wip_spreadsheet").hide();
if (configuration['Dream-Configuration'].gui.wip_spreadsheet){
$("#wip_spreadsheet").show();
}
try { try {
// spreadsheets // spreadsheets
var spreadsheet_data = data.spreadsheet; var spreadsheet_data = data.spreadsheet; // XXX rename as wip_spreadsheet in json ?
if (spreadsheet_data !== undefined) { if (spreadsheet_data !== undefined) {
var spreadsheet = $('#wip_spreadsheet'); var spreadsheet = $('#wip_spreadsheet');
spreadsheet.handsontable('populateFromArray', 0, 0, spreadsheet_data); spreadsheet.handsontable('populateFromArray', 0, 0, spreadsheet_data);
......
...@@ -200,6 +200,7 @@ class Simulation(object): ...@@ -200,6 +200,7 @@ class Simulation(object):
schema["processTimeout"] schema["processTimeout"]
], ],
"gui": { "gui": {
'debug_json': 0,
'wip_spreadsheet': 0, 'wip_spreadsheet': 0,
'shift_spreadsheet': 0, 'shift_spreadsheet': 0,
......
...@@ -29,7 +29,7 @@ class Simulation(ACO.Simulation): ...@@ -29,7 +29,7 @@ class Simulation(ACO.Simulation):
"_class": 'Dream.ExitJobShop' "_class": 'Dream.ExitJobShop'
} }
# XXX remove default machines etc ? # XXX remove default machines etc ?
conf["Dream-Configuration"]["gui"]["wip_spreasheet"] = 1 conf["Dream-Configuration"]["gui"]["wip_spreadsheet"] = 1
conf["Dream-Configuration"]["gui"]["job_schedule_spreadsheet"] = 1 conf["Dream-Configuration"]["gui"]["job_schedule_spreadsheet"] = 1
conf["Dream-Configuration"]["gui"]["job_gantt"] = 1 conf["Dream-Configuration"]["gui"]["job_gantt"] = 1
return conf return conf
......
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