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
62546528
authored
Apr 16, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add operations to vm-details templates
parent
a77de49a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
88 deletions
+27
-88
circle/dashboard/static/dashboard/vm-details.js
+1
-0
circle/dashboard/templates/dashboard/vm-detail.html
+2
-88
circle/dashboard/templates/dashboard/vm-detail/_operations.html
+14
-0
circle/vm/operations.py
+10
-0
No files found.
circle/dashboard/static/dashboard/vm-details.js
View file @
62546528
...
...
@@ -211,6 +211,7 @@ function checkNewActivity(only_status, runs) {
success
:
function
(
data
)
{
if
(
!
only_status
)
{
$
(
"#activity-timeline"
).
html
(
data
[
'activities'
]);
$
(
"#ops"
).
html
(
data
[
'ops'
]);
$
(
"[title]"
).
tooltip
();
}
...
...
circle/dashboard/templates/dashboard/vm-detail.html
View file @
62546528
...
...
@@ -6,54 +6,8 @@
{% block content %}
<div
class=
"body-content"
>
<div
class=
"page-header"
>
<div
class=
"pull-right"
style=
"padding-top: 15px;"
>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"sleep"
/>
<button
title=
"{% trans "
Sleep
"
%}"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-moon"
></i></button>
</form>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"deploy"
/>
<button
title=
"{% trans "
Deploy
"
%}"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-play"
></i></button>
</form>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"wake_up"
/>
<button
title=
"{% trans "
Wake
up
"
%}"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-sun"
></i></button>
</form>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"shut_down"
/>
<button
title=
"{% trans "
Shut
down
"
%}"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-off"
></i></button>
</form>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"reboot"
/>
<button
title=
"{% trans "
Reboot
(
ctrl
+
alt
+
del
)"
%}"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-refresh"
></i></button>
</form>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"reset"
/>
<button
title=
"{% trans "
Reset
(
power
cycle
)"
%}"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-bolt"
></i></button>
</form>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"shut_off"
/>
<button
title=
"{% trans "
Shut
off
"
%}"
class=
"btn btn-default btn-xs"
type=
"submit"
>
<i
class=
"icon-ban-circle"
></i>
</button>
</form>
<a
title=
"Migrate"
data-vm-pk=
"{{ instance.pk }}"
href=
"{% url "
dashboard
.
views
.
vm-migrate
"
pk=
instance.pk
%}"
class=
"btn btn-default btn-xs vm-migrate"
>
<i
class=
"icon-truck"
></i>
</a>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"save_as"
/>
<button
title=
"{% trans "
Save
as
template
"
%}"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-save"
></i></button>
</form>
<a
title=
"{% trans "
Destroy
"
%}"
href=
"{% url "
dashboard
.
views
.
delete-vm
"
pk=
instance.pk
%}"
class=
"btn btn-default btn-xs vm-delete"
data-vm-pk=
"{{ instance.pk }}"
><i
class=
"icon-remove"
></i></a>
<a
title=
"{% trans "
Help
"
%}"
href=
"#"
class=
"btn btn-default btn-xs vm-details-help-button"
><i
class=
"icon-question"
></i></a>
<div
class=
"pull-right"
style=
"padding-top: 15px;"
id=
"ops"
>
{% include "dashboard/vm-detail/_operations.html" %}
</div>
<h1>
<div
id=
"vm-details-rename"
>
...
...
@@ -68,46 +22,6 @@
</div>
<small>
{{ instance.primary_host.get_fqdn }}
</small>
</h1>
<div
class=
"vm-details-help js-hidden"
>
<ul
style=
"list-style: none;"
>
<li>
<strong>
{% trans "Sleep" %}:
</strong>
{% trans "Suspend virtual machine with memory dump." %}
</li>
<li>
<strong>
{% trans "Wake up" %}:
</strong>
{% trans "Wake up suspended machine." %}
</li>
<li>
<strong>
{% trans "Shutdown" %}:
</strong>
{% trans "Shutdown virtual machine with ACPI signal." %}
</li>
<li>
<strong>
{% trans "Reboot (ctrl + alt + del)" %}:
</strong>
{% trans "Reboot virtual machine with Ctrl+Alt+Del signal." %}
</li>
<li>
<strong>
{% trans "Reset (power cycle)" %}:
</strong>
{% trans "Reset virtual machine (reset button)" %}
</li>
<li>
<strong>
{% trans "Shut off" %}:
</strong>
{% trans "Shut off VM. (plug-out)" %}
</li>
<li>
<strong>
{% trans "Migrate" %}:
</strong>
{% trans "Live migrate running vm to another node." %}
</li>
<li>
<strong>
{% trans "Save as template" %}:
</strong>
{% trans "Shut down the virtual machine, and save it as a new template." %}
</li>
<li>
<strong>
{% trans "Destroy" %}:
</strong>
{% trans "Remove virtual machine and its networks." %}
</li>
</ul>
</div>
<div
style=
"clear: both;"
></div>
</div>
<div
class=
"row"
>
...
...
circle/dashboard/templates/dashboard/vm-detail/_operations.html
0 → 100644
View file @
62546528
{% load i18n %}
{% for op in ops %}
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
class=
"operation operation-{{op.id}}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"{{op.id}}"
/>
<button
title=
"{{op.name}}: {{op.description}}"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-{{op.icon|default:'cog'}}"
></i></button>
</form>
{% endfor %}
{% if user.is_superuser %}
<a
title=
"Migrate"
data-vm-pk=
"{{ instance.pk }}"
href=
"{% url "
dashboard
.
views
.
vm-migrate
"
pk=
instance.pk
%}"
class=
"btn btn-default btn-xs vm-migrate"
>
<i
class=
"icon-truck"
></i>
</a>
{% endif %}
circle/vm/operations.py
View file @
62546528
...
...
@@ -64,6 +64,7 @@ class DeployOperation(InstanceOperation):
id
=
'deploy'
name
=
_
(
"deploy"
)
description
=
_
(
"Deploy new virtual machine with network."
)
icon
=
'play'
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'RUNNING'
...
...
@@ -100,6 +101,7 @@ class DestroyOperation(InstanceOperation):
id
=
'destroy'
name
=
_
(
"destroy"
)
description
=
_
(
"Destroy virtual machine and its networks."
)
icon
=
'remove'
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'DESTROYED'
...
...
@@ -140,6 +142,7 @@ class MigrateOperation(InstanceOperation):
id
=
'migrate'
name
=
_
(
"migrate"
)
description
=
_
(
"Live migrate running VM to another node."
)
icon
=
'truck'
def
_operation
(
self
,
activity
,
user
,
system
,
to_node
=
None
,
timeout
=
120
):
if
not
to_node
:
...
...
@@ -170,6 +173,7 @@ class RebootOperation(InstanceOperation):
id
=
'reboot'
name
=
_
(
"reboot"
)
description
=
_
(
"Reboot virtual machine with Ctrl+Alt+Del signal."
)
icon
=
'refresh'
def
_operation
(
self
,
activity
,
user
,
system
,
timeout
=
5
):
self
.
instance
.
reboot_vm
(
timeout
=
timeout
)
...
...
@@ -183,6 +187,7 @@ class ResetOperation(InstanceOperation):
id
=
'reset'
name
=
_
(
"reset"
)
description
=
_
(
"Reset virtual machine (reset button)."
)
icon
=
'bolt'
def
_operation
(
self
,
activity
,
user
,
system
,
timeout
=
5
):
self
.
instance
.
reset_vm
(
timeout
=
timeout
)
...
...
@@ -199,6 +204,7 @@ class SaveAsTemplateOperation(InstanceOperation):
Template can be shared with groups and users.
Users can instantiate Virtual Machines from Templates.
"""
)
icon
=
'save'
def
_operation
(
self
,
activity
,
name
,
user
,
system
,
timeout
=
300
,
with_shutdown
=
True
,
**
kwargs
):
...
...
@@ -256,6 +262,7 @@ class ShutdownOperation(InstanceOperation):
id
=
'shutdown'
name
=
_
(
"shutdown"
)
description
=
_
(
"Shutdown virtual machine with ACPI signal."
)
icon
=
'off'
def
on_abort
(
self
,
activity
,
error
):
if
isinstance
(
error
,
TimeLimitExceeded
):
...
...
@@ -280,6 +287,7 @@ class ShutOffOperation(InstanceOperation):
id
=
'shut_off'
name
=
_
(
"shut off"
)
description
=
_
(
"Shut off VM (plug-out)."
)
icon
=
'ban-circle'
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'STOPPED'
...
...
@@ -306,6 +314,7 @@ class SleepOperation(InstanceOperation):
id
=
'sleep'
name
=
_
(
"sleep"
)
description
=
_
(
"Suspend virtual machine with memory dump."
)
icon
=
'moon'
def
check_precond
(
self
):
super
(
SleepOperation
,
self
)
.
check_precond
()
...
...
@@ -345,6 +354,7 @@ class WakeUpOperation(InstanceOperation):
Power on Virtual Machine and load its memory from dump.
"""
)
icon
=
'sun'
def
check_precond
(
self
):
super
(
WakeUpOperation
,
self
)
.
check_precond
()
...
...
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