Import*Table: Show key_column as first column
This commit is contained in:
parent
b4cb6f8ccb
commit
d1077a5616
|
@ -10,6 +10,7 @@ class ImportedrowsTable extends QuickTable
|
|||
{
|
||||
protected $columns;
|
||||
|
||||
/** @var ImportRun */
|
||||
protected $importRun;
|
||||
|
||||
public function setImportRun(ImportRun $run)
|
||||
|
@ -28,6 +29,12 @@ class ImportedrowsTable extends QuickTable
|
|||
{
|
||||
if ($this->columns === null) {
|
||||
$cols = $this->importRun->listColumnNames();
|
||||
|
||||
$keyColumn = $this->importRun->importSource()->get('key_column');
|
||||
if ($keyColumn !== null && ($pos = array_search($keyColumn, $cols)) !== false) {
|
||||
unset($cols[$pos]);
|
||||
array_unshift($cols, $keyColumn);
|
||||
}
|
||||
} else {
|
||||
$cols = $this->columns;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ use Icinga\Module\Director\Web\Table\QuickTable;
|
|||
|
||||
class ImportsourceHookTable extends QuickTable
|
||||
{
|
||||
/** @var ImportSource */
|
||||
protected $source;
|
||||
|
||||
protected $dataCache;
|
||||
|
@ -27,6 +28,13 @@ class ImportsourceHookTable extends QuickTable
|
|||
);
|
||||
|
||||
sort($this->columnCache);
|
||||
|
||||
// prioritize key column
|
||||
$keyColumn = $this->source->get('key_column');
|
||||
if ($keyColumn !== null && ($pos = array_search($keyColumn, $this->columnCache)) !== false) {
|
||||
unset($this->columnCache[$pos]);
|
||||
array_unshift($this->columnCache, $keyColumn);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->columnCache;
|
||||
|
|
Loading…
Reference in New Issue