root / templates / user_routes.html @ 6a946adf
History | View | Annotate | Download (4.8 kB)
1 |
{% extends "base.html" %} |
---|---|
2 |
{% load i18n %} |
3 |
{% block extrahead %} |
4 |
<script type="text/javascript" src="/static/js/jquery.dataTables.js"></script> |
5 |
<script type="text/javascript"> |
6 |
$(document).ready( function(){
|
7 |
$('#dialog').dialog({
|
8 |
height: 220,
|
9 |
width: 300,
|
10 |
modal: true,
|
11 |
autoOpen: false,
|
12 |
buttons: {
|
13 |
'Delete': function() {
|
14 |
route = $('#route_to_delete').text();
|
15 |
route_url_id = '#del_route_'+route;
|
16 |
url = $(route_url_id).attr('href');
|
17 |
$.ajax({
|
18 |
url: url ,
|
19 |
cache: false,
|
20 |
success: function(data) {
|
21 |
$('#dialog').dialog('close');
|
22 |
}
|
23 |
});
|
24 |
},
|
25 |
Cancel: function() {
|
26 |
$('#dialog').dialog('close');
|
27 |
}
|
28 |
}
|
29 |
});
|
30 |
$('#console').dialog({
|
31 |
height: 250,
|
32 |
width: 800,
|
33 |
modal: true,
|
34 |
autoOpen: false
|
35 |
});
|
36 |
$('#routes_table').dataTable( {
|
37 |
"bJQueryUI": true,
|
38 |
"oLanguage": {
|
39 |
"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> routes'
|
40 |
},
|
41 |
"iDisplayLength": 25,
|
42 |
} );
|
43 |
$( ".button_place #routebutton" ).button({
|
44 |
icons: {
|
45 |
primary: "ui-icon-circle-plus"
|
46 |
},
|
47 |
});
|
48 |
$( " .edit_button" ).button({
|
49 |
icons: {
|
50 |
primary: "ui-icon-wrench"
|
51 |
},
|
52 |
});
|
53 |
$( " .del_button" ).button({
|
54 |
icons: {
|
55 |
primary: "ui-icon-circle-close"
|
56 |
},
|
57 |
})
|
58 |
.click(function(){
|
59 |
$('#dialog').dialog('open');
|
60 |
return false;
|
61 |
});
|
62 |
$("#consolebutton").button({
|
63 |
icons: {
|
64 |
primary: "ui-icon-image"
|
65 |
},
|
66 |
})
|
67 |
.click(function(){
|
68 |
$("#consolebutton").stop().stop();
|
69 |
$("#consolebutton").css('color', '#555555');
|
70 |
$('#console').dialog('open');
|
71 |
return false;
|
72 |
});
|
73 |
});
|
74 |
|
75 |
function delete_route(route){
|
76 |
route_name = route;
|
77 |
$('#route_to_delete').text(route_name);
|
78 |
return false;
|
79 |
}
|
80 |
|
81 |
|
82 |
|
83 |
</script>
|
84 |
<style type="text/css"> |
85 |
#console { |
86 |
background: none repeat scroll 0 0 #36102a !important; |
87 |
color: #edeae8 !important; |
88 |
font-family: monospace !important; |
89 |
} |
90 |
.message { |
91 |
font-family: monospace !important; |
92 |
} |
93 |
|
94 |
</style>
|
95 |
{% endblock %} |
96 |
{% block title %}{% trans "My routes" %}{% endblock %} |
97 |
{% block content %} |
98 |
<div style="float:left"> |
99 |
<h3 style="margin-top: 0px;">{% trans "My routes" %}</h3> |
100 |
</div>
|
101 |
<div class='button_place' style="float:right"> |
102 |
<button id="consolebutton">Console</button> <a href="{% url add-route %}" id="routebutton">Add Route</a> |
103 |
</div>
|
104 |
<table class="display" width="100%" id="routes_table"> |
105 |
<thead>
|
106 |
<tr>
|
107 |
<th>{% trans "Name" %}</th> |
108 |
<th>{% trans "Match" %}</th> |
109 |
<th style="text-align: center;">{% trans "Then" %}</th> |
110 |
<th style="text-align: center;">{% trans "Status" %}</th> |
111 |
{% comment %}<th style="text-align: center;">{% trans "Details" %}</th>{% endcomment %} |
112 |
<th style="text-align: center;">{% trans "Applier" %}</th> |
113 |
<th style="text-align: center;">{% trans "Expires" %}</th> |
114 |
<th style="text-align: center;">{% trans "Response" %}</th> |
115 |
<th style="text-align: center; width:140px;">{% trans "Actions" %}</th> |
116 |
</tr>
|
117 |
</thead>
|
118 |
|
119 |
<tbody>
|
120 |
{% for route in routes %} |
121 |
|
122 |
<tr {% ifequal 'ACTIVE' %} class="GradeA" {% else %} class="GradeX" {% endifequal %}> |
123 |
<td>{{ route.name }}</td> |
124 |
<td>{{ route.get_match|safe|escape }}</td> |
125 |
<td style="text-align: center;">{{route.get_then|safe|escape}}</td> |
126 |
<td style="text-align: center;">{{route.status}}</td> |
127 |
{% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %} |
128 |
<td style="text-align: center;">{{ route.applier }}</td> |
129 |
<td style="text-align: center;">{{ route.expires }}</td> |
130 |
<td style="text-align: center;">{{ route.response }}</td> |
131 |
<td style="text-align: center;"> |
132 |
{% ifequal route.status 'ACTIVE' %} |
133 |
<a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Edit</a> |
134 |
<button class="del_button" id="{{route.name}}" onclick="javascript:delete_route(this.id)">Del</button> |
135 |
<a href="{% url delete-route route.name %}" style="display:none" id="del_route_{{route.name}}"></a> |
136 |
{% else %} |
137 |
{% ifequal route.status 'INACTIVE' %} |
138 |
<a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Reactivate</a> |
139 |
{% else %} |
140 |
{% ifequal route.status 'OUTOFSYNC' %} |
141 |
<a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">ReSync</a> |
142 |
{% else %} |
143 |
- |
144 |
{% endifequal %} |
145 |
{% endifequal %} |
146 |
{% endifequal %}</td>
|
147 |
</tr>
|
148 |
|
149 |
{% endfor %} |
150 |
</tbody>
|
151 |
</table>
|
152 |
|
153 |
<div id="dialog" title="Delete Route"> |
154 |
<p>You are about to delete route <strong><span id="route_to_delete"></span></strong></p> |
155 |
<p>Deleting the route will automatically remove the configuration from the network and mark this route as inactive.</p> |
156 |
<p>Are you sure you want to proceed?</p> |
157 |
</div>
|
158 |
<div id="console" title="Console"> |
159 |
{% include "poll.html" %} |
160 |
</div>
|
161 |
{% endblock %} |