--- dao/DaoAdresseVedligehold/src/main/webapp/index.html 2016/01/31 21:56:30 2890 +++ dao/DaoAdresseVedligehold/src/main/webapp/index.html 2016/02/03 22:30:22 2909 @@ -19,7 +19,7 @@ function loadTasks() { - $.get("TaskServlet", function(data) { + $.get("rest/tasks/list", function(data) { //console.log(data); @@ -42,15 +42,33 @@ html += "
"; html += "

" + entry.description + "

"; + html += "
"; html += entry.detail; if (entry.state == "STATE_ABORTED") html += "
" + entry.errorMessage + "
"; + + if (entry.state == "STATE_RUNNING") { + if (entry.percentCompleted >= 0) { + var percent = entry.percentCompleted.toFixed(2); + html += "
"; + html += "
" ; + html += percent + "%"; + html += "
"; + html += "
"; + } + } + + var viewlog = ""; + if (entry.state == "STATE_RUNNING" || entry.state == "STATE_DONE" || entry.state == "STATE_ABORTED") { + viewlog = "Log"; + } - html += "
" + entry.state + "
"; + html += "
" + entry.state + viewlog + "
"; - html += "
"; + html += "
"; //panel-body + html += ""; //panel }); if (html == "") { @@ -76,9 +94,15 @@ $(document).ready( function() { loadTasks(); - setInterval(loadTasks, 2500); + //setInterval(loadTasks, 2500); + $(document).on('click', '.viewlog', function(event) { // Bind future elements + var taskid = $(this).attr('taskid'); + $("#logview").load('rest/tasks/log/' + taskid); + + }); + $("#file").fileinput({ //'showUpload':false, 'showRemove': false, @@ -112,7 +136,9 @@ } - $.get("rest/commands/distancecalculation/" + dist); + $.get("rest/commands/distancecalculation/" + dist, function() { + loadTasks(); //Force reload of tasks immediately + } ); }); @@ -142,8 +168,9 @@ -
- b +
+
+