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