mirror of
https://github.com/netbox-community/netbox.git
synced 2026-02-05 14:56:24 -06:00
* Initial work on #15621 * Signal receiver should ignore models which don't support notifications * Flesh out NotificationGroup functionality * Add NotificationGroup filters for users & groups * Separate read & dimiss actions * Enable one-click dismissals from notifications list * Include total notification count in dropdown * Drop 'kind' field from Notification model * Register event types in the registry; add colors & icons * Enable event rules to target notification groups * Define dynamic choices for Notification.event_name * Move event registration to core * Add more job events * Misc cleanup * Misc cleanup * Correct absolute URLs for notifications & subscriptions * Optimize subscriber notifications * Use core event types when queuing events * Standardize queued event attribute to event_type; change content_type to object_type * Rename Notification.event_name to event_type * Restore NotificationGroupBulkEditView * Add API tests * Add view & filterset tests * Add model documentation * Fix tests * Update notification bell when notifications have been cleared * Ensure subscribe button appears only on relevant models * Notifications/subscriptions cannot be ordered by object * Misc cleanup * Add event icon & type to notifications table * Adjust icon sizing * Mute color of read notifications * Misc cleanup
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from netbox.events import *
|
||||
|
||||
__all__ = (
|
||||
'JOB_COMPLETED',
|
||||
'JOB_ERRORED',
|
||||
'JOB_FAILED',
|
||||
'JOB_STARTED',
|
||||
'OBJECT_CREATED',
|
||||
'OBJECT_DELETED',
|
||||
'OBJECT_UPDATED',
|
||||
)
|
||||
|
||||
# Object events
|
||||
OBJECT_CREATED = 'object_created'
|
||||
OBJECT_UPDATED = 'object_updated'
|
||||
OBJECT_DELETED = 'object_deleted'
|
||||
|
||||
# Job events
|
||||
JOB_STARTED = 'job_started'
|
||||
JOB_COMPLETED = 'job_completed'
|
||||
JOB_FAILED = 'job_failed'
|
||||
JOB_ERRORED = 'job_errored'
|
||||
|
||||
# Register core events
|
||||
Event(name=OBJECT_CREATED, text=_('Object created')).register()
|
||||
Event(name=OBJECT_UPDATED, text=_('Object updated')).register()
|
||||
Event(name=OBJECT_DELETED, text=_('Object deleted')).register()
|
||||
Event(name=JOB_STARTED, text=_('Job started')).register()
|
||||
Event(name=JOB_COMPLETED, text=_('Job completed'), type=EVENT_TYPE_SUCCESS).register()
|
||||
Event(name=JOB_FAILED, text=_('Job failed'), type=EVENT_TYPE_WARNING).register()
|
||||
Event(name=JOB_ERRORED, text=_('Job errored'), type=EVENT_TYPE_DANGER).register()
|
||||
Reference in New Issue
Block a user