Statistics
| Branch: | Tag: | Revision:

root / templates / user_routes.html @ b27537d5

History | View | Annotate | Download (5.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
                $("#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
                        "aoColumns": [ 
58
                                {"bVisible": false, "bSearchable": false,"bSortable": false },
59
                                {"bSearchable": true,"bSortable": true},
60
                                {"bSearchable": true,"bSortable": true},
61
                                {"bSearchable": true,"bSortable": true},
62
                                {"bSearchable": true,"bSortable": true},
63
                                {"bSearchable": true,"bSortable": true},
64
                                {"bSearchable": true,"bSortable": true},
65
                                {"bSearchable": true,"bSortable": true},
66
                                {"bVisible": true, "bSearchable": false,"bSortable": false}
67
                        ],
68
                         "aaSorting": [[0,'desc']],
69
                        "oLanguage": {
70
                                "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> rules'
71
                        },
72
                        "iDisplayLength": 25,
73
        } );
74
        $( ".button_place #routebutton" ).button({
75
            icons: {
76
                primary: "ui-icon-circle-plus"
77
            },
78
                        });
79
                $( " .edit_button" ).button({
80
            icons: {
81
                primary: "ui-icon-wrench"
82
            },
83
                        });
84
                $( " .del_button" ).button({
85
            icons: {
86
                primary: "ui-icon-circle-close"
87
            },
88
                        })
89
                        .click(function(){
90
                                $('#dialog').dialog('open');
91
                                return false;
92
                        });
93
                $("#consolebutton").button({
94
            icons: {
95
                primary: "ui-icon-image"
96
            },
97
                        })
98
                        .click(function(){
99
                                $("#consolebutton").stop().stop();
100
                                $("#consolebutton").css('color', '#555555');
101
                                $('#console').dialog('open');
102
                                return false;
103
                        });
104

105
                });
106
                
107
function delete_route(route){
108
        route_name = route;
109
        $('#route_to_delete').text(route_name);
110
        return false;
111
}                
112
                
113
                
114

    
115
</script>
116
<style type="text/css">
117
        #console {
118
                background: none repeat scroll 0 0 #36102a !important;
119
                color: #edeae8 !important;
120
                font-family: monospace !important;
121
        }
122
        .message {
123
                font-family: monospace !important;
124
        }
125
        
126
</style>
127
{% endblock %}
128
{% block title %}{% trans "My rules" %}{% endblock %}
129
{% block content %}
130
<div style="float:left">
131
        <h3 style="margin-top: 0px;">{% trans "My rules" %}</h3>
132
</div>
133
<div class='button_place' style="float:right">
134
        <button id="consolebutton">Console</button> <a href="{% url add-route %}" id="routebutton">Add Rule</a>
135
</div>
136
<table class="display" width="100%" id="routes_table">
137
<thead>
138
<tr>
139
        <th>Id</th>
140
        <th>{% trans "Name" %}</th>
141
        <th>{% trans "Match" %}</th>
142
        <th style="text-align: center;">{% trans "Then" %}</th>
143
        <th style="text-align: center;">{% trans "Status" %}</th>
144
        {% comment %}<th style="text-align: center;">{% trans "Details" %}</th>{% endcomment %}
145
        <th style="text-align: center;">{% trans "Applier" %}</th>
146
        <th style="text-align: center;">{% trans "Expires" %}</th>
147
        <th style="text-align: center;">{% trans "Response" %}</th>
148
        <th style="text-align: center; width:130px;">{% trans "Actions" %}</th>
149
</tr>
150
</thead>
151

    
152
<tbody>
153
{% for route in routes %}
154

    
155
<tr {% ifequal  'ACTIVE' %} class="GradeA" {% else %} class="GradeX" {% endifequal %}>
156
        <td>{{ route.pk }}</td>
157
        <td>{{ route.name }}</td>
158
        <td>{{ route.get_match|safe|escape }}</td>
159
        <td style="text-align: center;">{{route.get_then|safe|escape}}</td>
160
        <td style="text-align: center;">{{route.status}}</td>
161
        {% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %}
162
        <td style="text-align: center;">{{ route.applier }}</td>
163
        <td style="text-align: center;">{{ route.expires }}</td>
164
        <td style="text-align: center;">{{ route.response }}</td>
165
        <td style="text-align: center; width:140px;">
166
                {% ifequal route.status 'ACTIVE' %}
167
                <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Edit</a> 
168
                <button class="del_button" id="{{route.name}}" onclick="javascript:delete_route(this.id)">Del</button>
169
                <a href="{% url delete-route route.name %}" style="display:none" id="del_route_{{route.name}}"></a>
170
                {% else %}
171
                {% ifequal route.status 'INACTIVE' %}
172
                <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Reactivate</a>
173
                {% else %}
174
                {% ifequal route.status 'OUTOFSYNC' %}
175
                <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">ReSync</a>
176
                {% else %}
177
                -
178
                {% endifequal %}
179
                {% endifequal %}
180
                {% endifequal %}</td>
181
</tr>
182

    
183
{% endfor %}
184
</tbody>
185
</table>
186

    
187
<div id="dialog" title="Delete Route">
188
                <p>You are about to delete rule <strong><span id="route_to_delete"></span></strong></p>
189
                <p>Deleting the rule will automatically remove the configuration from the network and mark this route as inactive.</p>
190
                <p>Are you sure you want to proceed?</p>
191
</div>
192
<div id="console" title="Console">
193
                                        {% include "poll.html" %}
194
</div>
195
{% endblock %}