Skip to content

Commit

Permalink
(Host|Service)Controller: Sort parents children tab list by default t…
Browse files Browse the repository at this point in the history
…o `severity`
  • Loading branch information
sukhwinder33445 committed Jan 15, 2025
1 parent 9c6f6cc commit df52697
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
16 changes: 12 additions & 4 deletions application/controllers/HostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,19 @@ public function parentsAction(): Generator

$limitControl = $this->createLimitControl();
$paginationControl = $this->createPaginationControl($nodesQuery);

$defaultSort = ['severity DESC', 'last_state_change DESC'];
$sortControl = $this->createSortControl(
$nodesQuery,
[
'name' => $this->translate('Name'),
'severity desc, last_state_change desc' => $this->translate('Severity'),
'name' => $this->translate('Name'),
'state' => $this->translate('Current State'),
'last_state_change desc' => $this->translate('Last State Change')
]
],
$defaultSort
);

$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);

$searchBar = $this->createSearchBar(
Expand Down Expand Up @@ -304,15 +308,19 @@ public function childrenAction(): Generator

$limitControl = $this->createLimitControl();
$paginationControl = $this->createPaginationControl($nodesQuery);

$defaultSort = ['severity DESC', 'last_state_change DESC'];
$sortControl = $this->createSortControl(
$nodesQuery,
[
'name' => $this->translate('Name'),
'severity desc, last_state_change desc' => $this->translate('Severity'),
'name' => $this->translate('Name'),
'state' => $this->translate('Current State'),
'last_state_change desc' => $this->translate('Last State Change')
]
],
$defaultSort
);

$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);

$searchBar = $this->createSearchBar(
Expand Down
16 changes: 12 additions & 4 deletions application/controllers/ServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,19 @@ public function parentsAction(): Generator

$limitControl = $this->createLimitControl();
$paginationControl = $this->createPaginationControl($nodesQuery);

$defaultSort = ['severity DESC', 'last_state_change DESC'];
$sortControl = $this->createSortControl(
$nodesQuery,
[
'name' => $this->translate('Name'),
'severity desc, last_state_change desc' => $this->translate('Severity'),
'name' => $this->translate('Name'),
'state' => $this->translate('Current State'),
'last_state_change desc' => $this->translate('Last State Change')
]
],
$defaultSort
);

$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);

$searchBar = $this->createSearchBar(
Expand Down Expand Up @@ -175,15 +179,19 @@ public function childrenAction(): Generator

$limitControl = $this->createLimitControl();
$paginationControl = $this->createPaginationControl($nodesQuery);

$defaultSort = ['severity DESC', 'last_state_change DESC'];
$sortControl = $this->createSortControl(
$nodesQuery,
[
'name' => $this->translate('Name'),
'severity desc, last_state_change desc' => $this->translate('Severity'),
'name' => $this->translate('Name'),
'state' => $this->translate('Current State'),
'last_state_change desc' => $this->translate('Last State Change')
]
],
$defaultSort
);

$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);

$searchBar = $this->createSearchBar(
Expand Down

0 comments on commit df52697

Please sign in to comment.