Commit a1bc007a authored by Romain Courteaud's avatar Romain Courteaud Committed by Jérome Perrin

Migrate queue statistics graph

parent a81401f1
......@@ -75,7 +75,6 @@
<li><a href="#station_utilisation_graph">Stations Utilization</a></li>
<li><a href="#capacity_utilisation_graph">Capacity Utilization</a></li>
<li><a href="#exit_stat">Exit Statistics</a></li>
<li><a href="#queue_stat">Queue Statistics</a></li>
<li><a href="#job_gantt">Job Gantt</a></li>
<li><a href="#job_schedule_spreadsheet">Job Schedule</a></li>
</ul>
......@@ -90,11 +89,6 @@
<div></div>
</div>
<div id="queue_stat">
<h1>Queues Statistics</h1>
<div id="queue_stat_graph"></div>
</div>
<div id="job_gantt" style='width:1320px; height:800px;'></div>
<div id="job_schedule_spreadsheet" style="overflow: scroll;"></div>
......
......@@ -23,6 +23,7 @@
"use strict";
function capacity_utilisation_graph_widget(input_data, output_data) {
var available_capacity_by_station = {},
capacity_usage_by_station = {};
......@@ -91,21 +92,6 @@
}
};
function queue_stat_widget(input_data, output_data) {
/* FIXME: does not support more than one replic.
* + see george email to integrate without the need of an EG
*/
var queue_stat = $("#queue_stat");
var series = [];
$.each(output_data.elementList, function(idx, el){
if (el._class == 'Dream.Queue'){
series.push({label: el.name || el.id,
data: el.wip_stat_list})
}
})
$.plot("#queue_stat_graph", series);
}
function exit_stat_widget(input_data, output_data) {
var exit_stat = $("#exit_stat").find('div').empty();
$.each(output_data.elementList, function(idx, el){
......
......@@ -21,6 +21,10 @@
"station_utilisation_graph",
key
),
gadget.whoWantToDisplayThisDocumentPage(
"queue_stat_graph",
key
),
gadget.whoWantToDisplayThisDocumentPage("debug_json", key)
]);
})
......@@ -30,7 +34,8 @@
{link: result_list[1], title: "Run simulation"},
{link: result_list[2], title: "Manage document"},
{link: result_list[3], title: "Stations Utilization"},
{link: result_list[4], title: "Debug JSON"}
{link: result_list[4], title: "Queues Statistics"},
{link: result_list[5], title: "Debug JSON"}
];
});
});
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Queues Statistics</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="../<%= curl.jqueryflot.relative_dest %>"></script>
<script src="../<%= curl.jqueryflotstack.relative_dest %>"></script>
<script src="document_page_mixin.js" type="text/javascript"></script>
<script src="queue_stat_graph.js" type="text/javascript"></script>
</head>
<body>
<div class="graph_container" style="width: 100%;height:300px"></div>
</body>
</html>
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery */
/*jslint nomen: true */
(function (window, rJS, RSVP, initDocumentPageMixin, $) {
"use strict";
function queue_stat_widget(output_data) {
/* FIXME: does not support more than one replic.
* + see george email to integrate without the need of an EG
*/
var series = [];
$.each(output_data.elementList, function (idx, el) {
if (el._class === 'Dream.Queue') {
series.push({label: el.name || el.id,
data: el.wip_stat_list});
}
});
return series;
}
var gadget_klass = rJS(window);
initDocumentPageMixin(gadget_klass);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.ready(function (g) {
g.props = {};
})
// Assign the element to a variable
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.props.element = element;
});
})
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var jio_key = options.id,
gadget = this;
gadget.props.jio_key = jio_key;
return gadget.aq_getAttachment({
"_id": gadget.props.jio_key,
"_attachment": "simulation.json"
})
.push(function (simulation_json) {
gadget.props.series = queue_stat_widget(
// XXX Hardcoded result
JSON.parse(simulation_json)[0].result
);
});
})
.declareMethod("startService", function () {
// XXX Manually calculate width and height when resizing
$.plot(
this.props.element.querySelector(".graph_container"),
this.props.series
);
});
}(window, rJS, RSVP, initDocumentPageMixin, jQuery));
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