Commit 77e20908 by Bence Dányi

firewall_gui: list vlans

parent 4fdfdd8b
......@@ -96,4 +96,5 @@ urlpatterns = patterns('',
url(r'^firewall/$', 'firewall_gui.views.index'),
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'),
)
......@@ -6,6 +6,9 @@ var module = angular.module('firewall', []).config(
}).when('/hosts/', {
templateUrl: '/static/partials/host-list.html',
controller: ListController('/firewall/hosts/')
}).when('/vlans/', {
templateUrl: '/static/partials/vlan-list.html',
controller: ListController('/firewall/vlans/')
}).
otherwise({
redirectTo: '/rules/'
......
......@@ -77,3 +77,20 @@ def list_hosts(request):
} for group in host.groups.all()]
} for host in Host.objects.all()]
return HttpResponse(json.dumps(hosts), content_type="application/json")
def list_vlans(request):
vlans = [{
"id": vlan.id,
"vid": vlan.vid,
"name": vlan.name,
"ipv4": vlan.ipv4+"/"+str(vlan.prefix4),
"ipv6": vlan.ipv6+"/"+str(vlan.prefix6),
"nat": vlan.snat_ip,
"description": vlan.description,
"domain": {
"id": vlan.domain.id,
"name": vlan.domain.name,
}
} for vlan in Vlan.objects.all()]
return HttpResponse(json.dumps(vlans), 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