Skip to content
Snippets Groups Projects
Commit edaa9d11 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by gracedb-dev1
Browse files

adding instructions to page for creating notifications

parent 5a98db30
No related branches found
No related tags found
No related merge requests found
......@@ -10,15 +10,23 @@ from pyparsing import ParseException
def triggerFormFactory(postdata=None, user=None):
class TF(forms.ModelForm):
farThresh = forms.FloatField(label='FAR Threshold (Hz)', required=False,
help_text="Leave blank to receive all events, regardless of FAR.")
farThresh = forms.FloatField(label='FAR Threshold (Hz)',
required=False)
class Meta:
model = Trigger
fields = ['contacts', 'pipelines', 'farThresh', 'labels', 'label_query']
widgets = {'label_query': forms.TextInput(attrs={'size': 50})}
help_texts = {
'label_query': 'Label names can be combined with binary AND: \'&amp;\' or \',\'; or binary OR: \'|\'. For N labels, there must be exactly N-1 binary operators. Parentheses are not allowed. Additionally, any of the labels in a query string can be negated with \'~\' or \'-\'. Labels can either be selected with the select box at the top, or a query can be specified, <i>but not both</i>.'
'label_query': ("Label names can be combined with binary AND: "
"'&amp;' or ','; or binary OR: '|'. For N "
"labels, there must be exactly N-1 binary "
"operators. Parentheses are not allowed. "
"Additionally, any of the labels in a query "
"string can be negated with '~' or '-'. "
"Labels can either be selected with the select"
" box at the top, or a query can be specified,"
" <i>but not both</i>."),
}
contacts = forms.ModelMultipleChoiceField(
......
......@@ -50,7 +50,30 @@ def managePassword(request):
@internal_user_required
def create(request):
explanation = ""
# Explanatory HTML block.
expl = ['<div style="padding: 10px;">',
'<h4>Instructions:</h4>',
'<ul><li>Select a contact to receive the notification.</li>',
('<li>Select a pipeline to receive alerts for events created '
'by that pipeline. Select all pipelines to receive alerts, '
'regardless of pipeline.</li>'),
('<li>Enter a FAR threshold if you want to only receive alerts '
'about events more significant than the threshold. Leave blank '
' to receive all events, regardless of FAR.</li>'),
('<li>Select a label or enter a label query to receive alerts '
'only when a specific label or set of labels is applied. Don\'t '
'select any labels to receive all events, regardless of labels.'
'</li>'),
('<li>To set up a notification based only on FAR, select a '
'contact, select all pipelines, enter a FAR threshold, and '
'do not select any labels or enter a label query.</li>'),
('<li>You may select multiple contacts, pipelines, and/or labels '
'by holding SHIFT and clicking or using CTRL + A to select all.'
'</li>'),
'</ul></div>'
]
expl = mark_safe("\n".join(expl))
message = ""
if request.method == "POST":
form = triggerFormFactory(request.POST, user=request.user)
......@@ -114,7 +137,7 @@ def create(request):
return render_to_response('profile/createNotification.html',
{ "form" : form,
"creating":"Notification",
"explanation": explanation,
"explanation": expl,
},
context_instance=RequestContext(request))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment