1<?php 2 3/** 4 * 5 * bareos-webui - Bareos Web-Frontend 6 * 7 * @link https://github.com/bareos/bareos for the canonical source repository 8 * @copyright Copyright (c) 2013-2020 Bareos GmbH & Co. KG (http://www.bareos.org/) 9 * @license GNU Affero General Public License (http://www.gnu.org/licenses/) 10 * 11 * This program is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Affero General Public License as published by 13 * the Free Software Foundation, either version 3 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Affero General Public License for more details. 20 * 21 * You should have received a copy of the GNU Affero General Public License 22 * along with this program. If not, see <http://www.gnu.org/licenses/>. 23 * 24 */ 25 26$title = 'Job details'; 27$this->headTitle($title); 28 29?> 30 31<ul class="nav nav-tabs"> 32 <li class="active"><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('Show'); ?></a></li> 33 <li><a href="<?php echo $this->url('job', array('action'=>'actions')); ?>"><?php echo $this->translate('Actions'); ?></a></li> 34 <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li> 35</ul> 36 37<br /> 38 39<?php if($this->acl_alert) : echo $this->ACLAlert($this->invalid_commands); elseif(!$this->acl_alert) : ?> 40 41<!-- Job --> 42<div class="row"> 43 44<div class="col-md-12"> 45 46<div class="panel panel-default"> 47 48<div class="panel-heading"> 49<h3 class="panel-title"><?php echo $this->translate("Job"); ?></h3> 50</div> 51 52<div class="panel-body"> 53 54<table class="table table-no-bordered table-hover" id="jobdetails"> 55 56<thead class="bg-primary"> 57 <th><?php echo $this->translate("Job ID"); ?></th> 58 <th><?php echo $this->translate("Job name"); ?></th> 59 <th><?php echo $this->translate("Client"); ?></th> 60 <th><?php echo $this->translate("Type"); ?></th> 61 <th><?php echo $this->translate("Level"); ?></th> 62 <th><?php echo $this->translate("Files"); ?></th> 63 <th><?php echo $this->translate("Bytes"); ?></th> 64 <th><?php echo $this->translate("Errors"); ?></th> 65 <th><?php echo $this->translate("Status"); ?></th> 66 <th><?php echo $this->translate("Actions"); ?></th> 67</thead> 68 69</table> 70 71</div> 72</div> 73</div> 74</div> 75 76<div class="row"> 77 78 <div class="col-md-8"> 79 <div class="panel panel-default"> 80 <div class="panel-heading"> 81 <h3 class="panel-title"><?php echo $this->translate("Messages"); ?></h3> 82 </div> 83 <div class="panel-body"> 84 <table class="table table-no-bordered table-hover" id="joblog"> 85 <thead class="bg-primary"> 86 <th>#</th> 87 <th><?php echo $this->translate("Timestamp"); ?></th> 88 <th><?php echo $this->translate("Message"); ?></th> 89 </thead> 90 </table> 91 </div> 92 </div> 93 </div> 94 95 <div class="col-md-4"> 96 <div class="panel panel-default"> 97 <div class="panel-heading"> 98 <h3 class="panel-title"><?php echo $this->translate("Used Volumes"); ?></h3> 99 </div> 100 <div class="panel-body"> 101 <table class="table table-no-bordered table-hover" id="jobmedia"> 102 <thead class="bg-primary"> 103 <th><?php echo $this->translate("Volume"); ?></th> 104 </thead> 105 </table> 106 </div> 107 </div> 108 </div> 109 110</div> 111 112 113<?php 114 echo $this->headScript()->prependFile($this->basePath() . '/js/custom-functions.js'); 115 echo $this->headLink()->prependStylesheet($this->basePath() . '/css/bootstrap-table.min.css'); 116 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table-formatter.js'); 117 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table-locale-all.min.js'); 118 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table-cookie.min.js'); 119 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table.min.js'); 120?> 121 122<!-- modal-001 start --> 123<div id="modal-001" class="modal fade modal-001" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel"> 124 <div class="modal-dialog modal-md"> 125 <div class="modal-content"> 126 <div class="modal-header"> 127 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> 128 <h4 class="modal-title" id="myModalLabel"><?php echo $this->translate("Failed to retrieve data from Bareos director"); ?></h4> 129 </div> 130 <div class="modal-body"> 131 <p><?php echo $this->translate("Error message received from director:"); ?></p> 132 <p class="text-danger"><?php echo $this->translate("Failed to send result as json. Maybe the result message is too long?"); ?></p> 133 </div> 134 <div class="modal-footer"> 135 <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->translate("Close"); ?></button> 136 </div> 137 </div> 138 </div> 139</div> 140<!-- modal-001 end --> 141 142<script> 143 144 var basePath = "<?php echo $this->basePath(); ?>"; 145 146 function detailFormatterJobDetails(index, row) { 147 var html = []; 148 html.push('<div class="container-fluid">'); 149 html.push('<table class="table table-bordered">'); 150 html.push('<tr>'); 151 html.push('<th><?php echo addslashes($this->translate("Fileset")); ?></th>'); 152 html.push('<td><a href="<?php echo $this->basePath() . '/fileset/details/'; ?>' + row.filesetid + '">' + row.fileset +'</a></td>'); 153 html.push('</tr>'); 154 html.push('<tr>'); 155 html.push('<th><?php echo addslashes($this->translate("Pool")); ?></th>'); 156 html.push('<td><a href="<?php echo $this->basePath() . '/pool/details/'; ?>' + row.poolname + '">' + row.poolname + '</a></td>'); 157 html.push('</tr>'); 158 html.push('<tr>'); 159 html.push('<th><?php echo addslashes($this->translate("Scheduled")); ?></th>'); 160 html.push('<td>' + row.schedtime + '</td>'); 161 html.push('</tr>'); 162 html.push('<tr>'); 163 html.push('<th><?php echo addslashes($this->translate("Start")); ?></th>'); 164 html.push('<td>' + row.starttime + '</td>'); 165 html.push('</tr>'); 166 html.push('<tr>'); 167 html.push('<th><?php echo addslashes($this->translate("End")); ?></th>'); 168 html.push('<td>' + row.endtime + '</td>'); 169 html.push('</tr>'); 170 html.push('</table>'); 171 html.push('</div>'); 172 return html.join(''); 173 } 174 175 function attachJobDetailsTable() { 176 $('#jobdetails').bootstrapTable({ 177 locale: '<?php echo str_replace('_','-', $_SESSION['bareos']['locale']); ?>', 178 url: '<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=details&jobid='.$this->jobid; ?>', 179 method: 'get', 180 dataType: 'json', 181 detailView: true, 182 detailFormatter: 'detailFormatterJobDetails', 183 columns: [ 184 { 185 field: 'jobid', 186 }, 187 { 188 field: 'name', 189 formatter: function(value) { 190 return formatJobName(value, basePath); 191 } 192 }, 193 { 194 field: 'client', 195 formatter: function(value) { 196 return formatClientName(value, basePath); 197 } 198 }, 199 { 200 field: 'type', 201 formatter: function(value) { 202 return formatJobType(value); 203 } 204 }, 205 { 206 field: 'level', 207 formatter: function(value) { 208 return formatJobLevel(value); 209 } 210 }, 211 { 212 field: 'jobfiles', 213 }, 214 { 215 field: 'jobbytes', 216 formatter: function(value) { 217 return formatBytes(value); 218 } 219 }, 220 { 221 field: 'joberrors', 222 }, 223 { 224 field: 'jobstatus', 225 formatter: function(value) { 226 return formatJobStatus(value); 227 } 228 }, 229 { 230 field: 'action', 231 formatter: function(value, row, index) { 232 return jobActionButtonsFormatter(value, row, index, basePath); 233 } 234 } 235 ] 236 }); 237 } 238 239 function attachJobLogTable() { 240 $('#joblog').bootstrapTable({ 241 locale: '<?php echo str_replace('_','-', $_SESSION['bareos']['locale']); ?>', 242 cookie: <?php echo $_SESSION['bareos']['dt_statesave']; ?>, 243 cookieIdTable: 'job_table_job_log', 244 url: '<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=logs&jobid='.$this->jobid; ?>', 245 method: 'get', 246 dataType: 'json', 247 pagination : true, 248 sidePagination: 'client', 249 pageList: [ <?php echo $_SESSION['bareos']['dt_lengthmenu']; ?> ], 250 pageSize: <?php echo $_SESSION['bareos']['dt_pagelength']; ?>, 251 search: true, 252 sortName: 'id', 253 sortOrder: 'desc', 254 columns: [ 255 { 256 field: 'id', 257 sortable: true, 258 }, 259 { 260 field: 'time' 261 }, 262 { 263 field: 'logtext', 264 formatter: function(value) { 265 return formatLogMessage(value); 266 } 267 } 268 ] 269 }); 270 } 271 272 function attachJobMediaTable() { 273 $('#jobmedia').bootstrapTable({ 274 locale: '<?php echo str_replace('_','-', $_SESSION['bareos']['locale']); ?>', 275 cookie: <?php echo $_SESSION['bareos']['dt_statesave']; ?>, 276 cookieIdTable: 'job_table_job_media', 277 url: '<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=jobmedia&jobid='.$this->jobid; ?>', 278 method: 'get', 279 dataType: 'json', 280 pagination : true, 281 sidePagination: 'client', 282 pageList: [ <?php echo $_SESSION['bareos']['dt_lengthmenu']; ?> ], 283 pageSize: <?php echo $_SESSION['bareos']['dt_pagelength']; ?>, 284 search: true, 285 sortName: 'volumename', 286 sortOrder: 'asc', 287 columns: [ 288 { 289 field: 'volumename', 290 sortable: true, 291 formatter: function(value) { 292 return formatVolumeName(value, basePath); 293 } 294 } 295 ] 296 }); 297 } 298 299 $(document).ready(function() { 300 301 setDtTextDomain('<?php echo $this->basePath() . '/js/locale'; ?>'); 302 setDtLocale('<?php echo $_SESSION['bareos']['locale']; ?>'); 303 304 attachJobDetailsTable(); 305 attachJobLogTable(); 306 attachJobMediaTable(); 307 308 }); 309 310 $('#joblog').on('load-error.bs.table', function(status, res) { 311 $("#modal-001").modal(); 312 }); 313 314</script> 315 316<?php endif; ?> 317