/[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 2890 - (show annotations) (download) (as text)
Sun Jan 31 21:56:30 2016 UTC (8 years, 3 months ago) by torben
File MIME type: text/html
File size: 5127 byte(s)
Rest interface to afstandandenrute subsystem
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 $("#afstandBtn").click( function(){
108 var dist = $("#afstand_distributor").val();
109 if (dist == "") {
110 alert("Du skal vælge distributør");
111 return;
112 }
113
114
115 $.get("rest/commands/distancecalculation/" + dist);
116
117 });
118
119 });
120
121 </script>
122
123 </head>
124 <body>
125
126 <div class="container">
127 <div class="page-header">
128 <h1>Dao Adresse Vedligehold</h1>
129 </div>
130 <div id="body">
131 <div class="row">
132 <div class="col-sm-3" id="leftCol" >
133 <div class="panel panel-primary">
134 <div class="panel-heading">
135 <h3 class="panel-title">Queue</h3>
136 </div>
137 <div class="panel-body" id="queue">
138
139
140
141 </div>
142 </div>
143 </div>
144
145 <div class="col-sm-6" id="center" >
146 b
147 </div>
148
149 <div class="col-sm-3" id="rightCol" >
150 <div class="panel panel-primary">
151 <div class="panel-heading">
152 <h3 class="panel-title">Upload File</h3>
153 </div>
154 <div class="panel-body">
155
156
157 <label for="distributor">Distributør:</label>
158 <select class="form-control" id="distributor" name="distributor">
159 <option></option>
160 <option>BK</option>
161 <option>DAO</option>
162 <option>FD</option>
163 <option>NS</option>
164 </select>
165
166 <label for="writeback">Write-back:</label>
167 <select class="form-control" id="writeback" name="writeback">
168 <option value="false">Nej</option>
169 <option value="true">Ja</option>
170 </select>
171
172
173 <label class="control-label">Select File</label>
174
175 <input type="hidden" name="distributor" value="BK">
176 <input type="file" name="file" id="file"><br>
177
178 <button class="btn btn-primary" id="uploadBtn">Upload</button>
179
180
181
182 </div>
183 </div> <!-- upload panel -->
184
185 <div class="panel panel-primary">
186 <div class="panel-heading">
187 <h3 class="panel-title">Afstand anden rute</h3>
188 </div>
189 <div class="panel-body">
190
191
192 <label for="distributor">Distributør:</label>
193 <select class="form-control" id="afstand_distributor" name="afstand_distributor">
194 <option></option>
195 <option>BK</option>
196 <option>DAO</option>
197 </select>
198 <br>
199
200 <button class="btn btn-primary" id="afstandBtn">Beregn</button>
201
202
203 </div>
204 </div><!-- Afstand-andenrute panel -->
205
206
207
208 </div><!-- rightcol -->
209 </div> <!-- row -->
210
211 </div><!-- body -->
212
213
214 </div>
215
216
217
218 </body>
219 </html>

  ViewVC Help
Powered by ViewVC 1.1.20