Commit b0a5f07e by Bence Dányi

firewall_gui: list hostgroups

parent 20170089
......@@ -98,4 +98,5 @@ urlpatterns = patterns('',
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'),
url(r'^firewall/hostgroups/$', 'firewall_gui.views.list_hostgroups'),
)
......@@ -12,6 +12,9 @@ var module = angular.module('firewall', []).config(
}).when('/vlangroups/', {
templateUrl: '/static/partials/vlangroup-list.html',
controller: ListController('/firewall/vlangroups/')
}).when('/hostgroups/', {
templateUrl: '/static/partials/hostgroup-list.html',
controller: ListController('/firewall/hostgroups/')
}).
otherwise({
redirectTo: '/rules/'
......
......@@ -112,3 +112,17 @@ def list_vlangroups(request):
} for group in VlanGroup.objects.all()]
return HttpResponse(json.dumps(vlangroups), content_type="application/json")
def list_hostgroups(request):
groups = [{
"id": group.id,
"name": group.name,
"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 Group.objects.all()]
return HttpResponse(json.dumps(groups), 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