/[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 2923 by torben, Thu Feb 4 22:00:00 2016 UTC
# Line 6  Line 6 
6          <link rel="stylesheet" href="webjars/bootstrap/3.3.5/css/bootstrap.min.css" />          <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" />          <link rel="stylesheet" href="webjars/bootstrap-fileinput/4.2.7/css/fileinput.min.css" />
9            
10            <style>
11            
12    @media (min-width: 1300px) {
13            .container {
14                width: 1300px; /*default 1170px*/
15            }
16    }
17            </style>
18    
19  <!--  use webjars for dependencies -->  <!--  use webjars for dependencies -->
20          <script src="webjars/jquery/2.1.4/jquery.js"></script>          <script src="webjars/jquery/2.1.4/jquery.js"></script>
# Line 19  Line 28 
28    
29    
30  function loadTasks() {  function loadTasks() {
31          $.get("TaskServlet", function(data) {          $.get("rest/tasks/list", function(data) {
32                  //console.log(data);                  //console.log(data);
33                                    
34                                    
# Line 41  function loadTasks() { Line 50  function loadTasks() {
50                                                    
51                                                    
52                          html += "<div class='panel " + pclass + "'>";                          html += "<div class='panel " + pclass + "'>";
53                          html += "<div class='panel-heading'><h4 class='panel-title'>" + entry.description + "</h4></div>";                          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                            html += "  <div class='panel-body'>";
60    
61                          html += entry.detail;                          html += entry.detail;
62                                                    
63                          html += "<br/><div style='font-size: 8px; margin: 7px;'>" + entry.state + "</div>";                          if (entry.state == "STATE_ABORTED")
64                                    html += "<br><div style='color: red'>" + entry.errorMessage + "</div>";
65                                    
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                            
77                            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                                                    
82                          html += "</div>";                          html += "  <div style='font-size: 8px; '>" + entry.state + viewlog + "</div>";
83                            
84                            html += "  </div>"; //panel-body
85                            html += "</div>"; //panel
86                                                    
87                  });                  });
88                  if (html == "") {                  if (html == "") {
# Line 73  function genUploadExtraData (previewId, Line 108  function genUploadExtraData (previewId,
108    
109  $(document).ready( function() {  $(document).ready( function() {
110          loadTasks();          loadTasks();
111          setInterval(loadTasks, 2500);          setInterval(loadTasks, 5000);
112            
113            
114            $(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            $(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          $("#file").fileinput({          $("#file").fileinput({
128                  //'showUpload':false,                  //'showUpload':false,
# Line 100  $(document).ready( function() { Line 148  $(document).ready( function() {
148                  $('#file').fileinput('upload');                  $('#file').fileinput('upload');
149          });          });
150                    
151            
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                    $.get("rest/commands/distancecalculation/" + dist, function() {
161                            loadTasks(); //Force reload of tasks immediately
162                    } );
163                    
164            });
165            
166  });  });
167    
168  </script>        </script>      
# Line 112  $(document).ready( function() { Line 175  $(document).ready( function() {
175      <h1>Dao Adresse Vedligehold</h1>      <h1>Dao Adresse Vedligehold</h1>
176    </div>    </div>
177    <div id="body">    <div id="body">
178      <div class="row">      <div class="row">
179        <div class="col-sm-3" id="leftCol" >        <div class="col-sm-3" id="leftCol" >
180          <div class="panel panel-primary">          <div class="panel panel-primary">
181                  <div class="panel-heading">                  <div class="panel-heading">
# Line 126  $(document).ready( function() { Line 189  $(document).ready( function() {
189          </div>          </div>
190        </div>        </div>
191                
192        <div class="col-sm-6" id="center" >        <div class="col-sm-6" id="center">
193          b        <pre id="logview">
194          </pre>
195        </div>        </div>
196                
197        <div class="col-sm-3" id="rightCol" >        <div class="col-sm-3" id="rightCol" >
198          <div class="panel panel-primary">          <div class="panel panel-primary">
199                  <div class="panel-heading">                  <div class="panel-heading">
200                          <h3 class="panel-title">Actions</h3>                          <h3 class="panel-title">Upload File</h3>
201                          </div>                          </div>
202                          <div class="panel-body">                          <div class="panel-body">
203                                                    
# Line 142  $(document).ready( function() { Line 206  $(document).ready( function() {
206                            <select class="form-control" id="distributor" name="distributor">                            <select class="form-control" id="distributor" name="distributor">
207                                  <option></option>                                  <option></option>
208                              <option>BK</option>                              <option>BK</option>
                           <!--  
209                              <option>DAO</option>                              <option>DAO</option>
210                              <option>FD</option>                              <option>FD</option>
211                              <option>NS</option>                              <option>NS</option>
                           -->  
212                            </select>                            </select>
213        
214                  <label for="writeback">Write-back:</label>                  <label for="writeback">Write-back:</label>
# Line 166  $(document).ready( function() { Line 228  $(document).ready( function() {
228                                                                    
229                                                    
230                          </div>                          </div>
231          </div>          </div> <!--  upload panel -->
232        </div>          
233      </div>            <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                
259    </div>    </div><!-- body -->
260      
261      
262  </div>  </div>
263        
264    

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

  ViewVC Help
Powered by ViewVC 1.1.20