diff --git a/modules/monitoring/application/controllers/MultiController.php b/modules/monitoring/application/controllers/MultiController.php index a6efcad25..723a7f576 100644 --- a/modules/monitoring/application/controllers/MultiController.php +++ b/modules/monitoring/application/controllers/MultiController.php @@ -45,54 +45,68 @@ class Monitoring_MultiController extends ActionController public function hostAction() { $hosts = array(); - $warnings = array(); + $hostnames = array(); + $comments = array(); + $downtimes = array(); + + $errors = array(); foreach ($this->view->queries as $index => $query) { - if (array_key_exists('host', $query)) { - $host = Host::fetch($this->backend, $query['host']); - $host->prefetch(); - $hosts[] = $host; - } else { - $warnings[] = 'Query ' . $index . ' misses property host.'; + if (!array_key_exists('host', $query)) { + $errors[] = 'Query ' . $index . ' misses property host.'; + continue; } + + $host = Host::fetch($this->backend, $query['host']); + foreach ($host->comments as $comment) { + $comments[$comment->comment_id] = null; + } + if ($host->host_in_downtime) { + $downtimes[] += $host->host_in_downtime; + } + $hostnames[] = $host->host_name; + $hosts[] = $host; } - $this->view->commands = array( - 'host' => array( - ), - 'service' => array( - - ), - 'notification' => array( - - ), - '' - ); $this->view->objects = $this->view->hosts = $hosts; - $this->view->warnings = $warnings; + $this->view->comments = array_keys($comments); + $this->view->hostnames = $hostnames; + $this->view->downtimes = $downtimes; + $this->view->errors = $errors; } public function serviceAction() { $services = array(); - $warnings = array(); + $comments = array(); + $downtimes = array(); + + $errors = array(); foreach ($this->view->queries as $index => $query) { if (!array_key_exists('host', $query)) { - $warnings[] = 'Query ' . $index . ' misses property host.'; + $errors[] = 'Query ' . $index . ' misses property host.'; continue; } if (!array_key_exists('service', $query)) { - $warnings[] = 'Query ' . $index . ' misses property service.'; + $errors[] = 'Query ' . $index . ' misses property service.'; continue; } - $service = Service::fetch($this->backend, $query['host'], $query['service']); - $service->prefetch(); - $services[] = $service; - } + $service = Service::fetch($this->backend, $query['host'], $query['service']); + foreach ($service->comments as $comment) { + $comments[$comment->comment_id] = null; + } + if ($service->service_in_downtime) { + $downtimes[] += $service->service_in_downtime; + } + $hostnames[] = $service->host_name; + $services[] = $service; + } $this->view->objects = $this->view->services = $services; - $this->view->warnings = $warnings; + $this->view->comments = array_keys($comments); + $this->view->downtimes = $downtimes; + $this->view->errors = $errors; } public function notificationAction() @@ -102,7 +116,7 @@ class Monitoring_MultiController extends ActionController public function historyAction() { - + } /** diff --git a/modules/monitoring/application/forms/Command/MultiFlagForm.php b/modules/monitoring/application/forms/Command/MultiFlagForm.php new file mode 100644 index 000000000..ccfe1c59c --- /dev/null +++ b/modules/monitoring/application/forms/Command/MultiFlagForm.php @@ -0,0 +1,15 @@ +commandInformation[$command]; + + } + /** * Information about interface commands * @@ -85,14 +98,15 @@ class Zend_View_Helper_CommandButton extends Zend_View_Helper_Abstracts { */ private static $commandInformation = array( self::CMD_DISABLE_ACTIVE_CHECKS => array( - 'Disable Active Checks For This %s', // Long description (mandatory) - 'Disable Active Checks', // Short description (mandatory) - '', // Icon anything (optional) - '' // Button css cls (optional) + 'Disable Active Checks For This %s', + 'Disable Active Checks', + '', + '' ), self::CMD_ENABLE_ACTIVE_CHECKS => array( 'Enable Active Checks For This %s', 'Enable Active Checks', + '', '' ), self::CMD_RESCHEDULE_NEXT_CHECK => array( @@ -104,66 +118,79 @@ class Zend_View_Helper_CommandButton extends Zend_View_Helper_Abstracts { self::CMD_SUBMIT_PASSIVE_CHECK_RESULT => array( 'Submit Passive Check Result', 'Submit Check Result', + '', '' ), self::CMD_STOP_OBSESSING => array( 'Stop Obsessing Over This %s', 'Stop Obsessing', + '', '' ), self::CMD_START_OBSESSING => array( 'Start Obsessing Over This %s', 'Start Obsessing', + '', '' ), self::CMD_STOP_ACCEPTING_PASSIVE_CHECKS => array( 'Stop Accepting Passive Checks For This %s', 'Stop Passive Checks', + '', '' ), self::CMD_START_ACCEPTING_PASSIVE_CHECKS => array( 'Start Accepting Passive Checks For This %s', 'Start Passive Checks', + '', '' ), self::CMD_DISABLE_NOTIFICATIONS => array( 'Disable Notifications For This %s', 'Disable Notifications', + '', '' ), self::CMD_ENABLE_NOTIFICATIONS => array( 'Enable Notifications For This %s', 'Enable Notifications', + '', '' ), self::CMD_SEND_CUSTOM_NOTIFICATION => array( 'Send Custom %s Notification', 'Send Notification', + '', '' ), self::CMD_SCHEDULE_DOWNTIME => array( 'Schedule Downtime For This %s', 'Schedule Downtime', + '', '' ), self::CMD_SCHEDULE_DOWNTIMES_TO_ALL => array( 'Schedule Downtime For This %s And All Services', 'Schedule Services Downtime', + '', '' ), self::CMD_REMOVE_DOWNTIMES_FROM_ALL => array( 'Remove Downtime(s) For This %s And All Services', 'Remove Downtime(s)', + '', '' ), self::CMD_DISABLE_NOTIFICATIONS_FOR_ALL => array( 'Disable Notification For All Service On This %s', 'Disable Service Notifications', + '', '' ), self::CMD_ENABLE_NOTIFICATIONS_FOR_ALL => array( 'Enable Notification For All Service On This %s', 'Enable Service Notifications', + '', '' ), self::CMD_RESCHEDULE_NEXT_CHECK_TO_ALL => array( @@ -175,36 +202,43 @@ class Zend_View_Helper_CommandButton extends Zend_View_Helper_Abstracts { self::CMD_DISABLE_ACTIVE_CHECKS_FOR_ALL => array( 'Disable Checks For All Services On This %s', 'Disable Service Checks', + '', '' ), self::CMD_ENABLE_ACTIVE_CHECKS_FOR_ALL => array( 'Enable Checks For All Services On This %s', 'Enable Service Checks', + '', '' ), self::CMD_DISABLE_EVENT_HANDLER => array( 'Disable Event Handler For This %s', 'Disable Event Handler', + '', '' ), self::CMD_ENABLE_EVENT_HANDLER => array( 'Enable Event Handler For This %s', 'Enable Event Handler', + '', '' ), self::CMD_DISABLE_FLAP_DETECTION => array( 'Disable Flap Detection For This %s', 'Disable Flap Detection', + '', '' ), self::CMD_ENABLE_FLAP_DETECTION => array( 'Enable Flap Detection For This %s', 'Enable Flap Detection', + '', '' ), self::CMD_ADD_COMMENT => array( 'Add New %s Comment', 'Add Comment', + '', '' ), self::CMD_RESET_ATTRIBUTES => array( @@ -228,7 +262,8 @@ class Zend_View_Helper_CommandButton extends Zend_View_Helper_Abstracts { self::CMD_DELAY_NOTIFICATION => array( 'Delay Next %s Notification', 'Delay Notification', + '', '' - ), + ) ); } \ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/multi/components/comments.phtml b/modules/monitoring/application/views/scripts/multi/components/comments.phtml index b3d9bbc7f..2b81ad9e6 100644 --- a/modules/monitoring/application/views/scripts/multi/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/multi/components/comments.phtml @@ -1 +1,24 @@ - +
+ {{COMMENT_ICON}} Comments +
+ +
+ + comments are present in the selected items. + +
+ {{REMOVE_COMMENTS_BUTTON}} + {{ADD_COMMENT_BUTTON}} + {{SEND_NOTIFICATION_BUTTON}} + {{DELAY_NOTIFICATION_BUTTON}} +
+
+ diff --git a/modules/monitoring/application/views/scripts/multi/components/configuration.phtml b/modules/monitoring/application/views/scripts/multi/components/configuration.phtml new file mode 100644 index 000000000..e7fa600fb --- /dev/null +++ b/modules/monitoring/application/views/scripts/multi/components/configuration.phtml @@ -0,0 +1,15 @@ +
+
+ Configuration +
+ +
+ Change settings: + +
+ Active Checks {{CHECKBOX}} + Passive Checks {{CHECKBOX}} + Flap Detection {{CHECKBOX}} +
+
+
diff --git a/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml b/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml new file mode 100644 index 000000000..87c4989c4 --- /dev/null +++ b/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml @@ -0,0 +1,20 @@ +
+
+ {{DOWNTIME_ICON}} Downtimes +
+
+ + Selected items are currently in downtime. + + +
+ {{REMOVE_DOWNTIME_BUTTON}} + {{REMOVE_ACKNOWLEDGEMENTS_BUTTON}} +
+
+
diff --git a/modules/monitoring/application/views/scripts/multi/components/summary.phtml b/modules/monitoring/application/views/scripts/multi/components/summary.phtml index bb712b997..07f4082d5 100644 --- a/modules/monitoring/application/views/scripts/multi/components/summary.phtml +++ b/modules/monitoring/application/views/scripts/multi/components/summary.phtml @@ -1,8 +1,50 @@ -
-
- Execute commands for all object(s) -
-
- monitoringCommands($objects, \Icinga\Module\Monitoring\Command\Meta::TYPE_FULL); ?> -
+

Selected objects.

+{{RECHECK_BUTTON}} +{{RESCHEDULE_BUTTON}} +{{ACKNOWLEDGE_PROBLEMS_BUTTON}} +{{SCHEDULE_DOWNTIMES}} +{{SUBMIT_PASSIVE_CHECK_RESULTS}} +
+ + 10) { + if (!$this->is_service) { + ?> + + + + + and more ... +
diff --git a/modules/monitoring/application/views/scripts/multi/downtimes.phtml b/modules/monitoring/application/views/scripts/multi/downtimes.phtml deleted file mode 100644 index 514102444..000000000 --- a/modules/monitoring/application/views/scripts/multi/downtimes.phtml +++ /dev/null @@ -1,12 +0,0 @@ -
-
- {{HOST_ICON}}

Selected hosts

-
-
- - - -
-
- -render('multi/components/summary.phtml') ?> \ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/multi/host.phtml b/modules/monitoring/application/views/scripts/multi/host.phtml index 5886d3693..b548b161d 100644 --- a/modules/monitoring/application/views/scripts/multi/host.phtml +++ b/modules/monitoring/application/views/scripts/multi/host.phtml @@ -1,21 +1,18 @@ +is_service = false; +?> +
-
- {{HOST_ICON}}

Selected hosts

+
+ {{HOST_ICON}} +

Hosts

-
- + +
+ render('multi/components/summary.phtml'); ?>
-render('multi/components/summary.phtml') ?> +render('multi/components/downtimes.phtml'); ?> +render('multi/components/comments.phtml'); ?> +render('multi/components/configuration.phtml'); ?> diff --git a/modules/monitoring/application/views/scripts/multi/service.phtml b/modules/monitoring/application/views/scripts/multi/service.phtml index 78c16c47e..311786ecd 100644 --- a/modules/monitoring/application/views/scripts/multi/service.phtml +++ b/modules/monitoring/application/views/scripts/multi/service.phtml @@ -1,22 +1,18 @@ +is_service = true; +?> +
- {{SERVICE_ICON}}

Selected services

+ {{SERVICE_ICON}} +

Services

+
- services as $service) { ?> -
  • - - host_name ?> service_description ?> - -
  • - + render('multi/components/summary.phtml'); ?>
    -render('multi/components/summary.phtml') ?> +render('multi/components/downtimes.phtml'); ?> +render('multi/components/comments.phtml'); ?> +render('multi/components/configuration.phtml'); ?>