From: Marcin Haba Date: Wed, 30 Dec 2015 07:27:41 +0000 (+0100) Subject: baculum: Add support for terminated with warnings job status X-Git-Tag: Release-7.4.0~69 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f57292c44d8caefe09bc4a798d87510e3e29636e;p=bacula%2Fbacula baculum: Add support for terminated with warnings job status --- diff --git a/gui/baculum/protected/Class/Miscellaneous.php b/gui/baculum/protected/Class/Miscellaneous.php index 1767f1ebb3..957e85b998 100644 --- a/gui/baculum/protected/Class/Miscellaneous.php +++ b/gui/baculum/protected/Class/Miscellaneous.php @@ -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'), diff --git a/gui/baculum/protected/Portlets/JobList.php b/gui/baculum/protected/Portlets/JobList.php index c5df9f4035..b3482ec7c5 100644 --- a/gui/baculum/protected/Portlets/JobList.php +++ b/gui/baculum/protected/Portlets/JobList.php @@ -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; + } } ?> diff --git a/gui/baculum/protected/Portlets/JobList.tpl b/gui/baculum/protected/Portlets/JobList.tpl index e79d97f9ff..5d46b31d30 100644 --- a/gui/baculum/protected/Portlets/JobList.tpl +++ b/gui/baculum/protected/Portlets/JobList.tpl @@ -51,7 +51,7 @@ -
<%=isset($this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value']) ? $this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value'] : ''%>
+
<%=$this->getPage()->JobWindow->getJobStatusValue($this->getParent()->Data)%>