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
809 stars 282 forks source link

acknowledge_expire = 1 does not show expire time date/time picker #2848

Closed pinkgothic closed 6 years ago

pinkgothic commented 7 years ago

When setting "acknowledge_expire = 1" in /etc/icingaweb2/modules/monitoring/config.ini, the "Use Expire Time" checkbox is checked, but the "Expire Time" date/time-picker is not visible. (The checkbox needs to be unchecked and re-checked before it appears.)

See also https://monitoring-portal.org/index.php?thread/39979-defaults-when-acknowledging-problems-sticky-acknowledgement-expiry-time/

Expected Behavior

I expect that when the "Use Expire Time" checkbox is ticked on initial page load, that the "Expire Time" date/time-picker is also visible.

Current Behavior

The "Expire Time" date/time-picker is not visible, unless the checkbox is unchecked and then checked aain.

Possible Solution

In the file /usr/share/icingaweb2/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php, change:

        if (isset($formData['expire']) && (bool) $formData['expire'] === true) {

...to:

        if (
           ((bool) $config->get('settings', 'acknowledge_expire', false))
           || (isset($formData['expire']) && (bool) $formData['expire'] === true)
        ) {

Steps to Reproduce (for bugs)

  1. edit /etc/icingaweb2/modules/monitoring/config.ini
  2. add [settings] section into the file if it does not yet exist
  3. add acknowledge_expire = 1 to the file, in the [settings] section
  4. restart icinga
  5. click into a currently broken service
  6. click 'Acknowledge'
  7. notice that the 'Expire Time' date/time-picker is missing even though the 'Use Expire Time' checkbox is ticked

Context

The setting acknowledge_expire is currently not effective for what we wanted to use it for - namely reduce the mad clicking that needs to happen if there's a larger-scale infrastructural problem (that we definitely don't want to acknowledge forever). Our desired defaults are:

acknowledge_expire = 1
acknowledge_sticky = 1
acknowledge_notify = 0

...but currently only help to a limited degree.

Your Environment

lippserd commented 7 years ago

Hi,

Thanks for providing all the details. This is indeed a bug. We'll fix it :).

Cheers, Eric

lippserd commented 6 years ago

@Al2Klimov Please have a look at this one.

Al2Klimov commented 6 years ago

Hello @pinkgothic and thank you for both reporting and providing a possible solution!

If you have tested that solution (and it works), please create a pull request with your solution with the following changes:

  1. Swap the two conditions around the ||
  2. Drop (bool) cast

Best, AK

pinkgothic commented 6 years ago

It actually looks like you guys already fixed this in cd8d6e41dc175d5b823dda3d1be155527f83d560 (which also links to https://monitoring-portal.org/woltlab/index.php?thread/39979-defaults-when-acknowledging-problems-sticky-acknowledgement-expiry-time/). I'll try to verify that in the coming days and get back to you.

Al2Klimov commented 6 years ago

No need to verify. This is effectively the same change. Thank you nevertheless.

pinkgothic commented 6 years ago

Did just get around to verifying it anyway! It works now. Thank you for the fix! :)

lippserd commented 6 years ago

Thanks for the feedback.