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