Skip to content

Commit

Permalink
Host/Service/Hostgroup/Servicegroup: Use severity as default sort order
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jan 9, 2025
1 parent 4806939 commit 9b37857
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
5 changes: 2 additions & 3 deletions application/controllers/HostgroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public function indexAction()
$paginationControl = $this->createPaginationControl($hostgroups);
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);

$defaultSort = null;
if ($viewModeSwitcher->getViewMode() === 'grid') {
$hostgroups->without([
'services_critical_handled',
Expand All @@ -53,10 +52,10 @@ public function indexAction()
'services_warning_handled',
'services_warning_unhandled',
]);

$defaultSort = ['hosts_severity DESC', 'display_name'];
}

$defaultSort = ['hosts_severity DESC', 'display_name'];

$sortControl = $this->createSortControl(
$hostgroups,
[
Expand Down
6 changes: 5 additions & 1 deletion application/controllers/HostsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,19 @@ public function indexAction()

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

$defaultSort = 'host.state.severity desc,host.state.last_state_change desc';
$sortControl = $this->createSortControl(
$hosts,
[
'host.display_name' => t('Name'),
'host.state.severity desc,host.state.last_state_change desc' => t('Severity'),
'host.state.soft_state' => t('Current State'),
'host.state.last_state_change desc' => t('Last State Change')
]
],
$defaultSort
);

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

Expand Down
5 changes: 1 addition & 4 deletions application/controllers/ServicegroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ public function indexAction()
$paginationControl = $this->createPaginationControl($servicegroups);
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);

$defaultSort = null;
if ($viewModeSwitcher->getViewMode() === 'grid') {
$defaultSort = ['services_severity DESC', 'display_name'];
}
$defaultSort = ['services_severity DESC', 'display_name'];

$sortControl = $this->createSortControl(
$servicegroups,
Expand Down
6 changes: 5 additions & 1 deletion application/controllers/ServicesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public function indexAction()

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

$defaultSort = 'service.state.severity desc,service.state.last_state_change desc';
$sortControl = $this->createSortControl(
$services,
[
Expand All @@ -68,8 +70,10 @@ public function indexAction()
'service.state.soft_state' => t('Current State'),
'service.state.last_state_change desc' => t('Last State Change'),
'host.display_name' => t('Host')
]
],
$defaultSort
);

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

Expand Down

0 comments on commit 9b37857

Please sign in to comment.