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
5ba3a119
authored
May 07, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: vlan details page added
parent
5b9e2594
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
1 deletions
+171
-1
cloud/urls.py
+1
-0
firewall_gui/static/js/project.js
+1
-1
firewall_gui/static/partials/vlan-edit.html
+131
-0
firewall_gui/views.py
+38
-0
No files found.
cloud/urls.py
View file @
5ba3a119
...
...
@@ -106,6 +106,7 @@ urlpatterns = patterns('',
url
(
r'^firewall/rules/(?P<id>\d+)/$'
,
'firewall_gui.views.show_rule'
),
url
(
r'^firewall/hosts/(?P<id>\d+)/$'
,
'firewall_gui.views.show_host'
),
url
(
r'^firewall/vlans/(?P<id>\d+)/$'
,
'firewall_gui.views.show_vlan'
),
url
(
r'^firewall/autocomplete/vlan/$'
,
'firewall_gui.views.autocomplete_vlan'
),
url
(
r'^firewall/autocomplete/vlangroup/$'
,
'firewall_gui.views.autocomplete_vlangroup'
),
...
...
firewall_gui/static/js/project.js
View file @
5ba3a119
...
...
@@ -34,7 +34,7 @@ $.ajaxSetup({
* @type {Array}
*/
var
listControllers
=
[
'rule'
,
'host'
,
'vlan'
,
'vlangroup'
,
'hostgroup'
,
'firewall'
,
'domain'
,
'record'
,
'blacklist'
];
var
entityControllers
=
[
'rule'
,
'host'
];
var
entityControllers
=
[
'rule'
,
'host'
,
'vlan'
];
var
module
=
angular
.
module
(
'firewall'
,
[]).
config
(
[
'$routeProvider'
,
function
(
$routeProvider
)
{
for
(
var
i
in
listControllers
)
{
...
...
firewall_gui/static/partials/vlan-edit.html
0 → 100644
View file @
5ba3a119
<form
class=
"form-horizontal"
>
<div
class=
"span5"
>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"ID"
>
ID
</label>
<div
class=
"controls"
>
<input
class=
"input-mini"
type=
"text"
id=
"ID"
placeholder=
"ID"
value=
"{{entity.id}}"
disabled=
"disabled"
>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"VID"
>
VID
</label>
<div
class=
"controls"
>
<input
class=
"input-mini"
type=
"text"
id=
"VID"
placeholder=
"ID"
ng-model=
"entity.vid"
>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"created_at"
>
Created at
</label>
<div
class=
"controls"
>
<input
class=
"input"
type=
"text"
id=
"created_at"
ng-model=
"entity.created_at"
disabled=
"disabled"
>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"modified_at"
>
Modified at
</label>
<div
class=
"controls"
>
<input
class=
"input"
type=
"text"
id=
"modified_at"
ng-model=
"entity.modified_at"
disabled=
"disabled"
>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"name"
>
Name
</label>
<div
class=
"controls"
>
<input
type=
"text"
id=
"name"
ng-model=
"entity.name"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"ipv4"
>
IPv4
</label>
<div
class=
"controls"
>
<input
type=
"text"
id=
"ipv4"
ng-model=
"entity.ipv4"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"ipv6"
>
IPv6
</label>
<div
class=
"controls"
>
<input
type=
"text"
class=
"input-xlarge"
id=
"ipv6"
ng-model=
"entity.ipv6"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"nat"
>
NAT
</label>
<div
class=
"controls"
>
<input
type=
"text"
id=
"nat"
ng-model=
"entity.nat"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"owner"
>
Owner
</label>
<div
class=
"controls"
>
<input
type=
"text"
autocomplete=
"off"
id=
"owner"
ng-model=
"entity.owner.name"
/>
</div>
</div>
</div>
<div
class=
"span5"
>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"interface"
>
Interface
</label>
<div
class=
"controls"
>
<input
type=
"text"
autocomplete=
"off"
id=
"interface"
ng-model=
"entity.interface.name"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"domain"
>
Domain
</label>
<div
class=
"controls"
>
<input
type=
"text"
autocomplete=
"off"
id=
"domain"
ng-model=
"entity.domain.name"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"reverse_domain"
>
Reverse domain
</label>
<div
class=
"controls"
>
<input
type=
"text"
autocomplete=
"off"
id=
"reverse_domain"
ng-model=
"entity.reverse_domain.name"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"description"
>
Description
</label>
<div
class=
"controls"
>
<textarea
rows=
"2"
id=
"description"
ng-model=
"entity.description"
>
</textarea>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"comment"
>
Comment
</label>
<div
class=
"controls"
>
<textarea
rows=
"2"
id=
"comment"
ng-model=
"entity.comment"
>
</textarea>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"dhcp_pool"
>
DHCP Pool
</label>
<div
class=
"controls"
>
<textarea
rows=
"2"
id=
"dhcp_pool"
ng-model=
"entity.dhcp_pool"
>
</textarea>
</div>
</div>
<div
class=
"control-group"
>
<div
class=
"controls"
>
<button
type=
"submit"
class=
"btn"
>
Save (nem működik!)
</button>
</div>
</div>
</div>
</form>
<div
class=
"span12"
>
<h3>
Rules belonging to this vlan
</h3>
<table
class=
"table table-striped"
>
<thead>
<tr>
<th>
Direction
</th>
<th>
Protocol
</th>
<th>
Accept
</th>
<th>
NAT
</th>
<th
colspan=
"2"
>
Owner
</th>
</tr>
</thead>
<tbody>
<tr
ng-repeat=
"rule in entity.rules"
>
<td>
{{rule.direction}}
</td>
<td>
{{rule.proto}}
</td>
<td>
{{rule.accept}}
</td>
<td>
{{rule.nat}}
</td>
<td>
{{rule.owner.name}}
</td>
<td>
<a
class=
"btn"
href=
"#/rules/{{rule.id}}/"
>
Edit
</a>
<a
class=
"btn btn-danger"
href=
"#/rules/{{rule.id}}/delete/"
>
Delete
</a>
</td>
</tr>
</tbody>
</table>
</div>
firewall_gui/views.py
View file @
5ba3a119
...
...
@@ -285,6 +285,44 @@ def show_host(request, id):
}
return
HttpResponse
(
json
.
dumps
(
host
),
content_type
=
'application/json'
)
def
show_vlan
(
request
,
id
):
vlan
=
get_object_or_404
(
Vlan
,
id
=
id
)
vlan
=
{
'id'
:
vlan
.
id
,
'vid'
:
vlan
.
vid
,
'name'
:
vlan
.
name
,
'ipv4'
:
vlan
.
ipv4
+
'/'
+
str
(
vlan
.
prefix4
),
'ipv6'
:
vlan
.
ipv6
+
'/'
+
str
(
vlan
.
prefix6
),
'nat'
:
vlan
.
snat_ip
,
'description'
:
vlan
.
description
,
'comment'
:
vlan
.
comment
,
'reverse_domain'
:
vlan
.
reverse_domain
,
'dhcp_pool'
:
vlan
.
dhcp_pool
,
'interface'
:
vlan
.
interface
,
'created_at'
:
vlan
.
created_at
.
isoformat
(),
'modified_at'
:
vlan
.
modified_at
.
isoformat
(),
'owner'
:
{
'name'
:
str
(
vlan
.
owner
),
'id'
:
vlan
.
owner
.
id
}
if
vlan
.
owner
else
None
,
'domain'
:
{
'id'
:
vlan
.
domain
.
id
,
'name'
:
vlan
.
domain
.
name
,
},
'rules'
:
[{
'id'
:
rule
.
id
,
'direction'
:
rule
.
get_direction_display
(),
'proto'
:
rule
.
proto
,
'owner'
:
{
'id'
:
rule
.
owner
.
id
,
'name'
:
str
(
rule
.
owner
),
},
'accept'
:
rule
.
accept
,
'nat'
:
rule
.
nat
}
for
rule
in
vlan
.
rules
.
all
()]
}
return
HttpResponse
(
json
.
dumps
(
vlan
),
content_type
=
'application/json'
)
def
autocomplete_vlan
(
request
):
return
HttpResponse
(
json
.
dumps
([{
...
...
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