Commit 1094e881 authored by Jérome Perrin's avatar Jérome Perrin

display gantt by job & by station

parent 6ed9db92
...@@ -330,6 +330,13 @@ ...@@ -330,6 +330,13 @@
// display demo graph. // display demo graph.
$("#graph_zone").show(); $("#graph_zone").show();
// temporary hack
var now = new Date();
now.setHours(0);
now.setMinutes(0);
now.setSeconds(0);
var blockage_data = [], var blockage_data = [],
waiting_data = [], waiting_data = [],
failure_data = [], failure_data = [],
...@@ -349,16 +356,29 @@ ...@@ -349,16 +356,29 @@
"Step No." "Step No."
] ]
], ],
start_date = new Date(now.getTime()),
gantt_data = { gantt_data = {
data: [], data: [
{
id: "by_job",
text: "By Job",
start_date: start_date,
duration: 0,
project: 1,
open: true
},
{
id: "by_station",
text: "By Station",
start_date: start_date,
duration: 0,
project: 1,
open: true
}
],
link: [] link: []
}; };
// temporary hack
var now = new Date();
now.setHours(0);
now.setMinutes(0);
now.setSeconds(0);
$.each(data['success'].elementList, function (idx, obj) { $.each(data['success'].elementList, function (idx, obj) {
if (obj.results.working_ratio !== undefined) { if (obj.results.working_ratio !== undefined) {
...@@ -392,14 +412,14 @@ ...@@ -392,14 +412,14 @@
if (obj._class === 'Dream.Job') { if (obj._class === 'Dream.Job') {
var property_dict = obj.extraPropertyDict; var property_dict = obj.extraPropertyDict;
var duration = 0; var duration = 0;
var start_date = new Date(now.getTime());
gantt_data.data.push({ gantt_data.data.push({
id: obj['id'], id: obj['id'],
text: property_dict['name'], text: property_dict['name'],
start_date: start_date, start_date: start_date,
duration: obj['results'].completionTime, duration: obj['results'].completionTime,
project: 1, project: 1,
open: true open: false,
parent: "by_job"
}); });
$.each(obj['results']['schedule'], function (i, schedule) { $.each(obj['results']['schedule'], function (i, schedule) {
spreadsheet_data.push([ spreadsheet_data.push([
...@@ -428,7 +448,25 @@ ...@@ -428,7 +448,25 @@
duration: duration, duration: duration,
parent: obj['id'] parent: obj['id']
}); });
} gantt_data.data.push({
id: 'job.' + obj['id'] + '.' + schedule['stepNumber'],
text: obj['id'],
start_date: task_start_date,
duration: duration,
parent: schedule['stationId'],
by_station:1,
});
};
});
} else {
gantt_data.data.push({
id: obj['id'],
text: obj['id'],
start_date: now,
duration: 0,
project: 1,
open: false,
parent: "by_station"
}); });
} }
}); });
...@@ -480,6 +518,7 @@ ...@@ -480,6 +518,7 @@
try { try {
gantt.clearAll(); gantt.clearAll();
} catch (e) {} } catch (e) {}
var gantt_output_height = 35 * (gantt_data.data.length + 1) + 1; var gantt_output_height = 35 * (gantt_data.data.length + 1) + 1;
$('#gantt_output').height(gantt_output_height).show().dhx_gantt({ $('#gantt_output').height(gantt_output_height).show().dhx_gantt({
data: gantt_data, data: gantt_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