/[projects]/dao/DaoAdresseVedligehold/src/main/webapp/index.html
ViewVC logotype

Contents of /dao/DaoAdresseVedligehold/src/main/webapp/index.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2917 - (show annotations) (download) (as text)
Thu Feb 4 14:21:30 2016 UTC (8 years, 3 months ago) by torben
File MIME type: text/html
File size: 6267 byte(s)
Better use of screen space
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("rest/tasks/list", 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 html += " <div class='panel-body'>";
46
47 html += entry.detail;
48
49 if (entry.state == "STATE_ABORTED")
50 html += "<br><div style='color: red'>" + entry.errorMessage + "</div>";
51
52 if (entry.state == "STATE_RUNNING") {
53 if (entry.percentCompleted >= 0) {
54 var percent = entry.percentCompleted.toFixed(2);
55 html += "<div class='progress'>";
56 html += "<div class='progress-bar' role='progressbar' aria-valuenow='" + percent + "' aria-valuemin='0' aria-valuemax='100' style='width:" + percent + "%'> " ;
57 html += percent + "%";
58 html += " </div>";
59 html += "</div>";
60 }
61 }
62
63 var viewlog = "";
64 if (entry.state == "STATE_RUNNING" || entry.state == "STATE_DONE" || entry.state == "STATE_ABORTED") {
65 viewlog = "<span style='float: right'><a href='#' class='viewlog' taskid='" + entry.id+ "'>Log</a></span>";
66 }
67
68 html += " <div style='font-size: 8px; '>" + entry.state + viewlog + "</div>";
69
70 html += " </div>"; //panel-body
71 html += "</div>"; //panel
72
73 });
74 if (html == "") {
75 html = "<div class='panel panel-primary'>Queue is empty</div>";
76 }
77
78 $("#queue").html(html);
79
80 }, "json");
81 }
82
83 function genUploadExtraData (previewId, index) {
84 var dist = $("#distributor").val();
85 var wb = $("#writeback").val();
86
87 var obj = {
88 distributor: dist,
89 writeback: wb
90 };
91
92 return obj;
93 }
94
95 $(document).ready( function() {
96 loadTasks();
97 setInterval(loadTasks, 5000);
98
99
100 $(document).on('click', '.viewlog', function(event) { // Bind future elements
101 var taskid = $(this).attr('taskid');
102 $("#logview").load('rest/tasks/log/' + taskid);
103
104 });
105
106 $("#file").fileinput({
107 //'showUpload':false,
108 'showRemove': false,
109 'showPreview': false,
110 'showUpload': false,
111 'uploadUrl': 'FileUploadServlet',
112 'uploadExtraData': genUploadExtraData, //brug callback til at finde ekstra data
113
114 'maxFileCount': 1,
115 'minFileCount': 1
116
117
118 });
119
120 $("#uploadBtn").click( function() {
121 var dist = $("#distributor").val();
122 if (dist == "") {
123 alert("Du skal vælge distributør");
124 return;
125 }
126
127 $('#file').fileinput('upload');
128 });
129
130
131 $("#afstandBtn").click( function(){
132 var dist = $("#afstand_distributor").val();
133 if (dist == "") {
134 alert("Du skal vælge distributør");
135 return;
136 }
137
138
139 $.get("rest/commands/distancecalculation/" + dist, function() {
140 loadTasks(); //Force reload of tasks immediately
141 } );
142
143 });
144
145 });
146
147 </script>
148
149 </head>
150 <body>
151
152 <div class="container-fluid">
153 <div class="page-header">
154 <h1>Dao Adresse Vedligehold</h1>
155 </div>
156 <div id="body">
157 <div class="row">
158 <div class="col-sm-1" id="leftCol-blank" >
159 </div>
160
161 <div class="col-sm-2" id="leftCol" >
162 <div class="panel panel-primary">
163 <div class="panel-heading">
164 <h3 class="panel-title">Queue</h3>
165 </div>
166 <div class="panel-body" id="queue">
167
168
169
170 </div>
171 </div>
172 </div>
173
174 <div class="col-sm-6" id="center">
175 <pre id="logview">
176 </pre>
177 </div>
178
179 <div class="col-sm-2" id="rightCol" >
180 <div class="panel panel-primary">
181 <div class="panel-heading">
182 <h3 class="panel-title">Upload File</h3>
183 </div>
184 <div class="panel-body">
185
186
187 <label for="distributor">Distributør:</label>
188 <select class="form-control" id="distributor" name="distributor">
189 <option></option>
190 <option>BK</option>
191 <option>DAO</option>
192 <option>FD</option>
193 <option>NS</option>
194 </select>
195
196 <label for="writeback">Write-back:</label>
197 <select class="form-control" id="writeback" name="writeback">
198 <option value="false">Nej</option>
199 <option value="true">Ja</option>
200 </select>
201
202
203 <label class="control-label">Select File</label>
204
205 <input type="hidden" name="distributor" value="BK">
206 <input type="file" name="file" id="file"><br>
207
208 <button class="btn btn-primary" id="uploadBtn">Upload</button>
209
210
211
212 </div>
213 </div> <!-- upload panel -->
214
215 <div class="panel panel-primary">
216 <div class="panel-heading">
217 <h3 class="panel-title">Afstand anden rute</h3>
218 </div>
219 <div class="panel-body">
220
221
222 <label for="distributor">Distributør:</label>
223 <select class="form-control" id="afstand_distributor" name="afstand_distributor">
224 <option></option>
225 <option>BK</option>
226 <option>DAO</option>
227 </select>
228 <br>
229
230 <button class="btn btn-primary" id="afstandBtn">Beregn</button>
231
232
233 </div>
234 </div><!-- Afstand-andenrute panel -->
235
236
237
238 </div><!-- rightcol -->
239 </div> <!-- row -->
240
241 </div><!-- body -->
242
243
244 </div>
245
246
247
248 </body>
249 </html>

  ViewVC Help
Powered by ViewVC 1.1.20