From e07e16d7a17193e6f3903ce98e6a7cd6076a7c49 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Oct 2015 14:26:53 +0200 Subject: [PATCH 001/205] lib: Remove UserNavigationItemRenderer --- library/Icinga/Application/Web.php | 5 +--- .../Renderer/UserNavigationItemRenderer.php | 26 ------------------- 2 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 library/Icinga/Web/Navigation/Renderer/UserNavigationItemRenderer.php diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index 24b7e641d..d8aba8757 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -293,10 +293,7 @@ class Web extends EmbeddedWeb 'label' => $this->user->getUsername(), 'icon' => 'user', 'url' => 'preference', - 'priority' => 900, - 'renderer' => array( - 'UserNavigationItemRenderer' - ), + 'priority' => 900 ), 'logout' => array( 'cssClass' => 'user-nav-item', diff --git a/library/Icinga/Web/Navigation/Renderer/UserNavigationItemRenderer.php b/library/Icinga/Web/Navigation/Renderer/UserNavigationItemRenderer.php deleted file mode 100644 index 5168253d2..000000000 --- a/library/Icinga/Web/Navigation/Renderer/UserNavigationItemRenderer.php +++ /dev/null @@ -1,26 +0,0 @@ -'; - } - - public function render(NavigationItem $item = null) - { - return '
' . $this->getAvatar() . parent::render($item) . '
'; - } -} From 4593c78d1679b03dc23aed410b5caa75166023c3 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 26 Oct 2015 12:30:50 +0100 Subject: [PATCH 002/205] lib: Fix JSON response exception on form failure --- library/Icinga/Web/Form.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index ca087bfcf..c747a0908 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -1171,10 +1171,9 @@ class Form extends Zend_Form $this->getView()->layout()->redirectUrl = $this->getRedirectUrl()->getAbsoluteUrl(); } } elseif ($this->getIsApiTarget()) { - $this->getResponse()->sendJson(array( - 'status' => 'fail', - 'data' => array_merge($this->getMessages(), $this->getErrorMessages()) - )); + $this->getResponse()->json()->setFailData( + array_merge($this->getMessages(), $this->getErrorMessages()) + )->sendResponse(); } } elseif ($this->getValidatePartial()) { // The form can't be processed but we may want to show validation errors though From 8341415d286ed09c382772aca7875615cca00a93 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 26 Oct 2015 12:32:49 +0100 Subject: [PATCH 003/205] nav: Give item renderer a chance to set the CSS class of the outer li element refs #5543 --- .../Web/Navigation/Renderer/NavigationRenderer.php | 3 ++- .../Navigation/Renderer/RecursiveNavigationRenderer.php | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php b/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php index ac7ee99c7..fb0ca0925 100644 --- a/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php +++ b/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php @@ -352,8 +352,9 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa foreach ($this as $item) { /** @var NavigationItem $item */ if ($item->shouldRender()) { + $content = $item->render(); $this->content[] = $this->beginItemMarkup($item); - $this->content[] = $item->render(); + $this->content[] = $content; $this->content[] = $this->endItemMarkup(); } } diff --git a/library/Icinga/Web/Navigation/Renderer/RecursiveNavigationRenderer.php b/library/Icinga/Web/Navigation/Renderer/RecursiveNavigationRenderer.php index 740df5602..d64ae3b27 100644 --- a/library/Icinga/Web/Navigation/Renderer/RecursiveNavigationRenderer.php +++ b/library/Icinga/Web/Navigation/Renderer/RecursiveNavigationRenderer.php @@ -162,14 +162,15 @@ class RecursiveNavigationRenderer extends RecursiveIteratorIterator implements N foreach ($this as $item) { /** @var NavigationItem $item */ if ($item->shouldRender()) { - $this->content[] = $this->getInnerIterator()->beginItemMarkup($item); - if ($this->getUseStandardItemRenderer()) { $renderer = new NavigationItemRenderer(); - $this->content[] = $renderer->render($item); + $content = $renderer->render($item); } else { - $this->content[] = $item->render(); + $content = $item->render(); } + $this->content[] = $this->getInnerIterator()->beginItemMarkup($item); + + $this->content[] = $content; if (! $item->hasChildren()) { $this->content[] = $this->getInnerIterator()->endItemMarkup(); From a35931020ef0783790c8477bb599b4db70c48596 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 26 Oct 2015 12:43:42 +0100 Subject: [PATCH 004/205] CSS: Remove useless color mixins refs #5543 --- public/css/icinga/colors.less | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/public/css/icinga/colors.less b/public/css/icinga/colors.less index f8fe951ec..77908d991 100644 --- a/public/css/icinga/colors.less +++ b/public/css/icinga/colors.less @@ -1,9 +1,5 @@ /*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ -.bg-color-default() { - background-color: inherit; -} - .bg-color-ok, .bg-color-up { background-color: @color-ok; @@ -87,11 +83,3 @@ .fg-color-pending { color: @color-pending; } - -.fg-color-default { - color: inherit; -} - -.fg-color-inverted() { - color: @text-color-inverted; -} From 6e5ba364fb3e74f585c5833ea57a8d6861641a2e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 26 Oct 2015 12:44:11 +0100 Subject: [PATCH 005/205] CSS: Introduce badge-nav-item refs #5543 --- .../Renderer/BadgeNavigationItemRenderer.php | 11 ++++++++-- public/css/icinga/badges.less | 22 ++++++++++--------- public/css/icinga/nav.less | 15 +++++++++++-- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/library/Icinga/Web/Navigation/Renderer/BadgeNavigationItemRenderer.php b/library/Icinga/Web/Navigation/Renderer/BadgeNavigationItemRenderer.php index 5160d5d66..36fd26248 100644 --- a/library/Icinga/Web/Navigation/Renderer/BadgeNavigationItemRenderer.php +++ b/library/Icinga/Web/Navigation/Renderer/BadgeNavigationItemRenderer.php @@ -94,7 +94,14 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer */ public function render(NavigationItem $item = null) { - return '
' . $this->renderBadge() . parent::render($item) . '
'; + if ($item === null) { + $item = $this->getItem(); + } + $item->setCssClass('badge-nav-item'); + $this->setEscapeLabel(false); + $label = $this->view()->escape($item->getLabel()); + $item->setLabel($this->renderBadge() . $label); + return parent::render($item); } /** @@ -107,7 +114,7 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer if ($count = $this->getCount()) { $view = $this->view(); return sprintf( - '%s', + '%s', $view->escape($this->getTitle()), $view->escape($this->getState()), $count diff --git a/public/css/icinga/badges.less b/public/css/icinga/badges.less index a2451198a..7e9ad6ce0 100644 --- a/public/css/icinga/badges.less +++ b/public/css/icinga/badges.less @@ -1,15 +1,17 @@ +/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ + .badge { - min-width: 25px; - font-family: tahoma, verdana, sans-serif; - font-weight: @font-weight-bold; - font-size: 11px; - text-align: center; - color: @text-color-inverted; - padding-left: 5px; - padding-right: 5px; - padding-top: 2px; - padding-bottom: 2px; background-color: @gray-light; + color: @text-color-inverted; + font-family: @font-family-wide; + font-size: @font-size-small; + font-weight: @font-weight-bold; + line-height: 1; + min-width: 3em; + padding: @vertical-padding @horizontal-padding; + text-align: center; + vertical-align: middle; + white-space: nowrap; &.state-ok { .bg-color-ok(); diff --git a/public/css/icinga/nav.less b/public/css/icinga/nav.less index 002bfe6e1..aa0b15ad7 100644 --- a/public/css/icinga/nav.less +++ b/public/css/icinga/nav.less @@ -1,7 +1,18 @@ /*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ +li.badge-nav-item { + > a { + .clearfix(); + + .badge { + float: right; + } + } +} + li.nav-item { - a, span { + > a, + > span { // Rollover display: block; } @@ -18,6 +29,6 @@ ul.tab-nav { .clearfix(); li { - .pull-left(); + float: left; } } From 4801fb95631bdc2d3ae17aee026cbe13ac6883ca Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 26 Oct 2015 12:49:48 +0100 Subject: [PATCH 006/205] CSS: Use em instead of px for font size Further, font size related settings have been moved to base.less to not create the impression that it's a good idea to change font sizes via themes. refs #10294 refs #10295 --- public/css/icinga/base.less | 23 ++++++++++++++--------- public/css/icinga/themes/icinga.less | 11 +---------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/public/css/icinga/base.less b/public/css/icinga/base.less index e00cf3db2..412f38e66 100644 --- a/public/css/icinga/base.less +++ b/public/css/icinga/base.less @@ -1,5 +1,12 @@ /*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ +@font-size: 0.875em; // 14 px +@font-size-small: 0.786em; // 11 px +@font-weight-bold: 600; + +@vertical-padding: 0.429em; // 6 px +@horizontal-padding: 0.857em; // 12 px + // Make padding not affect the final computed width of an element html { box-sizing: border-box; @@ -22,7 +29,7 @@ a { } blockquote { - border-left: 6px solid @gray-light; + border-left: @vertical-padding solid @gray-light; color: @text-color-light; // Reset default margin margin: 0; @@ -35,26 +42,24 @@ body { color: @text-color; font-family: @font-family; font-size: @font-size; + // Set line-height w/o unit so that the line-height is dynamically calculated as font-size * line-height + line-height: 1.3; } h1 { border-bottom: 1px solid @gray-lightest; - font-size: 18px; + font-size: 1.286em; font-weight: normal; - line-height: 22px; + margin: @vertical-padding 0; } h2 { border-bottom: 1px solid @gray-lightest; - font-size: 16px; + font-size: 1.143em; font-weight: normal; - line-height: 19px; } p { - color: @text-color; - font-size: @font-size; - line-height: @line-height; // Remove default margin margin: 0; } @@ -78,6 +83,6 @@ td { @media print { .dont-print { - display:none; + display: none; } } diff --git a/public/css/icinga/themes/icinga.less b/public/css/icinga/themes/icinga.less index c663e757b..f85758106 100644 --- a/public/css/icinga/themes/icinga.less +++ b/public/css/icinga/themes/icinga.less @@ -29,15 +29,6 @@ // Text color on @link-color: @text-color; -// Font and line-height for text @font-family: Calibri, Helvetica, sans-serif; @font-family-fixed: Menlo, monospace; -@font-size: 14px; -@font-size-small: 11px; -@font-weight-bold: 600; -@line-height: 17px; -@line-height-small: 14px; - -// Default padding -@vertical-padding: 6px; -@horizontal-padding: 12px; +@font-family-wide: Tahoma, Verdana, sans-serif; From ed86758e3d1e7640afa937fea8c0d558f98db115 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 26 Oct 2015 13:28:24 +0100 Subject: [PATCH 007/205] monitoring: Display unhandled services in the hosts overview more prominent fixes #10268 --- .../monitoring/application/views/scripts/list/hosts.phtml | 2 +- modules/monitoring/public/css/module.less | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 9c955ef66..fd80e4d2a 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -60,7 +60,7 @@ if (! $this->compact): ?> ) ) ?> host_name])): ?> - (qlink( + (qlink( sprintf( $this->translatePlural( '%u unhandled service', '%u unhandled services', $summary[$host->host_name] diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index a0dbb0d8f..a5e60aa8b 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -1,5 +1,11 @@ /*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ +.host-services-incidents { + color: @color-critical; + font-family: @font-family-wide; + font-size: @font-size-small; +} + .state-badges { display: inline-block; From a391ceeafc66a702b5100e00ed2c8ac80fbef1e1 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 26 Oct 2015 13:40:17 +0100 Subject: [PATCH 008/205] monitoring/CSS: Vertically center state summary badges refs #5543 --- modules/monitoring/public/css/module.less | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index a5e60aa8b..cb1485ddd 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -1,16 +1,19 @@ /*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ +// Link to unhandled services in the hosts overview .host-services-incidents { color: @color-critical; font-family: @font-family-wide; font-size: @font-size-small; } +// State summary badges .state-badges { display: inline-block; + vertical-align: middle; > ul > li { - padding-right: 5px; + padding-right: @vertical-padding; &:last-child { padding-right: 0; From dc273aa9a125b5e561a1dc2ecb511a8d0ccb8239 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 26 Oct 2015 13:42:01 +0100 Subject: [PATCH 009/205] monitoring/CSS: Increase readability of state labels in tables refs #5543 --- modules/monitoring/public/css/module.less | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index cb1485ddd..45eca8e18 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -21,6 +21,13 @@ } } +// State labels in tables +.state-label { + font-family: @font-family-wide; + font-size: @font-size-small; + letter-spacing: 1px; +} + .hosts-summary, .services-summary { .v-center(); From 4eb92438dd8eae3254ec602a0f4088b14577ca2c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 27 Oct 2015 13:52:18 +0100 Subject: [PATCH 010/205] Add nav-level-$level CSS classes to navigation --- .../Icinga/Web/Navigation/Renderer/NavigationRenderer.php | 6 +++++- .../Web/Navigation/Renderer/RecursiveNavigationRenderer.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php b/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php index fb0ca0925..7dc9da387 100644 --- a/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php +++ b/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php @@ -271,9 +271,11 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa /** * Return the opening markup for multiple navigation items * + * @param int $level + * * @return string */ - public function beginChildrenMarkup() + public function beginChildrenMarkup($level = 1) { $cssClass = array(static::CSS_CLASS_NAV); if ($this->navigation->getLayout() === Navigation::LAYOUT_TABS) { @@ -282,6 +284,8 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa $cssClass[] = static::CSS_CLASS_NAV_DROPDOWN; } + $cssClass[] = 'nav-level-' . $level; + return '