Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
57979689
authored
Jan 26, 2015
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add rule list table to firewall detail
parent
6562e1be
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
5 deletions
+46
-5
circle/network/tables.py
+23
-0
circle/network/templates/network/columns/firewall-rule-actions.html
+5
-0
circle/network/templates/network/columns/host-rule-action.html
+1
-1
circle/network/templates/network/confirm/base_delete.html
+1
-1
circle/network/templates/network/firewall-edit.html
+11
-1
circle/network/templates/network/host-edit.html
+1
-1
circle/network/views.py
+4
-1
No files found.
circle/network/tables.py
View file @
57979689
...
...
@@ -255,3 +255,26 @@ class FirewallTable(Table):
attrs
=
{
'class'
:
'table table-striped'
}
fields
=
(
'pk'
,
'name'
,
)
order_by
=
'pk'
class
FirewallRuleTable
(
Table
):
color_desc
=
TemplateColumn
(
template_name
=
"network/columns/rule-short-description.html"
,
verbose_name
=
_
(
"Short description"
),
orderable
=
False
,
)
actions
=
TemplateColumn
(
template_name
=
"network/columns/firewall-rule-actions.html"
,
verbose_name
=
_
(
"Actions"
),
orderable
=
False
,
)
class
Meta
:
model
=
Rule
template
=
"django_tables2/table_no_page.html"
attrs
=
{
'class'
:
'table table-striped table-hover table-condensed'
,
'id'
:
"rule-list-table"
}
fields
=
(
'color_desc'
,
'extra'
,
'direction'
,
'action'
,
'proto'
,
'actions'
)
order_by
=
'-pk'
empty_text
=
_
(
"No related rules found."
)
circle/network/templates/network/columns/firewall-rule-actions.html
0 → 100644
View file @
57979689
{% load i18n %}
<div
style=
"white-space: nowrap;"
>
<a
href=
"{% url "
network
.
rule_delete
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"fa fa-times"
></i></a>
<a
href=
"{% url "
network
.
rule
"
pk=
record.pk
%}"
><i
class=
"fa fa-pencil"
></i></a>
</div>
circle/network/templates/network/columns/host-rule-action.html
View file @
57979689
{% load i18n %}
{% load l10n %}
<div
style=
"white-space: nowrap;"
>
<a
href=
"{% url "
network
.
rule_delete
"
pk=
record.pk
%}?
from
=
{{
request
.
path
}}"
><i
class=
"fa fa-times"
></i></a>
<a
href=
"{% url "
network
.
rule_delete
"
pk=
record.pk
%}?
next
=
{{
request
.
path
}}"
><i
class=
"fa fa-times"
></i></a>
<a
href=
"{% url "
network
.
rule
"
pk=
record.pk
%}"
><i
class=
"fa fa-pencil"
></i></a>
</div>
circle/network/templates/network/confirm/base_delete.html
View file @
57979689
...
...
@@ -31,7 +31,7 @@
</div>
{% endif %}
<form
action=
""
method=
"post"
>
{% csrf_token %}
<input
type=
"hidden"
value=
"{{ request.GET.
from
}}"
name=
"next"
/>
<input
type=
"hidden"
value=
"{{ request.GET.
next
}}"
name=
"next"
/>
{% if confirmation %}
<label><p>
{% trans "If you are really sure, type in the object's name!" %}
...
...
circle/network/templates/network/firewall-edit.html
View file @
57979689
{% extends "network/base.html" %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% load staticfiles %}
{% load crispy_forms_tags %}
{% block title-page %}{{
switch_port_pk
}} | {% trans "firewall" %}{% endblock %}
{% block title-page %}{{
object.name
}} | {% trans "firewall" %}{% endblock %}
{% block content %}
<div
class=
"page-header"
>
...
...
@@ -18,4 +19,13 @@
{% crispy form %}
</div>
</div>
<div
class=
"page-header"
>
<h2>
{% trans "Related rules" %}
</h2>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
{% render_table rule_table %}
</div>
</div>
{% endblock %}
circle/network/templates/network/host-edit.html
View file @
57979689
...
...
@@ -35,7 +35,7 @@
{% for group in group_rule_list %}
<div>
<h4
id=
"{{ group.pk }}_group_pk"
>
{{ group.name }}
<a
href=
"{% url "
network
.
remove_host_group
"
pk=
host_pk
group_pk=
group.pk
%}?
from
=
{{
request
.
path
}}"
>
<a
href=
"{% url "
network
.
remove_host_group
"
pk=
host_pk
group_pk=
group.pk
%}?
next
=
{{
request
.
path
}}"
>
<i
class=
"fa fa-times"
style=
"vertical-align: middle;"
></i></a>
<a
href=
"{% url "
network
.
group
"
group
.
pk
%}"
>
<i
class=
"fa fa-pencil"
style=
"vertical-align: middle;"
></i></a>
...
...
circle/network/views.py
View file @
57979689
...
...
@@ -35,7 +35,7 @@ from .tables import (
HostTable
,
VlanTable
,
SmallHostTable
,
DomainTable
,
GroupTable
,
RecordTable
,
BlacklistItemTable
,
RuleTable
,
VlanGroupTable
,
SmallRuleTable
,
SmallGroupRuleTable
,
SmallRecordTable
,
SwitchPortTable
,
SmallDhcpTable
,
FirewallTable
SmallDhcpTable
,
FirewallTable
,
FirewallRuleTable
,
)
from
.forms
import
(
HostForm
,
VlanForm
,
DomainForm
,
GroupForm
,
RecordForm
,
BlacklistItemForm
,
...
...
@@ -312,6 +312,9 @@ class FirewallDetail(LoginRequiredMixin, SuperuserRequiredMixin,
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
FirewallDetail
,
self
)
.
get_context_data
(
**
kwargs
)
rules
=
Rule
.
objects
.
filter
(
firewall
=
self
.
object
)
context
[
'rule_table'
]
=
FirewallRuleTable
(
rules
,
request
=
self
.
request
)
return
context
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment