diff --git a/modules/monitoring/application/controllers/MultiController.php b/modules/monitoring/application/controllers/MultiController.php index a9b7a0075..427bac73b 100644 --- a/modules/monitoring/application/controllers/MultiController.php +++ b/modules/monitoring/application/controllers/MultiController.php @@ -28,6 +28,7 @@ use \Icinga\Web\Form; use \Icinga\Web\Controller\ActionController; +use \Icinga\Web\Widget\Tabextension\OutputFormat; use \Icinga\Module\Monitoring\Backend; use \Icinga\Module\Monitoring\Object\Host; use \Icinga\Module\Monitoring\Object\Service; @@ -44,6 +45,7 @@ class Monitoring_MultiController extends ActionController { $this->view->queries = $this->getDetailQueries(); $this->backend = Backend::createBackend($this->_getParam('backend')); + $this->createTabs(); } public function hostAction() @@ -251,4 +253,15 @@ class Monitoring_MultiController extends ActionController } return $objects; } + + /** + * Return all tabs for this controller + * + * @return Tabs + */ + private function createTabs() + { + $tabs = $this->getTabs(); + $tabs->extend(new OutputFormat()); + } } diff --git a/modules/monitoring/application/views/scripts/multi/components/comments.phtml b/modules/monitoring/application/views/scripts/multi/components/comments.phtml index fc2fa6ab8..f89d5ce04 100644 --- a/modules/monitoring/application/views/scripts/multi/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/multi/components/comments.phtml @@ -1,8 +1,8 @@ -
+
- Comments + Comments
- +
diff --git a/modules/monitoring/application/views/scripts/multi/components/configuration.phtml b/modules/monitoring/application/views/scripts/multi/components/configuration.phtml index 7d2f4cab5..7dd4c0844 100644 --- a/modules/monitoring/application/views/scripts/multi/components/configuration.phtml +++ b/modules/monitoring/application/views/scripts/multi/components/configuration.phtml @@ -1,7 +1,8 @@ -
+
- Configuration + Configuration
+
Change configuration for objects) ?> objects. form->render($this); ?> diff --git a/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml b/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml index 134677625..6d269ba9a 100644 --- a/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml @@ -1,7 +1,8 @@ -
+
- Downtimes + Downtimes
+
0) { ?> diff --git a/modules/monitoring/application/views/scripts/multi/components/summary.phtml b/modules/monitoring/application/views/scripts/multi/components/summary.phtml index 7424d4f68..f79ed0753 100644 --- a/modules/monitoring/application/views/scripts/multi/components/summary.phtml +++ b/modules/monitoring/application/views/scripts/multi/components/summary.phtml @@ -1,7 +1,6 @@ getHelper('CommandForm'); - $servicequery = isset($this->servicequery) ? $this->servicequery : ''; ?> @@ -89,20 +88,22 @@ $this->href( - 10) { - if (!$this->is_service) { + 10) { + $text = ' and ' . (count($objects) - 10) . ' more ...'; + } else { + $text = ' show all ...'; + } + if ($this->is_service) { + $link = 'monitoring/list/hosts'; + $target = array( + 'host' => implode(',', $hostnames) + ); + } else { + $link = 'monitoring/list/services'; + // TODO: Show multiple targets for services + $target = array(); + } ?> - - - - - and more ... - +
diff --git a/modules/monitoring/application/views/scripts/multi/host.phtml b/modules/monitoring/application/views/scripts/multi/host.phtml index 927003b13..915bb6ba9 100644 --- a/modules/monitoring/application/views/scripts/multi/host.phtml +++ b/modules/monitoring/application/views/scripts/multi/host.phtml @@ -6,10 +6,12 @@ $this->target = array( ); ?> -
+tabs->render($this); ?> +
-

Hosts

+ Hosts
+
render('multi/components/summary.phtml'); ?> diff --git a/modules/monitoring/application/views/scripts/multi/service.phtml b/modules/monitoring/application/views/scripts/multi/service.phtml index a8e84cacb..79421501f 100644 --- a/modules/monitoring/application/views/scripts/multi/service.phtml +++ b/modules/monitoring/application/views/scripts/multi/service.phtml @@ -8,11 +8,13 @@ $this->target = array( ); ?> -
+tabs->render($this); ?> +
-

Services

+ Services
+
render('multi/components/summary.phtml'); ?> diff --git a/modules/monitoring/test/php/library/Command/MetaTest.php b/modules/monitoring/test/php/library/Command/MetaTest.php deleted file mode 100644 index 94e814ac1..000000000 --- a/modules/monitoring/test/php/library/Command/MetaTest.php +++ /dev/null @@ -1,185 +0,0 @@ -getRawCommands(); - - $this->assertCount(173, $commands); - - $this->assertTrue(in_array('SCHEDULE_SERVICEGROUP_SVC_DOWNTIME', $commands)); - $this->assertTrue(in_array('SCHEDULE_SVC_CHECK', $commands)); - $this->assertTrue(in_array('ENABLE_HOSTGROUP_SVC_CHECKS', $commands)); - $this->assertTrue(in_array('PROCESS_HOST_CHECK_RESULT', $commands)); - $this->assertTrue(in_array('ACKNOWLEDGE_SVC_PROBLEM', $commands)); - $this->assertTrue(in_array('ACKNOWLEDGE_HOST_PROBLEM', $commands)); - $this->assertTrue(in_array('SCHEDULE_FORCED_SVC_CHECK', $commands)); - $this->assertTrue(in_array('DISABLE_FLAP_DETECTION', $commands)); - } - - public function testRawCommands2() - { - $meta = new Meta(); - $categories = $meta->getRawCategories(); - - $this->assertCount(7, $categories); - - $this->assertEquals( - array( - 'comment', - 'contact', - 'global', - 'host', - 'hostgroup', - 'service', - 'servicegroup' - ), - $categories - ); - } - - public function testRawCommands3() - { - $meta = new Meta(); - - $this->assertCount(9, $meta->getRawCommandsForCategory('hostgroup')); - $this->assertCount(14, $meta->getRawCommandsForCategory('servicegroup')); - - $test1 = $meta->getRawCommandsForCategory('global'); - $this->count(26, $test1); - - $this->assertTrue(in_array('DISABLE_NOTIFICATIONS', $test1)); - $this->assertTrue(in_array('RESTART_PROCESS', $test1)); - $this->assertTrue(in_array('ENABLE_FLAP_DETECTION', $test1)); - $this->assertTrue(in_array('PROCESS_FILE', $test1)); - } - - /** - * @expectedException Icinga\Exception\ProgrammingError - * @expectedExceptionMessage Category does not exists: DOES_NOT_EXIST - */ - public function testRawCommands4() - { - $meta = new Meta(); - $meta->getRawCommandsForCategory('DOES_NOT_EXIST'); - } - - public function testObjectForCommand1() - { - $meta = new Meta(); - - $object = new HostStruct(); - - $commands = $meta->getCommandForObject($object, Meta::TYPE_SMALL); - - $this->assertEquals(3, $commands[0]->id); - $this->assertEquals(27, $commands[1]->id); - - $object->host_state = '0'; - - $commands = $meta->getCommandForObject($object, Meta::TYPE_SMALL); - - $this->assertEquals(3, $commands[0]->id); - $this->assertFalse(isset($commands[1])); // STATE IS OK AGAIN - - $object->host_state = '1'; - $object->host_acknowledged = '0'; - - $commands = $meta->getCommandForObject($object, Meta::TYPE_SMALL); - - $this->assertEquals(3, $commands[0]->id); - $this->assertEquals(26, $commands[1]->id); - } - - public function testObjectForCommand2() - { - $meta = new Meta(); - - $object = new HostStruct(); - - $object->host_obsessing = '0'; - $object->host_flap_detection_enabled = '0'; - $object->host_active_checks_enabled = '0'; - - $commands = $meta->getCommandForObject($object, Meta::TYPE_FULL); - - $this->assertEquals(2, $commands[0]->id); - $this->assertEquals(6, $commands[3]->id); - } - - /** - * @expectedException Icinga\Exception\ProgrammingError - * @expectedExceptionMessage Type has no commands defined: UNKNOWN - */ - public function testObjectForCommand3() - { - $meta = new Meta(); - - $test = new \stdClass(); - $test->UNKNOWN_state = '2'; - $test->UNKNOWN_flap_detection_enabled = '1'; - - $commands = $meta->getCommandForObject($test, Meta::TYPE_FULL); - } -}