From 2d7928158366e62e0a74f742e9cbbdfabe431689 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 18 Oct 2021 10:04:28 +0200 Subject: [PATCH] ApplyRulesTable: use UUIDs refs #2411 --- library/Director/Web/Table/ApplyRulesTable.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/library/Director/Web/Table/ApplyRulesTable.php b/library/Director/Web/Table/ApplyRulesTable.php index 0096010f..02b499a6 100644 --- a/library/Director/Web/Table/ApplyRulesTable.php +++ b/library/Director/Web/Table/ApplyRulesTable.php @@ -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',