Skip to content

Commit 3c5cafb

Browse files
sukhwinder33445nilmerg
authored andcommitted
Host/Service/Hostgroup/Servicegroup: Use severity as default sort order
1 parent 609aa08 commit 3c5cafb

5 files changed

Lines changed: 8 additions & 13 deletions

File tree

application/controllers/HostController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ public function servicesAction(): Generator
215215
'service.state.severity desc,service.state.last_state_change desc' => $this->translate('Severity'),
216216
'service.state.soft_state' => $this->translate('Current State'),
217217
'service.state.last_state_change desc' => $this->translate('Last State Change')
218-
]
218+
],
219+
['service.state.severity DESC', 'service.state.last_state_change DESC']
219220
);
220221

221222
yield $this->export($services);

application/controllers/HostgroupsController.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public function indexAction()
4343
$paginationControl = $this->createPaginationControl($hostgroups);
4444
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);
4545

46-
$defaultSort = null;
4746
if ($viewModeSwitcher->getViewMode() === 'grid') {
4847
$hostgroups->without([
4948
'services_critical_handled',
@@ -56,8 +55,6 @@ public function indexAction()
5655
'services_warning_handled',
5756
'services_warning_unhandled',
5857
]);
59-
60-
$defaultSort = ['hosts_severity DESC', 'display_name'];
6158
}
6259

6360
$sortControl = $this->createSortControl(
@@ -67,7 +64,7 @@ public function indexAction()
6764
'hosts_severity desc, display_name' => t('Severity'),
6865
'hosts_total desc' => t('Total Hosts'),
6966
],
70-
$defaultSort
67+
['hosts_severity DESC', 'display_name']
7168
);
7269

7370
$searchBar = $this->createSearchBar($hostgroups, [

application/controllers/HostsController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public function indexAction()
5757
'host.state.severity desc,host.state.last_state_change desc' => t('Severity'),
5858
'host.state.soft_state' => t('Current State'),
5959
'host.state.last_state_change desc' => t('Last State Change')
60-
]
60+
],
61+
['host.state.severity DESC', 'host.state.last_state_change DESC']
6162
);
6263
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);
6364
$columns = $this->createColumnControl($hosts, $viewModeSwitcher);

application/controllers/ServicegroupsController.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,14 @@ public function indexAction()
4545
$paginationControl = $this->createPaginationControl($servicegroups);
4646
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);
4747

48-
$defaultSort = null;
49-
if ($viewModeSwitcher->getViewMode() === 'grid') {
50-
$defaultSort = ['services_severity DESC', 'display_name'];
51-
}
52-
5348
$sortControl = $this->createSortControl(
5449
$servicegroups,
5550
[
5651
'display_name' => t('Name'),
5752
'services_severity desc, display_name' => t('Severity'),
5853
'services_total desc' => t('Total Services')
5954
],
60-
$defaultSort
55+
['services_severity DESC', 'display_name']
6156
);
6257

6358
$searchBar = $this->createSearchBar($servicegroups, [

application/controllers/ServicesController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public function indexAction()
6868
'service.state.soft_state' => t('Current State'),
6969
'service.state.last_state_change desc' => t('Last State Change'),
7070
'host.display_name' => t('Host')
71-
]
71+
],
72+
['service.state.severity DESC', 'service.state.last_state_change DESC']
7273
);
7374
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl);
7475
$columns = $this->createColumnControl($services, $viewModeSwitcher);

0 commit comments

Comments
 (0)