Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
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) {
...
@@ -211,6 +211,7 @@ function checkNewActivity(only_status, runs) {
success
:
function
(
data
)
{
success
:
function
(
data
)
{
if
(
!
only_status
)
{
if
(
!
only_status
)
{
$
(
"#activity-timeline"
).
html
(
data
[
'activities'
]);
$
(
"#activity-timeline"
).
html
(
data
[
'activities'
]);
$
(
"#ops"
).
html
(
data
[
'ops'
]);
$
(
"[title]"
).
tooltip
();
$
(
"[title]"
).
tooltip
();
}
}
...
...
circle/dashboard/templates/dashboard/vm-detail.html
View file @
62546528
...
@@ -6,54 +6,8 @@
...
@@ -6,54 +6,8 @@
{% block content %}
{% block content %}
<div
class=
"body-content"
>
<div
class=
"body-content"
>
<div
class=
"page-header"
>
<div
class=
"page-header"
>
<div
class=
"pull-right"
style=
"padding-top: 15px;"
>
<div
class=
"pull-right"
style=
"padding-top: 15px;"
id=
"ops"
>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% include "dashboard/vm-detail/_operations.html" %}
{% 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>
</div>
<h1>
<h1>
<div
id=
"vm-details-rename"
>
<div
id=
"vm-details-rename"
>
...
@@ -68,46 +22,6 @@
...
@@ -68,46 +22,6 @@
</div>
</div>
<small>
{{ instance.primary_host.get_fqdn }}
</small>
<small>
{{ instance.primary_host.get_fqdn }}
</small>
</h1>
</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
style=
"clear: both;"
></div>
</div>
</div>
<div
class=
"row"
>
<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):
...
@@ -64,6 +64,7 @@ class DeployOperation(InstanceOperation):
id
=
'deploy'
id
=
'deploy'
name
=
_
(
"deploy"
)
name
=
_
(
"deploy"
)
description
=
_
(
"Deploy new virtual machine with network."
)
description
=
_
(
"Deploy new virtual machine with network."
)
icon
=
'play'
def
on_commit
(
self
,
activity
):
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'RUNNING'
activity
.
resultant_state
=
'RUNNING'
...
@@ -100,6 +101,7 @@ class DestroyOperation(InstanceOperation):
...
@@ -100,6 +101,7 @@ class DestroyOperation(InstanceOperation):
id
=
'destroy'
id
=
'destroy'
name
=
_
(
"destroy"
)
name
=
_
(
"destroy"
)
description
=
_
(
"Destroy virtual machine and its networks."
)
description
=
_
(
"Destroy virtual machine and its networks."
)
icon
=
'remove'
def
on_commit
(
self
,
activity
):
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'DESTROYED'
activity
.
resultant_state
=
'DESTROYED'
...
@@ -140,6 +142,7 @@ class MigrateOperation(InstanceOperation):
...
@@ -140,6 +142,7 @@ class MigrateOperation(InstanceOperation):
id
=
'migrate'
id
=
'migrate'
name
=
_
(
"migrate"
)
name
=
_
(
"migrate"
)
description
=
_
(
"Live migrate running VM to another node."
)
description
=
_
(
"Live migrate running VM to another node."
)
icon
=
'truck'
def
_operation
(
self
,
activity
,
user
,
system
,
to_node
=
None
,
timeout
=
120
):
def
_operation
(
self
,
activity
,
user
,
system
,
to_node
=
None
,
timeout
=
120
):
if
not
to_node
:
if
not
to_node
:
...
@@ -170,6 +173,7 @@ class RebootOperation(InstanceOperation):
...
@@ -170,6 +173,7 @@ class RebootOperation(InstanceOperation):
id
=
'reboot'
id
=
'reboot'
name
=
_
(
"reboot"
)
name
=
_
(
"reboot"
)
description
=
_
(
"Reboot virtual machine with Ctrl+Alt+Del signal."
)
description
=
_
(
"Reboot virtual machine with Ctrl+Alt+Del signal."
)
icon
=
'refresh'
def
_operation
(
self
,
activity
,
user
,
system
,
timeout
=
5
):
def
_operation
(
self
,
activity
,
user
,
system
,
timeout
=
5
):
self
.
instance
.
reboot_vm
(
timeout
=
timeout
)
self
.
instance
.
reboot_vm
(
timeout
=
timeout
)
...
@@ -183,6 +187,7 @@ class ResetOperation(InstanceOperation):
...
@@ -183,6 +187,7 @@ class ResetOperation(InstanceOperation):
id
=
'reset'
id
=
'reset'
name
=
_
(
"reset"
)
name
=
_
(
"reset"
)
description
=
_
(
"Reset virtual machine (reset button)."
)
description
=
_
(
"Reset virtual machine (reset button)."
)
icon
=
'bolt'
def
_operation
(
self
,
activity
,
user
,
system
,
timeout
=
5
):
def
_operation
(
self
,
activity
,
user
,
system
,
timeout
=
5
):
self
.
instance
.
reset_vm
(
timeout
=
timeout
)
self
.
instance
.
reset_vm
(
timeout
=
timeout
)
...
@@ -199,6 +204,7 @@ class SaveAsTemplateOperation(InstanceOperation):
...
@@ -199,6 +204,7 @@ class SaveAsTemplateOperation(InstanceOperation):
Template can be shared with groups and users.
Template can be shared with groups and users.
Users can instantiate Virtual Machines from Templates.
Users can instantiate Virtual Machines from Templates.
"""
)
"""
)
icon
=
'save'
def
_operation
(
self
,
activity
,
name
,
user
,
system
,
timeout
=
300
,
def
_operation
(
self
,
activity
,
name
,
user
,
system
,
timeout
=
300
,
with_shutdown
=
True
,
**
kwargs
):
with_shutdown
=
True
,
**
kwargs
):
...
@@ -256,6 +262,7 @@ class ShutdownOperation(InstanceOperation):
...
@@ -256,6 +262,7 @@ class ShutdownOperation(InstanceOperation):
id
=
'shutdown'
id
=
'shutdown'
name
=
_
(
"shutdown"
)
name
=
_
(
"shutdown"
)
description
=
_
(
"Shutdown virtual machine with ACPI signal."
)
description
=
_
(
"Shutdown virtual machine with ACPI signal."
)
icon
=
'off'
def
on_abort
(
self
,
activity
,
error
):
def
on_abort
(
self
,
activity
,
error
):
if
isinstance
(
error
,
TimeLimitExceeded
):
if
isinstance
(
error
,
TimeLimitExceeded
):
...
@@ -280,6 +287,7 @@ class ShutOffOperation(InstanceOperation):
...
@@ -280,6 +287,7 @@ class ShutOffOperation(InstanceOperation):
id
=
'shut_off'
id
=
'shut_off'
name
=
_
(
"shut off"
)
name
=
_
(
"shut off"
)
description
=
_
(
"Shut off VM (plug-out)."
)
description
=
_
(
"Shut off VM (plug-out)."
)
icon
=
'ban-circle'
def
on_commit
(
self
,
activity
):
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'STOPPED'
activity
.
resultant_state
=
'STOPPED'
...
@@ -306,6 +314,7 @@ class SleepOperation(InstanceOperation):
...
@@ -306,6 +314,7 @@ class SleepOperation(InstanceOperation):
id
=
'sleep'
id
=
'sleep'
name
=
_
(
"sleep"
)
name
=
_
(
"sleep"
)
description
=
_
(
"Suspend virtual machine with memory dump."
)
description
=
_
(
"Suspend virtual machine with memory dump."
)
icon
=
'moon'
def
check_precond
(
self
):
def
check_precond
(
self
):
super
(
SleepOperation
,
self
)
.
check_precond
()
super
(
SleepOperation
,
self
)
.
check_precond
()
...
@@ -345,6 +354,7 @@ class WakeUpOperation(InstanceOperation):
...
@@ -345,6 +354,7 @@ class WakeUpOperation(InstanceOperation):
Power on Virtual Machine and load its memory from dump.
Power on Virtual Machine and load its memory from dump.
"""
)
"""
)
icon
=
'sun'
def
check_precond
(
self
):
def
check_precond
(
self
):
super
(
WakeUpOperation
,
self
)
.
check_precond
()
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