config/activities: (un)deployed rows, icons, style
This commit is contained in:
parent
2b80c554d5
commit
01659f3505
|
@ -85,7 +85,10 @@ class ConfigController extends ActionController
|
|||
$this->setAutorefreshInterval(10);
|
||||
$this->overviewTabs()->activate('activitylog');
|
||||
$this->view->title = $this->translate('Activity Log');
|
||||
$this->prepareAndRenderTable('activityLog');
|
||||
$lastDeployedId = $this->db()->getLastDeploymentActivityLogId();
|
||||
$this->prepareTable('activityLog');
|
||||
$this->view->table->setLastDeployedId($lastDeployedId);
|
||||
$this->render('list/table', null, true);
|
||||
}
|
||||
|
||||
protected function fetchLogs()
|
||||
|
|
|
@ -8,6 +8,8 @@ class ActivityLogTable extends QuickTable
|
|||
{
|
||||
protected $filters = array();
|
||||
|
||||
protected $lastDeployedId;
|
||||
|
||||
protected $extraParams = array();
|
||||
|
||||
public function getColumns()
|
||||
|
@ -17,15 +19,33 @@ class ActivityLogTable extends QuickTable
|
|||
'change_time' => 'l.change_time',
|
||||
'author' => 'l.author',
|
||||
'action' => "CONCAT(l.action_name || ' ' || REPLACE(l.object_type, 'icinga_', '')"
|
||||
. " || ' \"' || l.object_name || '\"')"
|
||||
. " || ' \"' || l.object_name || '\"')",
|
||||
'action_name' => 'l.action_name',
|
||||
);
|
||||
}
|
||||
|
||||
public function setLastDeployedId($id)
|
||||
{
|
||||
$this->lastDeployedId = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function listTableClasses()
|
||||
{
|
||||
return array_merge(array('activity-log'), parent::listTableClasses());
|
||||
}
|
||||
|
||||
protected function getRowClasses($row)
|
||||
{
|
||||
$action = 'action-' . $row->action_name . ' ';
|
||||
|
||||
if ($row->id > $this->lastDeployedId) {
|
||||
return $action . 'undeployed';
|
||||
} else {
|
||||
return $action . 'deployed';
|
||||
}
|
||||
}
|
||||
|
||||
protected function getActionUrl($row)
|
||||
{
|
||||
return $this->url(
|
||||
|
|
|
@ -45,6 +45,20 @@ class Db extends DbConnection
|
|||
return (int) $db->fetchOne($query);
|
||||
}
|
||||
|
||||
// TODO: use running config?!
|
||||
public function getLastDeploymentActivityLogId()
|
||||
{
|
||||
$db = $this->db();
|
||||
|
||||
$query = ' SELECT COALESCE(id, 0) AS id FROM director_activity_log WHERE checksum = ('
|
||||
. ' SELECT last_activity_checksum FROM director_generated_config WHERE checksum = ('
|
||||
. ' SELECT config_checksum FROM director_deployment_log ORDER by id desc limit 1'
|
||||
. ' )'
|
||||
. ')';
|
||||
|
||||
return (int) $db->fetchOne($query);
|
||||
}
|
||||
|
||||
public function getMasterZoneName()
|
||||
{
|
||||
if ($zone = $this->getSetting('master_zone')) {
|
||||
|
|
|
@ -734,16 +734,30 @@ table.activity-log {
|
|||
}
|
||||
}
|
||||
|
||||
tr.deployed td:first-child::before {
|
||||
// icon-ok
|
||||
tr.action-create td:first-child::before {
|
||||
// icon-plus
|
||||
color: @color-pending;
|
||||
content: '\e805';
|
||||
}
|
||||
|
||||
tr.action-modify td:first-child::before {
|
||||
// icon-wrench
|
||||
color: @color-ok;
|
||||
content: '\e803';
|
||||
content: '\e83d';
|
||||
}
|
||||
|
||||
tr.action-delete td:first-child::before {
|
||||
// icon-cancel
|
||||
color: @color-critical;
|
||||
content: '\e804';
|
||||
}
|
||||
|
||||
tr.undeployed td, tr.undeployed a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
tr.undeployed td:first-child::before {
|
||||
color: @gray;
|
||||
// icon-clock
|
||||
content: '\e833';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue