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

  ViewVC Help
Powered by ViewVC 1.1.20