Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use severity as as default sort #1121

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 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,15 +52,15 @@ 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,
[
'display_name' => t('Name'),
'hosts_severity desc, display_name' => t('Severity'),
'display_name' => t('Name'),
'hosts_total desc' => t('Total Hosts'),
],
$defaultSort
Expand Down
9 changes: 7 additions & 2 deletions application/controllers/HostsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,20 @@ 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.display_name' => t('Name'),
'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
7 changes: 2 additions & 5 deletions application/controllers/ServicegroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,13 @@ 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,
[
'display_name' => t('Name'),
'services_severity desc, display_name' => t('Severity'),
'display_name' => t('Name'),
'services_total desc' => t('Total Services')
],
$defaultSort
Expand Down
8 changes: 6 additions & 2 deletions application/controllers/ServicesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,20 @@ 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,
[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, change the order of the array to reflect the default sort.

'service.display_name' => t('Name'),
'service.state.severity desc,service.state.last_state_change desc' => t('Severity'),
'service.display_name' => t('Name'),
'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
Loading