diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index ce48e7ef1..b90db8e47 100755 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -112,10 +112,12 @@ class ActionController extends Zend_Controller_Action $url = substr($url, strlen($this->getRequest()->getBaseUrl())); // the host is mandatory, but ignored in Zend $req = new Request('http://ignoredhost/' . $url); - + $req->setBaseUrl($this->getRequest()->getBaseUrl()); $router = Zend_Controller_Front::getInstance()->getRouter(); $router->route($req); + Zend_Controller_Front::getInstance()->setRequest($req); $detailHtml = $this->view->action($req->getActionName(), $req->getControllerName(), $req->getModuleName()); + Zend_Controller_Front::getInstance()->setRequest($this->getRequest()); $this->_helper->layout->assign('detailContent', $detailHtml); $this->_helper->layout->assign('detailClass', 'col-sm-12 col-xs-12 col-md-12 col-lg-6'); $this->_helper->layout->assign('mainClass', 'col-sm-12 col-xs-12 col-md-12 col-lg-6'); diff --git a/library/Icinga/Web/Widget/Tab.php b/library/Icinga/Web/Widget/Tab.php index 16ed0e7a8..817fe39ce 100644 --- a/library/Icinga/Web/Widget/Tab.php +++ b/library/Icinga/Web/Widget/Tab.php @@ -96,6 +96,13 @@ class Tab implements Widget */ private $iconCls = null; + /** + * Additional a tag attributes + * + * @var array + */ + private $tagParams; + /** * Sets an icon image for this tab * @@ -166,6 +173,16 @@ class Tab implements Widget $this->urlParams = $urlParams; } + /** + * Set additional a tag attributes + * + * @param array $tagParams + */ + public function setTagParams(array $tagParams) + { + $this->tagParams = $tagParams; + } + /** * Create a new Tab with the given properties * @@ -215,7 +232,13 @@ class Tab implements Widget } if ($this->url !== null) { $this->url->overwriteParams($this->urlParams); - $tab = '' . $caption . ''; + $tagParams = ''; + if ($this->tagParams !== null) { + foreach ($this->tagParams as $key => $value) { + $tagParams .= ' ' . $key . '="' . $value . '"'; + } + } + $tab = '' . $caption . ''; } else { $tab = $caption; } diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 1cc61a2a9..bbea98652 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -31,7 +31,7 @@ use \Icinga\Application\Benchmark; use \Icinga\Data\Db\Query; use \Icinga\File\Csv; -use \Icinga\Web\Controller\ActionController; +use \Icinga\Module\Monitoring\Controller as MonitoringController; use \Icinga\Web\Hook; use \Icinga\Web\Widget\Tabextension\DashboardAction; use \Icinga\Web\Widget\Tabextension\OutputFormat; @@ -47,7 +47,7 @@ use Icinga\Module\Monitoring\DataView\Contactgroup as ContactgroupView; use Icinga\Module\Monitoring\DataView\HostAndServiceStatus as HostAndServiceStatusView; use Icinga\Module\Monitoring\DataView\Comment as CommentView; -class Monitoring_ListController extends ActionController +class Monitoring_ListController extends MonitoringController { /** * The backend used for this controller @@ -137,39 +137,7 @@ class Monitoring_ListController extends ActionController public function servicesAction() { $this->compactView = 'services-compact'; - $query = HostAndServiceStatusView::fromRequest( - $this->_request, - array( - 'host_name', - 'host_state', - 'host_state_type', - 'host_last_state_change', - 'host_address', - 'host_handled', - 'service_description', - 'service_display_name', - 'service_state' => 'service_state', - 'service_in_downtime', - 'service_acknowledged', - 'service_handled', - 'service_output', - 'service_last_state_change' => 'service_last_state_change', - 'service_icon_image', - 'service_long_output', - 'service_is_flapping', - 'service_state_type', - 'service_handled', - 'service_severity', - 'service_last_check', - 'service_notifications_enabled', - 'service_action_url', - 'service_notes_url', - 'service_last_comment', - 'service_active_checks_enabled', - 'service_passive_checks_enabled' - ) - )->getQuery(); - $this->view->services = $query->paginate(); + $this->view->services = $this->fetchServices(); $this->setupSortControl(array( 'service_last_check' => 'Last Service Check', 'service_severity' => 'Severity', @@ -182,7 +150,6 @@ class Monitoring_ListController extends ActionController 'host_address' => 'Host Address', 'host_last_check' => 'Last Host Check' )); - $this->handleFormatRequest($query); } /** diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 79b6d6c6e..046c894dd 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -28,7 +28,7 @@ // @codingStandardsIgnoreStart use \Icinga\Module\Monitoring\Backend; -use \Icinga\Web\Controller\ActionController; +use Icinga\Module\Monitoring\Controller as MonitoringController; use \Icinga\Web\Hook; use \Icinga\Module\Monitoring\Object\Host; use \Icinga\Module\Monitoring\Object\Service; @@ -43,7 +43,7 @@ use \Icinga\Web\Widget\Tabs; * * Actions for show context */ -class Monitoring_ShowController extends ActionController +class Monitoring_ShowController extends MonitoringController { /** * @var Backend @@ -86,7 +86,6 @@ class Monitoring_ShowController extends ActionController public function serviceAction() { $this->view->object->prefetch(); - $this->view->object->eventHistory = $this->view->object->eventHistory->limit(10)->fetchAll(); $this->view->preserve = array(); } @@ -96,14 +95,27 @@ class Monitoring_ShowController extends ActionController public function hostAction() { $this->view->object->prefetch(); - $this->view->object->eventHistory = $this->view->object->eventHistory->limit(10)->fetchAll(); $this->view->preserve = array(); } + public function historyAction() + { + $this->view->object->fetchEventHistory(); + $this->view->history = $this->view->object->eventHistory->limit(10)->paginate(); + } + + public function servicesAction() + { + $params = $this->_request->getParams(); + unset($params['service']); + $this->view->services = $this->fetchServices($params); + } + + /** * History entries for objects */ - public function historyAction() +/* public function historyAction() { $this->view->history = $this->backend->select() ->from( @@ -130,7 +142,7 @@ class Monitoring_ShowController extends ActionController $this->view->preserve['sort'] = $this->_getParam('sort'); } $this->view->preserve = $this->view->history->getAppliedFilter()->toParams(); - } + }*/ /** * Creating tabs for this controller @@ -140,26 +152,66 @@ class Monitoring_ShowController extends ActionController { $object = $this->view->object; $tabs = $this->getTabs(); - if (!$this->view->host) { - return $tabs; - } $params = array( - 'host' => $this->view->host->host_name, + 'host' => $object->host_name, ); - if ($backend = $this->_getParam('backend')) { - $params['backend'] = $backend; - } if ($object instanceof Service) { $params['service'] = $object->service_description; } elseif ($service = $this->_getParam('service')) { $params['service'] = $service; } - + if (isset($params['service'])) { + $tabs->add( + 'service', + array( + 'title' => 'Service', + 'icon' => '', + 'url' => 'monitoring/show/service', + 'urlParams' => $params, + 'tagParams' => array( + 'data-icinga-target' => 'detail' + ) + ) + ); + } + $tabs->add( + 'host', + array( + 'title' => 'Host', + 'icon' => '', + 'url' => 'monitoring/show/host', + 'urlParams' => $params, + 'tagParams' => array( + 'data-icinga-target' => 'detail' + ) + ) + ); + $tabs->add( + 'services', + array( + 'title' => 'Services', + 'icon' => 'img/classic/service.png', + 'url' => 'monitoring/show/services', + 'urlParams' => $params, + 'tagParams' => array( + 'data-icinga-target' => 'detail' + ) + ) + ); + $tabs->add( + 'history', + array( + 'title' => 'History', + 'icon' => '', + 'url' => 'monitoring/show/history', + 'urlParams' => $params, + 'tagParams' => array( + 'data-icinga-target' => 'detail' + ) + ) + ); $tabs->extend(new OutputFormat()) - ->extend(new DashboardAction()) - ->extend(new BasketAction); - - return $tabs; + ->extend(new DashboardAction()); } } // @codingStandardsIgnoreEnd diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index abc6a4ae8..e1190e9f5 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -8,7 +8,7 @@ $viewHelper = $this->getHelper('MonitoringState');
sortControl->render($this); ?> - paginationControl($this->services, null, null, array('preserve' => $this->preserve)); ?> + paginationControl($services, null, null, array('preserve' => $this->preserve)); ?> diff --git a/modules/monitoring/application/views/scripts/show/components/comments.phtml b/modules/monitoring/application/views/scripts/show/components/comments.phtml index 0099f0f93..cf7c2ede9 100644 --- a/modules/monitoring/application/views/scripts/show/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/show/components/comments.phtml @@ -1,29 +1,19 @@ -comments)): ?> -comments as $comment) { - $text = $this->escape($comment->comment_data); - $commets[] = sprintf( - '[%s] %s (%s): %s', - $this->escape($comment->comment_author), - $this->format()->timeSince($comment->comment_timestamp), - $comment->comment_type, - $text - ); -} -?> - -
-
- {{COMMENT_ICON}} Comments -
-
- {{COMMENT_COMMAND_BUTTON}} - {{NOTIFICATION_COMMAND_BUTTON}}
- comments)): ?> -
', $commets); ?>{{REMOVE_COMMENT_COMMAND}}
- - No comments - -
+
+ Comments + comments)): ?> +
+ comments as $comment): ?> +

+ escape($comment->comment_author), + $this->format()->timeSince($comment->comment_timestamp), + $comment->comment_type, + $comment->comment_data + ); ?> + {{REMOVE_ICON}} +

+ +
+
diff --git a/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml b/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml index fa806a27e..e69de29bb 100644 --- a/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml +++ b/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml @@ -1,103 +0,0 @@ -eventHistory)): ?> -
-
- History -
-
-
- - eventHistory as $event): ?> - - - - - - - - - -
timestamp); ?> - - - service_description ?> - - - - host_name ?> - - - - type) { - case 'notify': - $icon = '{{NOTIFICATION_ICON}}'; - $title = 'Notification'; - $msg = $event->output; - break; - case 'comment': - $icon = '{{COMMENT_ICON}}'; - $title = 'Comment'; - $msg = $event->output; - break; - case 'ack': - $icon = '{{ACKNOWLEDGEMENT_ICON}}'; - $title = 'Acknowledgement'; - $msg = ''; - break; - case 'dt_comment': - $icon = '{{IN_DOWNTIME_ICON}}'; - $title = 'In Downtime'; - $msg = $event->output; - break; - case 'flapping': - $icon = '{{FLAPPING_ICON}}'; - $title = 'Flapping'; - $msg = ''; - break; - case 'hard_state': - $icon = '{{HARDSTATE_ICON}}'; - $title = 'Hard State'; - $msg = '[' . $event->attempt . '/' . $event->max_attempts . ']'; - break; - case 'soft_state': - $icon = '{{SOFTSTATE_ICON}}'; - $title = 'Soft State'; - $msg = '[' . $event->attempt . '/' . $event->max_attempts . ']'; - break; - case 'dt_start': - $icon = '{{DOWNTIME_START_ICON}}'; - $title = 'Downtime Start'; - $msg = $event->output; - break; - case 'dt_end': - $icon = '{{DOWNTIME_END_ICON}}'; - $title = 'Downtime End'; - $msg = $event->output; - break; - } - ?> - - -
- - - All events for service_description ?> - - - - All events for host_name ?> - - -
- - diff --git a/modules/monitoring/application/views/scripts/show/components/properties.phtml b/modules/monitoring/application/views/scripts/show/components/properties.phtml index 55a10f2ea..37fc1ebc1 100644 --- a/modules/monitoring/application/views/scripts/show/components/properties.phtml +++ b/modules/monitoring/application/views/scripts/show/components/properties.phtml @@ -1,15 +1,93 @@
-
- Properties -
+
Properties
- monitoringProperties($object) as $label => $value): ?> - - + + + + + + + + + + + + + + + + + + + + + + -
Current Attempt + current_check_attempt, + $object->max_check_attempts, + ($object->state_type === '1') ? 'HARD' : 'SOFT' + ); ?> +
Check Type + passive_checks_enabled === '1' && $object->active_checks_enabled === '0'): ?> + PASSIVE + passive_checks_enabled === '0' && $object->active_checks_enabled === '0'): ?> + DISABLED + + ACTIVE + +
Check Latency / Duration + passive_checks_enabled === '0' && $object->active_checks_enabled === '0'): ?> + N/A + + check_latency); ?> / check_execution_time); ?> seconds + +
Last Notification + service_description) { + $notificationsHref = $this->href('monitoring/list/notifications', + array( + 'host' => $object->host_name, + 'service' => $object->service_description + ) + ); + } else { + $notificationsHref = $this->href('monitoring/list/notifications', + array( + 'host' => $object->host_name + ) + ); + } + ?> + + last_notification === '0000-00-00 00:00:00'): ?> + N/A + + last_notification ?> + current_notification_number > 0): ?> +
+ current_notification_number ?> notifications sent during current problem state + + +
+
Is This service_description ? 'Service' : 'Host' ?> Flapping? + is_flapping === '1'): ?> + YES + + NO + + percent_state_change); ?>% state change +
In Scheduled Downtime? + in_downtime === '1'): ?> + YES + + NO + +
diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index f5f4254b7..457f56b89 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -1,7 +1,103 @@ -render('show/components/header.phtml') ?> -limit(10); -$hhistory = $this->history->paginate(); +tabs->render($this); ?> -?> +

History

+ +
+ paginationControl($history, null, null, array('preserve' => $this->preserve)); ?> + + + + + + + + + + + + +
timestamp); ?> + + + service_description ?> + + + + host_name ?> + + + + type) { + case 'notify': + $icon = '{{NOTIFICATION_ICON}}'; + $title = 'Notification'; + $msg = $event->output; + break; + case 'comment': + $icon = '{{COMMENT_ICON}}'; + $title = 'Comment'; + $msg = $event->output; + break; + case 'ack': + $icon = '{{ACKNOWLEDGEMENT_ICON}}'; + $title = 'Acknowledgement'; + $msg = ''; + break; + case 'dt_comment': + $icon = '{{IN_DOWNTIME_ICON}}'; + $title = 'In Downtime'; + $msg = $event->output; + break; + case 'flapping': + $icon = '{{FLAPPING_ICON}}'; + $title = 'Flapping'; + $msg = ''; + break; + case 'hard_state': + $icon = '{{HARDSTATE_ICON}}'; + $title = 'Hard State'; + $msg = '[' . $event->attempt . '/' . $event->max_attempts . ']'; + break; + case 'soft_state': + $icon = '{{SOFTSTATE_ICON}}'; + $title = 'Soft State'; + $msg = '[' . $event->attempt . '/' . $event->max_attempts . ']'; + break; + case 'dt_start': + $icon = '{{DOWNTIME_START_ICON}}'; + $title = 'Downtime Start'; + $msg = $event->output; + break; + case 'dt_end': + $icon = '{{DOWNTIME_END_ICON}}'; + $title = 'Downtime End'; + $msg = $event->output; + break; + } + ?> + + +
+ + + All events for service_description ?> + + + + All events for host_name ?> + + +
+ diff --git a/modules/monitoring/application/views/scripts/show/host.phtml b/modules/monitoring/application/views/scripts/show/host.phtml index a00320520..8df35597e 100644 --- a/modules/monitoring/application/views/scripts/show/host.phtml +++ b/modules/monitoring/application/views/scripts/show/host.phtml @@ -1,15 +1,61 @@ -
-
+tabs->render($this); ?> + +
+
+
object->host_icon_image): ?> Host image {{HOST_ICON}} -

Host Status escape($this->object->host_name); ?>

+

+ Host Status + + escape($this->object->host_name); ?> + + object->host_address && $this->object->host_address !== $this->object->host_name): ?> + (object->host_address; ?>) + + object->host_alias) && $this->object->host_alias !== $this->object->host_name): ?> + (object->host_alias; ?>) + +

+
+
+ util()->getHostStateName($this->object->host_state); ?> + since timeSince($this->object->host_last_state_change); ?> +
-
+
+ pluginOutput($this->object->output); ?> +
+ + {{RECHECK_COMMAND} + +
+ perfdata($this->object->perfdata); ?> +
+ +
+ pluginOutput($this->object->long_output); ?> +
+ + render('show/components/comments.phtml'); ?> + +
+ Check Statistics +
+
Last Check
+
last_check; ?>
+
Next Check
+
next_check; ?> {{RESCHEDULE_COMMAND}}
+
+
+ +
+ host_handled && $object->host_state > 0): ?> - - - - - + - - + + - object->host_address && $this->object->host_address !== $this->object->host_name): ?> + - - - - - object->host_alias) && $this->object->host_alias !== $this->object->host_name): ?> - - - - object->host_action_url || $this->object->host_notes_url): ?> - - - - - object->perfdata): ?> - - - -
@@ -27,37 +73,19 @@ {{ACKNOWLEDGED_ICON}} - Status - - util()->getHostStateName($this->object->host_state); ?> - since timeSince($this->object->host_last_state_change); ?> - {{RECHECK_COMMAND_BUTTON}
Last Checklast_check ?>
Next Checknext_check ?>{{RESCHEDULE_COMMAND_BUTTON}}
Host Addressescape($this->object->host_address); ?>
Aliasobject->host_alias; ?>
@@ -70,40 +98,18 @@
Plugin Output - pluginOutput($this->object->output); ?> - pluginOutput($this->object->long_output); ?> - - {{SUBMIT_PASSIVE_CHECK_RESULT_COMMAND}} -
Performance Data perfdata($this->object->perfdata); ?>
- - View Services For This Host - - - {{{RECHECK_ALL_SERVICES_COMMAND}} -
render('show/components/downtime.phtml'); ?> -render('show/components/comments.phtml'); ?> - render('show/components/properties.phtml'); ?> render('show/components/flags.phtml'); ?> diff --git a/modules/monitoring/application/views/scripts/show/service.phtml b/modules/monitoring/application/views/scripts/show/service.phtml index 75a05d2f5..ea95d53b4 100644 --- a/modules/monitoring/application/views/scripts/show/service.phtml +++ b/modules/monitoring/application/views/scripts/show/service.phtml @@ -1,3 +1,5 @@ +tabs->render($this); ?> +
{{SERVICE_ICON}}

Service Status escape($this->object->service_description); ?>

diff --git a/modules/monitoring/application/views/scripts/show/services.phtml b/modules/monitoring/application/views/scripts/show/services.phtml new file mode 100644 index 000000000..719e39e0d --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/services.phtml @@ -0,0 +1,7 @@ +tabs->render($this); ?> +partial( + 'list/services-compact.phtml', + 'monitoring', array( + 'services' => $services + ) +); ?> diff --git a/modules/monitoring/library/Monitoring/Controller.php b/modules/monitoring/library/Monitoring/Controller.php new file mode 100644 index 000000000..762cc2a58 --- /dev/null +++ b/modules/monitoring/library/Monitoring/Controller.php @@ -0,0 +1,93 @@ +_request, + $columns + )->getQuery(); + } else { + $params['backend'] = $this->_request->getParam('backend'); + $query = HostAndServiceStatusView::fromParams( + $params, + $columns + )->getQuery(); + } + $this->handleFormatRequest($query); + return $query->paginate(); + } + + private function handleFormatRequest($query) + { + if ($this->_getParam('format') === 'sql' + && IcingaConfig::app()->global->get('environment', 'production') === 'development') { + echo '
'
+                . htmlspecialchars(wordwrap($query->dump()))
+                . '
'; + exit; + } + if ($this->_getParam('format') === 'json' + || $this->_request->getHeader('Accept') === 'application/json') + { + header('Content-type: application/json'); + echo json_encode($query->fetchAll()); + exit; + } + if ($this->_getParam('format') === 'csv' + || $this->_request->getHeader('Accept') === 'text/csv') { + Csv::fromQuery($query)->dump(); + exit; + } + } +} +// @codingStandardsIgnoreEnd diff --git a/modules/monitoring/library/Monitoring/DataView/DataView.php b/modules/monitoring/library/Monitoring/DataView/DataView.php index c3909255b..3ee7f285a 100644 --- a/modules/monitoring/library/Monitoring/DataView/DataView.php +++ b/modules/monitoring/library/Monitoring/DataView/DataView.php @@ -99,6 +99,33 @@ abstract class DataView return $view; } + /** + * Create view from params + * + * @param array $params + * @param array $columns + * + * @return static + */ + public static function fromParams(array $params, array $columns = null) + { + $view = new static(Backend::createBackend($params['backend']), $columns); + $view->filter($params); + $order = isset($params['order']) ? $params['order'] : null; + if ($order !== null) { + if (strtolower($order) === 'desc') { + $order = self::SORT_DESC; + } else { + $order = self::SORT_ASC; + } + } + $view->sort( + isset($params['sort']) ? $params['sort'] : null, + $order + ); + return $view; + } + /** * Filter rows that match all of the given filters. If a filter is not valid, it's silently ignored * diff --git a/modules/monitoring/library/Monitoring/Object/AbstractObject.php b/modules/monitoring/library/Monitoring/Object/AbstractObject.php index fcc512884..799fe171e 100644 --- a/modules/monitoring/library/Monitoring/Object/AbstractObject.php +++ b/modules/monitoring/library/Monitoring/Object/AbstractObject.php @@ -150,7 +150,7 @@ abstract class AbstractObject return $this; } - protected function fetchEventHistory() + public function fetchEventHistory() { $this->foreign['eventHistory'] = $this->applyObjectFilter( $this->backend->select()->from('eventHistory', array( diff --git a/modules/monitoring/library/Monitoring/Object/Host.php b/modules/monitoring/library/Monitoring/Object/Host.php index 8999683d2..59f32cf32 100644 --- a/modules/monitoring/library/Monitoring/Object/Host.php +++ b/modules/monitoring/library/Monitoring/Object/Host.php @@ -30,8 +30,7 @@ class Host extends AbstractObject ->fetchContacts() ->fetchContactgroups() ->fetchCustomvars() - ->fetchComments() - ->fetchEventHistory(); + ->fetchComments(); } protected function fetchObject() @@ -42,7 +41,7 @@ class Host extends AbstractObject 'host_address', 'host_state', 'host_handled', - 'host_in_downtime', + 'in_downtime' => 'host_in_downtime', 'host_acknowledged', 'host_last_state_change', 'last_check' => 'host_last_check', @@ -59,7 +58,13 @@ class Host extends AbstractObject 'notifications_enabled' => 'host_notifications_enabled', 'event_handler_enabled' => 'host_event_handler_enabled', 'flap_detection_enabled' => 'host_flap_detection_enabled', - 'active_checks_enabled' => 'host_active_checks_enabled' + 'active_checks_enabled' => 'host_active_checks_enabled', + 'current_check_attempt' => 'host_current_check_attempt', + 'max_check_attempts' => 'host_max_check_attempts', + 'last_notification' => 'host_last_notification', + 'current_notification_number' => 'host_current_notification_number', + 'percent_state_change' => 'host_percent_state_change', + 'is_flapping' => 'host_is_flapping' ))->where('host_name', $this->name1)->fetchRow(); } } diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php index 209167065..fd7819b9c 100644 --- a/modules/monitoring/library/Monitoring/Object/Service.php +++ b/modules/monitoring/library/Monitoring/Object/Service.php @@ -31,8 +31,7 @@ class Service extends AbstractObject ->fetchContacts() ->fetchContactgroups() ->fetchCustomvars() - ->fetchComments() - ->fetchEventHistory(); + ->fetchComments(); } protected function fetchObject() diff --git a/public/js/icinga/components/container.js b/public/js/icinga/components/container.js index c50173a76..b568abb33 100644 --- a/public/js/icinga/components/container.js +++ b/public/js/icinga/components/container.js @@ -488,10 +488,15 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe if (Container.isExternalLink($(targetEl).attr('href'))) { return true; } else { - // detail links render to main by default; - Icinga.replaceBodyFromUrl( - mainContainer.updateContainerHref(URI($(targetEl).attr('href')).href()) - ); + if ($(targetEl).attr('data-icinga-target') === 'detail') { + Icinga.replaceBodyFromUrl( + detailContainer.updateContainerHref(URI($(targetEl).attr('href')).href()) + ); + } else { + Icinga.replaceBodyFromUrl( + mainContainer.updateContainerHref(URI($(targetEl).attr('href')).href()) + ); + } ev.preventDefault(); ev.stopPropagation(); @@ -512,4 +517,4 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe }; return Container; -}); \ No newline at end of file +}); diff --git a/public/js/icinga/components/mainDetailGrid.js b/public/js/icinga/components/mainDetailGrid.js index 2ada235bb..653776e0f 100644 --- a/public/js/icinga/components/mainDetailGrid.js +++ b/public/js/icinga/components/mainDetailGrid.js @@ -166,10 +166,16 @@ function(Container, $, logger, URI) { }); $('.pagination li a', contentNode.parent()).on('click', function(ev) { + var container = (new Container(this)); - container.replaceDomFromUrl( - container.updateContainerHref($(this).attr('href')) - ); + logger.debug("Pagination clicked in " + container.containerType); + // Detail will be removed when main pagination changes + if (container.containerType === 'icingamain') { + Icinga.replaceBodyFromUrl(URI($(this).attr('href')).removeQuery('detail')); + } else { + container.replaceDomFromUrl($(this).attr('href')); + } + ev.preventDefault(); ev.stopPropagation(); return false; @@ -207,7 +213,7 @@ function(Container, $, logger, URI) { this.registerControls(); this.registerTableLinks(); this.registerHistoryChanges(); - this.registerLoadIndicator(); + }; this.construct(gridDomNode);