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 22, 2025
1 parent 4806939 commit 753bea9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
3 changes: 2 additions & 1 deletion application/controllers/HostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ public function servicesAction()
'service.state.severity desc,service.state.last_state_change desc' => t('Severity'),
'service.state.soft_state' => t('Current State'),
'service.state.last_state_change desc' => t('Last State Change')
]
],
['service.state.severity DESC', 'service.state.last_state_change DESC']
);

yield $this->export($services);
Expand Down
5 changes: 1 addition & 4 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,8 +52,6 @@ public function indexAction()
'services_warning_handled',
'services_warning_unhandled',
]);

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

$sortControl = $this->createSortControl(
Expand All @@ -64,7 +61,7 @@ public function indexAction()
'hosts_severity desc, display_name' => t('Severity'),
'hosts_total desc' => t('Total Hosts'),
],
$defaultSort
['hosts_severity DESC', 'display_name']
);

$searchBar = $this->createSearchBar($hostgroups, [
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/HostsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public function indexAction()
'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')
]
],
['host.state.severity DESC', 'host.state.last_state_change DESC']
);
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);
$columns = $this->createColumnControl($hosts, $viewModeSwitcher);
Expand Down
7 changes: 1 addition & 6 deletions application/controllers/ServicegroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,14 @@ public function indexAction()
$paginationControl = $this->createPaginationControl($servicegroups);
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);

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

$sortControl = $this->createSortControl(
$servicegroups,
[
'display_name' => t('Name'),
'services_severity desc, display_name' => t('Severity'),
'services_total desc' => t('Total Services')
],
$defaultSort
['services_severity DESC', 'display_name']
);

$searchBar = $this->createSearchBar($servicegroups, [
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/ServicesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ 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')
]
],
['service.state.severity DESC', 'service.state.last_state_change DESC']
);
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);
$columns = $this->createColumnControl($services, $viewModeSwitcher);
Expand Down

0 comments on commit 753bea9

Please sign in to comment.