mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
monitoring: Use descriptive variable names in servicesAction()
This commit is contained in:
parent
ad8cffcbbd
commit
f50906dade
@ -114,10 +114,16 @@ class ListController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display service list
|
* List services
|
||||||
*/
|
*/
|
||||||
public function servicesAction()
|
public function servicesAction()
|
||||||
{
|
{
|
||||||
|
$this->addTitleTab(
|
||||||
|
'services',
|
||||||
|
$this->translate('Services'),
|
||||||
|
$this->translate('List services')
|
||||||
|
);
|
||||||
|
|
||||||
// Handle soft and hard states
|
// Handle soft and hard states
|
||||||
if (strtolower($this->params->shift('stateType', 'soft')) === 'hard') {
|
if (strtolower($this->params->shift('stateType', 'soft')) === 'hard') {
|
||||||
$stateColumn = 'service_hard_state';
|
$stateColumn = 'service_hard_state';
|
||||||
@ -127,14 +133,9 @@ class ListController extends Controller
|
|||||||
$stateChangeColumn = 'service_last_state_change';
|
$stateChangeColumn = 'service_last_state_change';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addTitleTab('services', $this->translate('Services'), $this->translate('List services'));
|
|
||||||
$this->view->showHost = true;
|
|
||||||
if (strpos($this->params->get('host_name', '*'), '*') === false) {
|
|
||||||
$this->view->showHost = false;
|
|
||||||
}
|
|
||||||
$this->setAutorefreshInterval(10);
|
$this->setAutorefreshInterval(10);
|
||||||
|
|
||||||
$columns = array_merge(array(
|
$services = $this->backend->select()->from('servicestatus', array_merge(array(
|
||||||
'host_name',
|
'host_name',
|
||||||
'host_display_name',
|
'host_display_name',
|
||||||
'host_state',
|
'host_state',
|
||||||
@ -157,14 +158,12 @@ class ListController extends Controller
|
|||||||
'service_notifications_enabled',
|
'service_notifications_enabled',
|
||||||
'service_active_checks_enabled',
|
'service_active_checks_enabled',
|
||||||
'service_passive_checks_enabled'
|
'service_passive_checks_enabled'
|
||||||
), $this->addColumns());
|
), $this->addColumns()));
|
||||||
$query = $this->backend->select()->from('servicestatus', $columns);
|
$this->applyRestriction('monitoring/filter/objects', $services);
|
||||||
$this->applyRestriction('monitoring/filter/objects', $query);
|
$this->filterQuery($services);
|
||||||
$this->filterQuery($query);
|
|
||||||
$this->view->services = $query;
|
|
||||||
|
|
||||||
|
$this->setupPaginationControl($services);
|
||||||
$this->setupLimitControl();
|
$this->setupLimitControl();
|
||||||
$this->setupPaginationControl($this->view->services);
|
|
||||||
$this->setupSortControl(array(
|
$this->setupSortControl(array(
|
||||||
'service_severity' => $this->translate('Service Severity'),
|
'service_severity' => $this->translate('Service Severity'),
|
||||||
'service_state' => $this->translate('Current Service State'),
|
'service_state' => $this->translate('Current Service State'),
|
||||||
@ -176,7 +175,7 @@ class ListController extends Controller
|
|||||||
'host_display_name' => $this->translate('Hostname'),
|
'host_display_name' => $this->translate('Hostname'),
|
||||||
'host_address' => $this->translate('Host Address'),
|
'host_address' => $this->translate('Host Address'),
|
||||||
'host_last_check' => $this->translate('Last Host Check')
|
'host_last_check' => $this->translate('Last Host Check')
|
||||||
), $query);
|
), $services);
|
||||||
|
|
||||||
$stats = $this->backend->select()->from('servicestatussummary', array(
|
$stats = $this->backend->select()->from('servicestatussummary', array(
|
||||||
'services_critical',
|
'services_critical',
|
||||||
@ -193,7 +192,14 @@ class ListController extends Controller
|
|||||||
'services_warning_unhandled'
|
'services_warning_unhandled'
|
||||||
));
|
));
|
||||||
$this->applyRestriction('monitoring/filter/objects', $stats);
|
$this->applyRestriction('monitoring/filter/objects', $stats);
|
||||||
|
|
||||||
|
$this->view->services = $services;
|
||||||
$this->view->stats = $stats;
|
$this->view->stats = $stats;
|
||||||
|
if (strpos($this->params->get('host_name', '*'), '*') === false) {
|
||||||
|
$this->view->showHost = false;
|
||||||
|
} else {
|
||||||
|
$this->view->showHost = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user