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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20