From 61ee062b350167605e801918e0f7db46ef354c62 Mon Sep 17 00:00:00 2001 From: Frank Bergkemper Date: Fri, 20 Apr 2018 12:04:28 +0200 Subject: [PATCH] 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 --- .../Controller/DashboardController.php | 11 ++++++--- .../view/dashboard/dashboard/index.phtml | 6 +++++ .../Dashboard/view/partial/JobsPast24h.phtml | 23 +++++++++++++++---- .../Job/src/Job/Controller/JobController.php | 14 ++++++++--- 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 4246ccbbdac..e8c92fb7eed 100644 --- a/module/Dashboard/src/Dashboard/Controller/DashboardController.php +++ b/module/Dashboard/src/Dashboard/Controller/DashboardController.php @@ -105,6 +105,7 @@ public function getDataAction() $waiting = null; $running = null; $successful = null; + $warning = null; $failed = null; $result = null; @@ -138,20 +139,24 @@ public function getDataAction() // 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 9cd72b735d0..1d9a86e4885 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(""); $('.successful-jobs-field').empty(); $('.successful-jobs-field').append(""); + $('.warning-jobs-field').empty(); + $('.warning-jobs-field').append(""); $('.failed-jobs-field').empty(); $('.failed-jobs-field').append(""); }); @@ -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 0fb654ff4c3..8170ae0f3c1 100644 --- a/module/Dashboard/view/partial/JobsPast24h.phtml +++ b/module/Dashboard/view/partial/JobsPast24h.phtml @@ -37,9 +37,11 @@
+
+
-
+

translate('Running'); ?>

@@ -50,7 +52,7 @@
-
+

translate('Waiting'); ?>

@@ -61,7 +63,7 @@
-
+

translate('Successful'); ?>

@@ -72,7 +74,18 @@
-
+
+

+ translate('Warning'); ?> +

+

+ + + +

+
+ +

translate('Failed'); ?>

@@ -85,6 +98,8 @@
+
+
diff --git a/module/Job/src/Job/Controller/JobController.php b/module/Job/src/Job/Controller/JobController.php index 24c936ec106..1b37f21d95f 100644 --- a/module/Job/src/Job/Controller/JobController.php +++ b/module/Job/src/Job/Controller/JobController.php @@ -418,8 +418,17 @@ public function getDataAction() 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 @@ public function getDataAction() } 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 c63fd846c0e..d9d15518dbb 100644 --- a/module/Job/src/Job/Form/JobForm.php +++ b/module/Job/src/Job/Form/JobForm.php @@ -98,12 +98,13 @@ public function __construct($jobs=null, $jobname=null, $period=null, $status=nul '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 )