]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Add support for terminated with warnings job status
authorMarcin Haba <marcin.haba@bacula.pl>
Wed, 30 Dec 2015 07:27:41 +0000 (08:27 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Wed, 30 Dec 2015 07:27:41 +0000 (08:27 +0100)
gui/baculum/protected/Class/Miscellaneous.php
gui/baculum/protected/Portlets/JobList.php
gui/baculum/protected/Portlets/JobList.tpl

index 1767f1ebb3aceefe19ebc9e516d8a64dbef878a7..957e85b9983079cae7dbb982e1fae50a02d77c54 100644 (file)
@@ -52,7 +52,7 @@ class Miscellaneous extends TModule {
                'R' => array('value' => 'Running', 'description' => 'Running'),
                'B' => array('value' => 'Blocked', 'description' => 'Blocked'),
                'T' => array('value' => 'Terminated', 'description' =>'Terminated normally'),
-               'W' => array('value' => 'Terminated with warnings', 'description' =>'Terminated normally with warnings'),
+               'W' => array('value' => 'Terminated', 'description' =>'Terminated normally with warnings'),
                'E' => array('value' => 'Error', 'description' =>'Terminated in Error'),
                'e' => array('value' => 'Non-fatal error', 'description' =>'Non-fatal error'),
                'f' => array('value' => 'Fatal error', 'description' =>'Fatal error'),
index c5df9f4035dbdd36704c4135f60d39e7dad2cbfc..b3482ec7c5ff4583dd92a16a4a36627661003d94 100644 (file)
@@ -144,5 +144,35 @@ class JobList extends Portlets implements ISlideWindow {
                }
                return $name;
        }
+
+       public function getJobStatusLetter($job) {
+               $statusLetter = '';
+               if (array_key_exists('jobstatus', $job)) {
+                       $errors = intval($job['joberrors']);
+                       if ($job['jobstatus'] === 'T' && $errors > 0) {
+                               $job['jobstatus'] = 'W';
+                       }
+                       $statusLetter = $job['jobstatus'];
+               }
+               return $statusLetter;
+       }
+
+       public function getJobStatusValue($job) {
+               $statusValue = '';
+               $jobLetter = $this->getJobStatusLetter($job);
+               if (array_key_exists($jobLetter, $this->jobStates)) {
+                       $statusValue = $this->jobStates[$jobLetter]['value'];
+               }
+               return $statusValue;
+       }
+
+       public function getJobStatusDescription($job) {
+               $statusDescription = '';
+               $jobLetter = $this->getJobStatusLetter($job);
+               if (array_key_exists($jobLetter, $this->jobStates)) {
+                       $statusDescription = $this->jobStates[$jobLetter]['description'];
+               }
+               return $statusDescription;
+       }
 }
 ?>
index e79d97f9ff214511b89c272d4a2b9cd413fd5829..5d46b31d300eda181836166819877940f30e2f72 100644 (file)
@@ -51,7 +51,7 @@
                </com:TActiveTemplateColumn>
                <com:TActiveTemplateColumn HeaderText="<%[ Job status ]%>" SortExpression="jobstatus">
                        <prop:ItemTemplate>
-                               <div class="job-status-<%=isset($this->getParent()->Data['jobstatus']) ? $this->getParent()->Data['jobstatus'] : ''%>" title="<%=isset($this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['description']) ? $this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['description'] : ''%>"><%=isset($this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value']) ? $this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value'] : ''%></div>
+                               <div class="job-status-<%=$this->getPage()->JobWindow->getJobStatusLetter($this->getParent()->Data)%>" title="<%=$this->getPage()->JobWindow->getJobStatusDescription($this->getParent()->Data)%>"><%=$this->getPage()->JobWindow->getJobStatusValue($this->getParent()->Data)%></div>
                        </prop:ItemTemplate>
                </com:TActiveTemplateColumn>
                <com:TActiveTemplateColumn HeaderText="<%[ Size ]%>" SortExpression="jobbytes">