Skip to content

Commit

Permalink
Add view mode functionality for RedundancyGroup items
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Nov 25, 2024
1 parent c869dc3 commit ac09fea
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
11 changes: 10 additions & 1 deletion library/Icingadb/Widget/ItemList/DependencyNodeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,23 @@ protected function getItemClass(): string

protected function createListItem(object $data): BaseListItem
{
$viewMode = $this->getViewMode();
/** @var UnreachableParent|DependencyNode $data */
if ($data->redundancy_group_id !== null) {
if ($viewMode === 'minimal') {
return new RedundancyGroupListItemMinimal($data->redundancy_group, $this);
}

if ($viewMode === 'detailed') {
$this->removeAttribute('class', 'default-layout');
}

return new RedundancyGroupListItem($data->redundancy_group, $this);
}

$object = $data->service_id !== null ? $data->service : $data->host;

switch ($this->getViewMode()) {
switch ($viewMode) {
case 'minimal':
$class = $object instanceof Host ? HostListItemMinimal::class : ServiceListItemMinimal::class;
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/* Icinga DB Web | (c) 2024 Icinga GmbH | GPLv2 */

namespace Icinga\Module\Icingadb\Widget\ItemList;

use Icinga\Module\Icingadb\Common\ListItemMinimalLayout;
use ipl\Web\Widget\StateBall;

class RedundancyGroupListItemMinimal extends RedundancyGroupListItem
{
use ListItemMinimalLayout;

protected function getStateBallSize(): string
{
return StateBall::SIZE_BIG;
}
}
30 changes: 26 additions & 4 deletions public/css/list/redundancy-group-list-item.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
.redundancy-group-list-item {
.caption {
display: flex;
justify-content: end;
.item-list.detailed,
.item-list.common,
.item-list.minimal {
.list-item.redundancy-group-list-item {
.title > * {
margin: 0 .28125em; // 0 calculated &nbsp; width

&:first-child {
margin-left: 0;
}

&:last-child {
margin-right: 0;
}
}

.caption {
display: flex;
justify-content: end;
}
}
}

.item-list.minimal > .list-item.redundancy-group-list-item {
.caption .object-statistics {
font-size: 9px;
}
}

0 comments on commit ac09fea

Please sign in to comment.