IcingaObjectTable: new base class, common style

This commit is contained in:
Thomas Gelf 2015-12-15 17:16:07 +01:00
parent 30ce3d8d4f
commit 19420b8c9f
8 changed files with 52 additions and 42 deletions

View File

@ -2,9 +2,9 @@
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
class IcingaCommandTable extends QuickTable
class IcingaCommandTable extends IcingaObjectTable
{
protected $searchColumns = array(
'command',
@ -29,23 +29,6 @@ class IcingaCommandTable extends QuickTable
}
}
protected function listTableClasses()
{
return array_merge(array('check-commands'), parent::listTableClasses());
}
protected function getRowClasses($row)
{
switch ($row->object_type) {
case 'object':
return 'icinga-object';
case 'template':
return 'icinga-template';
case 'external_object':
return 'icinga-object-external';
}
}
public function getTitles()
{
$view = $this->view();

View File

@ -2,9 +2,9 @@
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
class IcingaEndpointTable extends QuickTable
class IcingaEndpointTable extends IcingaObjectTable
{
protected $searchColumns = array(
'endpoint',

View File

@ -3,9 +3,9 @@
namespace Icinga\Module\Director\Tables;
use Icinga\Data\Limitable;
use Icinga\Module\Director\Web\Table\QuickTable;
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
class IcingaHostTable extends QuickTable
class IcingaHostTable extends IcingaObjectTable
{
protected $searchColumns = array(
'host',
@ -14,11 +14,12 @@ class IcingaHostTable extends QuickTable
public function getColumns()
{
return array(
'id' => 'h.id',
'host' => 'h.object_name',
'address' => 'h.address',
'zone' => 'z.object_name',
'parents' => "GROUP_CONCAT(ih.object_name ORDER BY hi.weight SEPARATOR ', ')"
'id' => 'h.id',
'host' => 'h.object_name',
'object_type' => 'h.object_type',
'address' => 'h.address',
'zone' => 'z.object_name',
'parents' => "GROUP_CONCAT(ih.object_name ORDER BY hi.weight SEPARATOR ', ')"
);
}

View File

@ -2,9 +2,9 @@
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
class IcingaServiceTable extends QuickTable
class IcingaServiceTable extends IcingaObjectTable
{
protected $searchColumns = array(
'service',
@ -14,10 +14,11 @@ class IcingaServiceTable extends QuickTable
public function getColumns()
{
return array(
'id' => 's.id',
'host_id' => 's.host_id',
'host' => 'h.object_name',
'service' => 's.object_name',
'id' => 's.id',
'host_id' => 's.host_id',
'host' => 'h.object_name',
'service' => 's.object_name',
'object_type' => 's.object_type',
);
}

View File

@ -2,9 +2,9 @@
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
class IcingaUserTable extends QuickTable
class IcingaUserTable extends IcingaObjectTable
{
protected $searchColumns = array(
'user',
@ -14,6 +14,7 @@ class IcingaUserTable extends QuickTable
{
return array(
'id' => 'u.id',
'object_type' => 'u.object_type',
'user' => 'u.object_name',
// 'display_name' => 'u.display_name',
'email' => 'u.email',

View File

@ -2,9 +2,9 @@
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
class IcingaZoneTable extends QuickTable
class IcingaZoneTable extends IcingaObjectTable
{
protected $searchColumns = array(
'zone',
@ -19,9 +19,10 @@ class IcingaZoneTable extends QuickTable
}
return array(
'id' => 'z.id',
'zone' => 'z.object_name',
'endpoints' => $endpoints,
'id' => 'z.id',
'zone' => 'z.object_name',
'object_type' => 'z.object_type',
'endpoints' => $endpoints,
);
}

View File

@ -0,0 +1,23 @@
<?php
namespace Icinga\Module\Director\Web\Table;
abstract class IcingaObjectTable extends QuickTable
{
protected function getRowClasses($row)
{
switch ($row->object_type) {
case 'object':
return 'icinga-object';
case 'template':
return 'icinga-template';
case 'external_object':
return 'icinga-object-external';
}
}
protected function listTableClasses()
{
return array_merge(array('icinga-objects'), parent::listTableClasses());
}
}

View File

@ -365,7 +365,7 @@ table.syncstate {
}
}
table.check-commands {
table.icinga-objects {
tr td:first-child {
padding-left: 2em;
&::before {