DeploymentLogTable: add active stage information

This commit is contained in:
Thomas Gelf 2015-10-16 18:07:08 +02:00
parent bbf7796b53
commit 3d20e55748
2 changed files with 37 additions and 3 deletions

View File

@ -134,7 +134,16 @@ class Director_ListController extends ActionController
$this->setConfigTabs()->activate('deploymentlog'); $this->setConfigTabs()->activate('deploymentlog');
$this->view->title = $this->translate('Deployments'); $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() protected function fetchLogs()
@ -178,11 +187,16 @@ class Director_ListController extends ActionController
return $api; return $api;
} }
protected function prepareAndRenderTable($name) protected function prepareTable($name)
{ {
$table = $this->loadTable($name)->setConnection($this->db()); $table = $this->loadTable($name)->setConnection($this->db());
$this->view->filterEditor = $table->getFilterEditor($this->getRequest()); $this->view->filterEditor = $table->getFilterEditor($this->getRequest());
$this->view->table = $this->applyPaginationLimits($table); $this->view->table = $this->applyPaginationLimits($table);
$this->render('table'); return $this;
}
protected function prepareAndRenderTable($name)
{
$this->prepareTable($name)->render('table');
} }
} }

View File

@ -6,6 +6,25 @@ use Icinga\Module\Director\Web\Table\QuickTable;
class DeploymentLogTable extends 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() public function getColumns()
{ {
$columns = array( $columns = array(
@ -14,6 +33,7 @@ class DeploymentLogTable extends QuickTable
'start_time' => 'l.start_time', 'start_time' => 'l.start_time',
'stage_collected' => 'l.stage_collected', 'stage_collected' => 'l.stage_collected',
'dump_succeeded' => 'l.dump_succeeded', 'dump_succeeded' => 'l.dump_succeeded',
'stage_name' => 'l.stage_name',
'startup_succeeded' => 'l.startup_succeeded', 'startup_succeeded' => 'l.startup_succeeded',
'checksum' => 'LOWER(HEX(c.checksum))', 'checksum' => 'LOWER(HEX(c.checksum))',
'duration' => "l.duration_dump || 'ms'", 'duration' => "l.duration_dump || 'ms'",