1 {% extends "base.html" %}
4 {% if user.is_authenticated %}
5 <script type="text/javascript" src="{% url load-js 'poller' %}"></script>
7 <script type="text/javascript" src="/static/js/jquery.dataTables.js"></script>
8 <link rel="stylesheet" type="text/css" href="/static/css/engage.itoggle.css"/>
9 <script type="text/javascript" src="/static/js/engage.itoggle-min.js"></script>
10 <script type="text/javascript">
11 $(document).ready(function(){
12 $("#hid_mid").val('');
20 route = $('#route_to_delete').text();
21 route_url_id = '#del_route_' + route;
22 url = $(route_url_id).attr('href');
26 success: function(data){
27 $('#dialog').dialog('close');
28 window.setTimeout('location.reload()', 1000);
33 $('#dialog').dialog('close');
39 update_val = $("#hid_mid").val();
40 if (update_val == 'UPDATED') {
41 $("#hid_mid").val('');
42 window.setTimeout('location.reload()', 500);
46 $('#console').dialog({
52 update_val = $("#hid_mid").val();
53 if (update_val == 'UPDATED') {
54 $("#hid_mid").val('');
55 window.setTimeout('location.reload()', 500);
60 var oTable = $('#routes_table').dataTable({
92 "aaSorting": [[0, 'desc']],
94 "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> rules'
101 $('input[name="status_filter"]').click(function(){
103 //slice off the last '|' or it doesn't work
104 //also be sure to use the third parameter
107 $(".button_place #routebutton").button({
109 primary: "ui-icon-circle-plus"
112 $(".edit_button").button({
114 primary: "ui-icon-wrench"
116 }).css('width','100px');;
117 $(" .del_button").button({
119 primary: "ui-icon-circle-close"
122 $('#dialog').dialog('open');
124 }).css('width','100px');
125 $("#consolebutton").button({
127 primary: "ui-icon-image"
130 $("#consolebutton").stop().stop();
131 $("#consolebutton").css('color', '#555555');
132 $('#console').dialog('open');
136 $(".expiresclass").tooltip();
137 $(".commentclass").tooltip();
139 var checkboxs = document.getElementsByName('status_filter');
140 for (var i = 0, inp; inp = checkboxs[i]; i++) {
141 checkCookie = readCookie("cookie_" + inp.value);
143 if (checkCookie == 'true') {
144 $(inp).attr('checked', true);
147 $(inp).attr('checked', false);
151 if (inp.type.toLowerCase() == 'checkbox' && inp.checked == true) {
152 reg_exp = reg_exp + inp.value + '|';
159 oTable.fnFilter(reg_exp.slice(0, -1), 4, true);
161 $('input[name="status_filter"]').iToggle({
165 var checkboxs = document.getElementsByName('status_filter');
167 for (var i = 0, inp; inp = checkboxs[i]; i++) {
168 if (inp.type.toLowerCase() == 'checkbox' && inp.checked) {
169 reg_exp = reg_exp + inp.value + '|';
171 createCookie("cookie_" + inp.value, inp.checked, 30);
173 //passing an empty string will result in no filter
174 //thus, it must be set to something that will not exist in the column
178 oTable.fnFilter(reg_exp.slice(0, -1), 4, true);
183 function delete_route(route){
185 $('#route_to_delete').text(route_name);
192 <style type="text/css">
194 background: none repeat scroll 0 0 #36102a !important;
195 color: #edeae8 !important;
196 font-family: monospace !important;
199 font-family: monospace !important;
203 background:transparent url(/static/black_arrow.png);
213 {% block title %}{% trans "My rules" %}{% endblock %}
215 <div style="float:left">
216 <h3 style="margin-top: 0px;">{% trans "My rules" %}</h3>
218 <div class='button_place' style="float:right">
219 <button id="consolebutton">Console</button> <a href="{% url add-route %}" id="routebutton">Add Rule</a>
224 <table cellpadding="0" cellspacing="0" border="0" class="display" style='width:200px;'>
227 <th>ACTIVE</th><th>SUSPENDED</th><th>EXPIRED</th><th>ADMINDISABLED</th><th>ERROR</th><th>PENDING</th>
231 <input type="checkbox" class="onoff" name="status_filter" value="ACTIVE" checked id="show_active"/>
235 <input type="checkbox" class="onoff" name="status_filter" value="SUSPENDED" id="show_inactive"/>
239 <input type="checkbox" class="onoff" name="status_filter" value="EXPIRED" id="show_expired"/>
243 <input type="checkbox" class="onoff" name="status_filter" value="ADMINDISABLED" id="show_admininactive"/>
247 <input type="checkbox" class="onoff" name="status_filter" value="ERROR" id="show_error"/>
251 <input type="checkbox" class="onoff" name="status_filter" value="PENDING" id="show_pending"/>
257 <table class="display" width="100%" id="nodes_table">
258 <table class="display" width="100%" id="routes_table">
262 <th>{% trans "Name" %}</th>
263 <th>{% trans "Match" %}</th>
264 <th style="text-align: center;">{% trans "Then" %}</th>
265 <th style="text-align: center; ">{% trans "Status" %}</th>
266 {% comment %}<th style="text-align: center;">{% trans "Details" %}</th>{% endcomment %}
267 <th style="text-align: center;">{% trans "Applier" %}</th>
268 <th style="text-align: center;">{% trans "Expires" %}</th>
269 <th style="text-align: center;">{% trans "Response" %}</th>
270 <th style="text-align: center; width:180px;">{% trans "Actions" %}</th>
275 {% for route in routes %}
278 <td>{{ route.pk }}</td>
279 <td><span {% if route.comments %}
281 style="border-bottom:1px dotted red;"
282 title="{{route.comments}}"
283 {% endif %}>{{ route.name }}</span></td>
284 <td>{{ route.get_match|safe|escape }}</td>
285 <td style="text-align: center;">{{route.get_then|safe|escape}}</td>
286 <td style="text-align: center; ">{% ifequal route.status 'INACTIVE' %}SUSPENDED{% else %}{% ifequal route.status 'ADMININACTIVE' %}ADMINDISABLED{% else %}{{route.status}}{% endifequal %}{% endifequal %}</td>
287 {% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %}
288 <td style="text-align: center;">{{ route.applier }}</td>
289 <td style="text-align: center;"><span {% if route.days_to_expire %}
291 style="border-bottom:2px dashed red;"
292 title="Expires {% ifequal route.days_to_expire '0' %}today{% else%}in {{route.days_to_expire}} day{{ route.days_to_expire|pluralize }}{% endifequal %}"
293 {% endif %}>{{ route.expires }}</span></td>
294 <td style="text-align: center;">{{ route.response }}</td>
295 <td style="text-align: center; width:180px;">
296 {% ifequal route.status 'ACTIVE' %}
297 <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Edit</a>
298 <button class="del_button" id="{{route.name}}" onclick="javascript:delete_route(this.id)">Suspend</button>
299 <a href="{% url delete-route route.name %}" style="display:none" id="del_route_{{route.name}}"></a>
301 {% ifequal route.status 'INACTIVE' %}
302 <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Reactivate</a>
304 {% ifequal route.status 'OUTOFSYNC' %}
305 <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">ReSync</a>
318 <div id="dialog" title="Delete Route">
319 <p>You are about to delete rule <strong><span id="route_to_delete"></span></strong></p>
320 <p>Deleting the rule will automatically remove the configuration from the network and mark this route as inactive.</p>
321 <p>Are you sure you want to proceed?</p>
323 <div id="console" title="Console">
324 {% include "poll.html" %}