1 |
torben |
2838 |
<html>
|
2 |
|
|
<head>
|
3 |
|
|
<head>
|
4 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
5 |
torben |
2932 |
|
6 |
|
|
<link rel="stylesheet" href="webjars/jquery-ui/1.11.4/jquery-ui.css" />
|
7 |
torben |
2838 |
|
8 |
|
|
<link rel="stylesheet" href="webjars/bootstrap/3.3.5/css/bootstrap.min.css" />
|
9 |
|
|
|
10 |
|
|
<link rel="stylesheet" href="webjars/bootstrap-fileinput/4.2.7/css/fileinput.min.css" />
|
11 |
torben |
2923 |
|
12 |
|
|
<style>
|
13 |
|
|
|
14 |
|
|
@media (min-width: 1300px) {
|
15 |
|
|
.container {
|
16 |
|
|
width: 1300px; /*default 1170px*/
|
17 |
|
|
}
|
18 |
|
|
}
|
19 |
|
|
</style>
|
20 |
torben |
2838 |
|
21 |
|
|
<!-- use webjars for dependencies -->
|
22 |
|
|
<script src="webjars/jquery/2.1.4/jquery.js"></script>
|
23 |
torben |
2932 |
<script src="webjars/jquery-ui/1.11.4/jquery-ui.js"></script>
|
24 |
torben |
2838 |
<script src="webjars/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
25 |
|
|
|
26 |
|
|
<script src="webjars/bootstrap-fileinput/4.2.7/js/fileinput.min.js"></script>
|
27 |
|
|
|
28 |
|
|
<script src="webjars/chartjs/1.0.2/Chart.min.js"></script>
|
29 |
|
|
|
30 |
|
|
<script>
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
function loadTasks() {
|
34 |
torben |
2903 |
$.get("rest/tasks/list", function(data) {
|
35 |
torben |
2838 |
//console.log(data);
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
var html = "";
|
39 |
|
|
data.forEach( function(entry) {
|
40 |
|
|
var pclass;
|
41 |
|
|
|
42 |
|
|
if (entry.state == "STATE_DONE")
|
43 |
|
|
pclass = "panel-success";
|
44 |
|
|
|
45 |
|
|
if (entry.state == "STATE_RUNNING")
|
46 |
|
|
pclass = "panel-info";
|
47 |
|
|
|
48 |
|
|
if (entry.state == "STATE_QUEUED")
|
49 |
|
|
pclass = "panel-warning";
|
50 |
|
|
|
51 |
|
|
if (entry.state == "STATE_ABORTED")
|
52 |
|
|
pclass = "panel-danger";
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
html += "<div class='panel " + pclass + "'>";
|
56 |
torben |
2918 |
html += "<div class='panel-heading'>";
|
57 |
torben |
2928 |
if (entry.state == "STATE_DONE" || entry.state == "STATE_ABORTED" || entry.state == "STATE_QUEUED") {
|
58 |
torben |
2918 |
html += "<button type='button' class='close removetask' aria-label='Close' taskid='" + entry.id+ "'><span aria-hidden='true'>×</span></button>";
|
59 |
|
|
}
|
60 |
|
|
html += "<h4 class='panel-title'>" + entry.description + "</h4>";
|
61 |
|
|
html += "</div>";
|
62 |
torben |
2899 |
html += " <div class='panel-body'>";
|
63 |
torben |
2838 |
|
64 |
|
|
html += entry.detail;
|
65 |
|
|
|
66 |
torben |
2844 |
if (entry.state == "STATE_ABORTED")
|
67 |
|
|
html += "<br><div style='color: red'>" + entry.errorMessage + "</div>";
|
68 |
torben |
2891 |
|
69 |
|
|
if (entry.state == "STATE_RUNNING") {
|
70 |
|
|
if (entry.percentCompleted >= 0) {
|
71 |
|
|
var percent = entry.percentCompleted.toFixed(2);
|
72 |
|
|
html += "<div class='progress'>";
|
73 |
|
|
html += "<div class='progress-bar' role='progressbar' aria-valuenow='" + percent + "' aria-valuemin='0' aria-valuemax='100' style='width:" + percent + "%'> " ;
|
74 |
|
|
html += percent + "%";
|
75 |
|
|
html += " </div>";
|
76 |
|
|
html += "</div>";
|
77 |
|
|
}
|
78 |
|
|
}
|
79 |
torben |
2844 |
|
80 |
torben |
2909 |
var viewlog = "";
|
81 |
|
|
if (entry.state == "STATE_RUNNING" || entry.state == "STATE_DONE" || entry.state == "STATE_ABORTED") {
|
82 |
|
|
viewlog = "<span style='float: right'><a href='#' class='viewlog' taskid='" + entry.id+ "'>Log</a></span>";
|
83 |
|
|
}
|
84 |
torben |
2838 |
|
85 |
torben |
2909 |
html += " <div style='font-size: 8px; '>" + entry.state + viewlog + "</div>";
|
86 |
|
|
|
87 |
torben |
2899 |
html += " </div>"; //panel-body
|
88 |
|
|
html += "</div>"; //panel
|
89 |
torben |
2838 |
|
90 |
|
|
});
|
91 |
|
|
if (html == "") {
|
92 |
|
|
html = "<div class='panel panel-primary'>Queue is empty</div>";
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
$("#queue").html(html);
|
96 |
|
|
|
97 |
|
|
}, "json");
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
function genUploadExtraData (previewId, index) {
|
101 |
|
|
var dist = $("#distributor").val();
|
102 |
|
|
var wb = $("#writeback").val();
|
103 |
|
|
|
104 |
|
|
var obj = {
|
105 |
|
|
distributor: dist,
|
106 |
|
|
writeback: wb
|
107 |
|
|
};
|
108 |
|
|
|
109 |
|
|
return obj;
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
$(document).ready( function() {
|
113 |
|
|
loadTasks();
|
114 |
torben |
2910 |
setInterval(loadTasks, 5000);
|
115 |
torben |
2838 |
|
116 |
torben |
2932 |
$("#center").resizable({
|
117 |
|
|
handles: 'e, w'
|
118 |
|
|
});
|
119 |
torben |
2838 |
|
120 |
torben |
2932 |
|
121 |
torben |
2909 |
$(document).on('click', '.viewlog', function(event) { // Bind future elements
|
122 |
|
|
var taskid = $(this).attr('taskid');
|
123 |
|
|
$("#logview").load('rest/tasks/log/' + taskid);
|
124 |
|
|
|
125 |
|
|
});
|
126 |
|
|
|
127 |
torben |
2918 |
$(document).on('click', '.removetask', function(event) { // Bind future elements
|
128 |
|
|
var taskid = $(this).attr('taskid');
|
129 |
|
|
$.get('rest/tasks/remove/' + taskid, function() {
|
130 |
|
|
loadTasks();
|
131 |
|
|
});
|
132 |
|
|
});
|
133 |
|
|
|
134 |
torben |
2838 |
$("#file").fileinput({
|
135 |
|
|
//'showUpload':false,
|
136 |
|
|
'showRemove': false,
|
137 |
|
|
'showPreview': false,
|
138 |
|
|
'showUpload': false,
|
139 |
|
|
'uploadUrl': 'FileUploadServlet',
|
140 |
|
|
'uploadExtraData': genUploadExtraData, //brug callback til at finde ekstra data
|
141 |
|
|
|
142 |
|
|
'maxFileCount': 1,
|
143 |
|
|
'minFileCount': 1
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
});
|
147 |
|
|
|
148 |
|
|
$("#uploadBtn").click( function() {
|
149 |
|
|
var dist = $("#distributor").val();
|
150 |
|
|
if (dist == "") {
|
151 |
|
|
alert("Du skal vælge distributør");
|
152 |
|
|
return;
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
$('#file').fileinput('upload');
|
156 |
|
|
});
|
157 |
|
|
|
158 |
torben |
2890 |
|
159 |
torben |
3002 |
|
160 |
|
|
|
161 |
torben |
2890 |
$("#afstandBtn").click( function(){
|
162 |
|
|
var dist = $("#afstand_distributor").val();
|
163 |
|
|
if (dist == "") {
|
164 |
|
|
alert("Du skal vælge distributør");
|
165 |
|
|
return;
|
166 |
|
|
}
|
167 |
torben |
2927 |
var type = $("#afstand_type").val();
|
168 |
|
|
var url = "rest/commands/distancecalculation/" + dist + "/" + type;
|
169 |
torben |
2890 |
|
170 |
|
|
|
171 |
torben |
2927 |
$.get(url, function() {
|
172 |
torben |
2895 |
loadTasks(); //Force reload of tasks immediately
|
173 |
|
|
} );
|
174 |
torben |
2890 |
|
175 |
|
|
});
|
176 |
|
|
|
177 |
torben |
3002 |
$("#dawaBtn").click( function(){
|
178 |
|
|
|
179 |
torben |
3072 |
var url = "rest/commands/dawa";
|
180 |
torben |
3002 |
|
181 |
|
|
|
182 |
|
|
$.get(url, function() {
|
183 |
|
|
loadTasks(); //Force reload of tasks immediately
|
184 |
|
|
} );
|
185 |
|
|
|
186 |
|
|
});
|
187 |
|
|
|
188 |
|
|
|
189 |
torben |
2838 |
});
|
190 |
|
|
|
191 |
|
|
</script>
|
192 |
|
|
|
193 |
|
|
</head>
|
194 |
|
|
<body>
|
195 |
|
|
|
196 |
torben |
2923 |
<div class="container">
|
197 |
torben |
2838 |
<div class="page-header">
|
198 |
|
|
<h1>Dao Adresse Vedligehold</h1>
|
199 |
|
|
</div>
|
200 |
|
|
<div id="body">
|
201 |
torben |
2923 |
<div class="row">
|
202 |
|
|
<div class="col-sm-3" id="leftCol" >
|
203 |
torben |
2838 |
<div class="panel panel-primary">
|
204 |
|
|
<div class="panel-heading">
|
205 |
|
|
<h3 class="panel-title">Queue</h3>
|
206 |
|
|
</div>
|
207 |
|
|
<div class="panel-body" id="queue">
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
</div>
|
212 |
|
|
</div>
|
213 |
|
|
</div>
|
214 |
|
|
|
215 |
torben |
2909 |
<div class="col-sm-6" id="center">
|
216 |
|
|
<pre id="logview">
|
217 |
|
|
</pre>
|
218 |
torben |
2838 |
</div>
|
219 |
|
|
|
220 |
torben |
2923 |
<div class="col-sm-3" id="rightCol" >
|
221 |
torben |
2838 |
<div class="panel panel-primary">
|
222 |
|
|
<div class="panel-heading">
|
223 |
torben |
2890 |
<h3 class="panel-title">Upload File</h3>
|
224 |
torben |
2838 |
</div>
|
225 |
|
|
<div class="panel-body">
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
<label for="distributor">Distributør:</label>
|
229 |
|
|
<select class="form-control" id="distributor" name="distributor">
|
230 |
|
|
<option></option>
|
231 |
|
|
<option>BK</option>
|
232 |
torben |
2844 |
<option>DAO</option>
|
233 |
torben |
2852 |
<option>FD</option>
|
234 |
torben |
2851 |
<option>NS</option>
|
235 |
torben |
2838 |
</select>
|
236 |
|
|
|
237 |
|
|
<label for="writeback">Write-back:</label>
|
238 |
|
|
<select class="form-control" id="writeback" name="writeback">
|
239 |
|
|
<option value="false">Nej</option>
|
240 |
|
|
<option value="true">Ja</option>
|
241 |
|
|
</select>
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
<label class="control-label">Select File</label>
|
245 |
|
|
|
246 |
|
|
<input type="hidden" name="distributor" value="BK">
|
247 |
|
|
<input type="file" name="file" id="file"><br>
|
248 |
|
|
|
249 |
|
|
<button class="btn btn-primary" id="uploadBtn">Upload</button>
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
</div>
|
254 |
torben |
2890 |
</div> <!-- upload panel -->
|
255 |
|
|
|
256 |
|
|
<div class="panel panel-primary">
|
257 |
|
|
<div class="panel-heading">
|
258 |
|
|
<h3 class="panel-title">Afstand anden rute</h3>
|
259 |
|
|
</div>
|
260 |
|
|
<div class="panel-body">
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
<label for="distributor">Distributør:</label>
|
264 |
|
|
<select class="form-control" id="afstand_distributor" name="afstand_distributor">
|
265 |
|
|
<option></option>
|
266 |
|
|
<option>BK</option>
|
267 |
|
|
<option>DAO</option>
|
268 |
|
|
</select>
|
269 |
torben |
2927 |
|
270 |
|
|
|
271 |
|
|
<label for="type">Type:</label>
|
272 |
|
|
<select class="form-control" id="afstand_type" name="afstand_type">
|
273 |
|
|
<option>Incremental</option>
|
274 |
|
|
<option>Full</option>
|
275 |
|
|
</select>
|
276 |
torben |
2890 |
<br>
|
277 |
torben |
2927 |
|
278 |
torben |
2890 |
|
279 |
|
|
<button class="btn btn-primary" id="afstandBtn">Beregn</button>
|
280 |
|
|
|
281 |
|
|
|
282 |
|
|
</div>
|
283 |
|
|
</div><!-- Afstand-andenrute panel -->
|
284 |
torben |
3002 |
|
285 |
|
|
<div class="panel panel-primary">
|
286 |
|
|
<div class="panel-heading">
|
287 |
|
|
<h3 class="panel-title">Dawa Indlæsning</h3>
|
288 |
|
|
</div>
|
289 |
|
|
<div class="panel-body">
|
290 |
|
|
|
291 |
|
|
<button class="btn btn-primary" id="dawaBtn">Beregn</button>
|
292 |
|
|
|
293 |
|
|
</div>
|
294 |
|
|
</div> <!-- DAWA -->
|
295 |
torben |
2890 |
|
296 |
|
|
|
297 |
|
|
</div><!-- rightcol -->
|
298 |
|
|
</div> <!-- row -->
|
299 |
torben |
2838 |
|
300 |
torben |
2890 |
</div><!-- body -->
|
301 |
|
|
|
302 |
|
|
|
303 |
torben |
2838 |
</div>
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
</body>
|
308 |
|
|
</html> |