/
filter.html
226 lines (212 loc) · 10.8 KB
/
filter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
{% extends "master.html" %}
{% block body %}
<div id="title-header" class="page-header">
<h1 class="read"> {{filter.name}}
<a href="#" data-parent="#title-header" class="btn btn-xs btn-edit btn-default">Edit</a></h1>
<h2 class="write hidden">
<form class="form-inline" role="form"
action="{{url_for('handle_filter')}}" method="post">
<input name="openid" id="openid" value="{{openid}}" type="hidden">
<input name="context" id="context" value="{{current}}" type="hidden">
<input name="filter_id" id="filter_id" value="{{filter.id}}" type="hidden">
<input name="filter_name" id="filter_name" value="{{filter.name}}">
<button type="submit" class="btn btn-xs btn-primary" name="method" value="post">
<span class="glyphicon glyphicon-ok-circle"></span>Save</button>
<a href="#" data-parent="#title-header" class="btn btn-xs btn-cancel btn-default">Cancel</a>
</form>
</h2>
<h3>sent to {{current}}</h3>
</div>
<div class="row-fluid">
<div class="col-md-6 col-md-offset-6">
<form class="form-inline" role="form"
action="{{url_for('handle_filter')}}" method="post">
<input name="openid" id="openid" value="{{openid}}" type="hidden">
<input name="context" id="context" value="{{current}}" type="hidden">
<input name="filter_name" id="filter_name" value="{{filter.name}}" type="hidden">
<input name="filter_id" id="filter_id" value="{{filter.id}}" type="hidden">
<div class="btn-group pull-right">
<span>
<a class="btn btn-info" href="{{url_for('context_json', openid=openid, context=current)}}"
data-toggle="tooltip" title="Export filter as JSON">
<span class="glyphicon glyphicon-floppy-save"></span>Export</a>
</span>
<span>
{% if filter.active %}
{% if filter.oneshot %}
<button type="submit" class="btn btn-primary" name="method"
value="disable-oneshot" data-toggle="tooltip" title="One-shot
filters fire only once and then automatically disable themselves.
You can use this feature to watch for a single build, or a single
comment somewhere. This is currently a one-shot filter.">
<span class="glyphicon glyphicon-star-empty"></span>Disable one-shot</button>
{% else %}
<button type="submit" class="btn btn-info" name="method"
value="enable-oneshot" data-toggle="tooltip" title="One-shot
filters fire only once and then automatically disable themselves.
You can use this feature to watch for a single build, or a single
comment somewhere. This is not currently a one-shot filter.">
<span class="glyphicon glyphicon-star"></span>Enable one-shot</button>
{% endif %}
<button type="submit" class="btn btn-warning" name="method"
value="disable" data-toggle="tooltip" title="This filter is active.
Use this button to temporarily it.">
<span class="glyphicon glyphicon-remove"></span>Disable</button>
{% else %}
<button type="submit" class="btn btn-success" name="method"
value="enable" data-toggle="tooltip" title="This filter is not
currently enabled. Use this button to re-enable it.">
<span class="glyphicon glyphicon-ok"></span>Enable</button>
{% endif %}
</span>
<span class="divider"></span>
<span>
<button type="submit" class="btn btn-danger" name="method"
value="delete" data-toggle="tooltip" title="WARNING - Clicking this
button will permanently delete this filter. Consider disabling it
instead."
onclick="return confirm('Are you sure you want to permanently delete this filter?');">
<span class="glyphicon glyphicon-remove"></span>Delete</button>
</span>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-md-7">
<p class="lead">Rules defined for this filter:</p>
<p>(all these rules must be satisfied for the notification to be sent)</p>
<div id="rules" class="list-group">
{% for rule in filter.rules %}
<span class="list-group-item">
<h4 class="list-group-item-heading">
{% if rule.negated %}
<span class="glyphicon glyphicon-exclamation-sign text-danger" data-toggle="tooltip"
title="(ignore) Messages matched by this rule count against a match by this filter">
</span>
{% else %}
<span class="glyphicon glyphicon-ok-circle text-success" data-toggle="tooltip"
title="(include) Messages matched by this rule contribute positively to a match by this filter">
</span>
{% endif %}
{{rule.title(valid_paths)}}
</h4>
<p class="list-group-item-text">{{rule.doc(valid_paths)}}
<dl class="dl-horizontal">
<form class="form-inline" role="form" action="{{url_for('handle_argument')}}" method="post">
<input name="rule_name" id="rule_name" value="{{rule.code_path}}" type="hidden">
<input name="openid" id="openid" value="{{openid}}" type="hidden">
<input name="context" id="context" value="{{current}}" type="hidden">
<input name="filter_id" id="filter_id" value="{{filter.id}}" type="hidden">
{% for key, value in rule.arguments.iteritems() %}
<dt>{{key}}</dt><dd id="{{key}}{{rule.id}}">
<span class="read">{{value}}
<a href="#" data-parent="#{{key}}{{rule.id}}" class="btn btn-xs btn-edit btn-default">Edit</a></h1>
</span>
<span class="write hidden">
<input name="key" id="key" value="{{key}}" type="hidden">
<input name="value" id="value" value="{{value}}">
<button type="submit" class="btn btn-xs btn-primary" name="method" value="post">
<span class="glyphicon glyphicon-ok-circle"></span>Save</button>
<a href="#" data-parent="#{{key}}{{rule.id}}" class="btn btn-xs btn-cancel btn-default">Cancel</a></h1>
</span>
</dd>
{% endfor %}
</form>
</dl>
</p>
<p class="list-group-item-text">
<div class="row">
<div class="col-md-offset-8 col-md-4">
<form class="form-inline" role="form" action="{{url_for('handle_rule')}}" method="post">
<input name="rule_name" id="rule_name" value="{{rule.code_path}}" type="hidden">
<input name="openid" id="openid" value="{{openid}}" type="hidden">
<input name="context" id="context" value="{{current}}" type="hidden">
<input name="filter_id" id="filter_id" value="{{filter.id}}" type="hidden">
{% if rule.negated %}
<button type="submit" class="btn btn-success btn-xs"
name="method" value="negate" data-toggle="tooltip"
title="This rule currently contributes negatively to the
filter. That is to say that, messages that match this rule
are immediately rejected and barred from further
consideration for delivery. Switching to 'include' mode
means to toggle that behavior such that messages that match
this rule will be further considered for delivery.">
<span class="glyphicon glyphicon-ok-circle"></span>
Include</button>
{% else %}
<button type="submit" class="btn btn-danger btn-xs"
name="method" value="negate" data-toggle="tooltip"
title="This rule currently contributes positively to the
filter: messages that match this rule are further considered
for delivery. To 'negate' the rule means to toggle that
behavior such that messages that match this rule will be excluded
from any further consideration.">
<span class="glyphicon glyphicon-exclamation-sign"></span>
Negate</button>
{% endif %}
<button type="submit" class="btn btn-danger btn-xs" name="method" value="delete"
onclick="return confirm('Are you sure you want to permanently delete this rule?');">
<span class="glyphicon glyphicon-remove"></span>
Delete</button>
</form>
</div>
</div>
</p>
</span>
{% endfor %}
</div>
<!-- A place to hold examples that match these rules.
We'll populate this with javascript to make the page load more quickly.
-->
<div id="examples-container">
<p class="lead"></p>
<ul class="list-group"></ul>
</div>
</div>
<div class="col-md-5">
<p class="lead">Possible rules:</p>
<p> You can add a new rule to this filter by selecting one from this
pre-defined list. Click on any rule to check it out.</p>
{% for kind in rule_types %}
<div class="panel-group" id="accordion-{{kind}}">
<h4>{{kind.capitalize()}} Rules</h4>
{% for root in valid_paths %}
{% for path in valid_paths[root] %}
{%- if valid_paths[root][path]['submodule'] != kind %} {% continue %} {% endif %}
<div class="panel panel-default">
<div class="panel-heading">
<h5 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion-{{kind}}" href="#collapse{{path}}">
{{ valid_paths[root][path]['title'] }}
</a>
</h5>
</div>
<div id="collapse{{path}}" class="panel-collapse collapse">
<div class="panel-body">
{{ valid_paths[root][path]['doc'] }}
<form class="form-inline" role="form" action="{{url_for('handle_rule')}}" method="post">
{% for arg in valid_paths[root][path]['args'] %}
{% if arg not in ['config', 'message'] %}
{{arg}}
<input name="{{arg}}" id="arg_{{arg}}" type="text" />
{% endif %}
{% endfor %}
<input name="rule_name" id="rule_name" value="{{root}}:{{path}}" type="hidden">
<input name="openid" id="openid" value="{{openid}}" type="hidden">
<input name="context" id="context" value="{{current}}" type="hidden">
<input name="filter_id" id="filter_id" value="{{filter.id}}" type="hidden">
<button type="submit" class="btn btn-success">
<span class="glyphicon glyphicon-plus"></span>
Add this rule</button>
</form>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
</div>
{% endfor %}
</div>
</div>
{% endblock %}