Support setting a default comment for acknowledgements (#1178)

I propose to add a new option for setting a default comment for
acknowledging problems (`acknowledge_comment_text`), similar to the
existing `hostdowntime_comment_text` and `servicedowntime_comment_text`
options.

This originally was a pull request for Icinga Web 2
(https://github.com/Icinga/icingaweb2/pull/5365). I was asked to
implement this in Icinga DB Web as well. *However, since I'm not using
Icinga DB Web myself, this is untested.*

Beside adding the new feature, I also fixed a copy-and-paste error for
the `servicedowntime_comment_text` option.
This commit is contained in:
marianrh 2025-05-08 14:24:15 +02:00 committed by GitHub
parent 93f717e45f
commit c4a8f4748f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 2 deletions

View file

@ -82,7 +82,8 @@ class AcknowledgeProblemForm extends CommandForm
'If you work with other administrators, you may find it useful to share information about'
. ' the host or service that is having problems. Make sure you enter a brief description of'
. ' what you are doing.'
)
),
'value' => $config->get('settings', 'acknowledge_comment_text')
]
);
$decorator->decorate($this->getElement('comment'));

View file

@ -47,7 +47,7 @@ class ScheduleServiceDowntimeForm extends CommandForm
$config = Config::module('icingadb');
$this->commentText = $config->get('settings', 'hostdowntime_comment_text');
$this->commentText = $config->get('settings', 'servicedowntime_comment_text');
$fixedEnd = clone $this->start;
$fixed = $config->get('settings', 'servicedowntime_end_fixed', 'PT1H');
$this->fixedEnd = $fixedEnd->add(new DateInterval($fixed));

View file

@ -71,6 +71,7 @@ configuration file `/etc/icingaweb2/modules/icingadb/config.ini`.
| Option | Description | Default |
|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|
| acknowledge_comment_text | Sets the value for "Comment" in the Acknowledgement dialog | "" |
| acknowledge_expire | Toggles "Use Expire Time" in the Acknowledgement dialog. | **0 (false)** |
| acknowledge_expire_time | Sets the value for "Expire Time" in the Acknowledgement dialog. It is calculated as now + this setting. Format is a [PHP Dateinterval](http://www.php.net/manual/en/dateinterval.construct.php). | **1 hour (PT1H)**. |
| acknowledge_notify | Toggles "Send Notification" in the Acknowledgement dialog. | **1 (true)** |