Commit 8b639567 by Bence Dányi

firewall_gui: vlangroup details page added

parent bc7234e7
......@@ -107,6 +107,7 @@ urlpatterns = patterns('',
url(r'^firewall/rules/(?P<id>\d+)/$', 'firewall_gui.views.show_rule'),
url(r'^firewall/hosts/(?P<id>\d+)/$', 'firewall_gui.views.show_host'),
url(r'^firewall/vlans/(?P<id>\d+)/$', 'firewall_gui.views.show_vlan'),
url(r'^firewall/vlangroups/(?P<id>\d+)/$', 'firewall_gui.views.show_vlangroup'),
url(r'^firewall/autocomplete/vlan/$', 'firewall_gui.views.autocomplete_vlan'),
url(r'^firewall/autocomplete/vlangroup/$', 'firewall_gui.views.autocomplete_vlangroup'),
......
......@@ -34,7 +34,7 @@ $.ajaxSetup({
* @type {Array}
*/
var listControllers = ['rule', 'host', 'vlan', 'vlangroup', 'hostgroup', 'firewall', 'domain', 'record', 'blacklist'];
var entityControllers = ['rule', 'host', 'vlan'];
var entityControllers = ['rule', 'host', 'vlan', 'vlangroup'];
var module = angular.module('firewall', []).config(
['$routeProvider', function($routeProvider) {
for (var i in listControllers) {
......@@ -153,7 +153,7 @@ function EntityController(url) {
return true;
}
});
['vlan', 'host', 'firewall'].forEach(function(t) {
['vlan', 'vlangroup', 'host', 'firewall'].forEach(function(t) {
$('#' + t).typeahead({
source: function(query, process) {
$.ajax({
......
......@@ -15,6 +15,14 @@
body {
padding-top: 60px;
}
.label {
margin: 3px;
padding: 5px;
}
.label a {
color: black;
font-weight: normal;
}
</style>
<link href="{% static "css/bootstrap-responsive.min.css" %}" rel="stylesheet">
......
......@@ -323,6 +323,36 @@ def show_vlan(request, id):
}
return HttpResponse(json.dumps(vlan), content_type='application/json')
def show_vlangroup(request, id):
group = get_object_or_404(VlanGroup, id=id)
group = {
'id': group.id,
'name': group.name,
'vlans': [{
'id': vlan.id,
'name': vlan.name
} for vlan in group.vlans.all()],
'description': group.description,
'owner': {
'id': group.owner.id,
'name': str(group.owner)
},
'created_at': group.created_at.isoformat(),
'modified_at': group.modified_at.isoformat(),
'rules': [{
'id': rule.id,
'direction': rule.get_direction_display(),
'proto': rule.proto,
'owner': {
'id': rule.owner.id,
'name': str(rule.owner),
},
'accept': rule.accept,
'nat': rule.nat
} for rule in group.rules.all()]
}
return HttpResponse(json.dumps(group), content_type='application/json')
def autocomplete_vlan(request):
return HttpResponse(json.dumps([{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment