Statistics
| Branch: | Tag: | Revision:

root / templates / user_routes.html @ 6ee21ffd

History | View | Annotate | Download (4.5 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
                console.log(route_url_id);
17
                url = $(route_url_id).attr('href');
18
                console.log(route, url);
19
                        $.ajax({
20
                        url: url ,
21
                        cache: false,
22
                        success: function(data) {
23
                                $('#dialog').dialog('close');
24
                          }
25
                });
26
//                                $('#dialog').dialog('close');
27
                },
28
                Cancel: function() {
29
                        $('#dialog').dialog('close');
30
                }
31
        }
32
                });
33
                $('#console').dialog({
34
                        height: 250,
35
            width: 500,
36
                        modal: true,
37
                        autoOpen: false
38
                        });
39
                        $('#routes_table').dataTable( {
40
                        "bJQueryUI": true,
41
                        "oLanguage": {
42
                                "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> routes'
43
                        },
44
                        "iDisplayLength": 25,
45
        } );
46
        $( ".button_place #routebutton" ).button({
47
            icons: {
48
                primary: "ui-icon-circle-plus"
49
            },
50
                        });
51
                $( " .edit_button" ).button({
52
            icons: {
53
                primary: "ui-icon-wrench"
54
            },
55
                        });
56
                $( " .del_button" ).button({
57
            icons: {
58
                primary: "ui-icon-circle-close"
59
            },
60
                        })
61
                        .click(function(){
62
                                $('#dialog').dialog('open');
63
                                return false;
64
                        });
65
                $("#consolebutton").button({
66
            icons: {
67
                primary: "ui-icon-image"
68
            },
69
                        })
70
                        .click(function(){
71
                                $("#consolebutton").stop().stop();
72
                                $("#consolebutton").css('color', '#555555');
73
                                $('#console').dialog('open');
74
                                return false;
75
                        });
76
                });
77
                
78
function delete_route(route){
79
        route_name = route;
80
        $('#route_to_delete').text(route_name);
81
        return false;
82
}                
83
                
84
                
85

    
86
</script>
87
<style type="text/css">
88
        #console {
89
                background: none repeat scroll 0 0 #36102a !important;
90
                color: #edeae8 !important;
91
                font-family: monospace !important;
92
        }
93
        .message {
94
                font-family: monospace !important;
95
        }
96
        
97
</style>
98
{% endblock %}
99
{% block title %}{% trans "My routes" %}{% endblock %}
100
{% block content %}
101
<div style="float:left">
102
        <h3 style="margin-top: 0px;">{% trans "My routes" %}</h3>
103
</div>
104
<div class='button_place' style="float:right">
105
        <button id="consolebutton">Console</button> <a href="{% url add-route %}" id="routebutton">Add Route</a>
106
</div>
107
<table class="display" width="100%" id="routes_table">
108
<thead>
109
<tr>
110
        <th>{% trans "Name" %}</th>
111
        <th>{% trans "Match" %}</th>
112
        <th style="text-align: center;">{% trans "Then" %}</th>
113
        <th style="text-align: center;">{% trans "Status" %}</th>
114
        {% comment %}<th style="text-align: center;">{% trans "Details" %}</th>{% endcomment %}
115
        <th style="text-align: center;">{% trans "Applier" %}</th>
116
        <th style="text-align: center;">{% trans "Expires" %}</th>
117
        <th style="text-align: center;">{% trans "Response" %}</th>
118
        <th style="text-align: center; width:120px;">{% trans "Actions" %}</th>
119
</tr>
120
</thead>
121

    
122
<tbody>
123
{% for route in routes %}
124

    
125
<tr {% if  %} class="GradeA" {% else %} class="GradeX" {% endif %}>
126
        <td>{{ route.name }}</td>
127
        <td>{{ route.get_match|safe|escape }}</td>
128
        <td style="text-align: center;">{{route.get_then|safe|escape}}</td>
129
        <td style="text-align: center;">{% if route.is_online %}Online{% else %}Offline{% endif %}</td>
130
        {% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %}
131
        <td style="text-align: center;">{{ route.applier }}</td>
132
        <td style="text-align: center;">{{ route.expires }}</td>
133
        <td style="text-align: center;">{{ route.response }}</td>
134
        <td style="text-align: center;">
135
                {% if route.is_active %}
136
                <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Edit</a> 
137
                <button class="del_button" id="{{route.name}}" onclick="javascript:delete_route(this.id)">Del</button>
138
                <a href="{% url delete-route route.name %}" style="display:none" id="del_route_{{route.name}}"></a>
139
                {% else %}
140
                -
141
                {% endif %}</td>
142
</tr>
143

    
144
{% endfor %}
145
</tbody>
146
</table>
147

    
148
<div id="dialog" title="Delete Route">
149
                <p>You are about to delete route <strong><span id="route_to_delete"></span></strong></p>
150
                <p>Deleting the route will automatically remove the configuration from the network and mark this route as inactive.</p>
151
                <p>Are you sure you want to proceed?</p>
152
</div>
153
<div id="console" title="Console">
154
                                        {% include "poll.html" %}
155
</div>
156
{% endblock %}