Add interval and window fields to NotificationRule

This commit is contained in:
2023-01-14 14:36:46 +00:00
parent 158fffed99
commit fbe5607899
3 changed files with 45 additions and 3 deletions

View File

@@ -8,10 +8,9 @@ from core.lib.rules import NotificationRuleData
from .models import NotificationRule, NotificationSettings, User
# from django.forms import ModelForm
# flake8: noqa: E501
# Create your forms here.
class RestrictedFormMixin:
"""
This mixin is used to restrict the queryset of a form to the current user.
@@ -89,16 +88,20 @@ class NotificationRuleForm(RestrictedFormMixin, ModelForm):
fields = (
"name",
"data",
"interval",
"window",
"priority",
"topic",
"enabled",
)
help_texts = {
"name": "The name of the rule.",
"priority": "The priority of the rule.",
"priority": "The notification priority of the rule.",
"topic": "The topic to send notifications to. Leave blank for default.",
"enabled": "Whether the rule is enabled.",
"data": "The notification rule definition.",
"interval": "How often to run the search. On demand only evaluates messages as they are received.",
"window": "Time window to search: 1d, 1h, 1m, 1s, etc.",
}
def clean(self):