Commit fa1355f8 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

make a list of results so that we can display any result.

parent 7510c7fc
...@@ -356,3 +356,13 @@ path { ...@@ -356,3 +356,13 @@ path {
background-color: #3DD388; background-color: #3DD388;
border-color: #28B06C; border-color: #28B06C;
} }
li.result {
width: 100%;
text-align: left;
cursor:pointer;
}
li.result.active {
background:#fcc;
}
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
</div> </div>
</div> </div>
<div class="twelve columns"> <div class="twelve columns">
<div id="result_zone">
<div>Result List</div>
<ul id="result_list"></ul></div>
<div id="graph_zone"> <div id="graph_zone">
<div>Stations Utilization</div> <div>Stations Utilization</div>
<div id="graph"></div> <div id="graph"></div>
......
...@@ -264,7 +264,11 @@ ...@@ -264,7 +264,11 @@
}); });
}; };
that.displayResult = function (result) { that.displayResult = function (idx) {
$('li.result').removeClass('active')
$($('li.result')[idx]).addClass('active')
var result = JSON.parse($("#json_result").val())[idx]['result'];
$("#result_zone").show();
$("#graph_zone").show(); $("#graph_zone").show();
$("#spreadsheet_output").show(); $("#spreadsheet_output").show();
$("#gantt_output").show(); $("#gantt_output").show();
......
...@@ -324,12 +324,21 @@ ...@@ -324,12 +324,21 @@
function (e) { function (e) {
dream_instance.runSimulation( dream_instance.runSimulation(
function (data) { function (data) {
$('#result_list').empty();
if (data['success']) { if (data['success']) {
$("#json_result").val(JSON.stringify(data['success'], $("#json_result").val(JSON.stringify(data['success'],
undefined, " ")); undefined, " "));
$.each(data['success'], function (idx, obj) {
dream_instance.displayResult(data['success'][0]['result']); $('#result_list').append('<li class="result">' + idx + ' : ' + obj['key'] + '</li>');
$('#result_list').children().last().click(
function (e) {
dream_instance.displayResult(idx);
}
);
});
dream_instance.displayResult(0);
} else { } else {
$("#result_zone").hide();
$("#graph_zone").hide(); $("#graph_zone").hide();
$("#spreadsheet_output").hide(); $("#spreadsheet_output").hide();
$("#gantt_output").hide(); $("#gantt_output").hide();
...@@ -408,6 +417,7 @@ ...@@ -408,6 +417,7 @@
dream_instance.redraw(); dream_instance.redraw();
}); });
$("#result_zone").hide();
$("#graph_zone").hide(); $("#graph_zone").hide();
$("#spreadsheet_output").hide(); $("#spreadsheet_output").hide();
$("#gantt_output").hide(); $("#gantt_output").hide();
......
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