Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
daf265d4
authored
Aug 22, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: bootstrap3 migration and bugfixes
parent
6f49fcd2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
201 additions
and
118 deletions
+201
-118
cloud/settings/base.py
+2
-0
network/forms.py
+0
-0
network/static/js/record.js
+16
-9
network/templates/network/base.html
+32
-20
network/templates/network/blacklist-edit.html
+7
-4
network/templates/network/blacklist-list.html
+1
-1
network/templates/network/columns/color-desc.html
+1
-1
network/templates/network/columns/host-rule.html
+2
-2
network/templates/network/domain-edit.html
+7
-3
network/templates/network/domain-list.html
+1
-1
network/templates/network/group-edit.html
+6
-2
network/templates/network/group-list.html
+1
-1
network/templates/network/host-create.html
+5
-4
network/templates/network/host-edit.html
+45
-32
network/templates/network/host-list.html
+2
-2
network/templates/network/index.html
+11
-11
network/templates/network/record-create.html
+5
-6
network/templates/network/record-edit.html
+8
-3
network/templates/network/record-list.html
+1
-1
network/templates/network/rule-edit.html
+11
-3
network/templates/network/rule-list.html
+1
-1
network/templates/network/vlan-edit.html
+7
-7
network/templates/network/vlan-group-edit.html
+6
-2
network/templates/network/vlan-group-list.html
+1
-1
network/templates/network/vlan-list.html
+1
-1
network/views.py
+21
-0
No files found.
cloud/settings/base.py
View file @
daf265d4
...
@@ -285,4 +285,6 @@ finally:
...
@@ -285,4 +285,6 @@ finally:
TEST_RUNNER
=
'django_nose.NoseTestSuiteRunner'
TEST_RUNNER
=
'django_nose.NoseTestSuiteRunner'
CRISPY_TEMPLATE_PACK
=
'bootstrap3'
# vim: et sw=4 ai fenc=utf8 smarttab :
# vim: et sw=4 ai fenc=utf8 smarttab :
network/forms.py
View file @
daf265d4
This diff is collapsed.
Click to expand it.
network/static/js/record
-create
.js
→
network/static/js/record.js
View file @
daf265d4
...
@@ -174,7 +174,14 @@ function validateForm() {
...
@@ -174,7 +174,14 @@ function validateForm() {
// name
// name
record_name
=
$
(
'#id_name'
).
val
()
record_name
=
$
(
'#id_name'
).
val
()
if
(
!
domain_re
.
test
(
record_name
))
{
if
(
!
record_name
)
{
messages
.
push
({
'message'
:
gettext
(
"You must specify a name!"
),
'id'
:
'name'
});
}
else
if
(
!
domain_re
.
test
(
record_name
))
{
text
=
gettext
(
'%s - invalid domain name'
),
text
=
gettext
(
'%s - invalid domain name'
),
messages
.
push
({
messages
.
push
({
'message'
:
interpolate
(
text
,
[
record_name
]),
'message'
:
interpolate
(
text
,
[
record_name
]),
...
@@ -230,8 +237,8 @@ function resetForm() {
...
@@ -230,8 +237,8 @@ function resetForm() {
// removes all error messages / classes
// removes all error messages / classes
function
resetErrors
()
{
function
resetErrors
()
{
// reset invalid inputs too
// reset invalid inputs too
$
(
'div[id^="div_id_"][class*="error"]'
).
each
(
function
()
{
$
(
'div[id^="div_id_"][class*="
has-
error"]'
).
each
(
function
()
{
$
(
this
).
removeClass
(
'error'
);
$
(
this
).
removeClass
(
'
has-
error'
);
});
});
// remove the error messages
// remove the error messages
...
@@ -267,7 +274,7 @@ $(function() {
...
@@ -267,7 +274,7 @@ $(function() {
$
(
'#submit-id-submit'
).
hide
();
$
(
'#submit-id-submit'
).
hide
();
$
(
'#div_id_type .controls'
).
append
(
$
(
'#div_id_type .controls'
).
append
(
//' <a id="type_next" onclick="type_next()" class="btn btn-info">Next</a>'
//' <a id="type_next" onclick="type_next()" class="btn btn-info">Next</a>'
'<span id="type_next" class="help-
inline
"><strong>'
+
'<span id="type_next" class="help-
block
"><strong>'
+
gettext
(
'Specify a type!'
)
+
gettext
(
'Specify a type!'
)
+
'</strong></span>'
'</strong></span>'
);
);
...
@@ -301,16 +308,16 @@ function type_next() {
...
@@ -301,16 +308,16 @@ function type_next() {
function
appendMessage
(
type
,
messages
,
id
)
{
function
appendMessage
(
type
,
messages
,
id
)
{
$
(
'#js_error'
).
remove
();
$
(
'#js_error'
).
remove
();
resetErrors
();
resetErrors
();
message
=
'<div id="js_error" style="display: none;" class="alert alert-
'
+
type
+
' alert-block
"><ul>'
message
=
'<div id="js_error" style="display: none;" class="alert alert-
danger
"><ul>'
for
(
var
i
=
0
;
i
<
messages
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
messages
.
length
;
i
++
)
{
message
+=
"<li>"
+
messages
[
i
].
message
+
"</li>"
;
message
+=
"<li>"
+
messages
[
i
].
message
+
"</li>"
;
if
(
messages
[
i
].
id
)
{
if
(
messages
[
i
].
id
)
{
$
(
'#id_'
+
messages
[
i
].
id
).
closest
(
'div[class="
control-group"]'
).
addClass
(
"
error"
);
$
(
'#id_'
+
messages
[
i
].
id
).
closest
(
'div[class="
form-group"]'
).
addClass
(
"has-
error"
);
}
}
}
}
message
+=
'</ul></div>'
;
message
+=
'</ul></div>'
;
$
(
'
.form-horizontal
'
).
before
(
message
);
$
(
'
form
'
).
before
(
message
);
$
(
'html, body'
).
animate
({
scrollTop
:
0
},
'slow'
,
function
()
{
$
(
'html, body'
).
animate
({
scrollTop
:
0
},
'slow'
,
function
()
{
$
(
'#js_error'
).
fadeIn
();
$
(
'#js_error'
).
fadeIn
();
});
});
...
@@ -321,8 +328,8 @@ function appendMessage(type, messages, id) {
...
@@ -321,8 +328,8 @@ function appendMessage(type, messages, id) {
// it also removes the help-inline span that shouldn't really appear
// it also removes the help-inline span that shouldn't really appear
$
(
'* [id^="id_"]'
).
focus
(
function
()
{
$
(
'* [id^="id_"]'
).
focus
(
function
()
{
id
=
"#div_"
+
$
(
this
).
prop
(
'id'
);
id
=
"#div_"
+
$
(
this
).
prop
(
'id'
);
if
(
$
(
id
).
hasClass
(
'error'
))
{
if
(
$
(
id
).
hasClass
(
'
has-
error'
))
{
$
(
id
).
removeClass
(
'error'
);
$
(
id
).
removeClass
(
'
has-
error'
);
$
(
'span[id="error_1_'
+
$
(
this
).
attr
(
'id'
)
+
'"]'
).
remove
();
$
(
'span[id="error_1_'
+
$
(
this
).
attr
(
'id'
)
+
'"]'
).
remove
();
}
}
});
});
network/templates/network/base.html
View file @
daf265d4
...
@@ -9,13 +9,23 @@
...
@@ -9,13 +9,23 @@
<title>
{% block title %}Firewall GUI{% endblock %}
</title>
<title>
{% block title %}Firewall GUI{% endblock %}
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
href=
'http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400&subset=latin,latin-ext'
rel=
'stylesheet'
type=
'text/css'
>
<link
href=
'http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400&subset=latin,latin-ext'
rel=
'stylesheet'
type=
'text/css'
>
<link
href=
"{% static "
css
/
bootstrap
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<link
rel=
"stylesheet"
href=
"//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css"
>
<link
href=
"//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css"
rel=
"stylesheet"
/>
<style
type=
"text/css"
>
<style
type=
"text/css"
>
body
{
body
{
padding-top
:
40px
;
padding-top
:
40px
;
}
}
/* note: this doesn't really work */
a
i
:hover
{
text-decoration
:
none
;
}
footer
{
margin-top
:
40px
;
}
</style>
</style>
<link
href=
"{% static "
css
/
bootstrap-responsive
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<!--[if lt IE 9]>
...
@@ -26,21 +36,19 @@
...
@@ -26,21 +36,19 @@
</head>
</head>
<body>
<body>
<div
class=
"navbar navbar-inverse navbar-fixed-top"
>
<div
class=
"navbar navbar-inverse navbar-fixed-top"
>
<div
class=
"navbar-inner"
>
<div
class=
"navbar-header"
>
<div
class=
"container"
>
<a
class=
"navbar-brand"
href=
"{% url network.index %}"
>
CIRCLE Network
</a
>
<button
type=
"button"
class=
"btn btn-navbar"
data-toggle=
"collapse"
data-target=
".nav
-collapse"
>
<button
type=
"button"
class=
"navbar-toggle"
data-toggle=
"collapse"
data-target=
".navbar
-collapse"
>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
</button>
<a
class=
"brand"
href=
"{% url network.index %}"
>
CIRCLE Network
</a
>
</div
>
<div
class=
"nav-collapse
collapse"
>
<div
class=
"collapse navbar-
collapse"
>
<ul
class=
"nav"
>
<ul
class=
"nav
navbar-nav
"
>
{% include "network/menu.html" %}
{% include "network/menu.html" %}
</ul>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
{% block messages %}
{% block messages %}
{% if messages %}
{% if messages %}
...
@@ -52,14 +60,18 @@
...
@@ -52,14 +60,18 @@
{% endif %}
{% endif %}
{% endblock messages %}
{% endblock messages %}
<div
class=
"container"
>
<div
class=
"container"
>
{% block content %}
{% block content %}
<div
class=
"alert-block"
>
This is an abstract base template.
</div>
<div
class=
"alert-block"
>
This is an abstract base template.
</div>
{% endblock %}
{% endblock %}
</div>
<footer>
<p
class=
"pull-right"
><a
href=
"#"
>
Vissza az oldal tetejére
</a></p>
<p>
©
2013 BME Közigazgatási Informatikai Központ
</footer>
</div>
<!-- .container -->
<script
src=
"http://code.jquery.com/jquery-latest.js"
></script>
<script
src=
"http://code.jquery.com/jquery-latest.js"
></script>
<script
src=
"{% url network.js_catalog %}"
></script>
<script
src=
"{% url network.js_catalog %}"
></script>
<script
src=
"{% static "
js
/
bootstrap
.
min
.
js
"
%}"
></script>
<script
src=
"//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"
></script>
<script
src=
"{% static "
js
/
bootbox
.
min
.
js
"
%}"
></script>
<!--<script src="{% static "js/select2-3.4.0/select2.min.js" %}"></script>-->
<!--<script src="{% static "js/select2-3.4.0/select2.min.js" %}"></script>-->
<script
src=
"{% static "
js
/
network
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
network
.
js
"
%}"
></script>
<script>
<script>
...
...
network/templates/network/blacklist-edit.html
View file @
daf265d4
...
@@ -6,9 +6,12 @@
...
@@ -6,9 +6,12 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-heading"
>
<div
class=
"page-header"
>
<h1>
{{ form.ipv4.value }}
<small>
details of restriction
</small></h1>
<h1>
{{ form.ipv4.value }}
<small>
{{ form.type.value }}
</small></h1>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-4"
>
{% crispy form %}
</div>
</div>
</div>
{% crispy form %}
{% endblock %}
{% endblock %}
network/templates/network/blacklist-list.html
View file @
daf265d4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
{% load staticfiles %}
{% load staticfiles %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
Blacklist
<small></small></h1>
<h1>
Blacklist
<small></small></h1>
</div>
</div>
...
...
network/templates/network/columns/color-desc.html
View file @
daf265d4
{% load i18n %}
{% load i18n %}
{% load l10n %}
{% load l10n %}
<span
style=
"color: #FF0000;"
>
[{{ record.r_type }}]
</span>
{#
<span
style=
"color: #FF0000;"
>
[{{ record.r_type }}]
</span>
#}
{% if record.direction == "1" %}{{ record.foreign_network }}{% else %}{{ record.r_type }}{% endif %}
{% if record.direction == "1" %}{{ record.foreign_network }}{% else %}{{ record.r_type }}{% endif %}
{#
<span
style=
"color: #0000FF;"
>
▸
</span>
#}
{#
<span
style=
"color: #0000FF;"
>
▸
</span>
#}
<i
class=
"icon-arrow-right"
></i>
<i
class=
"icon-arrow-right"
></i>
...
...
network/templates/network/columns/host-rule.html
View file @
daf265d4
...
@@ -11,10 +11,10 @@
...
@@ -11,10 +11,10 @@
{% endif %}
{% endif %}
{% if record.extra %}
{% if record.extra %}
<span
class=
"label label-
inverse
"
>
{{ record.extra }}
</span>
<span
class=
"label label-
default
"
>
{{ record.extra }}
</span>
{% endif %}
{% endif %}
{% if record.nat %}
{% if record.nat %}
<span
class=
"label"
>
NAT
<span
class=
"label
label-success
"
>
NAT
[ {{ record.dport }}
<i
class=
"icon-arrow-right"
></i>
{{record.nat_dport}} ]
</span>
[ {{ record.dport }}
<i
class=
"icon-arrow-right"
></i>
{{record.nat_dport}} ]
</span>
{% endif %}
{% endif %}
network/templates/network/domain-edit.html
View file @
daf265d4
...
@@ -6,9 +6,13 @@
...
@@ -6,9 +6,13 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
{{ form.name.value }}
<small>
details of domain
</small></h1>
<h1>
{{ form.name.value }}
<small></small></h1>
</div>
</div>
{% crispy form %}
<div
class=
"row"
>
<div
class=
"col-sm-4"
>
{% crispy form %}
</div>
</div>
{% endblock %}
{% endblock %}
network/templates/network/domain-list.html
View file @
daf265d4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
{% load staticfiles %}
{% load staticfiles %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
Domains
<small>
list of all domains
</small></h1>
<h1>
Domains
<small>
list of all domains
</small></h1>
</div>
</div>
...
...
network/templates/network/group-edit.html
View file @
daf265d4
...
@@ -6,9 +6,13 @@
...
@@ -6,9 +6,13 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
{{ form.name.value }}
<small>
details of group
</small></h1>
<h1>
{{ form.name.value }}
<small>
details of group
</small></h1>
</div>
</div>
{% crispy form %}
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
{% crispy form %}
</div>
</div>
{% endblock %}
{% endblock %}
network/templates/network/group-list.html
View file @
daf265d4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
{% load staticfiles %}
{% load staticfiles %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
Host groups
<small>
list of all host groups
</small></h1>
<h1>
Host groups
<small>
list of all host groups
</small></h1>
</div>
</div>
...
...
network/templates/network/host-create.html
View file @
daf265d4
...
@@ -6,16 +6,17 @@
...
@@ -6,16 +6,17 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h2>
Create a new host
</h2>
<h2>
Create a new host
</h2>
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"
span
8"
>
<div
class=
"
col-sm-
8"
>
{% crispy form %}
{% crispy form %}
</div>
</div>
<div
class=
"span4"
>
<div
class=
"col-sm-4"
>
</div>
<!-- span4 -->
Maybe some help text here?
</div>
<!-- col-sm-4 -->
</div>
<!-- row -->
</div>
<!-- row -->
{% endblock %}
{% endblock %}
network/templates/network/host-edit.html
View file @
daf265d4
...
@@ -6,48 +6,61 @@
...
@@ -6,48 +6,61 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
{{ form.hostname.value }}
<small>
details of host
</small></h1>
<h1>
{{ form.hostname.value }}
<small>
details of host
</small></h1>
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"span8"
>
<div
class=
"col-sm-8"
>
{% crispy form %}
{% crispy form %}
</div>
</div>
<div
class=
"span4"
>
<div
class=
"col-sm-4"
>
<h3>
Rules
</h3>
<div
class=
"page-header"
>
{% render_table rule_list %}
<h3>
Rules
</h3>
<h3>
Groups
</h3>
{% 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 }}"
>
<i
class=
"icon-remove"
style=
"vertical-align: middle;"
></i></a>
<a
href=
"{% url network.group group.pk %}"
>
<i
class=
"icon-pencil"
style=
"vertical-align: middle;"
></i></a>
</h4>
{% render_table group.table %}
</div>
</div>
{% endfor %}
{% if rule_list.data.data.count > 0 %}
{% render_table rule_list %}
<h3>
Add host group
</h3>
{% else %}
No rules associated with this host!
{% endif %}
<div
class=
"page-header"
>
<h3>
Groups
</h3>
</div>
{% 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 }}"
>
<i
class=
"icon-remove"
style=
"vertical-align: middle;"
></i></a>
<a
href=
"{% url network.group group.pk %}"
>
<i
class=
"icon-pencil"
style=
"vertical-align: middle;"
></i></a>
</h4>
{% render_table group.table %}
</div>
{% endfor %}
<div
class=
"page-header"
>
<h3>
Add host group
</h3>
</div>
{% if not_used_groups|length == 0 %}
{% if not_used_groups|length == 0 %}
No more groups to add!
No more groups to add!
{% else %}
{% else %}
<form
action=
"{% url network.add_host_group pk=host_pk %}"
method=
"POST"
>
<form
action=
"{% url network.add_host_group pk=host_pk %}"
method=
"POST"
>
{% csrf_token %}
{% csrf_token %}
<div
class=
"input-append"
>
<div
class=
"input-group"
>
<select
name=
"group"
id=
"add_group"
>
<select
name=
"group"
id=
"add_group"
class=
"form-control"
>
{% for rest in not_used_groups %}
{% for rest in not_used_groups %}
<option
value=
"{{ rest.pk }}"
>
{{ rest }}
</option>
<option
value=
"{{ rest.pk }}"
>
{{ rest }}
</option>
{% endfor %}
{% endfor %}
</select>
</select>
<input
type=
"submit"
value=
"Add group"
class=
"btn"
></input>
<div
class=
"input-group-btn"
>
</div>
<!-- input append -->
<input
type=
"submit"
value=
"Add group"
class=
"btn btn-default"
></input>
</form>
</div>
</div>
<!-- input-group -->
</form>
{% endif %}
{% endif %}
</div>
<!-- span
4 -->
</div>
<!-- col-sm-
4 -->
</div>
<!-- row -->
</div>
<!-- row -->
{% endblock %}
{% endblock %}
network/templates/network/host-list.html
View file @
daf265d4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<style>
<style>
</style>
</style>
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
<h1>
Hosts
Hosts
<small>
<small>
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</h1>
</h1>
</div>
</div>
<ul
class=
"nav nav-pills"
>
<ul
class=
"nav nav-pills"
style=
"margin: 5px 0 20px 0;"
>
<li
class=
"disabled"
><a
href=
"#"
>
Filter by vlans
</a></li>
<li
class=
"disabled"
><a
href=
"#"
>
Filter by vlans
</a></li>
<li
{%
if
not
request
.
GET
.
vlan
%}
class=
"active"
{%
endif
%}
><a
href=
"{{ request.path }}"
>
ALL
</a></li>
<li
{%
if
not
request
.
GET
.
vlan
%}
class=
"active"
{%
endif
%}
><a
href=
"{{ request.path }}"
>
ALL
</a></li>
{% for vlan in vlans %}
{% for vlan in vlans %}
...
...
network/templates/network/index.html
View file @
daf265d4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
Latest modifications
</h1>
<h1>
Latest modifications
</h1>
</div>
</div>
...
@@ -23,15 +23,15 @@
...
@@ -23,15 +23,15 @@
<td><a
href=
"{{ l.link }}"
>
{{ l.name }}
</a></td>
<td><a
href=
"{{ l.link }}"
>
{{ l.name }}
</a></td>
<td>
{{ l.modified_at|timesince }}
</td>
<td>
{{ l.modified_at|timesince }}
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</table>
</table>
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
Dashboard
<small>
foo bar baz
</small></h1>
<h1>
Dashboard
<small>
foo bar baz
</small></h1>
</div>
</div>
<ul
class=
"thumbnails"
>
<ul
class=
"thumbnails"
>
<li
class=
"
span
3"
>
<li
class=
"
col-sm-
3"
>
<div
class=
"thumbnail"
>
<div
class=
"thumbnail"
>
<p
class=
"lead"
><a
href=
"{% url network.host_list %}"
>
Hosts
</a>
are machines on the network.
</p>
<p
class=
"lead"
><a
href=
"{% url network.host_list %}"
>
Hosts
</a>
are machines on the network.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
</p>
</p>
</div>
</div>
</li>
</li>
<li
class=
"
span
3"
>
<li
class=
"
col-sm-
3"
>
<div
class=
"thumbnail"
>
<div
class=
"thumbnail"
>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
</p>
</p>
</div>
</div>
</li>
</li>
<li
class=
"
span
3"
>
<li
class=
"
col-sm-
3"
>
<div
class=
"thumbnail"
>
<div
class=
"thumbnail"
>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
</p>
</p>
</div>
</div>
</li>
</li>
<li
class=
"
span
3"
>
<li
class=
"
col-sm-
3"
>
<div
class=
"thumbnail"
>
<div
class=
"thumbnail"
>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
</ul>
</ul>
<ul
class=
"thumbnails"
>
<ul
class=
"thumbnails"
>
<li
class=
"
span
3"
>
<li
class=
"
col-sm-
3"
>
<div
class=
"thumbnail"
>
<div
class=
"thumbnail"
>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
</p>
</p>
</div>
</div>
</li>
</li>
<li
class=
"
span
3"
>
<li
class=
"
col-sm-
3"
>
<div
class=
"thumbnail"
>
<div
class=
"thumbnail"
>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
</p>
</p>
</div>
</div>
</li>
</li>
<li
class=
"
span
3"
>
<li
class=
"
col-sm-
3"
>
<div
class=
"thumbnail"
>
<div
class=
"thumbnail"
>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
...
@@ -90,7 +90,7 @@
...
@@ -90,7 +90,7 @@
</p>
</p>
</div>
</div>
</li>
</li>
<li
class=
"
span
3"
>
<li
class=
"
col-sm-
3"
>
<div
class=
"thumbnail"
>
<div
class=
"thumbnail"
>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p
class=
"lead"
>
Lorem ipsum
<a
href=
"#"
>
dolor
</a>
sit amet, consectetur adipiscing elit.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
<p>
Proin mattis enim risus. Ut condimentum eu enim quis auctor. Duis lobortis sollicitudin lacus, scelerisque dictum arcu aliquam nec.
</p>
...
...
network/templates/network/record-create.html
View file @
daf265d4
...
@@ -6,20 +6,19 @@
...
@@ -6,20 +6,19 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h2>
Create a new record
</h2>
<h2>
Create a new record
</h2>
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"
span8
"
>
<div
class=
"
col-sm-6
"
>
{% crispy form %}
{% crispy form %}
</div>
</div>
<div
class=
"
span
4"
>
<div
class=
"
col-sm-
4"
>
</div>
<!--
span
4 -->
</div>
<!--
col-sm-
4 -->
</div>
<!-- row -->
</div>
<!-- row -->
{% endblock %}
{% endblock %}
{% block extra_etc %}
{% block extra_etc %}
<script
src=
"{% static "
js
/
record
-create
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
record
.
js
"
%}"
></script>
{% endblock %}
{% endblock %}
~
~
network/templates/network/record-edit.html
View file @
daf265d4
...
@@ -6,12 +6,17 @@
...
@@ -6,12 +6,17 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
{{ fqdn }}
<small>
details of record
</small></h1>
<h1>
{{ fqdn }}
<small>
details of record
</small></h1>
</div>
</div>
{% crispy form %}
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
{% crispy form %}
</div>
</div>
{% endblock %}
{% endblock %}
{% block extra_etc %}
{% block extra_etc %}
<script
src=
"{% static "
js
/
record
-create
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
record
.
js
"
%}"
></script>
{% endblock %}
{% endblock %}
network/templates/network/record-list.html
View file @
daf265d4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
{% load staticfiles %}
{% load staticfiles %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
<h1>
Records
Records
<small>
<small>
...
...
network/templates/network/rule-edit.html
View file @
daf265d4
...
@@ -6,9 +6,17 @@
...
@@ -6,9 +6,17 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-heading"
>
<div
class=
"page-header"
>
<h1>
{{ form.hostname.value }}
<small>
details of rule
</small></h1>
<h3>
{% with rule as record %}
{% include "network/columns/host-rule.html" %}
{% endwith %}
</h3>
</div>
</div>
{% crispy form %}
<div
class=
"row"
>
<div
class=
"col-sm-7"
>
{% crispy form %}
</div>
</div>
{% endblock %}
{% endblock %}
network/templates/network/rule-list.html
View file @
daf265d4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
{% load staticfiles %}
{% load staticfiles %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
Rules
<small>
list of all rules
</small></h1>
<h1>
Rules
<small>
list of all rules
</small></h1>
</div>
</div>
...
...
network/templates/network/vlan-edit.html
View file @
daf265d4
...
@@ -6,16 +6,16 @@
...
@@ -6,16 +6,16 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
{{ form.name.value }}
<small>
details of vlan
</small></h1>
<h1>
{{ form.name.value }}
<small>
details of vlan
</small></h1>
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"span
8"
>
<div
class=
"col-sm-
8"
>
{% crispy form %}
{% crispy form %}
</div>
</div>
<div
class=
"span
4"
>
<div
class=
"col-sm-
4"
>
{% render_table host_list %}
{% render_table host_list %}
</div>
</div>
</div>
</div>
{% endblock %}
{% endblock %}
network/templates/network/vlan-group-edit.html
View file @
daf265d4
...
@@ -6,9 +6,13 @@
...
@@ -6,9 +6,13 @@
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
{{ form.name.value }}
<small>
details of vlan group
</small></h1>
<h1>
{{ form.name.value }}
<small>
details of vlan group
</small></h1>
</div>
</div>
{% crispy form %}
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
{% crispy form %}
</div>
</div>
{% endblock %}
{% endblock %}
network/templates/network/vlan-group-list.html
View file @
daf265d4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
{% load staticfiles %}
{% load staticfiles %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
Vlan groups
<small>
list of all vlan groups
</small></h1>
<h1>
Vlan groups
<small>
list of all vlan groups
</small></h1>
</div>
</div>
...
...
network/templates/network/vlan-list.html
View file @
daf265d4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
{% load staticfiles %}
{% load staticfiles %}
{% block content %}
{% block content %}
<div
class=
"page-head
ing
"
>
<div
class=
"page-head
er
"
>
<h1>
Vlans
<small>
list of all vlans
</small></h1>
<h1>
Vlans
<small>
list of all vlans
</small></h1>
</div>
</div>
...
...
network/views.py
View file @
daf265d4
...
@@ -143,6 +143,18 @@ class HostDetail(UpdateView):
...
@@ -143,6 +143,18 @@ class HostDetail(UpdateView):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
return
super
(
HostDetail
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
return
super
(
HostDetail
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
pk
=
self
.
kwargs
.
get
(
'pk'
)
# this is usually not None (well, with curl and whatnot it can be)
if
pk
:
groups
=
Host
.
objects
.
get
(
pk
=
pk
)
.
groups
.
all
()
groups
=
[
i
.
pk
for
i
in
groups
]
# request.POST is immutable
post_copy
=
request
.
POST
.
copy
()
post_copy
.
setlist
(
'groups'
,
groups
)
request
.
POST
=
post_copy
return
super
(
HostDetail
,
self
)
.
post
(
request
,
*
args
,
**
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
HostDetail
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
HostDetail
,
self
)
.
get_context_data
(
**
kwargs
)
# own rules
# own rules
...
@@ -225,6 +237,15 @@ class RuleDetail(UpdateView):
...
@@ -225,6 +237,15 @@ class RuleDetail(UpdateView):
if
'pk'
in
self
.
kwargs
:
if
'pk'
in
self
.
kwargs
:
return
reverse_lazy
(
'network.rule'
,
kwargs
=
self
.
kwargs
)
return
reverse_lazy
(
'network.rule'
,
kwargs
=
self
.
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
RuleDetail
,
self
)
.
get_context_data
(
**
kwargs
)
pk
=
self
.
kwargs
.
get
(
'pk'
)
rule
=
Rule
.
objects
.
get
(
pk
=
pk
)
context
[
'rule'
]
=
rule
return
context
class
RuleDelete
(
DeleteView
):
class
RuleDelete
(
DeleteView
):
model
=
Rule
model
=
Rule
...
...
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