= $this->translate('Commands') ?> |
diff --git a/modules/monitoring/application/views/scripts/list/comments.phtml b/modules/monitoring/application/views/scripts/list/comments.phtml
index f8c4383bd..551d0cbac 100644
--- a/modules/monitoring/application/views/scripts/list/comments.phtml
+++ b/modules/monitoring/application/views/scripts/list/comments.phtml
@@ -36,7 +36,7 @@ if (count($comments) === 0) {
objecttype === 'service'): ?>
= $this->icon('service', $this->translate('Service')); ?>
-
+
= $this->qlink(
sprintf(
$this->translate('%s on %s', 'Service running on host'),
@@ -52,7 +52,7 @@ if (count($comments) === 0) {
))) ?>
= $this->icon('host', $this->translate('Host')); ?>
-
+
= $this->qlink(
$comment->host_display_name,
'monitoring/comment/show',
@@ -74,10 +74,9 @@ if (count($comments) === 0) {
?>
= $comment->expiration ? sprintf(
- $this->translate('This comment expires on %s at %s.'),
- date('d.m.y', $comment->expiration),
- date('H:i', $comment->expiration)
- ) : $this->translate('This comment does not expire.'); ?>
+ $this->translate('This comment expires %s.'),
+ $this->timeUntil($comment->expiration)
+ ) : $this->translate('This comment does not expire.'); ?>
|
diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml
index 79a0e1b92..d062274e7 100644
--- a/modules/monitoring/application/views/scripts/list/downtimes.phtml
+++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml
@@ -26,8 +26,8 @@ if (count($downtimes) === 0) {
return;
}
?>
-
@@ -45,24 +45,15 @@ if (count($downtimes) === 0) {
= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?>
- =
- $this->dateTimeRenderer(
- ($downtime->is_in_effect ? $downtime->end : $downtime->start),
- true
- )->render(
- $this->translate('on %s', 'datetime'),
- $this->translate('at %s', 'time'),
- $this->translate('in %s', 'timespan')
- );
- ?>
+ = $this->timeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start, $this->compact) ?>
|
- icon('service');
} else {
echo $this->icon('host');
- }
+ }
?>
= $this->qlink(
sprintf($this->translate('%s on %s', 'Service running on host'), $downtime->service_display_name, $downtime->host_display_name),
@@ -83,20 +74,20 @@ if (count($downtimes) === 0) {
$isService
? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.')
: $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'),
- date('d.m.y', $downtime->start),
- date('H:i', $downtime->start),
- $this->format()->duration($downtime->duration),
- date('d.m.y', $downtime->end),
- date('H:i', $downtime->end)
+ $this->formatDate($downtime->start),
+ $this->formatTime($downtime->start),
+ $this->formatDuration($downtime->duration),
+ $this->formatDate($downtime->end),
+ $this->formatTime($downtime->end)
); ?>
= sprintf(
$isService
? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.')
: $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'),
- date('d.m.y H:i', $downtime->scheduled_start),
- date('d.m.y H:i', $downtime->scheduled_end),
- $this->format()->duration($downtime->duration)
+ $this->formatDateTime($downtime->scheduled_start),
+ $this->formatDateTime($downtime->scheduled_end),
+ $this->formatDuration($downtime->duration)
); ?>
@@ -105,20 +96,20 @@ if (count($downtimes) === 0) {
$isService
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
: $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'),
- date('d.m.y', $downtime->start),
- date('H:i', $downtime->start),
- date('d.m.y', $downtime->end),
- date('H:i', $downtime->end)
+ $this->formatDate($downtime->start),
+ $this->formatTime($downtime->start),
+ $this->formatDate($downtime->end),
+ $this->formatTime($downtime->end)
); ?>
= sprintf(
$isService
? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.')
: $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
- date('d.m.y', $downtime->scheduled_start),
- date('H:i', $downtime->scheduled_start),
- date('d.m.y', $downtime->scheduled_end),
- date('H:i', $downtime->scheduled_end)
+ $this->formatDate($downtime->start),
+ $this->formatTime($downtime->start),
+ $this->formatDate($downtime->end),
+ $this->formatTime($downtime->end)
); ?>
diff --git a/modules/monitoring/application/views/scripts/list/eventgrid.phtml b/modules/monitoring/application/views/scripts/list/eventgrid.phtml
index 6936e9063..20016f9f4 100644
--- a/modules/monitoring/application/views/scripts/list/eventgrid.phtml
+++ b/modules/monitoring/application/views/scripts/list/eventgrid.phtml
@@ -75,7 +75,7 @@ foreach ($summary as $entry) {
$caption = sprintf(
$settings[$column]['tooltip'],
$value,
- $this->dateFormat()->formatDate(strtotime($day))
+ $this->formatDate(strtotime($day))
);
$linkFilter = Filter::matchAll(
Filter::expression('timestamp', '<', strtotime($day . ' 23:59:59')),
diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml
index 9ab581d59..491dee8ff 100644
--- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml
+++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml
@@ -85,7 +85,7 @@ if (count($history) === 0) {
|
= $this->escape($title); ?>
- = date('d.m. H:i', $event->timestamp); ?>
+ = $this->timeAgo($event->timestamp, $this->compact); ?>
|
diff --git a/modules/monitoring/application/views/scripts/list/hostgroups.phtml b/modules/monitoring/application/views/scripts/list/hostgroups.phtml
index 23d031b3f..f1a3e2004 100644
--- a/modules/monitoring/application/views/scripts/list/hostgroups.phtml
+++ b/modules/monitoring/application/views/scripts/list/hostgroups.phtml
@@ -60,7 +60,7 @@ if (count($hostgroups) === 0) {
|
= Host::getStateText($state, true); ?>
- = $this->prefixedTimeSince($lastStateChange); ?>
+ = $this->timeSince($lastStateChange, $this->compact); ?>
|
= $this->qlink(
diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml
index a83f3bb8a..5535d14fa 100644
--- a/modules/monitoring/application/views/scripts/list/hosts.phtml
+++ b/modules/monitoring/application/views/scripts/list/hosts.phtml
@@ -40,13 +40,14 @@ if (count($hosts) === 0) {
|
- = Host::getStateText($host->host_state, true); ?>
+ = Host::getStateText($host->host_state, true); ?>
host_state !== 99): ?>
- = $this->prefixedTimeSince($host->host_last_state_change, true) ?>
- host_state > 0 && (int) $host->host_state_type === 0): ?>
-
- Soft = $host->host_attempt ?>
-
+
+ = $this->timeSince($host->host_last_state_change, $this->compact) ?>
+ host_state > 0 && (int) $host->host_state_type === 0): ?>
+
+ Soft = $host->host_attempt ?>
+
|
diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml
index c49f5fc3f..3d1598a69 100644
--- a/modules/monitoring/application/views/scripts/list/notifications.phtml
+++ b/modules/monitoring/application/views/scripts/list/notifications.phtml
@@ -32,11 +32,7 @@ if (count($notifications) === 0) {
?>
- = $this->dateTimeRenderer($notification->notification_start_time)->render(
- $this->translate('on %s', 'datetime'),
- $this->translate('at %s', 'time'),
- $this->translate('%s ago', 'timespan')
- ) ?>
+ = $this->timeAgo($notification->notification_start_time, $this->compact) ?>
|
diff --git a/modules/monitoring/application/views/scripts/list/servicegroups.phtml b/modules/monitoring/application/views/scripts/list/servicegroups.phtml
index 9fb8d0e08..ba160af42 100644
--- a/modules/monitoring/application/views/scripts/list/servicegroups.phtml
+++ b/modules/monitoring/application/views/scripts/list/servicegroups.phtml
@@ -29,49 +29,49 @@ if (count($servicegroups) === 0) {
|
= $this->translate('CRITICAL'); ?>
- = $this->prefixedTimeSince($s->services_critical_last_state_change_unhandled); ?>
+ = $this->timeSince($s->services_critical_last_state_change_unhandled); ?>
|
services_unknown_last_state_change_unhandled): ?>
= $this->translate('UNKNOWN'); ?>
- = $this->prefixedTimeSince($s->services_unknown_last_state_change_unhandled); ?>
+ = $this->timeSince($s->services_unknown_last_state_change_unhandled); ?>
|
services_warning_last_state_change_unhandled): ?>
= $this->translate('WARNING'); ?>
- = $this->prefixedTimeSince($s->services_warning_last_state_change_unhandled); ?>
+ = $this->timeSince($s->services_warning_last_state_change_unhandled); ?>
|
services_critical_last_state_change_handled): ?>
= $this->translate('CRITICAL'); ?>
- = $this->prefixedTimeSince($s->services_critical_last_state_change_handled); ?>
+ = $this->timeSince($s->services_critical_last_state_change_handled); ?>
|
services_unknown_last_state_change_handled): ?>
= $this->translate('UNKNOWN'); ?>
- = $this->prefixedTimeSince($s->services_unknown_last_state_change_handled); ?>
+ = $this->timeSince($s->services_unknown_last_state_change_handled); ?>
|
services_warning_last_state_change_handled): ?>
= $this->translate('WARNING'); ?>
- = $this->prefixedTimeSince($s->services_warning_last_state_change_handled); ?>
+ = $this->timeSince($s->services_warning_last_state_change_handled); ?>
|
services_ok_last_state_change): ?>
= $this->translate('OK'); ?>
- = $this->prefixedTimeSince($s->services_ok_last_state_change); ?>
+ = $this->timeSince($s->services_ok_last_state_change); ?>
|
= $this->translate('PENDING'); ?>
- = $this->prefixedTimeSince($s->services_pending_last_state_change); ?>
+ = $this->timeSince($s->services_pending_last_state_change); ?>
|
diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml
index 964a0e982..9f87e7c60 100644
--- a/modules/monitoring/application/views/scripts/list/services.phtml
+++ b/modules/monitoring/application/views/scripts/list/services.phtml
@@ -48,12 +48,15 @@ if (count($services) === 0) {
?>
|
- = Service::getStateText($service->service_state, true); ?>
- compact): ?>= $this->prefixedTimeSince($service->service_last_state_change); ?>= $this->timeSince($service->service_last_state_change); ?>
- service_state > 0 && (int) $service->service_state_type === 0): ?>
-
- Soft = $service->service_attempt ?>
-
+ = Service::getStateText($service->service_state, true); ?>
+ service_state !== 99): ?>
+
+ = $this->timeSince($service->service_last_state_change, $this->compact) ?>
+ service_state > 0 && (int) $service->service_state_type === 0): ?>
+
+ Soft = $service->service_attempt ?>
+
+
|
diff --git a/modules/monitoring/application/views/scripts/partials/comment/comment-description.phtml b/modules/monitoring/application/views/scripts/partials/comment/comment-description.phtml
index 2c5f07133..87a7308fc 100644
--- a/modules/monitoring/application/views/scripts/partials/comment/comment-description.phtml
+++ b/modules/monitoring/application/views/scripts/partials/comment/comment-description.phtml
@@ -24,4 +24,4 @@
?>
= $this->escape($title); ?>
= $this->icon($icon, $tooltip) ?>
-= $this->prefixedTimeSince($comment->timestamp); ?>
+= $this->timeAgo($comment->timestamp, $this->compact); ?>
diff --git a/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml b/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml
index 92759a12a..85bd06b5c 100644
--- a/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml
@@ -3,16 +3,7 @@
|
= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?>
- =
- $this->dateTimeRenderer(
- ($downtime->is_in_effect ? $downtime->end : $downtime->start),
- true
- )->render(
- $this->translate('on %s', 'datetime'),
- $this->translate('at %s', 'time'),
- $this->translate('in %s', 'timespan')
- );
- ?>
+ = $this->timeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start, $this->compact) ?>
|
@@ -22,20 +13,20 @@
$this->isService
? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.')
: $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'),
- date('d.m.y', $downtime->start),
- date('H:i', $downtime->start),
- $this->format()->duration($downtime->duration),
- date('d.m.y', $downtime->end),
- date('H:i', $downtime->end)
+ $this->formatDate($downtime->start),
+ $this->formatTime($downtime->start),
+ $this->formatDuration($downtime->duration),
+ $this->formatDate($downtime->end),
+ $this->formatTime($downtime->end)
); ?>
= sprintf(
$this->isService
? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.')
: $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'),
- date('d.m.y H:i', $downtime->scheduled_start),
- date('d.m.y H:i', $downtime->scheduled_end),
- $this->format()->duration($downtime->duration)
+ $this->formatDateTime($downtime->scheduled_start),
+ $this->formatDateTime($downtime->scheduled_end),
+ $this->formatDuration($downtime->duration)
); ?>
@@ -44,20 +35,20 @@
$this->isService
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
: $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'),
- date('d.m.y', $downtime->start),
- date('H:i', $downtime->start),
- date('d.m.y', $downtime->end),
- date('H:i', $downtime->end)
+ $this->formatDate($downtime->start),
+ $this->formatTime($downtime->start),
+ $this->formatDate($downtime->end),
+ $this->formatTime($downtime->end)
); ?>
= sprintf(
$this->isService
? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.')
: $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
- date('d.m.y', $downtime->scheduled_start),
- date('H:i', $downtime->scheduled_start),
- date('d.m.y', $downtime->scheduled_end),
- date('H:i', $downtime->scheduled_end)
+ $this->formatDate($downtime->start),
+ $this->formatTime($downtime->start),
+ $this->formatDate($downtime->end),
+ $this->formatTime($downtime->end)
); ?>
diff --git a/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml b/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml
index 5518e5022..d3dc665a9 100644
--- a/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml
@@ -8,16 +8,7 @@
= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?>
- =
- $this->dateTimeRenderer(
- ($downtime->is_in_effect ? $downtime->end : $downtime->start),
- true
- )->render(
- $this->translate('on %s', 'datetime'),
- $this->translate('at %s', 'time'),
- $this->translate('in %s', 'timespan')
- );
- ?>
+ = $this->timeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start, $this->compact) ?>
|
isService): ?>
@@ -27,27 +18,27 @@
= $this->icon('host', $this->translate('Host')) ?>
= $downtime->host_name ?>.
-
+
is_flexible): ?>
is_in_effect): ?>
= sprintf(
$this->isService
? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.')
: $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'),
- date('d.m.y', $downtime->start),
- date('H:i', $downtime->start),
- $this->format()->duration($downtime->duration),
- date('d.m.y', $downtime->end),
- date('H:i', $downtime->end)
+ $this->formatDate($downtime->start),
+ $this->formatTime($downtime->start),
+ $this->formatDuration($downtime->duration),
+ $this->formatDate($downtime->end),
+ $this->formatTime($downtime->end)
); ?>
= sprintf(
$this->isService
? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.')
: $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'),
- date('d.m.y H:i', $downtime->scheduled_start),
- date('d.m.y H:i', $downtime->scheduled_end),
- $this->format()->duration($downtime->duration)
+ $this->formatDateTime($downtime->scheduled_start),
+ $this->formatDateTime($downtime->scheduled_end),
+ $this->formatDuration($downtime->duration)
); ?>
@@ -56,20 +47,20 @@
$this->isService
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
: $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'),
- date('d.m.y', $downtime->start),
- date('H:i', $downtime->start),
- date('d.m.y', $downtime->end),
- date('H:i', $downtime->end)
+ $this->formatDate($downtime->start),
+ $this->formatTime($downtime->start),
+ $this->formatDate($downtime->end),
+ $this->formatTime($downtime->end)
); ?>
= sprintf(
$this->isService
? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.')
: $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
- date('d.m.y', $downtime->scheduled_start),
- date('H:i', $downtime->scheduled_start),
- date('d.m.y', $downtime->scheduled_end),
- date('H:i', $downtime->scheduled_end)
+ $this->formatDate($downtime->start),
+ $this->formatTime($downtime->start),
+ $this->formatDate($downtime->end),
+ $this->formatTime($downtime->end)
); ?>
@@ -91,4 +82,4 @@
)
) ?>
-
\ No newline at end of file
+
diff --git a/modules/monitoring/application/views/scripts/partials/host/object-header.phtml b/modules/monitoring/application/views/scripts/partials/host/object-header.phtml
index ed7edae79..1a2fc356d 100644
--- a/modules/monitoring/application/views/scripts/partials/host/object-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/host/object-header.phtml
@@ -6,7 +6,7 @@ use Icinga\Module\Monitoring\Object\Host;
|
= Host::getStateText($object->host_state, true); ?>
- = $this->prefixedTimeSince($object->host_last_state_change, true); ?>
+ = $this->timeSince($object->host_last_state_change); ?>
|
= $this->iconImage()->host($object) ?>
diff --git a/modules/monitoring/application/views/scripts/partials/service/object-header.phtml b/modules/monitoring/application/views/scripts/partials/service/object-header.phtml
index c6dbb4730..c3df4044b 100644
--- a/modules/monitoring/application/views/scripts/partials/service/object-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/service/object-header.phtml
@@ -7,7 +7,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
= Host::getStateText($object->host_state, true); ?>
- = $this->prefixedTimeSince($object->host_last_state_change, true); ?>
+ = $this->timeSince($object->host_last_state_change) ?>
|
= $this->iconImage()->service($object) ?>
@@ -25,7 +25,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
= Service::getStateText($object->service_state, true); ?>
- = $this->prefixedTimeSince($object->service_last_state_change, true); ?>
+ = $this->timeSince($object->service_last_state_change) ?>
|
= $this->iconImage()->host($object) ?>
diff --git a/modules/monitoring/application/views/scripts/process/info.phtml b/modules/monitoring/application/views/scripts/process/info.phtml
index 5ebecce4d..85e576116 100644
--- a/modules/monitoring/application/views/scripts/process/info.phtml
+++ b/modules/monitoring/application/views/scripts/process/info.phtml
@@ -27,15 +27,15 @@ if (! $this->compact): ?>
|
= $this->translate('Program Start Time') ?> |
- = $this->dateFormat()->formatDateTime($this->programStatus->program_start_time) ?> |
+ = $this->formatDateTime($this->programStatus->program_start_time) ?> |
= $this->translate('Last Status Update'); ?> |
- = sprintf($this->translate('%s ago'), $this->timeSince($this->programStatus->status_update_time)); ?> |
+ = $this->timeAgo($this->programStatus->status_update_time); ?> |
= $this->translate('Last External Command Check'); ?> |
- = sprintf($this->translate('%s ago'), $this->timeSince($this->programStatus->last_command_check)); ?> |
+ = $this->timeAgo($this->programStatus->last_command_check); ?> |
= $this->translate('Last Log File Rotation'); ?> |
@@ -66,7 +66,10 @@ if (! $this->compact): ?>
programStatus->is_currently_running === true): ?>
= sprintf(
- $this->translate('Backend %s has been up and running with PID %d since %s'),
+ $this->translate(
+ '%1$s has been up and running with PID %2$d %3$s',
+ 'Last format parameter represents the time running'
+ ),
$this->backendName,
$this->programStatus->process_id,
$this->timeSince($this->programStatus->program_start_time)) ?>
diff --git a/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml b/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml
index 18fbdb82f..415b66b76 100644
--- a/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml
@@ -20,7 +20,7 @@ if ($object->getType() === $object::TYPE_HOST) {
- = $this->timeSince($object->last_check) ?>
+ = $this->timeAgo($object->last_check) ?>
@@ -54,7 +54,8 @@ if ($object->getType() === $object::TYPE_HOST) {
)
);
}
- } ?> = $this->timeUntil($object->next_check) ?>
+ } ?>
+ = $this->timeUntil($object->next_check) ?>
diff --git a/modules/monitoring/application/views/scripts/show/components/comments.phtml b/modules/monitoring/application/views/scripts/show/components/comments.phtml
index 478b1e7f3..c4b947e3c 100644
--- a/modules/monitoring/application/views/scripts/show/components/comments.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/comments.phtml
@@ -44,7 +44,7 @@ foreach ($object->comments as $comment) {
?>
- = $this->escape($comment->author); ?> (= $this->timeSince($comment->timestamp); ?>) |
+ = $this->escape($comment->author); ?> (= $this->timeAgo($comment->timestamp); ?>) |
downtimes as $downtime) {
) : $this->escape($downtime->comment);
if ((bool) $downtime->is_in_effect) {
- $state = 'in downtime since ';
- $time = $this->timeSince($downtime->start);
+ $state = sprintf(
+ $this->translate('in downtime %s', 'Last format parameter represents the time in downtime'),
+ $this->timeSince($downtime->start)
+ );
} else {
if ((bool) $downtime->is_fixed) {
- $state = 'scheduled ';
- $time = $this->timeUntil($downtime->start);
+ $state = sprintf(
+ $this->translate('scheduled %s', 'Last format parameter represents the time scheduled'),
+ $this->timeUntil($downtime->start)
+ );
} else {
- $state = 'scheduled flexible ';
- $time = $this->timeUntil($downtime->start);
+ $state = sprintf(
+ $this->translate('scheduled flexible %s', 'Last format parameter represents the time scheduled'),
+ $this->timeUntil($downtime->start)
+ );
}
}
?>
|
- = $this->escape($downtime->author_name); ?> |
+ = $this->escape($downtime->author_name); ?> (= $this->timeAgo($downtime->entry_time); ?>) |
downtimes as $downtime) {
);
echo $delDowntimeForm;
} ?>
- = $this->translate('Downtime'); ?>
- =
- $this->qlink(
- $state,
- 'monitoring/downtime/show',
- array('downtime_id' => $downtime->id),
- array('data-base-target' => '_next')
- ) . $time ; ?> - = str_replace(array('\r\n', '\n'), ' ', $commentText); ?>
+ = $this->translate('Downtime'); ?>= $state; ?> - = str_replace(array('\r\n', '\n'), ' ', $commentText); ?>
|
diff --git a/modules/monitoring/application/views/scripts/show/components/notifications.phtml b/modules/monitoring/application/views/scripts/show/components/notifications.phtml
index af57eb934..5fea60cc1 100644
--- a/modules/monitoring/application/views/scripts/show/components/notifications.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/notifications.phtml
@@ -1,59 +1,66 @@
- = $this->translate('Notifications') ?> |
-
- hasPermission('monitoring/command/send-custom-notification')) {
- if ($object->getType() === $object::TYPE_HOST) {
- $ackLink = $this->href(
- 'monitoring/host/send-custom-notification',
- array('host' => $object->getName())
- );
- } else {
- $ackLink = $this->href(
- 'monitoring/service/send-custom-notification',
- array('host' => $object->getHost()->getName(), 'service' => $object->getName())
- );
- }
- ?>
- = $this->qlink(
- $this->translate('Send notification'),
- $ackLink,
- null,
- array(
- 'icon' => 'bell',
- 'data-base-target' => '_self',
- 'title' => $this->translate(
- 'Send a custom notification, share information about the'
- . ' object to contacts.'
- )
- )
- ) ?>
-
-state, array(0, 99))) {
-
- if ($object->current_notification_number > 0) {
- if ((int) $object->current_notification_number === 1) {
- $msg = sprintf(
- $this->translate('A notication has been sent for this issue %s ago'),
- $this->timeSince($object->last_notification)
- );
- } else {
- $msg = sprintf(
- $this->translate('%s notications have been sent for this issue'),
- $object->current_notification_number
- ) . ' ' . sprintf(
- $this->translate('The last one occured %s ago'),
- $this->timeSince($object->last_notification)
- );
+ | = $this->translate('Notifications') ?> |
+
+ hasPermission('monitoring/command/send-custom-notification')) {
+ if ($object->getType() === $object::TYPE_HOST) {
+ /** @var \Icinga\Module\Monitoring\Object\Host $object */
+ echo $this->qlink(
+ $this->translate('Send notification'),
+ 'monitoring/host/send-custom-notification',
+ array('host_name' => $object->getName()),
+ array(
+ 'icon' => 'bell',
+ 'data-base-target' => '_self',
+ 'title' => $this->translate(
+ 'Send a custom notification to contacts responsible for this host'
+ )
+ )
+ );
+ } else {
+ /** @var \Icinga\Module\Monitoring\Object\Service $object */
+ echo $this->qlink(
+ $this->translate('Send notification'),
+ 'monitoring/service/send-custom-notification',
+ array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName()),
+ array(
+ 'icon' => 'bell',
+ 'data-base-target' => '_self',
+ 'title' => $this->translate(
+ 'Send a custom notification to contacts responsible for this service'
+ )
+ )
+ );
+ }
+ if (! in_array((int) $object->state, array(0, 99))) {
+ echo ' ';
+ }
+ } elseif (in_array((int) $object->state, array(0, 99))) {
+ echo '-';
}
- echo $msg;
- } else {
- echo '('
- . $this->translate('No notification has been sent for this issue')
- . ')';
- }
-}
-?>
- |
+ // We are not interested in notifications for OK or pending objects
+ if (! in_array((int) $object->state, array(0, 99))) {
+ if ($object->current_notification_number > 0) {
+ if ((int) $object->current_notification_number === 1) {
+ $msg = sprintf(
+ $this->translate('A notification has been sent for this issue %s.'),
+ $this->timeAgo($object->last_notification)
+ );
+ } else {
+ $msg = sprintf(
+ $this->translate('%d notifications have been sent for this issue.'),
+ $object->current_notification_number
+ ) . ' ' . sprintf(
+ $this->translate('The last one was sent %s.'),
+ $this->timeAgo($object->last_notification)
+ );
+ }
+ } else {
+ $msg = $this->translate('No notification has been sent for this issue.');
+ }
+ echo $msg;
+ }
+ ?>
+
diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less
index 357948373..c64f24b84 100644
--- a/modules/monitoring/public/css/module.less
+++ b/modules/monitoring/public/css/module.less
@@ -234,3 +234,11 @@ div.backend-not-running {
text-align: center;
padding: 0.1em;
}
+
+td.state {
+ .time-ago,
+ .time-since,
+ .time-until {
+ text-transform: capitalize;
+ }
+}
diff --git a/public/css/icinga/monitoring-colors.less b/public/css/icinga/monitoring-colors.less
index 020db57cd..2b2b70b27 100644
--- a/public/css/icinga/monitoring-colors.less
+++ b/public/css/icinga/monitoring-colors.less
@@ -445,8 +445,9 @@ div.box.contents.zero {
div.box.contents.zero span {
font-weight: bold;
+ line-height: 2em;
- color: white;
+ color: #666;
}
div.box.contents.zero h3 {
@@ -454,7 +455,7 @@ div.box.contents.zero h3 {
font-size: 12em;
line-height: 1em;
- color: white;
+ color: #666;
}
div.box.ok_hosts.state_up {
diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js
index 3bfb87c61..b9e63aa11 100644
--- a/public/js/icinga/ui.js
+++ b/public/js/icinga/ui.js
@@ -577,70 +577,60 @@
);
},
+ /**
+ * Refresh partial time counters
+ *
+ * This function runs every second.
+ */
refreshTimeSince: function () {
-
- $('.timesince').each(function (idx, el) {
-
- // todo remove after replace timeSince
- var mp = el.innerHTML.match(/^(.*?)(-?\d+)d\s(-?\d+)h/);
- if (mp !== null) {
- return true;
- }
-
- var m = el.innerHTML.match(/^(.*?)(-?\d+)(.+\s)(-?\d+)(.+)/);
- if (m !== null) {
- var nm = parseInt(m[2]);
- var ns = parseInt(m[4]);
- if (ns < 59) {
- ns++;
+ $('.time-ago, .time-since').each(function (idx, el) {
+ var partialTime = /(\d{1,2})m (\d{1,2})s/.exec(el.innerHTML);
+ if (partialTime !== null) {
+ var minute = parseInt(partialTime[1], 10),
+ second = parseInt(partialTime[2], 10);
+ if (second < 59) {
+ ++second;
} else {
- ns = 0;
- nm++;
+ ++minute;
+ second = 0;
}
- $(el).html(m[1] + nm + m[3] + ns + m[5]);
+ el.innerHTML = el.innerHTML.substr(0, partialTime.index) + minute.toString() + 'm '
+ + second.toString() + 's' + el.innerHTML.substr(partialTime.index + partialTime[0].length);
}
});
- $('.timeuntil').each(function (idx, el) {
-
- // todo remove after replace timeUntil
- var mp = el.innerHTML.match(/^(.*?)(-?\d+)d\s(-?\d+)h/);
- if (mp !== null) {
- return true;
- }
-
- var m = el.innerHTML.match(/^(.*?)(-?\d+)(.+\s)(-?\d+)(.+)/);
- if (m !== null) {
- var nm = parseInt(m[2]);
- var ns = parseInt(m[4]);
- var signed = '';
- var sec = 0;
-
- if (nm < 0) {
- signed = '-';
- nm = nm * -1;
- sec = nm * 60 + ns;
- sec++;
- } else if (nm == 0 && ns == 0) {
- signed = '-';
- sec = 1;
- } else if (nm == 0 && m[2][0] == '-') {
- signed = '-';
- sec = ns;
- sec++;
- } else if (nm == 0 && m[2][0] != '-') {
- sec = ns;
- sec--;
+ $('.time-until').each(function (idx, el) {
+ var partialTime = /(-?)(\d{1,2})m (\d{1,2})s/.exec(el.innerHTML);
+ if (partialTime !== null) {
+ var minute = parseInt(partialTime[2], 10),
+ second = parseInt(partialTime[3], 10),
+ invert = partialTime[1];
+ if (invert.length) {
+ // Count up because partial time is negative
+ if (second < 59) {
+ ++second;
+ } else {
+ ++minute;
+ second = 0;
+ }
} else {
- signed = '';
- sec = nm * 60 + ns;
- sec--;
+ // Count down because partial time is positive
+ if (second === 0) {
+ if (minute === 0) {
+ // Invert counter
+ minute = 0;
+ second = 1;
+ invert = '-';
+ } else {
+ --minute;
+ second = 59;
+ }
+ } else {
+ --second;
+ }
}
-
- nm = Math.floor(sec/60);
- ns = sec - nm * 60;
-
- $(el).html(m[1] + signed + nm + m[3] + ns + m[5]);
+ el.innerHTML = el.innerHTML.substr(0, partialTime.index) + invert + minute.toString() + 'm '
+ + second.toString() + 's' + el.innerHTML.substr(partialTime.index + partialTime[0].length);
}
});
},
diff --git a/test/php/library/Icinga/Util/DateTimeFactoryTest.php b/test/php/library/Icinga/Util/DateTimeFactoryTest.php
deleted file mode 100644
index 2e8e097eb..000000000
--- a/test/php/library/Icinga/Util/DateTimeFactoryTest.php
+++ /dev/null
@@ -1,69 +0,0 @@
- 'invalid'));
- }
-
- public function testWhetherParseWorksWithASpecificTimezone()
- {
- $dt = DateTimeFactory::parse('17-04-14 17:00', 'd-m-y H:i', new DateTimeZone('Europe/Berlin'));
- $dt->setTimezone(new DateTimeZone('UTC'));
-
- $this->assertEquals(
- '15',
- $dt->format('H'),
- 'DateTimeFactory::parse does not properly parse a given datetime or does not respect the given timezone'
- );
- }
-
- public function testWhetherParseWorksWithoutASpecificTimezone()
- {
- $this->assertEquals(
- '15',
- DateTimeFactory::parse('17-04-14 15:00', 'd-m-y H:i')->format('H'),
- 'DateTimeFactory::parse does not properly parse a given datetime'
- );
- }
-
- public function testWhetherCreateWorksWithASpecificTimezone()
- {
- $dt = DateTimeFactory::create('2014-04-17 5PM', new DateTimeZone('Europe/Berlin'));
- $dt->setTimezone(new DateTimeZone('UTC'));
-
- $this->assertEquals(
- '15',
- $dt->format('H'),
- 'DateTimeFactory::create does not properly parse a given datetime or does not respect the given timezone'
- );
- }
-
- public function testWhetherCreateWorksWithoutASpecificTimezone()
- {
- $this->assertEquals(
- '15',
- DateTimeFactory::create('2014-04-17 3PM')->format('H'),
- 'DateTimeFactory::create does not properly parse a given datetime'
- );
- }
-}
diff --git a/test/php/library/Icinga/Web/View/DateTimeRendererTest.php b/test/php/library/Icinga/Web/View/DateTimeRendererTest.php
deleted file mode 100644
index 279c18ba1..000000000
--- a/test/php/library/Icinga/Web/View/DateTimeRendererTest.php
+++ /dev/null
@@ -1,101 +0,0 @@
-assertInstanceOf(
- 'Icinga\Web\View\DateTimeRenderer',
- $dt,
- 'Dashboard::create() could not create DateTimeRenderer'
- );
- }
-
- /**
- * @depends testWhetherCreateCreatesDateTimeRenderer
- */
- public function testWhetherIsDateTimeReturnsRightType()
- {
- $dateTime = new DateTime('+1 day');
- $dt = DateTimeRenderer::create($dateTime);
-
- $this->assertTrue(
- $dt->isDateTime(),
- 'Dashboard::isDateTime() returns wrong type'
- );
- }
-
- /**
- * @depends testWhetherCreateCreatesDateTimeRenderer
- */
- public function testWhetherIsTimeReturnsRightType()
- {
- $dateTime = new DateTime('+1 hour');
- $dt = DateTimeRenderer::create($dateTime);
-
- $this->assertTrue(
- $dt->isTime(),
- 'Dashboard::isTime() returns wrong type'
- );
- }
-
- /**
- * @depends testWhetherCreateCreatesDateTimeRenderer
- */
- public function testWhetherIsTimespanReturnsRightType()
- {
- $dateTime = new DateTime('+1 minute');
- $dt = DateTimeRenderer::create($dateTime);
-
- $this->assertTrue(
- $dt->isTimespan(),
- 'Dashboard::isTimespan() returns wrong type'
- );
- }
-
- /**
- * @depends testWhetherCreateCreatesDateTimeRenderer
- */
- public function testWhetherNormalizeReturnsNormalizedDateTime()
- {
- $dateTime = time();
- $dt = DateTimeRenderer::normalize($dateTime);
-
- $this->assertInstanceOf(
- 'DateTime',
- $dt,
- 'Dashboard::normalize() returns wrong instance'
- );
- }
-
- /**
- * @depends testWhetherCreateCreatesDateTimeRenderer
- */
- public function testWhetherRenderReturnsRightText()
- {
- $dateTime = new DateTime('+1 minute');
- $dt = DateTimeRenderer::create($dateTime);
-
- $text = $dt->render(
- '#1 The service is down since %s',
- '#2 The service is down since %s o\'clock.',
- '#3 The service is down for %s.'
- );
-
- $this->assertRegExp(
- '/#3/',
- $text,
- 'Dashboard::render() returns wrong text'
- );
- }
-}
| |