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('');
19 'Suspend': function(){
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({
51 overlay: { opacity: 0.5, background: 'black'},
53 update_val = $("#hid_mid").val();
54 if (update_val == 'UPDATED') {
55 $("#hid_mid").val('');
56 window.setTimeout('location.reload()', 500);
60 $('#console').parent().css('opacity', 0.9);
61 $('#console').parent().css('filter', 'alpha(opacity=90)');
62 var oTable = $('#routes_table').dataTable({
94 "aaSorting": [[0, 'desc']],
96 "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> rules'
103 $('input[name="status_filter"]').click(function(){
105 //slice off the last '|' or it doesn't work
106 //also be sure to use the third parameter
109 $(".button_place #routebutton").button({
111 primary: "ui-icon-circle-plus"
114 $(".edit_button").button({
116 primary: "ui-icon-wrench"
118 }).css('width','100px');;
119 $(" .del_button").button({
121 primary: "ui-icon-circle-close"
124 $('#dialog').dialog('open');
126 }).css('width','100px');
127 $("#consolebutton").button({
129 primary: "ui-icon-image"
132 $("#consolebutton").stop().stop();
133 $("#consolebutton").css('color', '#555555');
134 $('#console').dialog('open');
138 $(".statustootipclass").tooltip();
139 $(".expiresclass").tooltip();
140 $(".commentclass").tooltip();
142 var checkboxs = document.getElementsByName('status_filter');
143 for (var i = 0, inp; inp = checkboxs[i]; i++) {
144 checkCookie = readCookie("cookie_" + inp.value);
146 if (checkCookie == 'true') {
147 $(inp).attr('checked', true);
150 $(inp).attr('checked', false);
154 if (inp.type.toLowerCase() == 'checkbox' && inp.checked == true) {
155 reg_exp = reg_exp + inp.value + '|';
162 oTable.fnFilter(reg_exp.slice(0, -1), 4, true);
164 $('input[name="status_filter"]').iToggle({
168 var checkboxs = document.getElementsByName('status_filter');
170 for (var i = 0, inp; inp = checkboxs[i]; i++) {
171 if (inp.type.toLowerCase() == 'checkbox' && inp.checked) {
172 reg_exp = reg_exp + inp.value + '|';
174 createCookie("cookie_" + inp.value, inp.checked, 30);
176 //passing an empty string will result in no filter
177 //thus, it must be set to something that will not exist in the column
181 oTable.fnFilter(reg_exp.slice(0, -1), 4, true);
186 function delete_route(route){
188 $('#route_to_delete').text(route_name);
195 <style type="text/css">
197 background: none repeat scroll 0 0 #36102a !important;
198 color: #edeae8 !important;
199 font-family: monospace !important;
202 font-family: monospace !important;
206 background:transparent url(/static/black_arrow.png);
216 {% block title %}{% trans "My rules" %}{% endblock %}
218 <div style="float:left">
219 <h3 style="margin-top: 0px;">{% trans "My rules" %}</h3>
221 <div class='button_place' style="float:right">
222 <button id="consolebutton">Console</button> <a href="{% url add-route %}" id="routebutton">Add Rule</a>
227 <table cellpadding="0" cellspacing="0" border="0" class="display" style='width:200px;'>
230 <th>ACTIVE</th><th>SUSPENDED</th><th>ERROR</th><th>PENDING</th>
234 <input type="checkbox" class="onoff" name="status_filter" value="ACTIVE" checked id="show_active"/>
238 <input type="checkbox" class="onoff" name="status_filter" value="SUSPENDED" id="show_inactive"/>
241 <input type="checkbox" class="onoff" name="status_filter" value="ERROR" id="show_error"/>
245 <input type="checkbox" class="onoff" name="status_filter" value="PENDING" id="show_pending"/>
251 <table class="display" width="100%" id="nodes_table">
252 <table class="display" width="100%" id="routes_table">
256 <th>{% trans "Name" %}</th>
257 <th>{% trans "Match" %}</th>
258 <th style="text-align: center;">{% trans "Then" %}</th>
259 <th style="text-align: center; ">{% trans "Status" %}</th>
260 {% comment %}<th style="text-align: center;">{% trans "Details" %}</th>{% endcomment %}
261 <th style="text-align: center;">{% trans "Applier" %}</th>
262 <th style="text-align: center;">{% trans "Expires" %}</th>
263 <th style="text-align: center;">{% trans "Response" %}</th>
264 <th style="text-align: center; width:180px;">{% trans "Actions" %}</th>
269 {% for route in routes %}
272 <td>{{ route.pk }}</td>
273 <td><span {% if route.comments %}
275 style="border-bottom:1px dotted red;"
276 title="{{route.comments}}"
277 {% endif %}>{{ route.name }}</span></td>
278 <td>{{ route.get_match|safe|escape }}</td>
279 <td style="text-align: center;">{{route.get_then|safe|escape}}</td>
280 <td style="text-align: center; "><span
281 {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' or route.status == 'OUTOFSYNC'%}
282 class="statustootipclass"
283 style="border-bottom:1px dotted red;"
284 title = "{% ifequal route.status 'INACTIVE' %}Suspended by user{% else %}{% ifequal route.status 'ADMININACTIVE' %}Suspended by administrator{% else %}{% ifequal route.status 'EXPIRED' %}Suspended due to expiration{% else %}{% ifequal route.status 'OUTOFSYNC' %}Syncronization error. Configuration in device deffers from rule{% endifequal %}{% endifequal %}{% endifequal %}{% endifequal %}"{% endif %}>{% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' %}SUSPENDED{% else %}{% if route.status == 'OUTOFSYNC' %}ERROR{% else %}{{route.status}}{% endif %}{% endif %}</span></td>
285 {% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %}
286 <td style="text-align: center;">{{ route.applier }}</td>
287 <td style="text-align: center;"><span {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' or route.status == 'OUTOFSYNC'%}{% else %}{% if route.days_to_expire %}
289 style="border-bottom:2px dashed red;"
290 title="Expires {% ifequal route.days_to_expire '0' %}today{% else%}in {{route.days_to_expire}} day{{ route.days_to_expire|pluralize }}{% endifequal %}"
291 {% endif %}{% endif %}>{{ route.expires }}</span></td>
292 <td style="text-align: center;">{% if route.status == 'EXPIRED' %}Rule expired{% else %}{% if route.status == 'ADMININACTIVE' %}Suspended by administrator{% else %}{% if route.status == 'INACTIVE' %}Suspended by user{% else %}{{ route.response }}{% endif %}{% endif %}{% endif %}</td>
293 <td style="text-align: center; width:180px;">
294 {% ifequal route.status 'ACTIVE' %}
295 <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Edit</a>
296 <button class="del_button" id="{{route.name}}" onclick="javascript:delete_route(this.id)">Suspend</button>
297 <a href="{% url delete-route route.name %}" style="display:none" id="del_route_{{route.name}}"></a>
299 {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' %}
300 <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Reactivate</a>
302 {% ifequal route.status 'OUTOFSYNC' %}
303 <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">ReSync</a>
316 <div id="dialog" title="Suspend Rule">
317 <p>You are about to suspend rule <strong><span id="route_to_delete"></span></strong></p>
318 <p>Suspending the rule will automatically remove the configuration from the network and mark this rule as inactive.</p>
319 <p>Are you sure you want to proceed?</p>
321 <div id="console" title="Console">
322 {% include "poll.html" %}