Commit 20170089 by Bence Dányi

firewall_gui: list vlangroups

parent 77e20908
......@@ -97,4 +97,5 @@ urlpatterns = patterns('',
url(r'^firewall/rules/$', 'firewall_gui.views.list_rules'),
url(r'^firewall/hosts/$', 'firewall_gui.views.list_hosts'),
url(r'^firewall/vlans/$', 'firewall_gui.views.list_vlans'),
url(r'^firewall/vlangroups/$', 'firewall_gui.views.list_vlangroups'),
)
......@@ -9,6 +9,9 @@ var module = angular.module('firewall', []).config(
}).when('/vlans/', {
templateUrl: '/static/partials/vlan-list.html',
controller: ListController('/firewall/vlans/')
}).when('/vlangroups/', {
templateUrl: '/static/partials/vlangroup-list.html',
controller: ListController('/firewall/vlangroups/')
}).
otherwise({
redirectTo: '/rules/'
......
......@@ -94,3 +94,21 @@ def list_vlans(request):
} for vlan in Vlan.objects.all()]
return HttpResponse(json.dumps(vlans), content_type="application/json")
def list_vlangroups(request):
vlangroups = [{
"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(),
} for group in VlanGroup.objects.all()]
return HttpResponse(json.dumps(vlangroups), content_type="application/json")
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