Commit 704e21f5 by Bence Dányi

firewall_gui: list domains

parent 54651ea8
......@@ -100,4 +100,5 @@ urlpatterns = patterns('',
url(r'^firewall/vlangroups/$', 'firewall_gui.views.list_vlangroups'),
url(r'^firewall/hostgroups/$', 'firewall_gui.views.list_hostgroups'),
url(r'^firewall/firewalls/$', 'firewall_gui.views.list_firewalls'),
url(r'^firewall/domains/$', 'firewall_gui.views.list_domains'),
)
......@@ -5,7 +5,7 @@
* and the `/static/partials/rule-list.html` template will be used.
* @type {Array}
*/
var listControllers = ['rule', 'host', 'vlan', 'vlangroup', 'hostgroup', 'firewall'];
var listControllers = ['rule', 'host', 'vlan', 'vlangroup', 'hostgroup', 'firewall', 'domain'];
var module = angular.module('firewall', []).config(
['$routeProvider', function($routeProvider) {
......
<div class="navbar">
<div class="navbar-inner">
<div class="pagination pull-left">
<ul>
<li ng-click="prevPage()" ng-class="{disabled: page == 1}"><a href>Előző</a></li>
<li ng-repeat="_page in pages" ng-click="setPage(_page)" ng-class="{active: _page == page}">
<a href>{{_page}}</a>
</li>
<li ng-click="nextPage()" ng-class="{disabled: page == pages.length}"><a href>Next</a></li>
</ul>
</div>
<form class="navbar-search" style="margin: 20px">
<input type="text" class="search-query" placeholder="Search" ng-model="query">
</form>
</div>
</div>
<table class="table table-striped">
<tr>
<th>Név</th>
<th>TTL</th>
<th>Leírás</th>
<th colspan="2">Tulajdonos</th>
</tr>
<tr ng-repeat="domain in getPage()">
<td><a href="#/domains/{{domain.id}}">{{domain.name}}</a></td>
<td>{{domain.ttl}}</td>
<td>{{domain.description}}</td>
<td>{{domain.owner.name}}</td>
<td>
<a class="btn" href="#/domains/{{domain.id}}/">Szerkesztés</a>
<a class="btn btn-danger" href="#/domains/{{domain.id}}/delete/">Törlés</a>
</td>
</tr>
</table>
......@@ -132,3 +132,18 @@ def list_firewalls(request):
"name": firewall.name,
} for firewall in Firewall.objects.all()]
return HttpResponse(json.dumps(firewalls), content_type="application/json")
def list_domains(request):
domains = [{
"id": domain.id,
"name": domain.name,
"created_at": domain.created_at.isoformat(),
"modified_at": domain.modified_at.isoformat(),
"ttl": domain.ttl,
"description": domain.description,
"owner": {
"id": domain.owner.id,
"name": str(domain.owner)
}
} for domain in Domain.objects.all()]
return HttpResponse(json.dumps(domains), 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