Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
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
03ac86a3
authored
Feb 10, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: vm action buttons
parent
d488150d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
13 deletions
+65
-13
circle/dashboard/templates/dashboard/vm-detail.html
+19
-10
circle/dashboard/views.py
+46
-3
No files found.
circle/dashboard/templates/dashboard/vm-detail.html
View file @
03ac86a3
...
...
@@ -6,25 +6,34 @@
<div
class=
"page-header"
>
<div
class=
"pull-right"
style=
"padding-top: 15px;"
>
<a
title=
"Rename"
href=
"#"
class=
"btn btn-default btn-xs vm-details-rename-button"
><i
class=
"icon-pencil"
></i></a>
{% if instance.state.lower == "running" %}
<a
title=
"Pause"
href=
"#"
class=
"btn btn-default btn-xs"
><i
class=
"icon-pause"
></i></a>
<a
title=
"Sleep"
href=
"#"
class=
"btn btn-default btn-xs"
><i
class=
"icon-moon"
></i></a>
{% else %}
<a
title=
"Start"
href=
"#"
class=
"btn btn-default btn-xs"
><i
class=
"icon-play"
></i></a>
<a
title=
"Wake up"
href=
"#"
class=
"btn btn-default btn-xs"
><i
class=
"icon-sun"
></i></a>
{% endif %}
<a
title=
"Pause == sleep?"
href=
"#"
class=
"btn btn-default btn-xs"
><i
class=
"icon-pause"
></i></a>
<form
style=
"display: inline;"
method=
"POST"
action=
"{% url "
dashboard
.
views
.
detail
"
pk=
instance.pk
%}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"sleep"
value=
"dummy"
/>
<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"
value=
"dummy"
/>
<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"
value=
"dummy"
/>
<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"
value=
"dummy"
/>
<button
title=
"
Shut down
"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-off"
></i></button>
<button
title=
"
{% trans "
Shut
down
"
%}
"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-off"
></i></button>
</form>
<a
title=
"Migrate"
href=
"#"
class=
"btn btn-default btn-xs"
><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"
value=
"dummy"
/>
<button
title=
"
Save as template
"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-save"
></i></button>
<button
title=
"
{% trans "
Save
as
template
"
%}
"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-save"
></i></button>
</form>
<a
title=
"
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 "
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>
</div>
<h1>
<div
id=
"vm-details-rename"
>
...
...
circle/dashboard/views.py
View file @
03ac86a3
...
...
@@ -177,8 +177,12 @@ class VmDetailView(CheckedDetailView):
'save_as'
:
self
.
__save_as
,
'disk-name'
:
self
.
__add_disk
,
'shut_down'
:
self
.
__shut_down
,
'sleep'
:
self
.
__sleep
,
'wake_up'
:
self
.
__wake_up
,
'deploy'
:
self
.
__deploy
,
'reset'
:
self
.
__reset
,
'reboot'
:
self
.
__reboot
,
}
for
k
,
v
in
options
.
iteritems
():
if
request
.
POST
.
get
(
k
)
is
not
None
:
return
v
(
request
)
...
...
@@ -370,8 +374,47 @@ class VmDetailView(CheckedDetailView):
raise
PermissionDenied
()
self
.
object
.
shutdown_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
reverse_lazy
(
"dashboard.views.detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
def
__sleep
(
self
,
request
):
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
self
.
object
.
sleep_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
def
__wake_up
(
self
,
request
):
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
self
.
object
.
wake_up_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
def
__deploy
(
self
,
request
):
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
self
.
object
.
deploy_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
def
__reset
(
self
,
request
):
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
self
.
object
.
reset_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
def
__reboot
(
self
,
request
):
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
self
.
object
.
reboot_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
class
NodeDetailView
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DetailView
):
...
...
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