Tinystatesummary: Adjust styles for summaries and headers

refs #7976
This commit is contained in:
Marius Hein 2015-02-12 15:06:37 +01:00
parent ca0914644c
commit fdcad4928e
5 changed files with 43 additions and 45 deletions

View File

@ -4,9 +4,7 @@ use Icinga\Web\Url;
$selfUrl = 'monitoring/list/hosts'; $selfUrl = 'monitoring/list/hosts';
$currentUrl = Url::fromRequest()->getRelativeUrl(); $currentUrl = Url::fromRequest()->getRelativeUrl();
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : '' ?>>
?>
<h1 class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : '' ?>>
<?= $this->qlink(sprintf($this->translate('%s hosts:'), $this->stats->hosts_total), $selfUrl); ?> <?= $this->qlink(sprintf($this->translate('%s hosts:'), $this->stats->hosts_total), $selfUrl); ?>
<span class="badges"> <span class="badges">
<?php if($this->stats->hosts_up): ?> <?php if($this->stats->hosts_up): ?>
@ -81,4 +79,4 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
</span> </span>
<?php endif; ?> <?php endif; ?>
</span> </span>
</h1> </div>

View File

@ -1,10 +1,10 @@
<?php <?php
use Icinga\Web\Url; use Icinga\Web\Url;
$selfUrl = 'monitoring/list/services'; $selfUrl = 'monitoring/list/services';
$currentUrl = Url::fromRequest()->getRelativeUrl(); $currentUrl = Url::fromRequest()->getRelativeUrl();
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : '' ?>>
?><h1 class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : '' ?>>
<?= $this->qlink(sprintf($this->translate('%s services:'), $this->stats->services_total), $selfUrl) ?> <?= $this->qlink(sprintf($this->translate('%s services:'), $this->stats->services_total), $selfUrl) ?>
<span class="badges"> <span class="badges">
<?php if ($this->stats->services_ok): ?> <?php if ($this->stats->services_ok): ?>
@ -15,9 +15,7 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
array('title' => sprintf($this->translate('Services with state %s'), $this->translate('OK'))) array('title' => sprintf($this->translate('Services with state %s'), $this->translate('OK')))
) ?></span> ) ?></span>
<?php endif ?> <?php endif ?>
<?php <?php
foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) { foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) {
$pre = 'services_' . $state; $pre = 'services_' . $state;
if ($this->stats->$pre) { if ($this->stats->$pre) {
@ -70,7 +68,6 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
echo "</span>\n"; echo "</span>\n";
} }
} }
?> ?>
<?php if ($this->stats->services_pending): ?> <?php if ($this->stats->services_pending): ?>
<span class="state pending<?= $currentUrl === Url::fromPath($selfUrl, array('service_state' => 99))->getRelativeUrl() ? ' active' : '' ?>"><?= $this->qlink( <span class="state pending<?= $currentUrl === Url::fromPath($selfUrl, array('service_state' => 99))->getRelativeUrl() ? ' active' : '' ?>"><?= $this->qlink(
@ -81,5 +78,4 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
) ?></span> ) ?></span>
<?php endif ?> <?php endif ?>
</span> </span>
</h1> </div>

View File

@ -1,11 +1,10 @@
<?php <?php
use Icinga\Web\Url; use Icinga\Web\Url;
$selfUrl = Url::fromPath('monitoring/show/services', array('host' => $this->object->host_name)); $selfUrl = Url::fromPath('monitoring/show/services', array('host' => $this->object->host_name));
$currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl(); $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : '' ?>>
?>
<h1 class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : '' ?>>
<?php if ($object->stats->services_total > 0): ?> <?php if ($object->stats->services_total > 0): ?>
<?= $this->qlink(sprintf($this->translatePlural('%d configured service:', '%d configured services:', $object->stats->services_total), $object->stats->services_total), $selfUrl) ?> <?= $this->qlink(sprintf($this->translatePlural('%d configured service:', '%d configured services:', $object->stats->services_total), $object->stats->services_total), $selfUrl) ?>
<?php else: ?> <?php else: ?>
@ -21,7 +20,6 @@ $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
) ?></span> ) ?></span>
<?php endif ?> <?php endif ?>
<?php <?php
foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) { foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) {
$pre = 'services_' . $state; $pre = 'services_' . $state;
if ($object->stats->$pre) { if ($object->stats->$pre) {
@ -74,7 +72,6 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
echo "</span>\n"; echo "</span>\n";
} }
} }
?> ?>
<?php if ($object->stats->services_pending): ?> <?php if ($object->stats->services_pending): ?>
<span class="state pending<?= $currentUrl === $selfUrl->with('service_state', 99)->getRelativeUrl() ? ' active' : '' ?>"><?= $this->qlink( <span class="state pending<?= $currentUrl === $selfUrl->with('service_state', 99)->getRelativeUrl() ? ' active' : '' ?>"><?= $this->qlink(
@ -85,5 +82,4 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
) ?></span> ) ?></span>
<?php endif ?> <?php endif ?>
</span> </span>
</h1> </div>

View File

@ -91,19 +91,19 @@ div.contacts div.notification-periods {
margin-top: 0.5em; margin-top: 0.5em;
} }
h1.tinystatesummary .badges { div.tinystatesummary {
.page-header();
font-size: 1em;
.badges {
display: inline-block; display: inline-block;
margin-bottom: 4px; margin-bottom: 4px;
margin-left: 1em; margin-left: 1em;
} }
.state > a {
h1.tinystatesummary .state > a {
color: white; color: white;
font-size: 0.8em; font-size: 0.8em;
padding: 2px 5px; padding: 2px 5px;
} }
h1.tinystatesummary .state.handled a {
} }
/* State badges */ /* State badges */

View File

@ -24,7 +24,20 @@
@colorPending: #77aaff; @colorPending: #77aaff;
@colorInvalid: #999; @colorInvalid: #999;
/* Mixins */
.page-header(@borderSize: 2px; @fontSize: 2em; @textColor: @colorTextDarkDefault) {
font-size: @fontSize;
color: @textColor;
border-bottom: @borderSize solid @colorPetrol;
a {
text-decoration: none;
color: inherit;
&:hover {
text-decoration: underline;
}
}
}
/*** Base rules ***/ /*** Base rules ***/
* { * {
@ -76,9 +89,7 @@ a:hover {
/* W3C Recommendation <http://www.w3.org/TR/CSS21/sample.html> (except h4) */ /* W3C Recommendation <http://www.w3.org/TR/CSS21/sample.html> (except h4) */
h1 { h1 {
font-size: 2em; .page-header();
color: @colorTextDefault;
border-bottom: 2px solid @colorPetrol;
} }
h2 { h2 {
@ -87,9 +98,7 @@ h2 {
} }
h3 { h3 {
font-size: 1.17em; .page-header(1px, 1.17em);
color: @colorTextDefault;
border-bottom: 1px solid @colorPetrol;
} }
h4 { h4 {
@ -98,8 +107,7 @@ h4 {
} }
h5 { h5 {
font-size: .83em; .page-header(1px, .83em);
border-bottom: 1px solid @colorPetrol;
} }
h6 { h6 {
@ -107,14 +115,16 @@ h6 {
color: @colorPetrol; color: @colorPetrol;
} }
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { h1, h2, h3, h4, h5, h6 {
a {
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
}
h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover { &:hover {
text-decoration: underline; text-decoration: underline;
} }
}
}
button { button {
font-family: inherit; font-family: inherit;
@ -129,5 +139,3 @@ button {
top: -2em; top: -2em;
} }
/*** END of Base rules */ /*** END of Base rules */