Revision 97e42c7d templates/apply.html
b/templates/apply.html | ||
---|---|---|
1 | 1 |
{% extends "base.html" %} |
2 | 2 |
{% load i18n %} |
3 |
|
|
3 |
|
|
4 | 4 |
{% block title %} |
5 | 5 |
{% if edit %} |
6 | 6 |
{% trans "Edit Route" %} {{form.data.name}} |
... | ... | |
16 | 16 |
{% trans "Create route" %} |
17 | 17 |
{% endif %} |
18 | 18 |
{% endblock %} |
19 |
|
|
19 |
{% block extrahead %} |
|
20 |
<script> |
|
21 |
$(document).ready( function(){ |
|
22 |
|
|
23 |
$("#id_sourceport").css('width', '100px').attr('size', '5'); |
|
24 |
$("#id_port").css('width', '100px').attr('size', '5'); |
|
25 |
$("#id_destinationport").css('width', '100px').attr('size', '5'); |
|
26 |
$('#id_then').attr("multiple", ""); |
|
27 |
$('#then_diag').dialog({ |
|
28 |
height: 220, |
|
29 |
width: 340, |
|
30 |
modal: true, |
|
31 |
autoOpen: false, |
|
32 |
buttons: { |
|
33 |
'Add': function() { |
|
34 |
console.log($("#add_rl_form").serialize()); |
|
35 |
$.ajax({ |
|
36 |
url:"{% url add-rate-limit %}", |
|
37 |
data:$("#add_rl_form").serialize(), |
|
38 |
type: "POST", |
|
39 |
cache: false, |
|
40 |
success:function(data){ |
|
41 |
try { |
|
42 |
value = data.pk; |
|
43 |
text = data.value; |
|
44 |
$('#id_then').append($("<option></option>").attr("value",value).text(text)); |
|
45 |
$('#then_diag').dialog('close'); |
|
46 |
} |
|
47 |
catch (exception) { |
|
48 |
$('#then_diag').html(data); |
|
49 |
} |
|
50 |
} |
|
51 |
}); |
|
52 |
}, |
|
53 |
Cancel: function() { |
|
54 |
$('#then_diag').dialog('close'); |
|
55 |
} |
|
56 |
} |
|
57 |
}); |
|
58 |
|
|
59 |
$('#port_diag').dialog({ |
|
60 |
height: 220, |
|
61 |
width: 340, |
|
62 |
modal: true, |
|
63 |
autoOpen: false, |
|
64 |
buttons: { |
|
65 |
'Add': function() { |
|
66 |
console.log($("#add_port_form").serialize()); |
|
67 |
$.ajax({ |
|
68 |
url:"{% url add-port %}", |
|
69 |
data:$("#add_port_form").serialize(), |
|
70 |
type: "POST", |
|
71 |
cache: false, |
|
72 |
success:function(data){ |
|
73 |
try { |
|
74 |
value = data.value; |
|
75 |
text = data.text; |
|
76 |
$('#id_port').append($("<option></option>").attr("value",value).text(text)); |
|
77 |
$('#id_destinationport').append($("<option></option>").attr("value",value).text(text)); |
|
78 |
$('#id_sourceport').append($("<option></option>").attr("value",value).text(text)); |
|
79 |
$('#port_diag').dialog('close'); |
|
80 |
} |
|
81 |
catch (exception) { |
|
82 |
$('#port_diag').html(data); |
|
83 |
} |
|
84 |
} |
|
85 |
}); |
|
86 |
}, |
|
87 |
Cancel: function() { |
|
88 |
$('#port_diag').dialog('close'); |
|
89 |
} |
|
90 |
} |
|
91 |
}); |
|
92 |
|
|
93 |
|
|
94 |
$("#new_then_actions").button({ |
|
95 |
icons: { |
|
96 |
primary: "ui-icon-plusthick" |
|
97 |
}, |
|
98 |
}) |
|
99 |
.click(function(){ |
|
100 |
$.ajax({ |
|
101 |
url: "{% url add-rate-limit %}", |
|
102 |
cache: false, |
|
103 |
success: function(data){ |
|
104 |
$("#then_diag").html(data); |
|
105 |
} |
|
106 |
}); |
|
107 |
$('#then_diag').dialog('open'); |
|
108 |
return false; |
|
109 |
}); |
|
110 |
|
|
111 |
|
|
112 |
$(".new_port").button({ |
|
113 |
icons: { |
|
114 |
primary: "ui-icon-plusthick" |
|
115 |
}, |
|
116 |
}) |
|
117 |
.click(function(){ |
|
118 |
$.ajax({ |
|
119 |
url: "{% url add-port %}", |
|
120 |
cache: false, |
|
121 |
success: function(data){ |
|
122 |
$("#port_diag").html(data); |
|
123 |
} |
|
124 |
}); |
|
125 |
$('#port_diag').dialog('open'); |
|
126 |
return false; |
|
127 |
}); |
|
128 |
}); |
|
129 |
|
|
130 |
</script> |
|
131 |
{% endblock %} |
|
20 | 132 |
{% block content %} |
21 | 133 |
<style type="text/css"> |
22 | 134 |
th { |
... | ... | |
30 | 142 |
|
31 | 143 |
} |
32 | 144 |
</style> |
33 |
|
|
34 | 145 |
<div align="center"> |
35 | 146 |
{% if edit %} |
36 | 147 |
<h3>{% trans "Edit route" %}: {{form.data.name}}</h3> |
... | ... | |
47 | 158 |
<legend>{% trans "Route Basic Info" %}</legend> |
48 | 159 |
<table> |
49 | 160 |
<tr><th>{{ form.name.label_tag }}</th><td>{{ form.name }}<span class="error">{{ form.name.errors|join:", " }}</span></td></tr> |
50 |
<tr class="help"><td></td><td>{{ form.name.help_text }}</td></tr>
|
|
161 |
<tr class="help"><td></td><td>A unique identifier will be added as a name_suffix</td></tr>
|
|
51 | 162 |
</table> |
52 | 163 |
</fieldset> |
53 | 164 |
|
54 | 165 |
<fieldset> |
55 | 166 |
<legend>{% trans "Route Match Conditions" %}</legend> |
56 | 167 |
<table> |
168 |
<input type="hidden" id="id_applier" name="applier" value="{{applier}}"/> |
|
57 | 169 |
<tr><th>{{ form.source.label_tag }}</th><td>{{ form.source }}<span class="error">{{ form.source.errors|join:", " }}</span></td></tr> |
58 | 170 |
<tr class="help"><td></td><td>{{ form.source.help_text }}</td></tr> |
59 |
<tr><th>{{ form.sourceport.label_tag }}</th><td>{{ form.sourceport }}<span class="error">{{ form.sourceport.errors|join:", " }}</span></td></tr> |
|
171 |
<tr><th>{{ form.sourceport.label_tag }}</th><td>{{ form.sourceport }} <button class="new_port">Port</button><span class="error">{{ form.sourceport.errors|join:", " }}</span></td></tr>
|
|
60 | 172 |
<tr class="help"><td></td><td>{{ form.sourceport.help_text }}</td></tr> |
61 | 173 |
<tr><th>{{ form.destination.label_tag }}</th><td>{{ form.destination }}<span class="error">{{ form.destination.errors|join:", " }}</span></td></tr> |
62 | 174 |
<tr class="help"><td></td><td>{{ form.destination.help_text }}</td></tr> |
63 |
<tr><th>{{ form.destinationport.label_tag }}</th><td>{{ form.destinationport }}<span class="error">{{ form.destinationport.errors|join:", " }}</span></td></tr> |
|
175 |
<tr><th>{{ form.destinationport.label_tag }}</th><td>{{ form.destinationport }} <button class="new_port">Port</button><span class="error">{{ form.destinationport.errors|join:", " }}</span></td></tr>
|
|
64 | 176 |
<tr class="help"><td></td><td>{{ form.destinationport.help_text }}</td></tr> |
65 |
<tr><th>{{ form.port.label_tag }}</th><td>{{ form.port }}<span class="error">{{ form.port.errors|join:", " }}</span></td></tr> |
|
177 |
<tr><th>{{ form.port.label_tag }}</th><td>{{ form.port }} <button class="new_port">Port</button><span class="error">{{ form.port.errors|join:", " }}</span></td></tr>
|
|
66 | 178 |
<tr class="help"><td></td><td>{{ form.port.help_text }}</td></tr> |
67 | 179 |
</table> |
68 | 180 |
</fieldset> |
69 | 181 |
<fieldset> |
70 | 182 |
<legend>{% trans "Route Actions" %}</legend> |
71 | 183 |
<table> |
72 |
<tr><th>{{ form.then.label_tag }}</th><td>{{ form.then }}<span class="error">{{ form.then.errors|join:", " }}</span></td></tr> |
|
73 |
<tr class="help"><td></td><td>{{ form.then.help_text }}</td></tr> |
|
184 |
<tr><th>{{ form.then.label_tag }}</th><td>{{ form.then }} <button id="new_then_actions">Rate-limit</button><span class="error">{{ form.then.errors|join:", " }}</span></td></tr> |
|
74 | 185 |
</table> |
75 | 186 |
</fieldset> |
76 | 187 |
<fieldset> |
... | ... | |
87 | 198 |
</form> |
88 | 199 |
</div> |
89 | 200 |
|
201 |
<div id="then_diag" title="Add new rate-limit value"> |
|
202 |
</div> |
|
203 |
|
|
204 |
<div id="port_diag" title="Add new port"> |
|
205 |
</div> |
|
206 |
|
|
90 | 207 |
{% endblock %} |
Also available in: Unified diff