Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
7bb777ef
authored
Sep 10, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: new CNAME button for host edit
parent
efdebdff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
50 deletions
+67
-50
circle/network/templates/network/host-edit.html
+50
-46
circle/network/views.py
+17
-4
No files found.
circle/network/templates/network/host-edit.html
View file @
7bb777ef
...
@@ -7,73 +7,77 @@
...
@@ -7,73 +7,77 @@
{% block content %}
{% block content %}
<div
class=
"page-header"
>
<div
class=
"page-header"
>
<a
href=
"{% url "
network
.
host_delete
"
pk=
host_pk%}"
class=
"btn btn-danger pull-right"
><i
class=
"fa fa-times-circle"
></i>
{% trans "Delete this host" %}
</a>
<a
href=
"{% url "
network
.
host_delete
"
pk=
host_pk%}"
class=
"btn btn-danger pull-right"
><i
class=
"fa fa-times-circle"
></i>
{% trans "Delete this host" %}
</a>
<h2>
{{ form.hostname.value }}
</h2>
<h2>
{{ form.hostname.value }}
</h2>
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<div
class=
"col-md-6"
>
{% crispy form %}
{% crispy form %}
</div>
<div
class=
"col-md-6"
>
<div
class=
"page-header"
>
<a
href=
"{% url "
network
.
rule_create
"
%}?
host=
{{
host_pk
}}"
class=
"btn btn-success pull-right btn-xs"
><i
class=
"fa fa-plus-circle"
></i>
{% trans "Add new rule" %}
</a>
<h3>
{% trans "Rules" %}
</h3>
</div>
</div>
<div
class=
"col-md-6"
>
{% if rule_list.data.data.count > 0 %}
<div
class=
"page-header"
>
{% render_table rule_list %}
<a
href=
"{% url "
network
.
rule_create
"
%}?
host=
{{
host_pk
}}"
class=
"btn btn-success pull-right btn-xs"
><i
class=
"fa fa-plus-circle"
></i>
{% trans "Add new rule" %}
</a>
{% else %}
<h3>
{% trans "Rules" %}
</h3>
{% trans "No rules associated with this host." %}
</div>
{% endif %}
{% if rule_list.data.data.count > 0 %}
{% render_table rule_list %}
{% else %}
{% trans "No rules associated with this host!" %}
{% endif %}
<div
class=
"page-header"
>
<div
class=
"page-header"
>
<h3>
{% trans "Groups" %}
</h3>
<h3>
{% trans "Groups" %}
</h3>
</div>
{% if group_rule_list|length > 0 %}
{% 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=
"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>
</h4>
</div>
</div>
{% if group_rule_list|length > 0 %}
{% endfor %}
{% for group in group_rule_list %}
{% else %}
<div>
{% trans "This host is not added to any host groups!" %}
<h4
id=
"{{ group.pk }}_group_pk"
>
{{ group.name }}
{% endif %}
<a
href=
"{% url "
network
.
remove_host_group
"
pk=
host_pk
group_pk=
group.pk
%}?
from=
{{
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>
</h4>
</div>
{% endfor %}
{% else %}
{% trans "This host is not added to any host groups!" %}
{% endif %}
<div
class=
"page-header"
>
<div
class=
"page-header"
>
<h3>
{% trans "Add host group" %}
</h3>
<h3>
{% trans "Add host group" %}
</h3>
</div>
</div>
{% if not_used_groups|length == 0 %}
{% if not_used_groups|length == 0 %}
No more groups to add!
{% trans "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-group"
>
<div
class=
"input-group"
>
<select
name=
"group"
id=
"add_group"
class=
"form-control"
>
<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>
<div
class=
"input-group-btn"
>
<div
class=
"input-group-btn"
>
<input
type=
"submit"
value=
"{% trans "
Add
group
"
%}"
class=
"btn btn-default"
></input>
<input
type=
"submit"
value=
"{% trans "
Add
group
"
%}"
class=
"btn btn-default"
></input>
</div>
</div>
</div>
<!-- input-group -->
</div>
<!-- input-group -->
</form>
</form>
{% endif %}
{% endif %}
<div
class=
"page-header"
>
<div
class=
"page-header"
>
<a
href=
"{% url "
network
.
record_create
"
%}?
host=
{{
host_pk
}}"
class=
"btn btn-xs btn-success pull-right"
>
<i
class=
"fa fa-plus-circle"
></i>
{% trans "Add new CNAME record" %}
</a>
<h3>
{% trans "Records" %}
</h3>
<h3>
{% trans "Records" %}
</h3>
</div>
</div>
{% render_table records_table %}
{% render_table records_table %}
</div>
<!-- col-sm-5 -->
</div>
<!-- col-sm-5 -->
</div>
<!-- row -->
</div>
<!-- row -->
{% endblock %}
{% endblock %}
{% block extra_etc %}
{% block extra_etc %}
<script
src=
"{% static "
js
/
host
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
host
.
js
"
%}"
></script>
{% endblock %}
{% endblock %}
circle/network/views.py
View file @
7bb777ef
...
@@ -505,10 +505,23 @@ class RecordCreate(LoginRequiredMixin, SuperuserRequiredMixin,
...
@@ -505,10 +505,23 @@ class RecordCreate(LoginRequiredMixin, SuperuserRequiredMixin,
success_message
=
_
(
u'Successfully created record!'
)
success_message
=
_
(
u'Successfully created record!'
)
def
get_initial
(
self
):
def
get_initial
(
self
):
return
{
host_pk
=
self
.
request
.
GET
.
get
(
"host"
)
# 'owner': 1,
try
:
'domain'
:
self
.
request
.
GET
.
get
(
'domain'
),
host
=
Host
.
objects
.
get
(
pk
=
host_pk
)
}
except
(
Host
.
DoesNotExist
,
ValueError
):
host
=
None
initial
=
{
'owner'
:
self
.
request
.
user
}
if
host
:
initial
.
update
({
'type'
:
"CNAME"
,
'host'
:
host
,
'address'
:
host
.
get_fqdn
(),
})
else
:
initial
[
'domain'
]
=
self
.
request
.
GET
.
get
(
'domain'
)
return
initial
class
RecordDelete
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DeleteView
):
class
RecordDelete
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DeleteView
):
...
...
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