ActivityLogTable: filter by host if given
In future we'll have better filtering possibilities, for now this scans all rows with a matching service name in the table fixes #1613
This commit is contained in:
parent
119635d290
commit
92c05f49a3
|
@ -224,10 +224,13 @@ abstract class ObjectController extends ActionController
|
|||
|
||||
$db = $this->db();
|
||||
$type = $this->getType();
|
||||
(new ActivityLogTable($db))
|
||||
$table = (new ActivityLogTable($db))
|
||||
->setLastDeployedId($db->getLastDeploymentActivityLogId())
|
||||
->filterObject('icinga_' . $type, $name)
|
||||
->renderTo($this);
|
||||
->filterObject('icinga_' . $type, $name);
|
||||
if ($host = $this->params->get('host')) {
|
||||
$table->filterHost($host);
|
||||
}
|
||||
$table->renderTo($this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -113,6 +113,19 @@ class ActivityLogTable extends ZfQueryBasedTable
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function filterHost($name)
|
||||
{
|
||||
$db = $this->db();
|
||||
$filter = '%"host":' . json_encode($name) . '%';
|
||||
$this->filters[] = ['('
|
||||
. $db->quoteInto('l.old_properties LIKE ?', $filter)
|
||||
. ' OR '
|
||||
. $db->quoteInto('l.new_properties LIKE ?', $filter)
|
||||
. ')', null];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
|
|
Loading…
Reference in New Issue