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
9b402980
authored
Mar 20, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: show hostname on vm list
parent
99a67989
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
circle/dashboard/templates/dashboard/index-vm.html
+5
-2
circle/vm/models/instance.py
+11
-0
circle/vm/tests/test_models.py
+7
-0
No files found.
circle/dashboard/templates/dashboard/index-vm.html
View file @
9b402980
...
...
@@ -16,7 +16,8 @@
<div
id=
"dashboard-vm-list"
>
{% for i in instances %}
<a
href=
"{{ i.get_absolute_url }}"
class=
"list-group-item"
>
<i
class=
"icon-{% if i.state == "
RUNNING
"
%}
play-sign
{%
else
%}
pause
{%
endif
%}"
></i>
{{ i.name }}
<i
class=
"{{ i.get_status_icon }}"
title=
"{{ i.get_status_display }}"
></i>
{{ i.name }}
<small
class=
"text-muted"
>
{{ i.primary_host.hostname }}
</small>
<div
class=
"pull-right dashboard-vm-favourite"
data-vm=
"{{ i.pk }}"
>
{% if i.fav %}
<i
class=
"icon-star text-primary title-favourite"
title=
"Unfavourite"
></i>
...
...
@@ -51,7 +52,9 @@
<p><span
class=
"bigbig"
><big>
{{ running_vm_num }}
</big>
running
</span>
<ul
class=
"list-inline"
>
{% for vm in running_vms %}
<li
class=
"label label-success"
><i
class=
"icon-play-sign"
></i>
{{ vm.name}}
</li>
<li
class=
"label label-success"
>
<a
href=
"vm.get_absolute_url"
title=
"{{vm.primary_host.get_fqdn}}"
><i
class=
"icon-play-sign"
></i>
{{ vm.name}}
</a>
</li>
{% endfor %}
</ul>
</p>
...
...
circle/vm/models/instance.py
View file @
9b402980
...
...
@@ -1177,3 +1177,14 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
**
kwargs
):
self
.
shutdown
(
user
,
task_uuid
)
self
.
save_as_template
(
name
,
**
kwargs
)
def
get_status_icon
(
self
):
return
{
'NOSTATE'
:
'icon-rocket'
,
'RUNNING'
:
'icon-play'
,
'STOPPED'
:
'icon-stop'
,
'SUSPENDED'
:
'icon-pause'
,
'ERROR'
:
'icon-warning_sign'
,
'PENDING'
:
'icon-rocket'
,
'DESTROYED'
:
'icon-trash'
,
'MIGRATING'
:
'icon-truck'
}
.
get
(
self
.
status
,
'icon-question-sign'
)
circle/vm/tests/test_models.py
View file @
9b402980
...
...
@@ -97,6 +97,13 @@ class InstanceTestCase(TestCase):
self
.
assertNotIn
(
call
()
.
__enter__
()
.
sub_activity
(
u'scheduling'
),
ia
.
mock_calls
)
def
test_status_icon
(
self
):
inst
=
MagicMock
(
spec
=
Instance
)
inst
.
status
=
'dummy-value'
self
.
assertEqual
(
Instance
.
get_status_icon
(
inst
),
'icon-question-sign'
)
inst
.
status
=
'RUNNING'
self
.
assertEqual
(
Instance
.
get_status_icon
(
inst
),
'icon-play'
)
class
InterfaceTestCase
(
TestCase
):
...
...
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