monitoring: Sort by display_names in the service grid

refs #9538
This commit is contained in:
Eric Lippmann 2015-08-19 12:41:58 +02:00
parent 9ea3f73e83
commit 0c43e4a36b

View File

@ -581,29 +581,31 @@ class Monitoring_ListController extends Controller
{ {
$this->addTitleTab('servicegrid', $this->translate('Service Grid'), $this->translate('Show the Service Grid')); $this->addTitleTab('servicegrid', $this->translate('Service Grid'), $this->translate('Show the Service Grid'));
$this->setAutorefreshInterval(15); $this->setAutorefreshInterval(15);
$problems = (bool) $this->params->shift('problems', 0);
$query = $this->backend->select()->from('servicestatus', array( $query = $this->backend->select()->from('servicestatus', array(
'host_display_name',
'host_name', 'host_name',
'service_description', 'service_description',
'service_state', 'service_display_name',
'service_handled',
'service_output', 'service_output',
'service_handled' 'service_state'
)); ));
$this->filterQuery($query); $this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->setupSortControl(array( $this->setupSortControl(array(
'host_name' => $this->translate('Hostname'), 'host_display_name' => $this->translate('Hostname'),
'service_description' => $this->translate('Service description') 'service_display_name' => $this->translate('Service Name')
), $query); ), $query);
$filter = (bool) $this->params->shift('problems', false) ? Filter::where('service_problem', 1) : null;
$pivot = $query->pivot( $pivot = $query->pivot(
'service_description', 'service_description',
'host_name', 'host_name',
$problems ? Filter::where('service_problem', 1) : null, $filter,
$problems ? Filter::where('service_problem', 1) : null $filter ? clone $filter : null
); );
$this->view->pivot = $pivot; $this->view->pivot = $pivot;
$this->view->horizontalPaginator = $pivot->paginateXAxis(); $this->view->horizontalPaginator = $pivot->paginateXAxis();
$this->view->verticalPaginator = $pivot->paginateYAxis(); $this->view->verticalPaginator = $pivot->paginateYAxis();
} }
/** /**