2015-09-29 20:35:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Tables;
|
|
|
|
|
|
|
|
use Icinga\Module\Director\Web\Table\QuickTable;
|
|
|
|
|
|
|
|
class DeploymentLogTable extends QuickTable
|
|
|
|
{
|
2015-10-16 18:07:08 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-09-29 20:35:05 +02:00
|
|
|
public function getColumns()
|
|
|
|
{
|
|
|
|
$columns = array(
|
|
|
|
'id' => 'l.id',
|
|
|
|
'peer_identity' => 'l.peer_identity',
|
|
|
|
'start_time' => 'l.start_time',
|
|
|
|
'stage_collected' => 'l.stage_collected',
|
|
|
|
'dump_succeeded' => 'l.dump_succeeded',
|
2015-10-16 18:07:08 +02:00
|
|
|
'stage_name' => 'l.stage_name',
|
2015-09-29 20:35:05 +02:00
|
|
|
'startup_succeeded' => 'l.startup_succeeded',
|
|
|
|
'checksum' => 'LOWER(HEX(c.checksum))',
|
|
|
|
'duration' => "l.duration_dump || 'ms'",
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($this->connection->getDbType() === 'pgsql') {
|
|
|
|
$columns['checksum'] = "LOWER(ENCODE(c.checksum, 'hex'))";
|
|
|
|
}
|
|
|
|
|
|
|
|
return $columns;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getActionUrl($row)
|
|
|
|
{
|
|
|
|
return $this->url('director/deployment/show', array('id' => $row->id));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitles()
|
|
|
|
{
|
|
|
|
$view = $this->view();
|
|
|
|
return array(
|
|
|
|
'peer_identity' => $view->translate('Peer'),
|
2015-10-16 18:11:05 +02:00
|
|
|
'start_time' => $view->translate('Time'),
|
2015-09-29 20:35:05 +02:00
|
|
|
'dump_succeeded' => $view->translate('Sent'),
|
|
|
|
'startup_succeeded' => $view->translate('Loaded'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getBaseQuery()
|
|
|
|
{
|
|
|
|
$db = $this->connection()->getConnection();
|
|
|
|
|
|
|
|
$query = $db->select()->from(
|
|
|
|
array('l' => 'director_deployment_log'),
|
|
|
|
array()
|
|
|
|
)->joinLeft(
|
|
|
|
array('c' => 'director_generated_config'),
|
2015-10-16 18:11:05 +02:00
|
|
|
'c.checksum = l.config_checksum',
|
2015-09-29 20:35:05 +02:00
|
|
|
array()
|
|
|
|
)->order('l.start_time DESC');
|
|
|
|
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
}
|