1 |
<html>
|
2 |
<head>
|
3 |
<head>
|
4 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
5 |
|
6 |
<link rel="stylesheet" href="webjars/bootstrap/3.3.5/css/bootstrap.min.css" />
|
7 |
|
8 |
<link rel="stylesheet" href="webjars/bootstrap-fileinput/4.2.7/css/fileinput.min.css" />
|
9 |
|
10 |
<!-- use webjars for dependencies -->
|
11 |
<script src="webjars/jquery/2.1.4/jquery.js"></script>
|
12 |
<script src="webjars/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
13 |
|
14 |
<script src="webjars/bootstrap-fileinput/4.2.7/js/fileinput.min.js"></script>
|
15 |
|
16 |
<script src="webjars/chartjs/1.0.2/Chart.min.js"></script>
|
17 |
|
18 |
<script>
|
19 |
|
20 |
|
21 |
function loadTasks() {
|
22 |
$.get("TaskServlet", function(data) {
|
23 |
//console.log(data);
|
24 |
|
25 |
|
26 |
var html = "";
|
27 |
data.forEach( function(entry) {
|
28 |
var pclass;
|
29 |
|
30 |
if (entry.state == "STATE_DONE")
|
31 |
pclass = "panel-success";
|
32 |
|
33 |
if (entry.state == "STATE_RUNNING")
|
34 |
pclass = "panel-info";
|
35 |
|
36 |
if (entry.state == "STATE_QUEUED")
|
37 |
pclass = "panel-warning";
|
38 |
|
39 |
if (entry.state == "STATE_ABORTED")
|
40 |
pclass = "panel-danger";
|
41 |
|
42 |
|
43 |
html += "<div class='panel " + pclass + "'>";
|
44 |
html += "<div class='panel-heading'><h4 class='panel-title'>" + entry.description + "</h4></div>";
|
45 |
|
46 |
html += entry.detail;
|
47 |
|
48 |
if (entry.state == "STATE_ABORTED")
|
49 |
html += "<br><div style='color: red'>" + entry.errorMessage + "</div>";
|
50 |
|
51 |
html += "<br/><div style='font-size: 8px; margin: 7px;'>" + entry.state + "</div>";
|
52 |
|
53 |
html += "</div>";
|
54 |
|
55 |
});
|
56 |
if (html == "") {
|
57 |
html = "<div class='panel panel-primary'>Queue is empty</div>";
|
58 |
}
|
59 |
|
60 |
$("#queue").html(html);
|
61 |
|
62 |
}, "json");
|
63 |
}
|
64 |
|
65 |
function genUploadExtraData (previewId, index) {
|
66 |
var dist = $("#distributor").val();
|
67 |
var wb = $("#writeback").val();
|
68 |
|
69 |
var obj = {
|
70 |
distributor: dist,
|
71 |
writeback: wb
|
72 |
};
|
73 |
|
74 |
return obj;
|
75 |
}
|
76 |
|
77 |
$(document).ready( function() {
|
78 |
loadTasks();
|
79 |
setInterval(loadTasks, 2500);
|
80 |
|
81 |
|
82 |
$("#file").fileinput({
|
83 |
//'showUpload':false,
|
84 |
'showRemove': false,
|
85 |
'showPreview': false,
|
86 |
'showUpload': false,
|
87 |
'uploadUrl': 'FileUploadServlet',
|
88 |
'uploadExtraData': genUploadExtraData, //brug callback til at finde ekstra data
|
89 |
|
90 |
'maxFileCount': 1,
|
91 |
'minFileCount': 1
|
92 |
|
93 |
|
94 |
});
|
95 |
|
96 |
$("#uploadBtn").click( function() {
|
97 |
var dist = $("#distributor").val();
|
98 |
if (dist == "") {
|
99 |
alert("Du skal vælge distributør");
|
100 |
return;
|
101 |
}
|
102 |
|
103 |
$('#file').fileinput('upload');
|
104 |
});
|
105 |
|
106 |
});
|
107 |
|
108 |
</script>
|
109 |
|
110 |
</head>
|
111 |
<body>
|
112 |
|
113 |
<div class="container">
|
114 |
<div class="page-header">
|
115 |
<h1>Dao Adresse Vedligehold</h1>
|
116 |
</div>
|
117 |
<div id="body">
|
118 |
<div class="row">
|
119 |
<div class="col-sm-3" id="leftCol" >
|
120 |
<div class="panel panel-primary">
|
121 |
<div class="panel-heading">
|
122 |
<h3 class="panel-title">Queue</h3>
|
123 |
</div>
|
124 |
<div class="panel-body" id="queue">
|
125 |
|
126 |
|
127 |
|
128 |
</div>
|
129 |
</div>
|
130 |
</div>
|
131 |
|
132 |
<div class="col-sm-6" id="center" >
|
133 |
b
|
134 |
</div>
|
135 |
|
136 |
<div class="col-sm-3" id="rightCol" >
|
137 |
<div class="panel panel-primary">
|
138 |
<div class="panel-heading">
|
139 |
<h3 class="panel-title">Actions</h3>
|
140 |
</div>
|
141 |
<div class="panel-body">
|
142 |
|
143 |
|
144 |
<label for="distributor">Distributør:</label>
|
145 |
<select class="form-control" id="distributor" name="distributor">
|
146 |
<option></option>
|
147 |
<option>BK</option>
|
148 |
<option>DAO</option>
|
149 |
<!--
|
150 |
|
151 |
<option>FD</option>
|
152 |
<option>NS</option>
|
153 |
-->
|
154 |
</select>
|
155 |
|
156 |
<label for="writeback">Write-back:</label>
|
157 |
<select class="form-control" id="writeback" name="writeback">
|
158 |
<option value="false">Nej</option>
|
159 |
<option value="true">Ja</option>
|
160 |
</select>
|
161 |
|
162 |
|
163 |
<label class="control-label">Select File</label>
|
164 |
|
165 |
<input type="hidden" name="distributor" value="BK">
|
166 |
<input type="file" name="file" id="file"><br>
|
167 |
|
168 |
<button class="btn btn-primary" id="uploadBtn">Upload</button>
|
169 |
|
170 |
|
171 |
|
172 |
</div>
|
173 |
</div>
|
174 |
</div>
|
175 |
</div>
|
176 |
|
177 |
</div>
|
178 |
</div>
|
179 |
|
180 |
|
181 |
|
182 |
</body>
|
183 |
</html> |