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

make UI component really optional

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