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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2838 by torben, Sun Jan 24 21:48:55 2016 UTC revision 2910 by torben, Wed Feb 3 22:32:05 2016 UTC
# Line 19  Line 19 
19    
20    
21  function loadTasks() {  function loadTasks() {
22          $.get("TaskServlet", function(data) {          $.get("rest/tasks/list", function(data) {
23                  //console.log(data);                  //console.log(data);
24                                    
25                                    
# Line 42  function loadTasks() { Line 42  function loadTasks() {
42                                                    
43                          html += "<div class='panel " + pclass + "'>";                          html += "<div class='panel " + pclass + "'>";
44                          html += "<div class='panel-heading'><h4 class='panel-title'>" + entry.description + "</h4></div>";                          html += "<div class='panel-heading'><h4 class='panel-title'>" + entry.description + "</h4></div>";
45                            html += "  <div class='panel-body'>";
46    
47                          html += entry.detail;                          html += entry.detail;
48                                                    
49                          html += "<br/><div style='font-size: 8px; margin: 7px;'>" + entry.state + "</div>";                          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>";                          html += "  </div>"; //panel-body
71                            html += "</div>"; //panel
72                                                    
73                  });                  });
74                  if (html == "") {                  if (html == "") {
# Line 73  function genUploadExtraData (previewId, Line 94  function genUploadExtraData (previewId,
94    
95  $(document).ready( function() {  $(document).ready( function() {
96          loadTasks();          loadTasks();
97          setInterval(loadTasks, 2500);          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({          $("#file").fileinput({
107                  //'showUpload':false,                  //'showUpload':false,
108                  'showRemove': false,                              'showRemove': false,            
# Line 100  $(document).ready( function() { Line 127  $(document).ready( function() {
127                  $('#file').fileinput('upload');                  $('#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>        </script>      
# Line 126  $(document).ready( function() { Line 168  $(document).ready( function() {
168          </div>          </div>
169        </div>        </div>
170                
171        <div class="col-sm-6" id="center" >        <div class="col-sm-6" id="center">
172          b        <pre id="logview">
173          </pre>
174        </div>        </div>
175                
176        <div class="col-sm-3" id="rightCol" >        <div class="col-sm-3" id="rightCol" >
177          <div class="panel panel-primary">          <div class="panel panel-primary">
178                  <div class="panel-heading">                  <div class="panel-heading">
179                          <h3 class="panel-title">Actions</h3>                          <h3 class="panel-title">Upload File</h3>
180                          </div>                          </div>
181                          <div class="panel-body">                          <div class="panel-body">
182                                                    
# Line 142  $(document).ready( function() { Line 185  $(document).ready( function() {
185                            <select class="form-control" id="distributor" name="distributor">                            <select class="form-control" id="distributor" name="distributor">
186                                  <option></option>                                  <option></option>
187                              <option>BK</option>                              <option>BK</option>
                           <!--  
188                              <option>DAO</option>                              <option>DAO</option>
189                              <option>FD</option>                              <option>FD</option>
190                              <option>NS</option>                              <option>NS</option>
                           -->  
191                            </select>                            </select>
192        
193                  <label for="writeback">Write-back:</label>                  <label for="writeback">Write-back:</label>
# Line 166  $(document).ready( function() { Line 207  $(document).ready( function() {
207                                                                    
208                                                    
209                          </div>                          </div>
210          </div>          </div> <!--  upload panel -->
211        </div>          
212      </div>            <div class="panel panel-primary">
213                    <div class="panel-heading">
214                            <h3 class="panel-title">Afstand anden rute</h3>
215                            </div>
216                            <div class="panel-body">
217                            
218                            
219                              <label for="distributor">Distributør:</label>
220                              <select class="form-control" id="afstand_distributor" name="afstand_distributor">
221                                    <option></option>
222                                <option>BK</option>
223                                <option>DAO</option>
224                              </select>
225                              <br>
226                              
227                              <button class="btn btn-primary" id="afstandBtn">Beregn</button>
228      
229                              
230                            </div>
231                    </div><!-- Afstand-andenrute panel -->
232                            
233            
234            
235          </div><!-- rightcol -->
236        </div> <!-- row -->
237                
238    </div>    </div><!-- body -->
239      
240      
241  </div>  </div>
242        
243    

Legend:
Removed from v.2838  
changed lines
  Added in v.2910

  ViewVC Help
Powered by ViewVC 1.1.20