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

View File

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

View File

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