]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Use new APIv2 status client request on job history view page
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 7 Mar 2021 09:53:48 +0000 (10:53 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 7 Mar 2021 12:06:24 +0000 (13:06 +0100)
gui/baculum/protected/Web/Pages/JobHistoryView.php

index b289859bb90adc1b39df0d3a12e4724b45352d49..bcc6c20ef10eec0b10c3edd088fbba4d56635012 100644 (file)
@@ -130,38 +130,27 @@ class JobHistoryView extends BaculumWebPage {
                        'is_running' => $this->is_running
                );
                if ($this->is_running) {
-                       // Don't call client if job isn't running
-                       $client_name = null;
-                       $client = $this->getModule('api')->get(
-                               array('clients', $clientid)
+                       $query_str = '?output=json&type=header';
+                       $graph_status = $this->getModule('api')->get(
+                               ['clients', $clientid, 'status', $query_str]
                        );
-                       if ($client->error === 0) {
-                               $client_name = $client->output->name;
-                       }
-
-                       if (is_string($client_name)) {
-                               $query_str = '?name=' . rawurlencode($client_name) . '&type=header';
-                               $graph_status = $this->getModule('api')->get(
-                                       array('status', 'client', $query_str)
-                               );
 
-                               if ($graph_status->error === 0) {
-                                       $running_job_status['header'] = $graph_status->output;
-                               }
+                       if ($graph_status->error === 0) {
+                               $running_job_status['header'] = $graph_status->output;
+                       }
 
-                               $query_str = '?name=' . rawurlencode($client_name) . '&type=running';
-                               $graph_status = $this->getModule('api')->get(
-                                       array('status', 'client', $query_str)
-                               );
-                               if ($graph_status->error === 0) {
-                                       $jobid = $this->getJobId();
-                                       for ($i = 0; $i < count($graph_status->output); $i++) {
-                                               foreach ($graph_status->output[$i] as $key => $val) {
-                                                       $prop = strtolower($key);
-                                                       if ($prop === 'jobid' && intval($val) == $jobid) {
-                                                               $running_job_status['job'] = $graph_status->output[$i];
-                                                               break 2;
-                                                       }
+                       $query_str = '?output=json&type=running';
+                       $graph_status = $this->getModule('api')->get(
+                               ['clients', $clientid, 'status', $query_str]
+                       );
+                       if ($graph_status->error === 0) {
+                               $jobid = $this->getJobId();
+                               for ($i = 0; $i < count($graph_status->output); $i++) {
+                                       foreach ($graph_status->output[$i] as $key => $val) {
+                                               $prop = strtolower($key);
+                                               if ($prop === 'jobid' && intval($val) == $jobid) {
+                                                       $running_job_status['job'] = $graph_status->output[$i];
+                                                       break 2;
                                                }
                                        }
                                }