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
9a58a90e
authored
Apr 03, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webui: show ipv4/6 addresses
parent
23e46445
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
22 deletions
+59
-22
one/templates/show.html
+36
-10
one/templates/vm-credentials.html
+16
-6
one/views.py
+7
-6
No files found.
one/templates/show.html
View file @
9a58a90e
...
@@ -146,20 +146,51 @@
...
@@ -146,20 +146,51 @@
<table>
<table>
<tr>
<tr>
<th>
{% trans "Protocol" %}
</th>
<th>
{% trans "Protocol" %}
</th>
<th>
{% trans "Public port" %}
</th>
<th
colspan=
"2"
>
{% trans "Access" %}
</th>
{% if i.template.network.nat %}
<th
colspan=
"2"
>
{% trans "Private port" %}
</th>
{%endif%}
</tr>
</tr>
{% for port in ports %}
{% for port in ports %}
<tr>
<tr>
<td>
{{port.proto}}
</td>
<td>
{{port.private}}/{{port.proto}}
</td>
<td>
{{port.public}}
</td>
<td
style=
"white-space: nowrap;"
>
{% if i.template.network.nat %}
<td>
{{port.private}}
</td>
{%endif%}
{% if port.private == 80 or port.private == 8080 or port.private == 8000 %}
<a
href=
"http://{{port.ipv4.host}}:{{port.ipv4.port}}"
>
{{port.ipv4.host}}:{{port.ipv4.port}}
</a>
{% elif port.private == 443 %}
<a
href=
"https://{{port.ipv4.host}}:{{port.ipv4.port}}"
>
{{port.ipv4.host}}:{{port.ipv4.port}}
</a>
{% else %}
{{port.ipv4.host}}:{{port.ipv4.port}}
{% endif %}
</td>
<td>
<a
href=
"{% url one.views.vm_port_del i.id port.proto port.public %}"
>
{% trans "Delete" %}
</a>
</td>
</tr>
<tr>
<td>
{{port.private}}/{{port.proto}}6
</td>
<td
style=
"white-space: nowrap;"
>
{% if port.private == 80 or port.private == 8080 or port.private == 8000 %}
<a
href=
"http://{{port.ipv6.host}}:{{port.ipv6.port}}"
>
{{port.ipv6.host}}:{{port.ipv6.port}}
</a>
{% elif port.private == 443 %}
<a
href=
"https://{{port.ipv6.host}}:{{port.ipv6.port}}"
>
{{port.ipv6.host}}:{{port.ipv6.port}}
</a>
{% else %}
{{port.ipv6.host}}:{{port.ipv6.port}}
{% endif %}
</td>
<td>
<td>
<a
href=
"{% url one.views.vm_port_del i.id port.proto port.public %}"
>
{% trans "Delete" %}
</a>
<a
href=
"{% url one.views.vm_port_del i.id port.proto port.public %}"
>
{% trans "Delete" %}
</a>
</td>
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
<tr>
<tr>
<th>
Protokoll
</th>
<th
colspan=
"2"
>
Port
</th>
</tr>
<tr>
<td>
<td>
<select
style=
"min-width:50px;"
name=
proto
>
<select
style=
"min-width:50px;"
name=
proto
>
<option
value=
"tcp"
>
tcp
</option>
<option
value=
"tcp"
>
tcp
</option>
...
@@ -169,11 +200,6 @@
...
@@ -169,11 +200,6 @@
<td>
<td>
<input
style=
"min-width:70px;width:70px;"
type=
"text"
name=
"public"
/>
<input
style=
"min-width:70px;width:70px;"
type=
"text"
name=
"public"
/>
</td>
</td>
{% if i.template.network.nat %}
<td>
<input
style=
"min-width:70px;width:70px;"
type=
"text"
name=
"private"
/>
</td>
{% endif %}
<td>
<td>
<input
type=
"submit"
style=
"min-width:3em"
value=
"{% trans "
Add
"
%}"
/>
<input
type=
"submit"
style=
"min-width:3em"
value=
"{% trans "
Add
"
%}"
/>
</td>
</td>
...
...
one/templates/vm-credentials.html
View file @
9a58a90e
...
@@ -37,13 +37,23 @@
...
@@ -37,13 +37,23 @@
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<th>
{% trans "
Host" %}{% if i.is_ipv6 %} (
<a
href=
"#"
class=
"host-toggle"
><span
class=
"v4"
>
IPv4
</span><span
class=
"v6"
>
IPv6
</span></a>
){% endif %}:
</th>
<th>
{% trans "
IPv4 Host" %}{% if i.is_ipv6 %} ({% trans "You are using IPv6" %}
){% endif %}:
</th>
<td>
<span
class=
"host"
>
{{ i.hostname }}
</span><span
class=
"ipv4host"
>
{{i.hostname_v4}}
</span>
</td>
<td>
{{ i.hostname_v4 }}
</td>
</tr>
</tr>
{% if i.nat %}
<tr>
<tr>
<th>
{% trans "Port" %}:
</th>
<th>
{% trans "IPv6 Host" %}{% if not i.is_ipv6 %} ({% trans "You are using IPv4" %}){% endif %}:
</th>
<td>
{{ i.port}}
</td>
<td>
{{ i.hostname_v6 }}
</td>
</tr>
{% endif %}
</tr>
{% if i.nat %}
<tr>
<th>
{% trans "IPv4 Port" %}:
</th>
<td>
{{ i.port_v4 }}
</td>
</tr>
<tr>
<th>
{% trans "IPv6 Port" %}:
</th>
<td>
{{ i.port_v6 }}
</td>
</tr>
{% endif %}
<tr>
<tr>
<th>
{% trans "Username" %}:
</th>
<th>
{% trans "Username" %}:
</th>
<td>
cloud
</td>
<td>
cloud
</td>
...
...
one/views.py
View file @
9a58a90e
...
@@ -105,11 +105,12 @@ def vm_credentials(request, iid):
...
@@ -105,11 +105,12 @@ def vm_credentials(request, iid):
try
:
try
:
vm
=
get_object_or_404
(
Instance
,
pk
=
iid
,
owner
=
request
.
user
)
vm
=
get_object_or_404
(
Instance
,
pk
=
iid
,
owner
=
request
.
user
)
is_ipv6
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
is_ipv6
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
vm
.
hostname
=
vm
.
get_connect_host
(
use_ipv6
=
is_ipv6
)
vm
.
is_ipv6
=
is_ipv6
vm
.
hostname_v4
=
vm
.
get_connect_host
(
use_ipv6
=
False
)
vm
.
hostname_v4
=
vm
.
get_connect_host
(
use_ipv6
=
False
)
vm
.
hostname_v6
=
vm
.
get_connect_host
(
use_ipv6
=
True
)
vm
.
is_ipv6
=
is_ipv6
vm
.
nat
=
vm
.
template
.
network
.
nat
vm
.
nat
=
vm
.
template
.
network
.
nat
vm
.
port
=
vm
.
get_port
(
use_ipv6
=
is_ipv6
)
vm
.
port_v4
=
vm
.
get_port
(
use_ipv6
=
False
)
vm
.
port_v6
=
vm
.
get_port
(
use_ipv6
=
True
)
return
render_to_response
(
'vm-credentials.html'
,
RequestContext
(
request
,
{
'i'
:
vm
}))
return
render_to_response
(
'vm-credentials.html'
,
RequestContext
(
request
,
{
'i'
:
vm
}))
except
:
except
:
return
HttpResponse
(
_
(
"Could not get Virtual Machine credentials."
),
status
=
404
)
return
HttpResponse
(
_
(
"Could not get Virtual Machine credentials."
),
status
=
404
)
...
@@ -370,10 +371,10 @@ def vm_show(request, iid):
...
@@ -370,10 +371,10 @@ def vm_show(request, iid):
is_ipv6
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
is_ipv6
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
inst
.
is_ipv6
=
is_ipv6
inst
.
is_ipv6
=
is_ipv6
inst
.
hostname_v4
=
inst
.
get_connect_host
(
use_ipv6
=
False
)
inst
.
hostname_v4
=
inst
.
get_connect_host
(
use_ipv6
=
False
)
inst
.
hostname_v6
=
inst
.
get_connect_host
(
use_ipv6
=
True
)
inst
.
nat
=
inst
.
template
.
network
.
nat
inst
.
nat
=
inst
.
template
.
network
.
nat
inst
.
port
=
inst
.
get_port
(
use_ipv6
=
is_ipv6
)
inst
.
port_v4
=
inst
.
get_port
(
use_ipv6
=
False
)
inst
.
hostname
=
inst
.
get_connect_host
(
use_ipv6
=
is_ipv6
)
inst
.
port_v6
=
inst
.
get_port
(
use_ipv6
=
True
)
inst
.
port
=
inst
.
get_port
(
use_ipv6
=
is_ipv6
)
return
render_to_response
(
"show.html"
,
RequestContext
(
request
,{
return
render_to_response
(
"show.html"
,
RequestContext
(
request
,{
'uri'
:
inst
.
get_connect_uri
(),
'uri'
:
inst
.
get_connect_uri
(),
'state'
:
inst
.
state
,
'state'
:
inst
.
state
,
...
...
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