mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 08:44:11 +02:00
Importrun: allow to show it's rows
This commit is contained in:
parent
c9e5f16d3e
commit
ec80dc9d87
25
application/controllers/ImportrunController.php
Normal file
25
application/controllers/ImportrunController.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Icinga\Module\Director\Web\Controller\ActionController;
|
||||||
|
use Icinga\Module\Director\Web\Hook\ImportSourceHook;
|
||||||
|
use Icinga\Module\Director\Util;
|
||||||
|
use Icinga\Module\Director\Objects\ImportSource;
|
||||||
|
use Icinga\Module\Director\Import\Import;
|
||||||
|
use Icinga\Exception\InvalidPropertyException;
|
||||||
|
use Icinga\Web\Notification;
|
||||||
|
|
||||||
|
class Director_ImportrunController extends ActionController
|
||||||
|
{
|
||||||
|
public function indexAction()
|
||||||
|
{
|
||||||
|
$this->view->title = $this->translate('Import run');
|
||||||
|
$this->view->table = $this->applyPaginationLimits(
|
||||||
|
$this->loadTable('importedrows')
|
||||||
|
->setChecksum(
|
||||||
|
$this->db()->getImportrunRowsetChecksum($this->params->get('id'))
|
||||||
|
)
|
||||||
|
->setConnection($this->db())
|
||||||
|
);
|
||||||
|
$this->render('list/table', null, true);
|
||||||
|
}
|
||||||
|
}
|
60
application/tables/ImportedrowsTable.php
Normal file
60
application/tables/ImportedrowsTable.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Icinga\Module\Director\Tables;
|
||||||
|
|
||||||
|
use Icinga\Module\Director\Web\Table\QuickTable;
|
||||||
|
|
||||||
|
class ImportedrowsTable extends QuickTable
|
||||||
|
{
|
||||||
|
protected $checksum;
|
||||||
|
|
||||||
|
public function getColumns()
|
||||||
|
{
|
||||||
|
$db = $this->connection();
|
||||||
|
return $db->listImportedRowsetColumnNames($this->checksum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setChecksum($checksum)
|
||||||
|
{
|
||||||
|
$this->checksum = $checksum;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitles()
|
||||||
|
{
|
||||||
|
$view = $this->view();
|
||||||
|
$cols = $this->getColumns();
|
||||||
|
return array(
|
||||||
|
'object_name' => $view->translate('Object name'),
|
||||||
|
) + array_combine($cols, $cols);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function count()
|
||||||
|
{
|
||||||
|
$db = $this->connection()->getConnection();
|
||||||
|
$query = $db->select()
|
||||||
|
->from('imported_rowset_row', 'COUNT(*)')
|
||||||
|
->where('rowset_checksum = ?', $this->checksum);
|
||||||
|
|
||||||
|
return $db->fetchOne($query);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fetchData()
|
||||||
|
{
|
||||||
|
$db = $this->connection()->getConnection();
|
||||||
|
$query = $this->getBaseQuery();
|
||||||
|
|
||||||
|
if ($this->hasLimit() || $this->hasOffset()) {
|
||||||
|
$query->limit($this->getLimit(), $this->getOffset());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $db->fetchAll($query);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBaseQuery()
|
||||||
|
{
|
||||||
|
return $this->connection()->createImportedRowsetRowsQuery(
|
||||||
|
$this->checksum
|
||||||
|
)->order('object_name');
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user