mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
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();
|
$db = $this->db();
|
||||||
$type = $this->getType();
|
$type = $this->getType();
|
||||||
(new ActivityLogTable($db))
|
$table = (new ActivityLogTable($db))
|
||||||
->setLastDeployedId($db->getLastDeploymentActivityLogId())
|
->setLastDeployedId($db->getLastDeploymentActivityLogId())
|
||||||
->filterObject('icinga_' . $type, $name)
|
->filterObject('icinga_' . $type, $name);
|
||||||
->renderTo($this);
|
if ($host = $this->params->get('host')) {
|
||||||
|
$table->filterHost($host);
|
||||||
|
}
|
||||||
|
$table->renderTo($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,6 +113,19 @@ class ActivityLogTable extends ZfQueryBasedTable
|
|||||||
return $this;
|
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()
|
public function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user