]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add new columns to job list page - idea proposed by Sergey Zhidkov
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 26 Jun 2021 08:06:05 +0000 (10:06 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:25 +0000 (09:03 +0100)
Changes:
 - new job list columns:
   = Job type
   = Enabled
   = Max. concur. jobs
   = Priority

gui/baculum/protected/Web/Pages/JobList.page
gui/baculum/protected/Web/Pages/JobList.php

index 43a891889b849ec095881a0a63a8489a37ab291b..8e976d361fb6f8e44bf1f3522cc0bad32cfceaf6 100644 (file)
                                        <th></th>
                                        <th><%[ Status ]%></th>
                                        <th><%[ Name ]%></th>
-                                       <th><%[ Director ]%></th>
+                                       <th><%[ Type ]%></th>
+                                       <th><%[ Enabled ]%></th>
+                                       <th>Max. concur. jobs</th>
+                                       <th><%[ Priority ]%></th>
                                        <th><%[ Actions ]%></th>
                                </tr>
                        </thead>
                                        <th></th>
                                        <th><%[ Status ]%></th>
                                        <th><%[ Name ]%></th>
-                                       <th><%[ Director ]%></th>
+                                       <th><%[ Type ]%></th>
+                                       <th><%[ Enabled ]%></th>
+                                       <th>Max. concur. jobs</th>
+                                       <th><%[ Priority ]%></th>
                                        <th><%[ Actions ]%></th>
                                </tr>
                        </tfoot>
@@ -103,7 +109,23 @@ var oJobList = {
                                        }.bind(this)
                                },
                                {data: 'job'},
-                               {data: 'director'},
+                               {
+                                       data: 'type',
+                                       render: function(data, type, row) {
+                                               return JobType.get_type(data);
+                                       }
+                               },
+                               {
+                                       data: 'enabled',
+                                       render: function(data, type, row) {
+                                               return (data == 1 ? '<%[ Yes ]%>' : '<%[ No ]%>');
+                                       }
+                               },
+                               {data: 'maxjobs'},
+                               {
+                                       data: 'priority',
+                                       visible: false
+                               },
                                {
                                        data: 'job',
                                        render: function(data, type, row) {
@@ -133,11 +155,11 @@ var oJobList = {
                        },
                        {
                                className: "dt-center",
-                               targets: [ 1, 4 ]
+                               targets: [ 1, 3, 4, 5, 6, 7 ]
                        }],
                        order: [2, 'asc'],
                        initComplete: function () {
-                               this.api().columns([2, 3]).every(function () {
+                               this.api().columns([2, 3, 4, 5, 6]).every(function () {
                                        var column = this;
                                        var select = $('<select><option value=""></option></select>')
                                        .appendTo($(column.footer()).empty())
@@ -149,7 +171,7 @@ var oJobList = {
                                                .search(val ? '^' + val + '$' : '', true, false)
                                                .draw();
                                        });
-                                       column.data().unique().sort().each(function (d, j) {
+                                       column.cells('', column[0]).render('display').unique().sort().each(function(d, j) {
                                                if (column.search() == '^' + dtEscapeRegex(d) + '$') {
                                                        select.append('<option value="' + d + '" selected>' + d + '</option>');
                                                } else {
index 760c3889203a2277d16ae1406dc2edb037d7c7e7..f32cab5b561140a7c79b956950e70e83ab32ae19 100644 (file)
@@ -42,12 +42,18 @@ class JobList extends BaculumWebPage {
                        return;
                }
                $result = $this->getModule('api')->get(
-                       array('jobs', 'resnames'), null, true, self::USE_CACHE
-               )->output;
-               $jobs = array();
-               foreach ($result as $director => $job_list) {
-                       for ($i = 0; $i < count($job_list); $i++) {
-                               $jobs[] = array('director' => $director, 'job' => $job_list[$i]);
+                       ['jobs', 'show', '?output=json'], null, true, self::USE_CACHE
+               );
+               $jobs = [];
+               if ($result->error === 0) {
+                       for ($i = 0; $i < count($result->output); $i++) {
+                               $jobs[] = [
+                                       'job' => $result->output[$i]->name,
+                                       'enabled' => $result->output[$i]->enabled,
+                                       'priority' => $result->output[$i]->priority,
+                                       'type' => chr($result->output[$i]->jobtype),
+                                       'maxjobs' => $result->output[$i]->maxjobs
+                               ];
                        }
                }
                $this->jobs = $jobs;