forked from shaba/openuds
Added level to notifier
This commit is contained in:
parent
1b9fd22ba1
commit
c7f96251ac
@ -1,4 +1,4 @@
|
||||
# Generated by Django 4.0 on 2022-02-07 13:22
|
||||
# Generated by Django 4.0 on 2022-02-08 19:08
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
@ -82,6 +82,7 @@ class Migration(migrations.Migration):
|
||||
('name', models.CharField(default='', max_length=128)),
|
||||
('comments', models.CharField(default='', max_length=256)),
|
||||
('enabled', models.BooleanField(default=True)),
|
||||
('level', models.CharField(choices=[('INFO', 'Info'), ('WARNING', 'Warning'), ('ERROR', 'Error'), ('CRITICAL', 'Critical')], default='ERROR', max_length=16)),
|
||||
('tags', models.ManyToManyField(to='uds.Tag')),
|
||||
],
|
||||
options={
|
||||
|
@ -42,10 +42,29 @@ logger = logging.getLogger(__name__)
|
||||
if typing.TYPE_CHECKING:
|
||||
from uds.core.alerts import notifier
|
||||
|
||||
|
||||
class Notifier(ManagedObjectModel, TaggingMixin):
|
||||
|
||||
NOTIFIER_LEVEL_INFO = 'INFO'
|
||||
NOTIFIER_LEVEL_WARNING = 'WARNING'
|
||||
NOTIFIER_LEVEL_ERROR = 'ERROR'
|
||||
NOTIFIER_LEVEL_CRITICAL = 'CRITICAL'
|
||||
|
||||
NOTIFIER_LEVEL_CHOICES = (
|
||||
(NOTIFIER_LEVEL_INFO, 'Info'),
|
||||
(NOTIFIER_LEVEL_WARNING, 'Warning'),
|
||||
(NOTIFIER_LEVEL_ERROR, 'Error'),
|
||||
(NOTIFIER_LEVEL_CRITICAL, 'Critical'),
|
||||
)
|
||||
|
||||
name = models.CharField(max_length=128, default='')
|
||||
comments = models.CharField(max_length=256, default='')
|
||||
enabled = models.BooleanField(default=True)
|
||||
level = models.CharField(
|
||||
max_length=16,
|
||||
choices=NOTIFIER_LEVEL_CHOICES,
|
||||
default=NOTIFIER_LEVEL_ERROR
|
||||
)
|
||||
|
||||
class Meta:
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user