From 3d20e5574847d6d8708657ad01631cfac3a1d63c Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 16 Oct 2015 18:07:08 +0200 Subject: [PATCH] DeploymentLogTable: add active stage information --- application/controllers/ListController.php | 20 +++++++++++++++++--- application/tables/DeploymentLogTable.php | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/application/controllers/ListController.php b/application/controllers/ListController.php index db0a2cf8..0f814de8 100644 --- a/application/controllers/ListController.php +++ b/application/controllers/ListController.php @@ -134,7 +134,16 @@ class Director_ListController extends ActionController $this->setConfigTabs()->activate('deploymentlog'); $this->view->title = $this->translate('Deployments'); - $this->prepareAndRenderTable('deploymentLog'); + $this->prepareTable('deploymentLog'); + try { + + $this->view->table->setActiveStageName( + $this->api()->getActiveStageName() + ); + } catch (Exception $e) { + // Don't care + } + $this->render('table'); } protected function fetchLogs() @@ -178,11 +187,16 @@ class Director_ListController extends ActionController return $api; } - protected function prepareAndRenderTable($name) + protected function prepareTable($name) { $table = $this->loadTable($name)->setConnection($this->db()); $this->view->filterEditor = $table->getFilterEditor($this->getRequest()); $this->view->table = $this->applyPaginationLimits($table); - $this->render('table'); + return $this; + } + + protected function prepareAndRenderTable($name) + { + $this->prepareTable($name)->render('table'); } } diff --git a/application/tables/DeploymentLogTable.php b/application/tables/DeploymentLogTable.php index a0144826..4fbfef5a 100644 --- a/application/tables/DeploymentLogTable.php +++ b/application/tables/DeploymentLogTable.php @@ -6,6 +6,25 @@ use Icinga\Module\Director\Web\Table\QuickTable; class DeploymentLogTable extends QuickTable { + protected $activeStageName; + + public function setActiveStageName($name) + { + $this->activeStageName = $name; + return $this; + } + + protected function getRowClasses($row) + { + if ($this->activeStageName !== null + && $row->stage_name === $this->activeStageName) + { + return 'running'; + } + + return false; + } + public function getColumns() { $columns = array( @@ -14,6 +33,7 @@ class DeploymentLogTable extends QuickTable 'start_time' => 'l.start_time', 'stage_collected' => 'l.stage_collected', 'dump_succeeded' => 'l.dump_succeeded', + 'stage_name' => 'l.stage_name', 'startup_succeeded' => 'l.startup_succeeded', 'checksum' => 'LOWER(HEX(c.checksum))', 'duration' => "l.duration_dump || 'ms'",