Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
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):
...
@@ -184,9 +184,8 @@ class UserListTablex(Table):
class
TemplateListTable
(
Table
):
class
TemplateListTable
(
Table
):
name
=
LinkColumn
(
name
=
TemplateColumn
(
'dashboard.views.template-detail'
,
template_name
=
"dashboard/template-list/column-template-name.html"
,
args
=
[
A
(
'pk'
)],
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
)
num_cores
=
Column
(
num_cores
=
Column
(
...
@@ -194,23 +193,31 @@ class TemplateListTable(Table):
...
@@ -194,23 +193,31 @@ class TemplateListTable(Table):
attrs
=
{
'th'
:
{
'data-sort'
:
"int"
}}
attrs
=
{
'th'
:
{
'data-sort'
:
"int"
}}
)
)
ram_size
=
TemplateColumn
(
ram_size
=
TemplateColumn
(
"{{ record.ram_size }} M
b
"
,
"{{ record.ram_size }} M
iB
"
,
attrs
=
{
'th'
:
{
'data-sort'
:
"
string"
}}
attrs
=
{
'th'
:
{
'data-sort'
:
"
int"
}},
)
)
lease
=
TemplateColumn
(
lease
=
TemplateColumn
(
"{{ record.lease.name }}"
,
"{{ record.lease.name }}"
,
verbose_name
=
_
(
"Lease"
),
verbose_name
=
_
(
"Lease"
),
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
)
arch
=
Column
(
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
system
=
Column
(
system
=
Column
(
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
)
)
access_method
=
Column
(
access_method
=
Column
(
attrs
=
{
'th'
:
{
'data-sort'
:
"string"
}}
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
(
actions
=
TemplateColumn
(
verbose_name
=
_
(
"Actions"
),
verbose_name
=
_
(
"Actions"
),
template_name
=
"dashboard/template-list/column-template-actions.html"
,
template_name
=
"dashboard/template-list/column-template-actions.html"
,
...
@@ -222,8 +229,8 @@ class TemplateListTable(Table):
...
@@ -222,8 +229,8 @@ class TemplateListTable(Table):
model
=
InstanceTemplate
model
=
InstanceTemplate
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover'
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover'
' template-list-table'
)}
' template-list-table'
)}
fields
=
(
'name'
,
'num_cores'
,
'ram_size'
,
'
arch
'
,
fields
=
(
'name'
,
'num_cores'
,
'ram_size'
,
'
system
'
,
'
system'
,
'access_method'
,
'lease
'
,
'actions'
,
)
'
access_method'
,
'lease'
,
'owner'
,
'running
'
,
'actions'
,
)
prefix
=
"template-"
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):
...
@@ -1555,6 +1555,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
'tags[]'
:
"tags__name__in"
,
'tags[]'
:
"tags__name__in"
,
'tags'
:
"tags__name__in"
,
# for search string
'tags'
:
"tags__name__in"
,
# for search string
'owner'
:
"owner__username"
,
'owner'
:
"owner__username"
,
'template'
:
"template__pk"
,
}
}
def
get
(
self
,
*
args
,
**
kwargs
):
def
get
(
self
,
*
args
,
**
kwargs
):
...
...
circle/vm/models/instance.py
View file @
05291f17
...
@@ -203,6 +203,9 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -203,6 +203,9 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
for
disk
in
self
.
disks
.
all
():
for
disk
in
self
.
disks
.
all
():
disk
.
destroy
()
disk
.
destroy
()
def
get_running_instances
(
self
):
return
Instance
.
active
.
filter
(
template
=
self
,
status
=
"RUNNING"
)
class
Instance
(
AclBase
,
VirtualMachineDescModel
,
StatusModel
,
OperatedMixin
,
class
Instance
(
AclBase
,
VirtualMachineDescModel
,
StatusModel
,
OperatedMixin
,
TimeStampedModel
):
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