SyncRule: sync rules should work now. refs. #9709
This commit is contained in:
parent
69ce25828b
commit
b9eac26193
|
@ -20,9 +20,9 @@ class Director_SyncruleController extends ActionController
|
|||
|
||||
public function runAction()
|
||||
{
|
||||
if ($runId = Import::run($id = ImportSource::load($this->params->get('id'), $this->db()))) {
|
||||
if ($runId = Import::run($id = SyncRule::load($this->params->get('id'), $this->db()))) {
|
||||
Notification::success('adf' . $runId);
|
||||
$this->redirectNow('director/list/importrun');
|
||||
$this->redirectNow('director/list/syncrule');
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
@ -36,21 +36,21 @@ class Director_SyncruleController extends ActionController
|
|||
}
|
||||
|
||||
if ($edit) {
|
||||
$this->view->title = $this->translate('Edit import source');
|
||||
$this->view->title = $this->translate('Edit sync rule');
|
||||
$this->getTabs()->add('edit', array(
|
||||
'url' => 'director/importsource/edit' . '?id=' . $id,
|
||||
'url' => 'director/syncrule/edit' . '?id=' . $id,
|
||||
'label' => $this->view->title,
|
||||
))->activate('edit');
|
||||
} else {
|
||||
$this->view->title = $this->translate('Add import source');
|
||||
$this->view->title = $this->translate('Add sync rule');
|
||||
$this->getTabs()->add('add', array(
|
||||
'url' => 'director/importsource/add',
|
||||
'url' => 'director/syncrule/add',
|
||||
'label' => $this->view->title,
|
||||
))->activate('add');
|
||||
}
|
||||
|
||||
$form = $this->view->form = $this->loadForm('importSource')
|
||||
->setSuccessUrl('director/list/importsource')
|
||||
$form = $this->view->form = $this->loadForm('syncRule')
|
||||
->setSuccessUrl('director/list/syncrule')
|
||||
->setDb($this->db());
|
||||
|
||||
if ($edit) {
|
||||
|
|
|
@ -26,8 +26,8 @@ class SyncRuleForm extends DirectorObjectForm
|
|||
));
|
||||
|
||||
$this->addElement('select', 'update_policy', array(
|
||||
'label' => $this->translate('Destination field'),
|
||||
'description' => $this->translate('The value of the source will be transformed to the given attribute'),
|
||||
'label' => $this->translate('Update Policity'),
|
||||
'description' => $this->translate('Whether the field should be merged, overriden or ignored'),
|
||||
'required' => true,
|
||||
'multiOptions' => array(
|
||||
'null' => '- please choose -',
|
||||
|
@ -37,9 +37,9 @@ class SyncRuleForm extends DirectorObjectForm
|
|||
)
|
||||
));
|
||||
|
||||
$this->addElement('text', 'purge_existing', array(
|
||||
'label' => $this->translate('Priority'),
|
||||
'description' => $this->translate('This allows to prioritize the import of a field, synced from different sources for the same object'),
|
||||
$this->addElement('select', 'purge_existing', array(
|
||||
'label' => $this->translate('Purge'),
|
||||
'description' => $this->translate('Purge existing values.'),
|
||||
'required' => true,
|
||||
'multiOptions' => array(
|
||||
'null' => '- please choose -',
|
||||
|
@ -48,10 +48,9 @@ class SyncRuleForm extends DirectorObjectForm
|
|||
)
|
||||
));
|
||||
|
||||
$this->addElement('text', 'filter', array(
|
||||
$this->addElement('text', 'filter_expression', array(
|
||||
'label' => $this->translate('Filter Expression'),
|
||||
'description' => $this->translate('This allows to filter for specific parts within the given source field'),
|
||||
'required' => true,
|
||||
'description' => $this->translate('This allows to filter for specific parts.'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Tables;
|
||||
|
||||
use Icinga\Module\Director\Web\Table\QuickTable;
|
||||
|
||||
class SyncruleTable extends QuickTable
|
||||
{
|
||||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'id' => 's.id',
|
||||
'rule_name' => 's.rule_name',
|
||||
'object_type' => 's.object_type',
|
||||
'update_policy' => 's.update_policy',
|
||||
'purge_existing' => 's.purge_existing',
|
||||
'filter_expression' => 's.filter_expression',
|
||||
);
|
||||
}
|
||||
|
||||
protected function getActionUrl($row)
|
||||
{
|
||||
return $this->url('director/syncrule/add', array('id' => $row->id));
|
||||
}
|
||||
|
||||
public function getTitles()
|
||||
{
|
||||
$view = $this->view();
|
||||
return array(
|
||||
'rule_name' => $view->translate('Rule name'),
|
||||
'object_type' => $view->translate('Object type'),
|
||||
);
|
||||
}
|
||||
|
||||
public function getBaseQuery()
|
||||
{
|
||||
$db = $this->connection()->getConnection();
|
||||
|
||||
$query = $db->select()->from(
|
||||
array('s' => 'sync_rule'),
|
||||
array()
|
||||
)->order('id');
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ class SyncRule extends DbObject
|
|||
'filter_expression' => null,
|
||||
);
|
||||
|
||||
/*
|
||||
/**
|
||||
protected $properties = array();
|
||||
|
||||
public function set($key, $value)
|
||||
|
@ -78,9 +78,9 @@ class SyncRule extends DbObject
|
|||
$del[$key] = $key;
|
||||
}
|
||||
|
||||
$modifier = $db->fetchRow(
|
||||
$sync_rule = $db->fetchRow(
|
||||
$db->select()->from(
|
||||
'sync_modifier',
|
||||
'sync_rule',
|
||||
array('id')
|
||||
)->where('property_id = ?', $property_id)
|
||||
)
|
||||
|
@ -134,5 +134,6 @@ class SyncRule extends DbObject
|
|||
protected function onLoadFromDb()
|
||||
{
|
||||
$this->settings = $this->fetchSettingsFromDb();
|
||||
} */
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue