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
cb95f714
authored
Mar 12, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: shut off button
parent
54080b7a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
circle/dashboard/templates/dashboard/vm-detail.html
+7
-0
circle/dashboard/views.py
+9
-0
No files found.
circle/dashboard/templates/dashboard/vm-detail.html
View file @
cb95f714
...
...
@@ -36,6 +36,13 @@
<input
type=
"hidden"
name=
"reset"
value=
"dummy"
/>
<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>
...
...
circle/dashboard/views.py
View file @
cb95f714
...
...
@@ -231,6 +231,7 @@ class VmDetailView(CheckedDetailView):
'deploy'
:
self
.
__deploy
,
'reset'
:
self
.
__reset
,
'reboot'
:
self
.
__reboot
,
'shut_off'
:
self
.
__shut_off
,
}
for
k
,
v
in
options
.
iteritems
():
if
request
.
POST
.
get
(
k
)
is
not
None
:
...
...
@@ -465,6 +466,14 @@ class VmDetailView(CheckedDetailView):
self
.
object
.
reboot_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
def
__shut_off
(
self
,
request
):
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
self
.
object
.
shut_off_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
class
NodeDetailView
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DetailView
):
template_name
=
"dashboard/node-detail.html"
...
...
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