ApplyRulesTable: use UUIDs

refs #2411
This commit is contained in:
Thomas Gelf 2021-10-18 10:04:28 +02:00
parent ce3ec67eb6
commit 2d79281583
1 changed files with 10 additions and 4 deletions

View File

@ -14,6 +14,7 @@ use gipfl\IcingaWeb2\Link;
use gipfl\IcingaWeb2\Table\ZfQueryBasedTable;
use gipfl\IcingaWeb2\Url;
use gipfl\IcingaWeb2\Zf1\Db\FilterRenderer;
use Ramsey\Uuid\Uuid;
use Zend_Db_Select as ZfSelect;
class ApplyRulesTable extends ZfQueryBasedTable
@ -72,10 +73,13 @@ class ApplyRulesTable extends ZfQueryBasedTable
public function renderRow($row)
{
if (isset($row->uuid) && is_resource($row->uuid)) {
$row->uuid = stream_get_contents($row->uuid);
}
if ($this->linkWithName) {
$params = ['name' => $row->object_name];
} else {
$params = ['id' => $row->id];
$params = ['uuid' => Uuid::fromBytes($row->uuid)->toString()];
}
$url = Url::fromPath("director/{$this->baseObjectUrl}/edit", $params);
@ -138,6 +142,7 @@ class ApplyRulesTable extends ZfQueryBasedTable
public function createActionLinks($row)
{
$params = ['uuid' => Uuid::fromBytes($row->uuid)->toString()];
$baseUrl = 'director/' . $this->baseObjectUrl;
$links = [];
$links[] = Link::create(
@ -150,21 +155,21 @@ class ApplyRulesTable extends ZfQueryBasedTable
$links[] = Link::create(
Icon::create('edit'),
"$baseUrl/edit",
['id' => $row->id],
$params,
['title' => $this->translate('Modify this Apply Rule')]
);
$links[] = Link::create(
Icon::create('doc-text'),
"$baseUrl/render",
['id' => $row->id],
$params,
['title' => $this->translate('Apply Rule rendering preview')]
);
$links[] = Link::create(
Icon::create('history'),
"$baseUrl/history",
['id' => $row->id],
$params,
['title' => $this->translate('Apply rule history')]
);
@ -210,6 +215,7 @@ class ApplyRulesTable extends ZfQueryBasedTable
$table = $this->getDummyObject()->getTableName();
$columns = [
'id' => 'o.id',
'uuid' => 'o.uuid',
'object_name' => 'o.object_name',
'disabled' => 'o.disabled',
'assign_filter' => 'o.assign_filter',