monitoring: Fix select columns for downtimes, again

refs #9009
refs #9319
This commit is contained in:
Eric Lippmann 2015-05-26 17:15:03 +02:00
parent 61565543ab
commit 0c1df335fc
3 changed files with 14 additions and 18 deletions

View File

@ -37,7 +37,7 @@ class Monitoring_DowntimeController extends Controller
$this->downtime = $this->backend->select()->from('downtime', array(
'id' => 'downtime_internal_id',
'objecttype' => 'downtime_objecttype',
'objecttype' => 'object_type',
'comment' => 'downtime_comment',
'author_name' => 'downtime_author_name',
'start' => 'downtime_start',
@ -49,11 +49,9 @@ class Monitoring_DowntimeController extends Controller
'is_fixed' => 'downtime_is_fixed',
'is_in_effect' => 'downtime_is_in_effect',
'entry_time' => 'downtime_entry_time',
'host_state' => 'downtime_host_state',
'service_state' => 'downtime_service_state',
'host_state',
'service_state',
'host_name',
'host',
'service',
'service_description',
'host_display_name',
'service_display_name'
@ -95,9 +93,9 @@ class Monitoring_DowntimeController extends Controller
Host::getStateText($this->downtime->host_state);
$this->view->listAllLink = Url::fromPath('monitoring/list/downtimes');
$this->view->showHostLink = Url::fromPath('monitoring/host/show')
->setParam('host', $this->downtime->host);
->setParam('host', $this->downtime->host_name);
$this->view->showServiceLink = Url::fromPath('monitoring/service/show')
->setParam('host', $this->downtime->host)
->setParam('host', $this->downtime->host_name)
->setParam('service', $this->downtime->service_description);
if ($this->hasPermission('monitoring/command/downtime/delete')) {
$this->view->delDowntimeForm = $this->createDelDowntimeForm();

View File

@ -41,7 +41,7 @@ class Monitoring_DowntimesController extends Controller
));
$this->downtimes = $this->backend->select()->from('downtime', array(
'id' => 'downtime_internal_id',
'objecttype' => 'downtime_objecttype',
'objecttype' => 'object_type',
'comment' => 'downtime_comment',
'author_name' => 'downtime_author_name',
'start' => 'downtime_start',
@ -53,11 +53,9 @@ class Monitoring_DowntimesController extends Controller
'is_fixed' => 'downtime_is_fixed',
'is_in_effect' => 'downtime_is_in_effect',
'entry_time' => 'downtime_entry_time',
'host_state' => 'downtime_host_state',
'service_state' => 'downtime_service_state',
'host_state',
'service_state',
'host_name',
'host',
'service',
'service_description',
'host_display_name',
'service_display_name'
@ -68,7 +66,7 @@ class Monitoring_DowntimesController extends Controller
$this->translate('Downtime not found')
);
}
$this->getTabs()->add(
'downtimes',
array(
@ -80,14 +78,14 @@ class Monitoring_DowntimesController extends Controller
'url' =>'monitoring/downtimes/show'
)
)->activate('downtimes');
foreach ($this->downtimes as $downtime) {
if (isset($downtime->service_description)) {
$downtime->isService = true;
} else {
$downtime->isService = false;
}
if ($downtime->isService) {
$downtime->stateText = Service::getStateText($downtime->service_state);
} else {
@ -127,4 +125,4 @@ class Monitoring_DowntimesController extends Controller
$delDowntimeForm->setDowntimes($this->downtimes)->handleRequest();
$this->view->delDowntimeForm = $delDowntimeForm;
}
}
}

View File

@ -274,7 +274,7 @@ abstract class MonitoredObject implements Filterable
{
$downtimes = $this->backend->select()->from('downtime', array(
'id' => 'downtime_internal_id',
'objecttype' => 'downtime_objecttype',
'objecttype' => 'object_type',
'comment' => 'downtime_comment',
'author_name' => 'downtime_author_name',
'start' => 'downtime_start',
@ -286,7 +286,7 @@ abstract class MonitoredObject implements Filterable
'is_in_effect' => 'downtime_is_in_effect',
'entry_time' => 'downtime_entry_time'
))
->where('downtime_objecttype', $this->type)
->where('object_type', $this->type)
->order('downtime_is_in_effect', 'DESC')
->order('downtime_scheduled_start', 'ASC');
if ($this->type === self::TYPE_SERVICE) {