19 |
|
|
20 |
|
|
21 |
function loadTasks() { |
function loadTasks() { |
22 |
$.get("TaskServlet", function(data) { |
$.get("rest/tasks/list", function(data) { |
23 |
//console.log(data); |
//console.log(data); |
24 |
|
|
25 |
|
|
41 |
|
|
42 |
|
|
43 |
html += "<div class='panel " + pclass + "'>"; |
html += "<div class='panel " + pclass + "'>"; |
44 |
html += "<div class='panel-heading'><h4 class='panel-title'>" + entry.description + "</h4></div>"; |
html += "<div class='panel-heading'>"; |
45 |
|
if (entry.state == "STATE_DONE" || entry.state == "STATE_ABORTED") { |
46 |
|
html += "<button type='button' class='close removetask' aria-label='Close' taskid='" + entry.id+ "'><span aria-hidden='true'>×</span></button>"; |
47 |
|
} |
48 |
|
html += "<h4 class='panel-title'>" + entry.description + "</h4>"; |
49 |
|
html += "</div>"; |
50 |
|
html += " <div class='panel-body'>"; |
51 |
|
|
52 |
html += entry.detail; |
html += entry.detail; |
53 |
|
|
54 |
if (entry.state == "STATE_ABORTED") |
if (entry.state == "STATE_ABORTED") |
55 |
html += "<br><div style='color: red'>" + entry.errorMessage + "</div>"; |
html += "<br><div style='color: red'>" + entry.errorMessage + "</div>"; |
56 |
|
|
57 |
|
if (entry.state == "STATE_RUNNING") { |
58 |
|
if (entry.percentCompleted >= 0) { |
59 |
|
var percent = entry.percentCompleted.toFixed(2); |
60 |
|
html += "<div class='progress'>"; |
61 |
|
html += "<div class='progress-bar' role='progressbar' aria-valuenow='" + percent + "' aria-valuemin='0' aria-valuemax='100' style='width:" + percent + "%'> " ; |
62 |
|
html += percent + "%"; |
63 |
|
html += " </div>"; |
64 |
|
html += "</div>"; |
65 |
|
} |
66 |
|
} |
67 |
|
|
68 |
|
var viewlog = ""; |
69 |
|
if (entry.state == "STATE_RUNNING" || entry.state == "STATE_DONE" || entry.state == "STATE_ABORTED") { |
70 |
|
viewlog = "<span style='float: right'><a href='#' class='viewlog' taskid='" + entry.id+ "'>Log</a></span>"; |
71 |
|
} |
72 |
|
|
73 |
html += "<br/><div style='font-size: 8px; margin: 7px;'>" + entry.state + "</div>"; |
html += " <div style='font-size: 8px; '>" + entry.state + viewlog + "</div>"; |
74 |
|
|
75 |
html += "</div>"; |
html += " </div>"; //panel-body |
76 |
|
html += "</div>"; //panel |
77 |
|
|
78 |
}); |
}); |
79 |
if (html == "") { |
if (html == "") { |
99 |
|
|
100 |
$(document).ready( function() { |
$(document).ready( function() { |
101 |
loadTasks(); |
loadTasks(); |
102 |
setInterval(loadTasks, 2500); |
setInterval(loadTasks, 5000); |
103 |
|
|
104 |
|
|
105 |
|
$(document).on('click', '.viewlog', function(event) { // Bind future elements |
106 |
|
var taskid = $(this).attr('taskid'); |
107 |
|
$("#logview").load('rest/tasks/log/' + taskid); |
108 |
|
|
109 |
|
}); |
110 |
|
|
111 |
|
$(document).on('click', '.removetask', function(event) { // Bind future elements |
112 |
|
var taskid = $(this).attr('taskid'); |
113 |
|
$.get('rest/tasks/remove/' + taskid, function() { |
114 |
|
loadTasks(); |
115 |
|
}); |
116 |
|
}); |
117 |
|
|
118 |
$("#file").fileinput({ |
$("#file").fileinput({ |
119 |
//'showUpload':false, |
//'showUpload':false, |
139 |
$('#file').fileinput('upload'); |
$('#file').fileinput('upload'); |
140 |
}); |
}); |
141 |
|
|
142 |
|
|
143 |
|
$("#afstandBtn").click( function(){ |
144 |
|
var dist = $("#afstand_distributor").val(); |
145 |
|
if (dist == "") { |
146 |
|
alert("Du skal vælge distributør"); |
147 |
|
return; |
148 |
|
} |
149 |
|
|
150 |
|
|
151 |
|
$.get("rest/commands/distancecalculation/" + dist, function() { |
152 |
|
loadTasks(); //Force reload of tasks immediately |
153 |
|
} ); |
154 |
|
|
155 |
|
}); |
156 |
|
|
157 |
}); |
}); |
158 |
|
|
159 |
</script> |
</script> |
161 |
</head> |
</head> |
162 |
<body> |
<body> |
163 |
|
|
164 |
<div class="container"> |
<div class="container-fluid"> |
165 |
<div class="page-header"> |
<div class="page-header"> |
166 |
<h1>Dao Adresse Vedligehold</h1> |
<h1>Dao Adresse Vedligehold</h1> |
167 |
</div> |
</div> |
168 |
<div id="body"> |
<div id="body"> |
169 |
<div class="row"> |
<div class="row"> |
170 |
<div class="col-sm-3" id="leftCol" > |
<div class="col-sm-1" id="leftCol-blank" > |
171 |
|
</div> |
172 |
|
|
173 |
|
<div class="col-sm-2" id="leftCol" > |
174 |
<div class="panel panel-primary"> |
<div class="panel panel-primary"> |
175 |
<div class="panel-heading"> |
<div class="panel-heading"> |
176 |
<h3 class="panel-title">Queue</h3> |
<h3 class="panel-title">Queue</h3> |
183 |
</div> |
</div> |
184 |
</div> |
</div> |
185 |
|
|
186 |
<div class="col-sm-6" id="center" > |
<div class="col-sm-6" id="center"> |
187 |
b |
<pre id="logview"> |
188 |
|
</pre> |
189 |
</div> |
</div> |
190 |
|
|
191 |
<div class="col-sm-3" id="rightCol" > |
<div class="col-sm-2" id="rightCol" > |
192 |
<div class="panel panel-primary"> |
<div class="panel panel-primary"> |
193 |
<div class="panel-heading"> |
<div class="panel-heading"> |
194 |
<h3 class="panel-title">Actions</h3> |
<h3 class="panel-title">Upload File</h3> |
195 |
</div> |
</div> |
196 |
<div class="panel-body"> |
<div class="panel-body"> |
197 |
|
|
201 |
<option></option> |
<option></option> |
202 |
<option>BK</option> |
<option>BK</option> |
203 |
<option>DAO</option> |
<option>DAO</option> |
|
<!-- |
|
|
|
|
204 |
<option>FD</option> |
<option>FD</option> |
205 |
<option>NS</option> |
<option>NS</option> |
|
--> |
|
206 |
</select> |
</select> |
207 |
|
|
208 |
<label for="writeback">Write-back:</label> |
<label for="writeback">Write-back:</label> |
222 |
|
|
223 |
|
|
224 |
</div> |
</div> |
225 |
</div> |
</div> <!-- upload panel --> |
226 |
</div> |
|
227 |
</div> |
<div class="panel panel-primary"> |
228 |
|
<div class="panel-heading"> |
229 |
|
<h3 class="panel-title">Afstand anden rute</h3> |
230 |
|
</div> |
231 |
|
<div class="panel-body"> |
232 |
|
|
233 |
|
|
234 |
|
<label for="distributor">Distributør:</label> |
235 |
|
<select class="form-control" id="afstand_distributor" name="afstand_distributor"> |
236 |
|
<option></option> |
237 |
|
<option>BK</option> |
238 |
|
<option>DAO</option> |
239 |
|
</select> |
240 |
|
<br> |
241 |
|
|
242 |
|
<button class="btn btn-primary" id="afstandBtn">Beregn</button> |
243 |
|
|
244 |
|
|
245 |
|
</div> |
246 |
|
</div><!-- Afstand-andenrute panel --> |
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
</div><!-- rightcol --> |
251 |
|
</div> <!-- row --> |
252 |
|
|
253 |
</div> |
</div><!-- body --> |
254 |
|
|
255 |
|
|
256 |
</div> |
</div> |
257 |
|
|
258 |
|
|