Skip to content
Snippets Groups Projects
Commit 48d8b751 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by Alexander Pace
Browse files

Updating web interface for creating contacts and notifications.

parent c416b9b2
No related branches found
No related tags found
No related merge requests found
......@@ -13,15 +13,4 @@
<input type="submit" value="Submit"/>
</form>
{% if creating == 'Notification' %}
<p> <b>NOTE:</b>
For the 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>.
</p>
{% endif %}
{% endblock %}
{% extends "base.html" %}
{% block title %}Options | Notifications{% endblock %}
{% block heading %}Notifications (LVC Users){% endblock %}
{% block heading %}<!-- leave heading blank -->{% endblock %}
{% block pageid %}userprofile{% endblock %}
{% block content %}
{% for trigger in triggers %}
<ul>
<li>
<!-- <a href="{% url "userprofile-edit" trigger.id %}">Edit</a> -->
<a href="{% url "userprofile-delete" trigger.id %}">Delete</a>
{{ trigger.userlessDisplay }}
</li>
</ul>
{% endfor %}
<a href="{% url "userprofile-create" %}">Create New Notification (LVC users)</a>
<br/><br/>
<h2>Contacts (LVC Users)</h2>
{% for contact in contacts %}
<ul>
......@@ -33,6 +20,20 @@
<a href="{% url "userprofile-create-contact" %}">Create New Contact</a>
<br/><br/>
<h2>Notifications (LVC Users)</h2>
{% for trigger in triggers %}
<ul>
<li>
<!-- <a href="{% url "userprofile-edit" trigger.id %}">Edit</a> -->
<a href="{% url "userprofile-delete" trigger.id %}">Delete</a>
{{ trigger.userlessDisplay }}
</li>
</ul>
{% endfor %}
<a href="{% url "userprofile-create" %}">Create New Notification (LVC users)</a>
<br/><br/>
<h2>Passwords for Scripted Access (LV-EM users)</h2>
<a href="{% url "userprofile-manage-password" %}">Manage Password</a>
......
......@@ -7,17 +7,21 @@ from gracedb.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 recieve all events, regardless of FAR.")
help_text="Leave blank to receive all events, regardless of FAR.")
class Meta:
model = Trigger
exclude = ['user', 'triggerType']
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>.'
}
contacts = forms.ModelMultipleChoiceField(
queryset=Contact.objects.filter(user=user),
required=False
)
required=False,
help_text="If blank, go back and create a Contact first.")
# XXX should probably override is_valid and check for
# truth of (atypes or labels)
# and set field error attributes appropriately.
......@@ -38,12 +42,16 @@ def triggerFormFactory(postdata=None, user=None):
else:
return TF()
# 11/29/2016 (TP): pretty sure this is deprecated in favor of
# triggerFormFactory; may remove at a later date.
class TriggerForm(forms.ModelForm):
class Meta:
model = Trigger
exclude = ['user', 'triggerType']
class ContactForm(forms.ModelForm):
desc = forms.CharField(label='Description')
class Meta:
model = Contact
fields = ['desc','email','phone']
......
......@@ -85,6 +85,6 @@ class Trigger(models.Model):
"|".join([a.name for a in self.pipelines.all()]) or "any pipeline",
label_disp,
thresh,
",".join([x.desc for x in self.contacts.all()])
", ".join([x.desc for x in self.contacts.all()])
)
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