Skip to content

Commit 4bb17bb

Browse files
IncidentDetail: Make the message limit configurable via module config
1 parent 1b26ce4 commit 4bb17bb

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

doc/03-Configuration.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ If you just installed Icinga Notifications Web, remember to activate it on your
3636
| notifications/view/contacts | Allow to view contacts |
3737
| notifications/api | Allow to modify configuration via API |
3838

39+
## General Configuration
40+
41+
There is currently one configurable option: the maximum number of characters of the incident
42+
message shown in the incident detail view (default: 10000). It can not be adjusted in the UI
43+
directly, but has to be set in the configuration file `/etc/icingaweb2/modules/notifications/config.ini`.
44+
45+
### Example
46+
47+
Setting the incident message character limit to 2500.
48+
49+
```
50+
[settings]
51+
incident_message_character_limit = 2500
52+
```
53+
3954
## Database Configuration
4055

4156
Connection configuration for the database, which both,

library/Notifications/Widget/Detail/IncidentDetail.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace Icinga\Module\Notifications\Widget\Detail;
77

8+
use Icinga\Application\Config;
89
use Icinga\Module\Notifications\Common\Auth;
910
use Icinga\Module\Notifications\Common\SourceHookLocator;
1011
use Icinga\Module\Notifications\Model\Incident;
@@ -106,7 +107,13 @@ protected function createMessage(): array
106107
'id' => 'persist-collapse-state',
107108
'data-visible-height' => 100
108109
]),
109-
Text::create(substr($this->incident->message, 0, 10000))
110+
Text::create(
111+
substr(
112+
$this->incident->message,
113+
0,
114+
(int) Config::module('notifications')
115+
->get('settings', 'incident_message_character_limit', 10000))
116+
)
110117
);
111118

112119
CopyToClipboard::attachTo($message);

0 commit comments

Comments
 (0)