From cd989f9c3aff968e19a3aeabc4eb9085787a6673 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:43:12 +0200 Subject: Adding upstream version 1.10.2. Signed-off-by: Daniel Baumann --- library/Director/Web/Table/SyncruleTable.php | 67 ++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 library/Director/Web/Table/SyncruleTable.php (limited to 'library/Director/Web/Table/SyncruleTable.php') diff --git a/library/Director/Web/Table/SyncruleTable.php b/library/Director/Web/Table/SyncruleTable.php new file mode 100644 index 0000000..4a8e4e5 --- /dev/null +++ b/library/Director/Web/Table/SyncruleTable.php @@ -0,0 +1,67 @@ +getAttributes()->add('class', 'syncstate'); + parent::assemble(); + } + + public function renderRow($row) + { + $caption = [Link::create( + $row->rule_name, + 'director/syncrule', + ['id' => $row->id] + )]; + if ($row->description !== null) { + $caption[] = ': ' . $row->description; + } + + if ($row->sync_state === 'failing' && $row->last_error_message) { + $caption[] = ' (' . $row->last_error_message . ')'; + } + + $tr = $this::row([$caption, $row->object_type]); + $tr->getAttributes()->add('class', $row->sync_state); + + return $tr; + } + + public function getColumnsToBeRendered() + { + return [ + $this->translate('Rule name'), + $this->translate('Object type'), + ]; + } + + public function prepareQuery() + { + return $this->db()->select()->from( + ['s' => 'sync_rule'], + [ + 'id' => 's.id', + 'rule_name' => 's.rule_name', + 'sync_state' => 's.sync_state', + 'object_type' => 's.object_type', + 'update_policy' => 's.update_policy', + 'purge_existing' => 's.purge_existing', + 'filter_expression' => 's.filter_expression', + 'last_error_message' => 's.last_error_message', + 'description' => 's.description', + ] + )->order('rule_name'); + } +} -- cgit v1.2.3