Icinga / icingaweb2

A lightweight and extensible web interface to keep an eye on your environment. Analyse problems and act on them.
https://icinga.com/get-started/
GNU General Public License v2.0
805 stars 280 forks source link

Restrict the downtime endtime to prevent unremoveable downtimes #4631

Open Svido opened 2 years ago

Svido commented 2 years ago

Describe the bug

Downtimes with a scheduled endtime after 2038-01-19 will result in an unremoveable downtime. This is probably caused 2038-01-19 is the maximum value in the database (MySQL). mysql > select FROM_UNIXTIME(2147483648); +---------------------------+ | FROM_UNIXTIME(2147483648) | +---------------------------+ | NULL | +---------------------------+ mysql > select FROM_UNIXTIME(2147483647); +---------------------------+ | FROM_UNIXTIME(2147483647) | +---------------------------+ | 2038-01-19 04:14:07 | +---------------------------+

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.

  1. Create a downtime with a scheduled endtime after 2038-01-19 04:14:07.
  2. Try to delete the downtime

Expected behavior

Limit the datetimepicker to a date that the database can handle.

Screenshots

If applicable, add screenshots to help explain your problem.

Your Environment

Include as many relevant details about the environment you experienced the problem in

Possible solution

Add 2038-01-19 04:14:07 as the max value for the downtime end datetime-picker. application/views/helpers/FormDateTime.php as described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#max

tectumopticum commented 5 months ago

It would be helpful to plan this maximum value as a configuration parameter instead of a hard-coded value in the code: sometimes users set a downtime to a max-value over several years. It should be possible to restrict this by configuration.