diff options
author | Frank Bergkemper <frank.bergkemper@bareos.com> | 2018-04-20 13:04:28 +0300 |
---|---|---|
committer | Frank Bergkemper <frank.bergkemper@bareos.com> | 2018-04-23 15:01:57 +0300 |
commit | 61ee062b350167605e801918e0f7db46ef354c62 (patch) | |
tree | d71fbb936a4c1adacd887f10cd5cee49103b42fc | |
parent | 59eccff78769c9bf734875dd969bb4cd45a41ea2 (diff) |
Warnings handled seperately
Jobs with a status 'Warning' or 'Canceled' are handled seperately now.
Following Job Status fall into the category warning.
JS_Warnings - W - Terminated normally with warnings
JS_Canceled - A - Canceled by user
-rw-r--r-- | module/Dashboard/src/Dashboard/Controller/DashboardController.php | 11 | ||||
-rw-r--r-- | module/Dashboard/view/dashboard/dashboard/index.phtml | 6 | ||||
-rw-r--r-- | module/Dashboard/view/partial/JobsPast24h.phtml | 23 | ||||
-rw-r--r-- | module/Job/src/Job/Controller/JobController.php | 14 | ||||
-rw-r--r-- | module/Job/src/Job/Form/JobForm.php | 5 |
5 files changed, 47 insertions, 12 deletions
diff --git a/module/Dashboard/src/Dashboard/Controller/DashboardController.php b/module/Dashboard/src/Dashboard/Controller/DashboardController.php index 4246ccb..e8c92fb 100644 --- a/module/Dashboard/src/Dashboard/Controller/DashboardController.php +++ b/module/Dashboard/src/Dashboard/Controller/DashboardController.php @@ -105,6 +105,7 @@ class DashboardController extends AbstractActionController $waiting = null; $running = null; $successful = null; + $warning = null; $failed = null; $result = null; @@ -138,20 +139,24 @@ class DashboardController extends AbstractActionController // successful $jobs_T = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'T', $days, $hours); + $successful = count($jobs_T); + + // warning + $jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'A', $days, $hours); $jobs_W = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'W', $days, $hours); - $successful = count($jobs_T) + count($jobs_W); + $warning = count($jobs_A) + count($jobs_W); // failed - $jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'A', $days, $hours); $jobs_E = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'E', $days, $hours); $jobs_e = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'e', $days, $hours); $jobs_f = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'f', $days, $hours); - $failed = count($jobs_A) + count($jobs_E) + count($jobs_e) + count($jobs_f); + $failed = count($jobs_E) + count($jobs_e) + count($jobs_f); // json result $result['waiting'] = $waiting; $result['running'] = $running; $result['successful'] = $successful; + $result['warning'] = $warning; $result['failed'] = $failed; } catch(Exception $e) { diff --git a/module/Dashboard/view/dashboard/dashboard/index.phtml b/module/Dashboard/view/dashboard/dashboard/index.phtml index 9cd72b7..1d9a86e 100644 --- a/module/Dashboard/view/dashboard/dashboard/index.phtml +++ b/module/Dashboard/view/dashboard/dashboard/index.phtml @@ -65,6 +65,8 @@ $this->headTitle($title); $('.running-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>"); $('.successful-jobs-field').empty(); $('.successful-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>"); + $('.warning-jobs-field').empty(); + $('.warning-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>"); $('.failed-jobs-field').empty(); $('.failed-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>"); }); @@ -89,6 +91,10 @@ $this->headTitle($title); $('.successful-jobs-field').append( data.successful ); + $('.warning-jobs-field').empty(); + $('.warning-jobs-field').append( + data.warning + ); $('.failed-jobs-field').empty(); $('.failed-jobs-field').append( data.failed diff --git a/module/Dashboard/view/partial/JobsPast24h.phtml b/module/Dashboard/view/partial/JobsPast24h.phtml index 0fb654f..8170ae0 100644 --- a/module/Dashboard/view/partial/JobsPast24h.phtml +++ b/module/Dashboard/view/partial/JobsPast24h.phtml @@ -37,9 +37,11 @@ <div class="container-fluid block"> + <div class="center-block"> + <div class="row"> - <div class="col-md-3 text-center"> + <div class="col-md-2 text-center"> <h4> <span class="label label-info"><?php echo $this->translate('Running'); ?></span> </h4> @@ -50,7 +52,7 @@ </h3> </div> - <div class="col-md-3 text-center"> + <div class="col-md-2 text-center"> <h4> <span class="label label-default"><?php echo $this->translate('Waiting'); ?></span> </h4> @@ -61,7 +63,7 @@ </h3> </div> - <div class="col-md-3 text-center"> + <div class="col-md-2 text-center"> <h4> <span class="label label-success"><?php echo $this->translate('Successful'); ?></span> </h4> @@ -72,7 +74,18 @@ </h3> </div> - <div class="col-md-3 text-center"> + <div class="col-md-2 text-center"> + <h4> + <span class="label label-warning"><?php echo $this->translate('Warning'); ?></span> + </h4> + <h3> + <a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'warning'))); ?>"> + <span class="warning-jobs-field"></span> + </a> + </h3> + </div> + + <div class="col-md-2 text-center"> <h4> <span class="label label-danger"><?php echo $this->translate('Failed'); ?></span> </h4> @@ -85,6 +98,8 @@ </div> + </div> + </div> </div> diff --git a/module/Job/src/Job/Controller/JobController.php b/module/Job/src/Job/Controller/JobController.php index 24c936e..1b37f21 100644 --- a/module/Job/src/Job/Controller/JobController.php +++ b/module/Job/src/Job/Controller/JobController.php @@ -418,8 +418,17 @@ class JobController extends AbstractActionController elseif($data == "jobs" && $status == "successful") { try { $jobs_T = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'T', $period, null); // Terminated + $result = $jobs_T; + } + catch(Exception $e) { + echo $e->getMessage(); + } + } + elseif($data == "jobs" && $status == "warning") { + try { + $jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'A', $period, null); // Terminated $jobs_W = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'W', $period, null); // Terminated with warnings - $result = array_merge($jobs_T, $jobs_W); + $result = array_merge($jobs_A, $jobs_W); } catch(Exception $e) { echo $e->getMessage(); @@ -427,11 +436,10 @@ class JobController extends AbstractActionController } elseif($data == "jobs" && $status == "unsuccessful") { try { - $jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'A', $period, null); // Canceled jobs $jobs_E = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'E', $period, null); // $jobs_e = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'e', $period, null); // $jobs_f = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'f', $period, null); // - $result = array_merge($jobs_A, $jobs_E, $jobs_e, $jobs_f); + $result = array_merge($jobs_E, $jobs_e, $jobs_f); } catch(Exception $e) { echo $e->getMessage(); diff --git a/module/Job/src/Job/Form/JobForm.php b/module/Job/src/Job/Form/JobForm.php index c63fd84..d9d1551 100644 --- a/module/Job/src/Job/Form/JobForm.php +++ b/module/Job/src/Job/Form/JobForm.php @@ -98,12 +98,13 @@ class JobForm extends Form 'running' => _('running'), 'waiting' => _('waiting'), 'unsuccessful' => _('terminated unsuccessfully'), - 'successful' => _('terminated successfully') + 'successful' => _('terminated successfully'), + 'warning' => _('warning') ) ), 'attributes' => array( 'class' => 'form-control selectpicker show-tick', - 'data-size' => '5', + 'data-size' => '6', 'id' => 'status', 'value' => $status ) |