ImportsourceTable: add revalidation stub and icons
This commit is contained in:
parent
12b5e0223e
commit
f41411c39a
|
@ -3,9 +3,14 @@
|
|||
namespace Icinga\Module\Director\Tables;
|
||||
|
||||
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
|
||||
{
|
||||
protected $revalidate = false;
|
||||
|
||||
protected $searchColumns = array(
|
||||
'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()
|
||||
{
|
||||
$db = $this->connection()->getConnection();
|
||||
|
|
Loading…
Reference in New Issue