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
05291f17
authored
Aug 08, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-239' into 'master'
Add running instance count to template-list
parents
3aaeff41
5274ed89
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
10 deletions
+28
-10
circle/dashboard/tables.py
+17
-10
circle/dashboard/templates/dashboard/template-list/column-template-name.html
+3
-0
circle/dashboard/templates/dashboard/template-list/column-template-owner.html
+1
-0
circle/dashboard/templates/dashboard/template-list/column-template-running.html
+3
-0
circle/dashboard/views.py
+1
-0
circle/vm/models/instance.py
+3
-0
No files found.
circle/dashboard/tables.py
View file @
05291f17
...
...
@@ -184,9 +184,8 @@ class UserListTablex(Table):
class
TemplateListTable
(
Table
):
name
=
LinkColumn
(
'dashboard.views.template-detail'
,
args
=
[
A
(
'pk'
)],
name
=
TemplateColumn
(
template_name
=
"dashboard/template-list/column-template-name.html"
,
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
num_cores
=
Column
(
...
...
@@ -194,23 +193,31 @@ class TemplateListTable(Table):
attrs
=
{
'th'
:
{
'data-sort'
:
"int"
}}
)
ram_size
=
TemplateColumn
(
"{{ record.ram_size }} M
b
"
,
attrs
=
{
'th'
:
{
'data-sort'
:
"
string"
}}
"{{ record.ram_size }} M
iB
"
,
attrs
=
{
'th'
:
{
'data-sort'
:
"
int"
}},
)
lease
=
TemplateColumn
(
"{{ record.lease.name }}"
,
verbose_name
=
_
(
"Lease"
),
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
arch
=
Column
(
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
system
=
Column
(
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
access_method
=
Column
(
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
owner
=
TemplateColumn
(
template_name
=
"dashboard/template-list/column-template-owner.html"
,
verbose_name
=
_
(
"Owner"
),
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
running
=
TemplateColumn
(
template_name
=
"dashboard/template-list/column-template-running.html"
,
verbose_name
=
_
(
"Running"
),
attrs
=
{
'th'
:
{
'data-sort'
:
"int"
}},
orderable
=
False
,
)
actions
=
TemplateColumn
(
verbose_name
=
_
(
"Actions"
),
template_name
=
"dashboard/template-list/column-template-actions.html"
,
...
...
@@ -222,8 +229,8 @@ class TemplateListTable(Table):
model
=
InstanceTemplate
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover'
' template-list-table'
)}
fields
=
(
'name'
,
'num_cores'
,
'ram_size'
,
'
arch
'
,
'
system'
,
'access_method'
,
'lease
'
,
'actions'
,
)
fields
=
(
'name'
,
'num_cores'
,
'ram_size'
,
'
system
'
,
'
access_method'
,
'lease'
,
'owner'
,
'running
'
,
'actions'
,
)
prefix
=
"template-"
...
...
circle/dashboard/templates/dashboard/template-list/column-template-name.html
0 → 100644
View file @
05291f17
<a
href=
"{% url "
dashboard
.
views
.
template-detail
"
pk=
record.pk
%}"
title=
"{{ record.description }}"
>
{{ record.name }}
</a>
circle/dashboard/templates/dashboard/template-list/column-template-owner.html
0 → 100644
View file @
05291f17
{% include "dashboard/_display-name.html" with user=record.owner show_org=True %}
circle/dashboard/templates/dashboard/template-list/column-template-running.html
0 → 100644
View file @
05291f17
<a
href=
"{% url "
dashboard
.
views
.
vm-list
"
%}?
s=
template:{{
record
.
pk
}}%
20status:running
"
>
{{ record.get_running_instances.count }}
</a>
circle/dashboard/views.py
View file @
05291f17
...
...
@@ -1555,6 +1555,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
'tags[]'
:
"tags__name__in"
,
'tags'
:
"tags__name__in"
,
# for search string
'owner'
:
"owner__username"
,
'template'
:
"template__pk"
,
}
def
get
(
self
,
*
args
,
**
kwargs
):
...
...
circle/vm/models/instance.py
View file @
05291f17
...
...
@@ -203,6 +203,9 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
for
disk
in
self
.
disks
.
all
():
disk
.
destroy
()
def
get_running_instances
(
self
):
return
Instance
.
active
.
filter
(
template
=
self
,
status
=
"RUNNING"
)
class
Instance
(
AclBase
,
VirtualMachineDescModel
,
StatusModel
,
OperatedMixin
,
TimeStampedModel
):
...
...
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