mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
parent
54c121f4a3
commit
3dce2a5d06
@ -159,9 +159,11 @@ class SyncruleController extends ActionController
|
|||||||
['rule_id' => $rule->get('id')],
|
['rule_id' => $rule->get('id')],
|
||||||
['class' => 'icon-plus']
|
['class' => 'icon-plus']
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addTitle($this->translate('Sync properties') . ': ' . $rule->get('rule_name'));
|
$this->addTitle($this->translate('Sync properties') . ': ' . $rule->get('rule_name'));
|
||||||
SyncpropertyTable::create($rule)->renderTo($this);
|
|
||||||
|
SyncpropertyTable::create($rule)
|
||||||
|
->handleSortPriorityActions($this->getRequest(), $this->getResponse())
|
||||||
|
->renderTo($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editpropertyAction()
|
public function editpropertyAction()
|
||||||
@ -201,7 +203,9 @@ class SyncruleController extends ActionController
|
|||||||
|
|
||||||
$this->content()->add($form->handleRequest());
|
$this->content()->add($form->handleRequest());
|
||||||
$this->tabs(new SyncRuleTabs($rule))->activate('property');
|
$this->tabs(new SyncRuleTabs($rule))->activate('property');
|
||||||
SyncpropertyTable::create($rule)->renderTo($this);
|
SyncpropertyTable::create($rule)
|
||||||
|
->handleSortPriorityActions($this->getRequest(), $this->getResponse())
|
||||||
|
->renderTo($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function historyAction()
|
public function historyAction()
|
||||||
|
@ -4,13 +4,25 @@ namespace Icinga\Module\Director\Web\Table;
|
|||||||
|
|
||||||
use Icinga\Module\Director\Objects\SyncRule;
|
use Icinga\Module\Director\Objects\SyncRule;
|
||||||
use ipl\Html\Link;
|
use ipl\Html\Link;
|
||||||
|
use ipl\Web\Table\Extension\ZfSortablePriority;
|
||||||
use ipl\Web\Table\ZfQueryBasedTable;
|
use ipl\Web\Table\ZfQueryBasedTable;
|
||||||
|
|
||||||
class SyncpropertyTable extends ZfQueryBasedTable
|
class SyncpropertyTable extends ZfQueryBasedTable
|
||||||
{
|
{
|
||||||
|
use ZfSortablePriority;
|
||||||
|
|
||||||
/** @var SyncRule */
|
/** @var SyncRule */
|
||||||
protected $rule;
|
protected $rule;
|
||||||
|
|
||||||
|
protected $searchColumns = [
|
||||||
|
'source_expression',
|
||||||
|
'destination_field',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $keyColumn = 'id';
|
||||||
|
|
||||||
|
protected $priorityColumn = 'priority';
|
||||||
|
|
||||||
public static function create(SyncRule $rule)
|
public static function create(SyncRule $rule)
|
||||||
{
|
{
|
||||||
$table = new static($rule->getConnection());
|
$table = new static($rule->getConnection());
|
||||||
@ -19,20 +31,28 @@ class SyncpropertyTable extends ZfQueryBasedTable
|
|||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return $this->renderWithSortableForm();
|
||||||
|
}
|
||||||
|
|
||||||
public function renderRow($row)
|
public function renderRow($row)
|
||||||
{
|
{
|
||||||
return $this::tr([
|
return $this->addSortPriorityButtons(
|
||||||
$this::td($row->source_name),
|
$this::row([
|
||||||
$this::td($row->source_expression),
|
$row->source_name,
|
||||||
$this::td(new Link(
|
$row->source_expression,
|
||||||
$row->destination_field,
|
new Link(
|
||||||
'director/syncrule/editproperty',
|
$row->destination_field,
|
||||||
[
|
'director/syncrule/editproperty',
|
||||||
'id' => $row->id,
|
[
|
||||||
'rule_id' => $row->rule_id,
|
'id' => $row->id,
|
||||||
]
|
'rule_id' => $row->rule_id,
|
||||||
)),
|
]
|
||||||
]);
|
),
|
||||||
|
]),
|
||||||
|
$row
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColumnsToBeRendered()
|
public function getColumnsToBeRendered()
|
||||||
@ -40,14 +60,15 @@ class SyncpropertyTable extends ZfQueryBasedTable
|
|||||||
return [
|
return [
|
||||||
$this->translate('Source name'),
|
$this->translate('Source name'),
|
||||||
$this->translate('Source field'),
|
$this->translate('Source field'),
|
||||||
$this->translate('Destination')
|
$this->translate('Destination'),
|
||||||
|
$this->getSortPriorityTitle()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepareQuery()
|
public function prepareQuery()
|
||||||
{
|
{
|
||||||
return $this->db()->select()->from(
|
return $this->db()->select()->from(
|
||||||
['r' => 'sync_rule'],
|
['p' => 'sync_property'],
|
||||||
[
|
[
|
||||||
'id' => 'p.id',
|
'id' => 'p.id',
|
||||||
'rule_id' => 'p.rule_id',
|
'rule_id' => 'p.rule_id',
|
||||||
@ -61,7 +82,7 @@ class SyncpropertyTable extends ZfQueryBasedTable
|
|||||||
'merge_policy' => 'p.merge_policy'
|
'merge_policy' => 'p.merge_policy'
|
||||||
]
|
]
|
||||||
)->join(
|
)->join(
|
||||||
['p' => 'sync_property'],
|
['r' => 'sync_rule'],
|
||||||
'r.id = p.rule_id',
|
'r.id = p.rule_id',
|
||||||
[]
|
[]
|
||||||
)->join(
|
)->join(
|
||||||
@ -69,7 +90,7 @@ class SyncpropertyTable extends ZfQueryBasedTable
|
|||||||
's.id = p.source_id',
|
's.id = p.source_id',
|
||||||
[]
|
[]
|
||||||
)->where(
|
)->where(
|
||||||
'r.id = ?',
|
'p.rule_id = ?',
|
||||||
$this->rule->get('id')
|
$this->rule->get('id')
|
||||||
)->order('p.priority');
|
)->order('p.priority');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user