Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e0d836aa
authored
Jan 14, 2015
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: more readable rule table
also disable a few column orderings
parent
843d7507
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
25 deletions
+72
-25
circle/network/static/network/network.less
+7
-0
circle/network/tables.py
+17
-6
circle/network/templates/network/columns/_rule-type.html
+16
-0
circle/network/templates/network/columns/color-desc.html
+0
-19
circle/network/templates/network/columns/rule-short-description.html
+32
-0
No files found.
circle/network/static/network/network.less
View file @
e0d836aa
...
@@ -11,3 +11,10 @@
...
@@ -11,3 +11,10 @@
text-align: center;
text-align: center;
width: 60px;
width: 60px;
}
}
#rule-list-table {
td {
text-align: center;
&:nth-child(2), &:nth-child(3) {text-align: left;}
}
}
circle/network/tables.py
View file @
e0d836aa
...
@@ -144,6 +144,7 @@ class RecordTable(Table):
...
@@ -144,6 +144,7 @@ class RecordTable(Table):
address
=
TemplateColumn
(
address
=
TemplateColumn
(
template_name
=
"network/columns/records-address.html"
template_name
=
"network/columns/records-address.html"
)
)
ttl
=
Column
(
verbose_name
=
_
(
"TTL"
))
class
Meta
:
class
Meta
:
model
=
Record
model
=
Record
...
@@ -167,16 +168,26 @@ class SmallRecordTable(Table):
...
@@ -167,16 +168,26 @@ class SmallRecordTable(Table):
class
RuleTable
(
Table
):
class
RuleTable
(
Table
):
r_type
=
LinkColumn
(
'network.rule'
,
args
=
[
A
(
'pk'
)])
r_type
=
LinkColumn
(
'network.rule'
,
args
=
[
A
(
'pk'
)],
verbose_name
=
_
(
"type"
),
orderable
=
False
,
)
color_desc
=
TemplateColumn
(
color_desc
=
TemplateColumn
(
template_name
=
"network/columns/color-desc.html"
template_name
=
"network/columns/rule-short-description.html"
,
verbose_name
=
_
(
"Short description"
),
orderable
=
False
,
)
nat_external_port
=
Column
(
verbose_name
=
_
(
"NAT"
)
)
)
class
Meta
:
class
Meta
:
model
=
Rule
model
=
Rule
attrs
=
{
'class'
:
'table table-striped table-hover table-condensed'
}
attrs
=
{
'class'
:
'table table-striped table-hover table-condensed'
,
fields
=
(
'r_type'
,
'color_desc'
,
'owner'
,
'extra'
,
'direction'
,
'id'
:
"rule-list-table"
}
'action'
,
'proto'
,
'sport'
,
'dport'
,
'nat'
,
fields
=
(
'r_type'
,
'color_desc'
,
'extra'
,
'direction'
,
'action'
,
'proto'
,
'dport'
,
'nat_external_port'
,
)
'nat_external_port'
,
)
order_by
=
'direction'
order_by
=
'direction'
...
@@ -198,7 +209,7 @@ class VlanTable(Table):
...
@@ -198,7 +209,7 @@ class VlanTable(Table):
class
Meta
:
class
Meta
:
model
=
Vlan
model
=
Vlan
attrs
=
{
'class'
:
'table table-striped table-condensed'
}
attrs
=
{
'class'
:
'table table-striped table-condensed'
}
fields
=
(
'vid'
,
'name'
,
'
interface'
,
'
network4'
,
'network6'
,
fields
=
(
'vid'
,
'name'
,
'network4'
,
'network6'
,
'domain'
,
)
'domain'
,
)
order_by
=
'vid'
order_by
=
'vid'
...
...
circle/network/templates/network/columns/_rule-type.html
0 → 100644
View file @
e0d836aa
{% if record.r_type == "host" %}
{{ record.host.get_fqdn }}
{% elif record.r_type == "vlan" %}
{{ record.vlan.name }}
{% elif record.r_type == "vlangroup" %}
{{ record.vlangroup }}
[{% for v in record.vlangroup.vlans.all %}
{{ v.name }}{% if not forloop.last %},{% endif %}
{% endfor %}]
{% elif record.r_type == "group" %}
{{ record.hostgroup.name }}
{% elif record.r_type == "firewall" %}
{{ record.firewall }}
{% else %}
-
{% endif %}
circle/network/templates/network/columns/color-desc.html
deleted
100644 → 0
View file @
843d7507
{% load i18n %}
{% load l10n %}
{#
<span
style=
"color: #FF0000;"
>
[{{ record.r_type }}]
</span>
#}
{% if record.direction == "1" %}{{ record.foreign_network }}{% else %}{{ record.r_type }}{% endif %}
{#
<span
style=
"color: #0000FF;"
>
▸
</span>
#}
<i
class=
"fa fa-arrow-right"
></i>
{% if record.direction == "0" %}{{ record.foreign_network }}{% else %}{{ record.r_type }}{% endif %}
<span
style=
"color: #00FF00;"
>
{% if record.proto %}
proto={{ record.proto }}
{% endif %}
{% if record.sport %}
sport={{ record.sport }}
{% endif %}
{% if record.dport %}
dport={{ record.dport }}
{% endif %}
{{ record.description }}
circle/network/templates/network/columns/rule-short-description.html
0 → 100644
View file @
e0d836aa
{% load i18n %}
{% if record.direction == "in" %}
{{ record.foreign_network }}
[{% for v in record.foreign_network.vlans.all %}
{{ v.name }}{% if not forloop.last %},{% endif %}
{% endfor %}]
{% else %}
{% include "network/columns/_rule-type.html" %}
{% endif %}
<i
class=
"fa fa-arrow-right"
></i>
{% if record.direction == "out" %}
{{ record.foreign_network }}
[{% for v in record.foreign_network.vlans.all %}
{{ v.name }}{% if not forloop.last %},{% endif %}
{% endfor %}]
{% else %}
{% include "network/columns/_rule-type.html" %}
{% endif %}
{% if record.nat %}
<span
class=
"label label-success"
>
NAT
[
{{record.nat_external_port}}
<i
class=
"fa fa-arrow-right"
></i>
{{ record.dport }}
]
{{ record.proto|upper }}
</span>
{% endif %}
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