mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-06-09 00:32:05 -04:00
Also use grid layout for users, usergroups and servicegroups
This commit is contained in:
parent
5303abe51c
commit
561382b8c8
19 changed files with 138 additions and 164 deletions
|
|
@ -10,7 +10,7 @@ use Icinga\Module\Icingadb\Model\ServicegroupSummary;
|
|||
use Icinga\Module\Icingadb\Redis\VolatileStateResults;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\ServiceList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\ServicegroupList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\ServicegroupTableRow;
|
||||
use ipl\Html\Html;
|
||||
use ipl\Stdlib\Filter;
|
||||
|
||||
|
|
@ -72,16 +72,10 @@ class ServicegroupController extends Controller
|
|||
|
||||
// ICINGAWEB_EXPORT_FORMAT is not set yet and $this->format is inaccessible, yeah...
|
||||
if ($this->getRequest()->getParam('format') === 'pdf') {
|
||||
$this->addContent((new ServicegroupList([$this->servicegroup]))
|
||||
->setViewMode('minimal')
|
||||
->setDetailActionsDisabled()
|
||||
->setNoSubjectLink());
|
||||
$this->addContent(new ServicegroupTableRow($this->servicegroup));
|
||||
$this->addContent(Html::tag('h2', null, t('Services')));
|
||||
} else {
|
||||
$this->addControl((new ServicegroupList([$this->servicegroup]))
|
||||
->setViewMode('minimal')
|
||||
->setDetailActionsDisabled()
|
||||
->setNoSubjectLink());
|
||||
$this->addControl(new ServicegroupTableRow($this->servicegroup));
|
||||
}
|
||||
|
||||
$this->addControl($paginationControl);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use Icinga\Module\Icingadb\Model\Servicegroup;
|
|||
use Icinga\Module\Icingadb\Model\ServicegroupSummary;
|
||||
use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\ServicegroupList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\ServicegroupTable;
|
||||
use Icinga\Module\Icingadb\Widget\ShowMore;
|
||||
use Icinga\Module\Icingadb\Web\Control\ViewModeSwitcher;
|
||||
use ipl\Web\Control\LimitControl;
|
||||
|
|
@ -77,7 +77,7 @@ class ServicegroupsController extends Controller
|
|||
$results = $servicegroups->execute();
|
||||
|
||||
$this->addContent(
|
||||
(new ServicegroupList($results))->setBaseFilter($filter)
|
||||
(new ServicegroupTable($results))->setBaseFilter($filter)
|
||||
);
|
||||
|
||||
if ($compact) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use Icinga\Exception\NotFoundError;
|
|||
use Icinga\Module\Icingadb\Model\User;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\Detail\UserDetail;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UserList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\UserTableRow;
|
||||
use ipl\Stdlib\Filter;
|
||||
|
||||
class UserController extends Controller
|
||||
|
|
@ -40,7 +40,7 @@ class UserController extends Controller
|
|||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->addControl((new UserList([$this->user]))->setNoSubjectLink()->setDetailActionsDisabled());
|
||||
$this->addControl(new UserTableRow($this->user));
|
||||
$this->addContent(new UserDetail($this->user));
|
||||
|
||||
$this->setAutorefreshInterval(10);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use Icinga\Exception\NotFoundError;
|
|||
use Icinga\Module\Icingadb\Model\Usergroup;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\Detail\UsergroupDetail;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UsergroupList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\UsergroupTableRow;
|
||||
use ipl\Stdlib\Filter;
|
||||
|
||||
class UsergroupController extends Controller
|
||||
|
|
@ -40,7 +40,7 @@ class UsergroupController extends Controller
|
|||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->addControl((new UsergroupList([$this->usergroup]))->setNoSubjectLink()->setDetailActionsDisabled());
|
||||
$this->addControl(new UsergroupTableRow($this->usergroup));
|
||||
$this->addContent(new UsergroupDetail($this->usergroup));
|
||||
|
||||
$this->setAutorefreshInterval(10);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use GuzzleHttp\Psr7\ServerRequest;
|
|||
use Icinga\Module\Icingadb\Model\Usergroup;
|
||||
use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UsergroupList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\UsergroupTable;
|
||||
use Icinga\Module\Icingadb\Web\Control\ViewModeSwitcher;
|
||||
use ipl\Web\Control\LimitControl;
|
||||
use ipl\Web\Control\SortControl;
|
||||
|
|
@ -64,7 +64,7 @@ class UsergroupsController extends Controller
|
|||
$this->addControl($limitControl);
|
||||
$this->addControl($searchBar);
|
||||
|
||||
$this->addContent(new UsergroupList($usergroups));
|
||||
$this->addContent(new UsergroupTable($usergroups));
|
||||
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use GuzzleHttp\Psr7\ServerRequest;
|
|||
use Icinga\Module\Icingadb\Model\User;
|
||||
use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UserList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\UserTable;
|
||||
use Icinga\Module\Icingadb\Web\Control\ViewModeSwitcher;
|
||||
use ipl\Web\Control\LimitControl;
|
||||
use ipl\Web\Control\SortControl;
|
||||
|
|
@ -66,7 +66,7 @@ class UsersController extends Controller
|
|||
$this->addControl($limitControl);
|
||||
$this->addControl($searchBar);
|
||||
|
||||
$this->addContent(new UserList($users));
|
||||
$this->addContent(new UserTable($users));
|
||||
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use Icinga\Module\Icingadb\Model\StateHistory;
|
|||
use Icinga\Module\Icingadb\Util\PluginOutput;
|
||||
use Icinga\Module\Icingadb\Widget\EmptyState;
|
||||
use ipl\Web\Widget\HorizontalKeyValue;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UserList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\UserTable;
|
||||
use Icinga\Module\Icingadb\Widget\PluginOutputContainer;
|
||||
use Icinga\Module\Icingadb\Widget\ShowMore;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
|
|
@ -159,7 +159,7 @@ class EventDetail extends BaseHtmlElement
|
|||
$users = $users->execute();
|
||||
/** @var ResultSet $users */
|
||||
|
||||
$notifiedUsers[] = new UserList($users);
|
||||
$notifiedUsers[] = new UserTable($users);
|
||||
$notifiedUsers[] = (new ShowMore(
|
||||
$users,
|
||||
Links::users()->addParams(['notification_history.id' => bin2hex($notification->id)]),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use Icinga\Module\Icingadb\Model\User;
|
|||
use Icinga\Module\Icingadb\Widget\EmptyState;
|
||||
use ipl\Html\Attributes;
|
||||
use ipl\Web\Widget\HorizontalKeyValue;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UsergroupList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\UsergroupTable;
|
||||
use Icinga\Module\Icingadb\Widget\ShowMore;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
use ipl\Html\HtmlElement;
|
||||
|
|
@ -84,7 +84,7 @@ class UserDetail extends BaseHtmlElement
|
|||
|
||||
return [
|
||||
new HtmlElement('h2', null, Text::create(t('Groups'))),
|
||||
new UsergroupList($userGroups),
|
||||
new UsergroupTable($userGroups),
|
||||
$showMoreLink
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use Icinga\Module\Icingadb\Common\Links;
|
|||
use Icinga\Module\Icingadb\Hook\ExtensionHook\ObjectDetailExtensionHook;
|
||||
use Icinga\Module\Icingadb\Model\Usergroup;
|
||||
use Icinga\Module\Icingadb\Widget\EmptyState;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UserList;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\UserTable;
|
||||
use Icinga\Module\Icingadb\Widget\ShowMore;
|
||||
use ipl\Html\Attributes;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
|
|
@ -74,7 +74,7 @@ class UsergroupDetail extends BaseHtmlElement
|
|||
|
||||
return [
|
||||
new HtmlElement('h2', null, Text::create(t('Users'))),
|
||||
new UserList($users),
|
||||
new UserTable($users),
|
||||
$showMoreLink
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemList;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\NoSubjectLink;
|
||||
use Icinga\Module\Icingadb\Common\ViewMode;
|
||||
use Icinga\Module\Icingadb\Common\BaseItemList;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class ServicegroupList extends BaseItemList
|
||||
{
|
||||
use NoSubjectLink;
|
||||
use ViewMode;
|
||||
|
||||
protected $defaultAttributes = ['class' => 'servicegroup-list item-table'];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->getAttributes()->get('class')->removeValue('item-list');
|
||||
$this->setDetailUrl(Url::fromPath('icingadb/servicegroup'));
|
||||
}
|
||||
|
||||
protected function getItemClass(): string
|
||||
{
|
||||
$this->addAttributes(['class' => $this->getViewMode()]);
|
||||
|
||||
return ServicegroupListItem::class;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemList;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\NoSubjectLink;
|
||||
use Icinga\Module\Icingadb\Common\BaseItemList;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class UserList extends BaseItemList
|
||||
{
|
||||
use NoSubjectLink;
|
||||
|
||||
protected $defaultAttributes = ['class' => 'user-list item-table'];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->getAttributes()->get('class')->removeValue('item-list');
|
||||
$this->setDetailUrl(Url::fromPath('icingadb/user'));
|
||||
}
|
||||
|
||||
protected function getItemClass(): string
|
||||
{
|
||||
return UserListItem::class;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemList;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\NoSubjectLink;
|
||||
use Icinga\Module\Icingadb\Common\BaseItemList;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class UsergroupList extends BaseItemList
|
||||
{
|
||||
use NoSubjectLink;
|
||||
|
||||
protected $defaultAttributes = ['class' => 'usergroup-list item-table'];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->getAttributes()->get('class')->removeValue('item-list');
|
||||
$this->setDetailUrl(Url::fromPath('icingadb/usergroup'));
|
||||
}
|
||||
|
||||
protected function getItemClass(): string
|
||||
{
|
||||
return UsergroupListItem::class;
|
||||
}
|
||||
}
|
||||
23
library/Icingadb/Widget/ItemTable/ServicegroupTable.php
Normal file
23
library/Icingadb/Widget/ItemTable/ServicegroupTable.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemTable;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\BaseItemTable;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class ServicegroupTable extends BaseItemTable
|
||||
{
|
||||
protected $defaultAttributes = ['class' => 'servicegroup-table'];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->setDetailUrl(Url::fromPath('icingadb/servicegroup'));
|
||||
}
|
||||
|
||||
protected function getItemClass(): string
|
||||
{
|
||||
return ServicegroupTableRow::class;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemList;
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemTable;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\BaseTableRowItem;
|
||||
use Icinga\Module\Icingadb\Common\Links;
|
||||
use Icinga\Module\Icingadb\Common\NoSubjectLink;
|
||||
use Icinga\Module\Icingadb\Model\Servicegroup;
|
||||
use Icinga\Module\Icingadb\Widget\Detail\ServiceStatistics;
|
||||
use ipl\Html\Attributes;
|
||||
|
|
@ -21,16 +20,17 @@ use ipl\Web\Widget\Link;
|
|||
* Servicegroup item of a servicegroup list. Represents one database row.
|
||||
*
|
||||
* @property Servicegroup $item
|
||||
* @property ServicegroupList $list
|
||||
* @property ServicegroupTable $table
|
||||
*/
|
||||
class ServicegroupListItem extends BaseTableRowItem
|
||||
class ServicegroupTableRow extends BaseTableRowItem
|
||||
{
|
||||
use NoSubjectLink;
|
||||
protected $defaultAttributes = ['class' => 'servicegroup-table-row'];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->setNoSubjectLink($this->list->getNoSubjectLink());
|
||||
$this->list->addDetailFilterAttribute($this, Filter::equal('name', $this->item->name));
|
||||
if (isset($this->table)) {
|
||||
$this->table->addDetailFilterAttribute($this, Filter::equal('name', $this->item->name));
|
||||
}
|
||||
}
|
||||
|
||||
protected function assembleColumns(HtmlDocument $columns)
|
||||
|
|
@ -38,31 +38,26 @@ class ServicegroupListItem extends BaseTableRowItem
|
|||
$serviceStats = new ServiceStatistics($this->item);
|
||||
|
||||
$serviceStats->setBaseFilter(Filter::equal('servicegroup.name', $this->item->name));
|
||||
if ($this->list->hasBaseFilter()) {
|
||||
if (isset($this->table) && $this->table->hasBaseFilter()) {
|
||||
$serviceStats->setBaseFilter(
|
||||
Filter::all($serviceStats->getBaseFilter(), $this->list->getBaseFilter())
|
||||
Filter::all($serviceStats->getBaseFilter(), $this->table->getBaseFilter())
|
||||
);
|
||||
}
|
||||
|
||||
$columns->addFrom($serviceStats, function (BaseHtmlElement $item) {
|
||||
$item->getAttributes()->add(['class' => 'col']);
|
||||
$item->setTag('div');
|
||||
return $item;
|
||||
});
|
||||
$columns->addHtml($this->createColumn($serviceStats));
|
||||
}
|
||||
|
||||
protected function assembleTitle(BaseHtmlElement $title)
|
||||
{
|
||||
$title->addHtml(
|
||||
$this->getNoSubjectLink()
|
||||
? new HtmlElement(
|
||||
isset($this->table)
|
||||
? new Link($this->item->display_name, Links::servicegroup($this->item), ['class' => 'subject'])
|
||||
: new HtmlElement(
|
||||
'span',
|
||||
Attributes::create(['class' => 'subject']),
|
||||
Text::create($this->item->display_name)
|
||||
)
|
||||
: new Link($this->item->display_name, Links::servicegroup($this->item), ['class' => 'subject']),
|
||||
new HtmlElement('br'),
|
||||
Text::create($this->item->name)
|
||||
),
|
||||
new HtmlElement('span', null, Text::create($this->item->name))
|
||||
);
|
||||
}
|
||||
}
|
||||
23
library/Icingadb/Widget/ItemTable/UserTable.php
Normal file
23
library/Icingadb/Widget/ItemTable/UserTable.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemTable;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\BaseItemTable;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class UserTable extends BaseItemTable
|
||||
{
|
||||
protected $defaultAttributes = ['class' => 'user-table'];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->setDetailUrl(Url::fromPath('icingadb/user'));
|
||||
}
|
||||
|
||||
protected function getItemClass(): string
|
||||
{
|
||||
return UserTableRow::class;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemList;
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemTable;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\BaseTableRowItem;
|
||||
use Icinga\Module\Icingadb\Common\Links;
|
||||
use Icinga\Module\Icingadb\Common\NoSubjectLink;
|
||||
use Icinga\Module\Icingadb\Model\User;
|
||||
use ipl\Html\Attributes;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
|
|
@ -20,16 +19,17 @@ use ipl\Web\Widget\Link;
|
|||
* User item of a user list. Represents one database row.
|
||||
*
|
||||
* @property User $item
|
||||
* @property UserList $list
|
||||
* @property UserTable $table
|
||||
*/
|
||||
class UserListItem extends BaseTableRowItem
|
||||
class UserTableRow extends BaseTableRowItem
|
||||
{
|
||||
use NoSubjectLink;
|
||||
protected $defaultAttributes = ['class' => 'user-table-row'];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->setNoSubjectLink($this->list->getNoSubjectLink());
|
||||
$this->list->addDetailFilterAttribute($this, Filter::equal('name', $this->item->name));
|
||||
if (isset($this->table)) {
|
||||
$this->table->addDetailFilterAttribute($this, Filter::equal('name', $this->item->name));
|
||||
}
|
||||
}
|
||||
|
||||
protected function assembleVisual(BaseHtmlElement $visual)
|
||||
|
|
@ -44,15 +44,14 @@ class UserListItem extends BaseTableRowItem
|
|||
protected function assembleTitle(BaseHtmlElement $title)
|
||||
{
|
||||
$title->addHtml(
|
||||
$this->getNoSubjectLink()
|
||||
? new HtmlElement(
|
||||
isset($this->table)
|
||||
? new Link($this->item->display_name, Links::user($this->item), ['class' => 'subject'])
|
||||
: new HtmlElement(
|
||||
'span',
|
||||
Attributes::create(['class' => 'subject']),
|
||||
Text::create($this->item->display_name)
|
||||
)
|
||||
: new Link($this->item->display_name, Links::user($this->item), ['class' => 'subject']),
|
||||
new HtmlElement('br'),
|
||||
Text::create($this->item->name)
|
||||
),
|
||||
new HtmlElement('span', null, Text::create($this->item->name))
|
||||
);
|
||||
}
|
||||
|
||||
23
library/Icingadb/Widget/ItemTable/UsergroupTable.php
Normal file
23
library/Icingadb/Widget/ItemTable/UsergroupTable.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemTable;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\BaseItemTable;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class UsergroupTable extends BaseItemTable
|
||||
{
|
||||
protected $defaultAttributes = ['class' => 'usergroup-table'];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->setDetailUrl(Url::fromPath('icingadb/usergroup'));
|
||||
}
|
||||
|
||||
protected function getItemClass(): string
|
||||
{
|
||||
return UsergroupTableRow::class;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemList;
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemTable;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\BaseTableRowItem;
|
||||
use Icinga\Module\Icingadb\Common\Links;
|
||||
use Icinga\Module\Icingadb\Common\NoSubjectLink;
|
||||
use Icinga\Module\Icingadb\Model\Usergroup;
|
||||
use ipl\Html\Attributes;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
|
|
@ -20,16 +19,17 @@ use ipl\Web\Widget\Link;
|
|||
* Usergroup item of a usergroup list. Represents one database row.
|
||||
*
|
||||
* @property Usergroup $item
|
||||
* @property UsergroupList $list
|
||||
* @property UsergroupTable $table
|
||||
*/
|
||||
class UsergroupListItem extends BaseTableRowItem
|
||||
class UsergroupTableRow extends BaseTableRowItem
|
||||
{
|
||||
use NoSubjectLink;
|
||||
protected $defaultAttributes = ['class' => 'usergroup-table-row'];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->setNoSubjectLink($this->list->getNoSubjectLink());
|
||||
$this->list->addDetailFilterAttribute($this, Filter::equal('name', $this->item->name));
|
||||
if (isset($this->table)) {
|
||||
$this->table->addDetailFilterAttribute($this, Filter::equal('name', $this->item->name));
|
||||
}
|
||||
}
|
||||
|
||||
protected function assembleVisual(BaseHtmlElement $visual)
|
||||
|
|
@ -44,15 +44,14 @@ class UsergroupListItem extends BaseTableRowItem
|
|||
protected function assembleTitle(BaseHtmlElement $title)
|
||||
{
|
||||
$title->addHtml(
|
||||
$this->getNoSubjectLink()
|
||||
? new HtmlElement(
|
||||
isset($this->table)
|
||||
? new Link($this->item->display_name, Links::usergroup($this->item), ['class' => 'subject'])
|
||||
: new HtmlElement(
|
||||
'span',
|
||||
Attributes::create(['class' => 'subject']),
|
||||
Text::create($this->item->display_name)
|
||||
)
|
||||
: new Link($this->item->display_name, Links::usergroup($this->item), ['class' => 'subject']),
|
||||
new HtmlElement('br'),
|
||||
Text::create($this->item->name)
|
||||
),
|
||||
new HtmlElement('span', null, Text::create($this->item->name))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -318,10 +318,17 @@ div.show-more {
|
|||
&.servicegroup-table {
|
||||
--columns: 1;
|
||||
}
|
||||
|
||||
&.user-table, // TODO: make them lists.....
|
||||
&.usergroup-table {
|
||||
--columns: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.hostgroup-table,
|
||||
.servicegroup-table {
|
||||
.servicegroup-table,
|
||||
.usergroup-table,
|
||||
.user-table {
|
||||
.title .content > * {
|
||||
display: block;
|
||||
max-width: fit-content;
|
||||
|
|
@ -333,7 +340,9 @@ div.show-more {
|
|||
}
|
||||
|
||||
.controls .hostgroup-table-row,
|
||||
.controls .servicegroup-table-row {
|
||||
.controls .servicegroup-table-row,
|
||||
.controls .usergroup-table-row,
|
||||
.controls .user-table-row {
|
||||
.title .content {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
Loading…
Reference in a new issue