Skip to content

Commit

Permalink
Merge pull request #444 from bareos/dev/fbergkemper/master/improve-fi…
Browse files Browse the repository at this point in the history
…ltering-on-jobs-bootstrap-table

improve search and filtering on jobs bootstrap table (job module)
  • Loading branch information
fbergkemper committed Mar 9, 2020
2 parents d0dc1d3 + 05be501 commit eb51625
Show file tree
Hide file tree
Showing 20 changed files with 6,950 additions and 892 deletions.
12 changes: 6 additions & 6 deletions webui/module/Dashboard/view/partial/JobsPast24h.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* bareos-webui - Bareos Web-Frontend
*
* @link https://github.com/bareos/bareos for the canonical source repository
* @copyright Copyright (c) 2013-2017 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @copyright Copyright (c) 2013-2020 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -46,7 +46,7 @@
<span class="label label-info"><?php echo $this->translate('Running'); ?></span>
</h4>
<h3>
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'running'))); ?>">
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'Running'))); ?>">
<span class="running-jobs-field"></span>
</a>
</h3>
Expand All @@ -57,7 +57,7 @@
<span class="label label-default"><?php echo $this->translate('Waiting'); ?></span>
</h4>
<h3>
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'waiting'))); ?>">
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'Waiting'))); ?>">
<span class="waiting-jobs-field"></span>
</a>
</h3>
Expand All @@ -68,7 +68,7 @@
<span class="label label-success"><?php echo $this->translate('Successful'); ?></span>
</h4>
<h3>
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'successful'))); ?>">
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'Success'))); ?>">
<span class="successful-jobs-field"></span>
</a>
</h3>
Expand All @@ -79,7 +79,7 @@
<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'))); ?>">
<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>
Expand All @@ -90,7 +90,7 @@
<span class="label label-danger"><?php echo $this->translate('Failed'); ?></span>
</h4>
<h3>
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'unsuccessful'))); ?>">
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'Failure'))); ?>">
<span class="failed-jobs-field"></span>
</a>
</h3>
Expand Down
79 changes: 7 additions & 72 deletions webui/module/Job/src/Job/Controller/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* bareos-webui - Bareos Web-Frontend
*
* @link https://github.com/bareos/bareos for the canonical source repository
* @copyright Copyright (c) 2013-2019 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @copyright Copyright (c) 2013-2020 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -77,8 +77,8 @@ public function indexAction()
}

$period = $this->params()->fromQuery('period') ? $this->params()->fromQuery('period') : '7';
$status = $this->params()->fromQuery('status') ? $this->params()->fromQUery('status') : 'all';
$jobname = $this->params()->fromQuery('jobname') ? $this->params()->fromQUery('jobname') : 'all';
$status = $this->params()->fromQuery('status') ? $this->params()->fromQuery('status') : 'all';
$jobname = $this->params()->fromQuery('jobname') ? $this->params()->fromQuery('jobname') : 'all';

try {
$this->bsock = $this->getServiceLocator()->get('director');
Expand Down Expand Up @@ -560,76 +560,11 @@ public function getDataAction()
echo $e->getMessage();
}

if($data == "jobs" && $status == "all") {
if($data == "jobs") {
try {
$result = $this->getJobModel()->getJobs($this->bsock, $jobname, $period);
}
catch(Exception $e) {
echo $e->getMessage();
}
}
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_A, $jobs_W);
}
catch(Exception $e) {
echo $e->getMessage();
}
}
elseif($data == "jobs" && $status == "unsuccessful") {
try {
$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_E, $jobs_e, $jobs_f);
}
catch(Exception $e) {
echo $e->getMessage();
}
}
elseif($data == "jobs" && $status == "running") {
try {
$jobs_R = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'R', $period, null);
$jobs_l = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'l', $period, null);
$result = array_merge($jobs_R, $jobs_l);
}
catch(Exception $e) {
echo $e->getMessage();
}
}
elseif($data == "jobs" && $status == "waiting") {
try {
$jobs_F = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'F', $period, null);
$jobs_S = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'S', $period, null);
$jobs_m = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'm', $period, null);
$jobs_M = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'M', $period, null);
$jobs_s = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 's', $period, null);
$jobs_j = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'j', $period, null);
$jobs_c = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'c', $period, null);
$jobs_d = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'd', $period, null);
$jobs_t = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 't', $period, null);
$jobs_p = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'p', $period, null);
$jobs_q = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'q', $period, null);
$jobs_C = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'C', $period, null);
$result = array_merge(
$jobs_F,$jobs_S,$jobs_m,$jobs_M,
$jobs_s,$jobs_j,$jobs_c,$jobs_d,
$jobs_t,$jobs_p,$jobs_q,$jobs_C
);
}
catch(Exception $e) {
echo $e->getMessage();
$result = $this->getJobModel()->getJobs($this->bsock, null, $period);
} catch(Exception $e) {
echo $e->getMessage();
}
}
elseif($data == "runjobs") {
Expand Down

0 comments on commit eb51625

Please sign in to comment.