Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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 @@
{% trans "Owner" as t %}
{% include "dashboard/vm-list/header-link.html" with name=t sort="owner" %}
</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 %}
{% include "dashboard/vm-list/header-link.html" with name=t sort="node" %}
</th>
{% endif %}
</th>
{% endif %}
</tr></thead><tbody>
{% for i in object_list %}
<tr
class=
"{% cycle 'odd' 'even' %}"
data-vm-pk=
"{{ i.pk }}"
>
...
...
@@ -93,7 +103,13 @@
{% endif %}
{# include "dashboard/_display-name.html" with user=i.owner show_org=True #}
</td>
<td
class=
"lease "
data-sort-value=
"{{ i.lease.name }}"
>
{{ i.lease.name }}
</td>
{% 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 }}"
>
{{ i.node.name|default:"-" }}
</td>
...
...
@@ -101,7 +117,7 @@
</tr>
{% empty %}
<tr>
<td
colspan=
"
5
"
>
<td
colspan=
"
7
"
>
{% if request.GET.s %}
<strong>
{% trans "No result." %}
</strong>
{% else %}
...
...
circle/dashboard/views.py
View file @
045df7bb
...
...
@@ -1875,7 +1875,8 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
return
queryset
.
filter
(
**
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
):
...
...
circle/vm/models/instance.py
View file @
045df7bb
...
...
@@ -513,7 +513,12 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
def
ipv4
(
self
):
"""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
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