Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
045df7bb
authored
Sep 02, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add ip and lease for vm list
parent
2fc29987
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
circle/dashboard/templates/dashboard/vm-list.html
+19
-3
circle/dashboard/views.py
+2
-1
circle/vm/models/instance.py
+6
-1
No files found.
circle/dashboard/templates/dashboard/vm-list.html
View file @
045df7bb
...
@@ -68,10 +68,20 @@
...
@@ -68,10 +68,20 @@
{% trans "Owner" as t %}
{% trans "Owner" as t %}
{% include "dashboard/vm-list/header-link.html" with name=t sort="owner" %}
{% include "dashboard/vm-list/header-link.html" with name=t sort="owner" %}
</th>
</th>
{% if user.is_superuser %}
<th
data-sort=
"string"
class=
"orderable sortable"
>
<th
data-sort=
"string"
class=
"orderable sortable"
>
{% trans "Lease" as t %}
{% include "dashboard/vm-list/header-link.html" with name=t sort="lease" %}
</th>
{% if user.is_superuser %}
<th
data-sort=
"string"
class=
"orderable sortable"
>
{% trans "IP address" as t %}
{% include "dashboard/vm-list/header-link.html" with name=t sort="ip_addr" %}
</th>
<th
data-sort=
"string"
class=
"orderable sortable"
>
{% trans "Node" as t %}
{% trans "Node" as t %}
{% include "dashboard/vm-list/header-link.html" with name=t sort="node" %}
{% include "dashboard/vm-list/header-link.html" with name=t sort="node" %}
</th>
{% endif %}
</th>
{% endif %}
</tr></thead><tbody>
</tr></thead><tbody>
{% for i in object_list %}
{% for i in object_list %}
<tr
class=
"{% cycle 'odd' 'even' %}"
data-vm-pk=
"{{ i.pk }}"
>
<tr
class=
"{% cycle 'odd' 'even' %}"
data-vm-pk=
"{{ i.pk }}"
>
...
@@ -93,7 +103,13 @@
...
@@ -93,7 +103,13 @@
{% endif %}
{% endif %}
{# include "dashboard/_display-name.html" with user=i.owner show_org=True #}
{# include "dashboard/_display-name.html" with user=i.owner show_org=True #}
</td>
</td>
<td
class=
"lease "
data-sort-value=
"{{ i.lease.name }}"
>
{{ i.lease.name }}
</td>
{% if user.is_superuser %}
{% if user.is_superuser %}
<td
class=
"ip_addr "
data-sort-value=
"{{ i.ipv4 }}"
>
{{ i.ipv4|default:"-" }}
</td>
<td
class=
"node "
data-sort-value=
"{{ i.node.normalized_name }}"
>
<td
class=
"node "
data-sort-value=
"{{ i.node.normalized_name }}"
>
{{ i.node.name|default:"-" }}
{{ i.node.name|default:"-" }}
</td>
</td>
...
@@ -101,7 +117,7 @@
...
@@ -101,7 +117,7 @@
</tr>
</tr>
{% empty %}
{% empty %}
<tr>
<tr>
<td
colspan=
"
5
"
>
<td
colspan=
"
7
"
>
{% if request.GET.s %}
{% if request.GET.s %}
<strong>
{% trans "No result." %}
</strong>
<strong>
{% trans "No result." %}
</strong>
{% else %}
{% else %}
...
...
circle/dashboard/views.py
View file @
045df7bb
...
@@ -1875,7 +1875,8 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
...
@@ -1875,7 +1875,8 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
return
queryset
.
filter
(
return
queryset
.
filter
(
**
self
.
get_queryset_filters
())
.
prefetch_related
(
**
self
.
get_queryset_filters
())
.
prefetch_related
(
"owner"
,
"node"
,
"owner__profile"
)
.
distinct
()
"owner"
,
"node"
,
"owner__profile"
,
"interface_set"
,
"lease"
,
"interface_set__host"
)
.
distinct
()
class
NodeList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
SingleTableView
):
class
NodeList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
SingleTableView
):
...
...
circle/vm/models/instance.py
View file @
045df7bb
...
@@ -513,7 +513,12 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -513,7 +513,12 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
def
ipv4
(
self
):
def
ipv4
(
self
):
"""Primary IPv4 address of the instance.
"""Primary IPv4 address of the instance.
"""
"""
return
self
.
primary_host
.
ipv4
if
self
.
primary_host
else
None
# return self.primary_host.ipv4 if self.primary_host else None
for
i
in
self
.
interface_set
.
all
():
if
i
.
host
:
return
i
.
host
.
ipv4
return
None
@property
@property
def
ipv6
(
self
):
def
ipv6
(
self
):
...
...
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