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
a3138b02
authored
Aug 06, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: enhance template list table
Closes #239
parent
aef328d4
Show 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 @
a3138b02
...
@@ -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 @
a3138b02
<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 @
a3138b02
{% 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 @
a3138b02
<a
href=
"{% url "
dashboard
.
views
.
vm-list
"
%}?
s=
template:{{
record
.
pk
}}
status:running
"
>
{{ record.get_running_instances.count }}
</a>
circle/dashboard/views.py
View file @
a3138b02
...
@@ -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 @
a3138b02
...
@@ -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