Skip to content

Commit 590b732

Browse files
Remove event table, related views and code (#467)
This PR removes the `event` table (Model) and all associated code that is no longer needed. ## Changes - Migrated `Event::mapSeverity()` into `IncidentHistoryRenderer::mapSeverity()`, rewritten as a `match` expression - Cleaned up references to the `event` relation in `Incident`, `IncidentHistory`, and `Objects` models, and in `ObjectHeader` - Removed event-related entries from `Links.php`, `configuration.php` , and `common.less` - `Daemon`: The `event_id` passed to the Event by `Daemon` was not used anywhere (no usage in notifications-worker.js), removed. - `Daemon`: The message is now fetched from `notification_history`, as it is the same as previous `event->message` in this case. ```sql ## Use this query to test: SELECT NOT EXISTS ( SELECT 1 FROM incident_history ih INNER JOIN event e ON e.id = ih.event_id WHERE ih.type = 'notified' AND ih.message != e.message ) AS messages_are_equal; ``` ## The following classes have been deleted: - `EventController` and `EventsController` — the list views and event detail are gone entirely - `LoadMoreObjectList` widget, which was only used in `EventsController` - `Event` ORM model - `EventDetail` and `EventRenderer` resolves #451
2 parents 16ae89d + ab02dfc commit 590b732

17 files changed

Lines changed: 23 additions & 886 deletions

application/controllers/EventController.php

Lines changed: 0 additions & 48 deletions
This file was deleted.

application/controllers/EventsController.php

Lines changed: 0 additions & 148 deletions
This file was deleted.

configuration.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@
4040
]
4141
);
4242

43-
$section->add(
44-
N_('Events'),
45-
[
46-
'icon' => 'history',
47-
'description' => $this->translate('Events'),
48-
'url' => 'notifications/events',
49-
'priority' => 20
50-
]
51-
);
52-
5343
if ($configLandingPage !== null) {
5444
$section->add(
5545
N_('Configuration'),

library/Notifications/Common/Links.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ public static function sourceAdd(): Url
1717
return Url::fromPath('notifications/sources/add');
1818
}
1919

20-
public static function event(int $id): Url
21-
{
22-
return Url::fromPath('notifications/event', ['id' => $id]);
23-
}
24-
25-
public static function events(): Url
26-
{
27-
return Url::fromPath('notifications/events');
28-
}
29-
3020
public static function incidents(): Url
3121
{
3222
return Url::fromPath('notifications/incidents');

library/Notifications/Daemon/Daemon.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ protected function processNotifications(): void
252252

253253
// grab new notifications and the current connections
254254
$notifications = IncidentHistory::on(Database::get())
255-
->with(['event', 'incident', 'incident.object', 'incident.object.source'])
255+
->with(['incident', 'incident.object', 'incident.object.source'])
256256
->withColumns(['incident.object.id_tags'])
257257
->filter(Filter::greaterThan('id', $this->lastIncidentId))
258258
->filter(Filter::equal('type', 'notified'))
@@ -287,10 +287,9 @@ protected function processNotifications(): void
287287
$notification->contact_id,
288288
(object) [
289289
'incident_id' => $notification->incident_id,
290-
'event_id' => $notification->event_id,
291290
'severity' => $incident->severity,
292291
'title' => ObjectsRendererHook::getObjectNameAsString($incident->object),
293-
'message' => $notification->event->message
292+
'message' => $notification->message
294293
]
295294
)
296295
]);

0 commit comments

Comments
 (0)