mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 09:14:09 +02:00
ImportsourceTable: add revalidation stub and icons
This commit is contained in:
parent
12b5e0223e
commit
f41411c39a
@ -3,9 +3,14 @@
|
|||||||
namespace Icinga\Module\Director\Tables;
|
namespace Icinga\Module\Director\Tables;
|
||||||
|
|
||||||
use Icinga\Module\Director\Web\Table\QuickTable;
|
use Icinga\Module\Director\Web\Table\QuickTable;
|
||||||
|
use Icinga\Module\Director\Import\Import;
|
||||||
|
use Icinga\Module\Director\Objects\ImportSource;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class ImportsourceTable extends QuickTable
|
class ImportsourceTable extends QuickTable
|
||||||
{
|
{
|
||||||
|
protected $revalidate = false;
|
||||||
|
|
||||||
protected $searchColumns = array(
|
protected $searchColumns = array(
|
||||||
'source_name',
|
'source_name',
|
||||||
);
|
);
|
||||||
@ -32,6 +37,34 @@ class ImportsourceTable extends QuickTable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function listTableClasses()
|
||||||
|
{
|
||||||
|
return array_merge(array('syncstate'), parent::listTableClasses());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getRowClasses($row)
|
||||||
|
{
|
||||||
|
if (! $this->revalidate) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$import = new Import(ImportSource::load($row->id,$this->connection()));
|
||||||
|
if ($import->providesChanges()) {
|
||||||
|
$row->source_name = sprintf(
|
||||||
|
'%s (%s)',
|
||||||
|
$row->source_name,
|
||||||
|
$this->view()->translate('has changes')
|
||||||
|
);
|
||||||
|
return 'pending-changes';
|
||||||
|
} else {
|
||||||
|
return 'in-sync';
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$row->source_name = $row->source_name . ' (' . $e->getMessage() . ')';
|
||||||
|
return 'failing';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getBaseQuery()
|
public function getBaseQuery()
|
||||||
{
|
{
|
||||||
$db = $this->connection()->getConnection();
|
$db = $this->connection()->getConnection();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user