Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Please give us back the timestamps in history view #1065

Open
Mordecaine opened this issue Sep 25, 2024 · 2 comments
Open

Comments

@Mordecaine
Copy link

In the monitoring module webinterface (the old web interface) you had timestamps in the history view.
In the icingadb webinterface, It's really hard to debug thinks because of the relative time values:
grafik

Please return to the good old timestamps:
thumbnail_image001

I have some ideas:
idea

@nilmerg nilmerg transferred this issue from Icinga/icingaweb2-module-director Sep 25, 2024
@mwester117
Copy link

+1
The old timestamp format, displaying the exact time directly, is much more efficient for monitoring. With the current implementation, hovering over the date to get the precise time adds an unnecessary step. In critical situations, especially in monitoring environments, it’s crucial to have immediate visibility of both the date and time without additional interaction. Reverting to the old format would improve usability and speed in resolving issues.

@alamp1360
Copy link

If you are interested in a quick "hack" to format the history list the way you see fit:
Add file /usr/share/icinga-php/ipl/vendor/ipl/web/src/Widget/TimeShortDT.php with the following content:

<?php

namespace ipl\Web\Widget;

use Icinga\Date\DateFormatter;
use ipl\Html\BaseHtmlElement;

class TimeShortDT extends BaseHtmlElement
{
    /** @var int */
    protected $timestamp;
    protected $tag = 'time';
    protected $defaultAttributes = ['class' => 'value'];

    public function __construct($timestamp)
    {
        $this->timestamp = (int) $timestamp;
    }

    protected function assemble()
    {
        $dateTime = DateFormatter::formatDateTime($this->timestamp);

        $this->addAttributes([
            'datetime' => $dateTime,
            'title'    => $dateTime
        ]);

        $this->add( date("j. M 'y H:i", $this->timestamp) );
    }
}

Then, apply this patch to /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php

*** BaseHistoryListItem.php     2024-08-05 14:16:40.000000000 +0200
--- BaseHistoryListItem.php_new 2024-10-07 11:00:30.001129726 +0200
***************
*** 24,29 ****
--- 24,30 ----
  use ipl\Web\Widget\EmptyState;
  use ipl\Web\Widget\StateBall;
  use ipl\Web\Widget\TimeAgo;
+ use ipl\Web\Widget\TimeShortDT;
  use ipl\Html\BaseHtmlElement;
  use ipl\Html\HtmlElement;
  use ipl\Html\Text;
***************
*** 402,407 ****

      protected function createTimestamp(): ?BaseHtmlElement
      {
!         return new TimeAgo($this->item->event_time->getTimestamp());
      }
  }
--- 403,408 ----

      protected function createTimestamp(): ?BaseHtmlElement
      {
!         return new TimeShortDT($this->item->event_time->getTimestamp());
      }
  }

This will display the time as "10. Oct '24 19:11". You can change the format to whatever you prefer by changing the date format in the last statement of the file TimeShortDT.php.

Of course you need to apply this change whenever you update icingaweb.

Hope this helps...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants