Still downtimes

This commit is contained in:
Thomas Gelf 2014-03-09 22:32:40 +01:00
parent 0598930b09
commit bf66271e49
5 changed files with 36 additions and 27 deletions

View File

@ -198,34 +198,33 @@ class Monitoring_ListController extends Controller
$query = DowntimeView::fromRequest(
$this->_request,
array(
'id' => 'downtime_internal_id',
'objecttype' => 'downtime_objecttype',
'comment' => 'downtime_comment',
'author' => 'downtime_author',
'start' => 'downtime_start',
'end' => 'downtime_end',
'duration' => 'downtime_duration',
'is_flexible' => 'downtime_is_flexible',
'is_in_effect' => 'downtime_is_in_effect',
'entry_time' => 'downtime_entry_time',
'host' => 'downtime_host',
'service' => 'downtime_service'
'id' => 'downtime_internal_id',
'objecttype' => 'downtime_objecttype',
'comment' => 'downtime_comment',
'author' => 'downtime_author',
'start' => 'downtime_start',
'scheduled_start' => 'downtime_scheduled_start',
'end' => 'downtime_end',
'duration' => 'downtime_duration',
'is_flexible' => 'downtime_is_flexible',
'is_fixed' => 'downtime_is_fixed',
'is_in_effect' => 'downtime_is_in_effect',
'entry_time' => 'downtime_entry_time',
'host' => 'downtime_host',
'service' => 'downtime_service'
)
)->getQuery()->order('downtime_is_in_effect', 'DESC')->order('downtime_scheduled_start_time', 'DESC');
)->getQuery()->order('downtime_is_in_effect', 'DESC')->order('downtime_scheduled_start', 'DESC');
$this->view->downtimes = $query->paginate();
$this->setupSortControl(array(
'downtime_is_in_effect' => 'Is In Effect',
'object_type' => 'Service/Host',
'host_name' => 'Host Name',
'service_description' => 'Service Name',
'downtime_host' => 'Host / Service',
'downtime_entry_time' => 'Entry Time',
'downtime_author_name' => 'Author',
'downtime_comment_data' => 'Comment',
'downtime_scheduled_start_time' => 'Start',
'downtime_scheduled_end_time' => 'End',
'downtime_trigger_time' => 'Trigger Time',
'downtime_internal_downtime_id' => 'Downtime ID',
'downtime_author' => 'Author',
'downtime_start' => 'Start Time',
'downtime_start' => 'End Time',
'downtime_scheduled_start_time' => 'Scheduled Start',
'downtime_scheduled_end_time' => 'Scheduled End',
'downtime_duration' => 'Duration',
));
$this->handleFormatRequest($query);

View File

@ -115,12 +115,12 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
foreach ($downtimes as $downtime) {
$label = sprintf(
'ID %s: %s%s Starting @ %s',
$downtime->downtime_internal_downtime_id,
$downtime->id,
$object->host_name,
$object instanceof Service ? ' (' . $object->service_description . ')' : '',
$dateFormat->formatDateTime($downtime->downtime_scheduled_start_time)
$dateFormat->formatDateTime($downtime->scheduled_start)
);
$options[$downtime->downtime_internal_downtime_id] = $label;
$options[$downtime->id] = $label;
}
return $options;
}

View File

@ -46,7 +46,7 @@ class DowntimeQuery extends IdoQuery
'downtime_is_fixed' => 'sd.is_fixed',
'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END',
'downtime_triggered_by_id' => 'sd.triggered_by_id',
'downtime_scheduled_start_time' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)',
'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)',
'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN sd.trigger_time != '0000-00-00 00:00:00' then sd.trigger_time ELSE sd.scheduled_start_time END)",
'downtime_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)',
'downtime_duration' => 'sd.duration',

View File

@ -46,6 +46,7 @@ class Downtime extends DataView
'downtime_is_fixed',
'downtime_is_flexible',
'downtime_start',
'downtime_scheduled_start',
'downtime_end',
'downtime_duration',
'downtime_is_in_effect',
@ -64,7 +65,14 @@ class Downtime extends DataView
),
'downtime_start' => array(
'order' => self::SORT_DESC
)
),
'downtime_host' => array(
'columns' => array(
'downtime_host',
'downtime_service'
),
'order' => self::SORT_ASC
),
);
}
}

View File

@ -71,9 +71,11 @@ abstract class AbstractObject
'comment' => 'downtime_comment',
'author' => 'downtime_author',
'start' => 'downtime_start',
'scheduled_start' => 'downtime_scheduled_start',
'end' => 'downtime_end',
'duration' => 'downtime_duration',
'is_flexible' => 'downtime_is_flexible',
'is_fixed' => 'downtime_is_fixed',
'is_in_effect' => 'downtime_is_in_effect',
'entry_time' => 'downtime_entry_time',
'host' => 'downtime_host',