diff --git a/application/views/scripts/joystickPagination.phtml b/application/views/scripts/joystickPagination.phtml new file mode 100644 index 000000000..1808ba7e3 --- /dev/null +++ b/application/views/scripts/joystickPagination.phtml @@ -0,0 +1,99 @@ +count() <= 1 && $yAxisPaginator->count() <= 1) { + return; // Display this pagination only if there are multiple pages +} + +$fromTo = t('%s: %d to %d of %d'); +$xAxisPages = $xAxisPaginator->getPages('all'); +$yAxisPages = $yAxisPaginator->getPages('all'); + +$totalYAxisPages = $yAxisPaginator->count(); +$currentYAxisPage = $yAxisPaginator->getCurrentPageNumber(); +$prevYAxisPage = $currentYAxisPage > 1 ? $currentYAxisPage - 1 : null; +$nextYAxisPage = $currentYAxisPage < $totalYAxisPages ? $currentYAxisPage + 1 : null; + +$totalXAxisPages = $xAxisPaginator->count(); +$currentXAxisPage = $xAxisPaginator->getCurrentPageNumber(); +$prevXAxisPage = $currentXAxisPage > 1 ? $currentXAxisPage - 1 : null; +$nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : null; + +?> + + + + + + + + + + + + + + + + + + + +
  + + icon('up_petrol.png'); ?> + + icon('up.png'); ?> + +  
+ + icon('prev_petrol.png'); ?> + + icon('prev.png'); ?> + +   + + icon('next_petrol.png'); ?> + + icon('next.png'); ?> + +
  + + icon('down_petrol.png'); ?> + + icon('down.png'); ?> + +  
\ No newline at end of file diff --git a/bin/icingacli b/bin/icingacli index 3f3cc47f1..cb0d68397 100755 --- a/bin/icingacli +++ b/bin/icingacli @@ -4,14 +4,6 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -define('ICINGAWEB_BASEDIR', dirname(__DIR__)); -// ICINGAWEB_BASEDIR is the parent folder for at least application, bin, modules, library/vendor and public - - -if (! @include_once ICINGAWEB_BASEDIR . '/library/Icinga/Application/Cli.php') { - // If the Icinga library wasn't found under ICINGAWEB_BASEDIR, require that the Icinga library is found in PHP's - // include path which is the case if Icinga Web 2 is installed via packages - require_once 'Icinga/Application/Cli.php'; -} +require_once dirname(__DIR__) . '/library/Icinga/Application/Cli.php'; Icinga\Application\Cli::start()->dispatch(); diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index ebd564163..a74a7f8c0 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -6,7 +6,6 @@ namespace Icinga\Application; use ErrorException; use Exception; -use LogicException; use Icinga\Application\Modules\Manager as ModuleManager; use Icinga\Data\ResourceFactory; use Icinga\Exception\ConfigurationError; @@ -41,6 +40,15 @@ use Icinga\Exception\IcingaException; */ abstract class ApplicationBootstrap { + /** + * Base directory + * + * Parent folder for at least application, bin, modules, library/vendor and public + * + * @var string + */ + protected $baseDir; + /** * Icinga auto loader * @@ -99,9 +107,16 @@ abstract class ApplicationBootstrap /** * Constructor + * + * @param string $baseDir Icinga Web 2 base directory + * @param string $configDir Path to Icinga Web 2's configuration files */ - protected function __construct($configDir = null) + protected function __construct($baseDir = null, $configDir = null) { + if ($baseDir === null) { + $baseDir = dirname($this->getBootstrapDirecory()); + } + $this->baseDir = $baseDir; if (! defined('ICINGAWEB_BASEDIR')) { define('ICINGAWEB_BASEDIR', dirname($this->getBootstrapDirecory())); } @@ -188,6 +203,35 @@ abstract class ApplicationBootstrap return $this->isWeb; } + /** + * Helper to glue directories together + * + * @param string $dir + * @param string $subdir + * + * @return string + */ + private function getDirWithSubDir($dir, $subdir = null) + { + if ($subdir !== null) { + $dir .= '/' . ltrim($subdir, '/'); + } + + return $dir; + } + + /** + * Get the base directory + * + * @param string $subDir Optional sub directory to get + * + * @return string + */ + public function getBaseDir($subDir = null) + { + return $this->getDirWithSubDir($subDir); + } + /** * Getter for application dir * @@ -227,32 +271,16 @@ abstract class ApplicationBootstrap } /** - * Helper to glue directories together + * Start the bootstrap * - * @param string $dir - * @param string $subdir + * @param string $baseDir Icinga Web 2 base directory + * @param string $configDir Path to Icinga Web 2's configuration files * - * @return string + * @return static */ - private function getDirWithSubDir($dir, $subdir = null) + public static function start($baseDir = null, $configDir = null) { - if ($subdir !== null) { - $dir .= '/' . ltrim($subdir, '/'); - } - - return $dir; - } - - /** - * Starting concrete bootstrap classes - * - * @param string $configDir - * - * @return ApplicationBootstrap - */ - public static function start($configDir = null) - { - $application = new static($configDir); + $application = new static($baseDir, $configDir); $application->bootstrap(); return $application; } diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 8c9906def..b60ae0a31 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -572,12 +572,12 @@ class Monitoring_ListController extends Controller $this->view->history = $query->paginate(); } - public function servicematrixAction() + public function servicegridAction() { if ($url = $this->hasBetterUrl()) { return $this->redirectNow($url); } - $this->addTitleTab('servicematrix'); + $this->addTitleTab('servicegrid', $this->translate('Service Grid')); $this->setAutorefreshInterval(15); $query = $this->backend->select()->from('serviceStatus', array( 'host_name', diff --git a/modules/monitoring/application/views/scripts/list/servicegrid.phtml b/modules/monitoring/application/views/scripts/list/servicegrid.phtml new file mode 100644 index 000000000..2bbfb343f --- /dev/null +++ b/modules/monitoring/application/views/scripts/list/servicegrid.phtml @@ -0,0 +1,77 @@ +compact): ?> +
+ tabs; ?> +
+ translate('Sort by'); ?> sortControl; ?> +
+
+ +
+ +pivot->toArray(); +$hostFilter = '(' . implode('|', array_keys($pivotData)) . ')'; +?> + + + translate('No Services matching the filter'); ?> + + + $serviceStates): ?> + + + + + + + + + + + + + + + + + + + + + + +
partial( + 'joystickPagination.phtml', + 'default', + array( + 'xAxisPaginator' => $horizontalPaginator, + 'yAxisPaginator' => $verticalPaginator + ) + ); ?> + +
+ + + + ·
+
diff --git a/modules/monitoring/application/views/scripts/list/servicematrix.phtml b/modules/monitoring/application/views/scripts/list/servicematrix.phtml deleted file mode 100644 index 62676a2d2..000000000 --- a/modules/monitoring/application/views/scripts/list/servicematrix.phtml +++ /dev/null @@ -1,84 +0,0 @@ -compact): ?> -
- tabs; ?> -
- translate('Sort by') ?> sortControl ?> -
- partial( - 'pivottablePagination.phtml', - 'default', - array( - 'xAxisPaginator' => $this->horizontalPaginator, - 'yAxisPaginator' => $this->verticalPaginator - ) - ); ?> -
- -
- -pivot->toArray(); -$hostFilter = '(' . implode('|', array_keys($pivotData)) . ')'; -?> - - - translate('No Services matching the filter'); ?> - - - $serviceStates): ?> - - - - - - - - - - - - - - - - - - - - - - - -
  - -
- - - - ·
-
diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index dea4d0df8..848d213bb 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -75,8 +75,8 @@ $section->add($this->translate('Services'), array( 'url' => 'monitoring/list/services', 'priority' => 50 )); -$section->add($this->translate('Servicematrix'), array( - 'url' => 'monitoring/list/servicematrix?service_problem=1', +$section->add($this->translate('Service Grid'), array( + 'url' => 'monitoring/list/servicegrid?service_problem=1', 'priority' => 51 )); $section->add($this->translate('Servicegroups'), array( diff --git a/public/css/icinga/monitoring-colors.less b/public/css/icinga/monitoring-colors.less index c7a1c7054..e1d764e72 100644 --- a/public/css/icinga/monitoring-colors.less +++ b/public/css/icinga/monitoring-colors.less @@ -581,6 +581,15 @@ div.pivot-pagination { } } +table.joystick-pagination { + margin-bottom: -1em; + + td { + width: 1.25em; + height: 1.3em; + } +} + table.pivot { a { text-decoration: none; @@ -591,7 +600,7 @@ table.pivot { } } - thead { + & > thead { th { height: 6em; @@ -629,7 +638,7 @@ table.pivot { } } - tbody { + & > tbody { th { padding: 0 14px 0 0; white-space: nowrap; diff --git a/public/index.php b/public/index.php index 085f73747..48a500666 100644 --- a/public/index.php +++ b/public/index.php @@ -2,8 +2,4 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -if (! @include_once dirname(__DIR__) . '/library/Icinga/Application/webrouter.php') { - // If the Icinga library wasn't found under ICINGAWEB_BASEDIR, require that the Icinga library is found in PHP's - // include path which is the case if Icinga Web 2 is installed via packages - require_once 'Icinga/Application/webrouter.php'; -} +require_once dirname(__DIR__) . '/library/Icinga/Application/webrouter.php';