Commit f016c45d by Bence Dányi

firewall_gui: list blacklists

parent ee7c6c6a
......@@ -102,4 +102,5 @@ urlpatterns = patterns('',
url(r'^firewall/firewalls/$', 'firewall_gui.views.list_firewalls'),
url(r'^firewall/domains/$', 'firewall_gui.views.list_domains'),
url(r'^firewall/records/$', 'firewall_gui.views.list_records'),
url(r'^firewall/blacklists/$', 'firewall_gui.views.list_blacklists'),
)
......@@ -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', 'domain', 'record'];
var listControllers = ['rule', 'host', 'vlan', 'vlangroup', 'hostgroup', 'firewall', 'domain', 'record', 'blacklist'];
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>IPv4</th>
<th>Host</th>
<th>Indok</th>
<th>Horkantási üzenet (?)</th>
<th colspan="2">Típus</th>
</tr>
<tr ng-repeat="blacklist in getPage()">
<td><a href="#/blacklists/{{blacklist.id}}">{{blacklist.name}}</a></td>
<td>{{blacklist.ipv4}}</td>
<td><a href="#/hosts/{{blacklist.host.id}}">{{blacklist.host.hostname}}</a></td>
<td>{{blacklist.reason}}</td>
<td>{{blacklist.snort_message}}</td>
<td>{{blacklist.type}}</td>
<td>
<a class="btn" href="#/blacklists/{{blacklist.id}}/">Szerkesztés</a>
<a class="btn btn-danger" href="#/blacklists/{{blacklist.id}}/delete/">Törlés</a>
</td>
</tr>
</table>
......@@ -172,3 +172,19 @@ def list_records(request):
"modified_at": record.modified_at.isoformat()
} for record in Record.objects.all()]
return HttpResponse(json.dumps(records), content_type="application/json")
def list_blacklists(request):
blacklists = [{
"id": blacklist.id,
"host": {
"id": blacklist.host.id,
"name": blacklist.host.hostname,
} if blacklist.host else None,
"reason": blacklist.reason,
"snort_message": blacklist.snort_message,
"type": blacklist.type,
"created_at": blacklist.created_at.isoformat(),
"modified_at": blacklist.modified_at.isoformat(),
"ipv4": blacklist.ipv4
} for blacklist in Blacklist.objects.all()]
return HttpResponse(json.dumps(blacklists), 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