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
cb95f714
authored
Mar 12, 2014
by
Kálmán Viktor
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: shut off button
parent
54080b7a
Hide 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 @@
...
@@ -36,6 +36,13 @@
<input
type=
"hidden"
name=
"reset"
value=
"dummy"
/>
<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>
<button
title=
"{% trans "
Reset
(
power
cycle
)"
%}"
class=
"btn btn-default btn-xs"
type=
"submit"
><i
class=
"icon-bolt"
></i></button>
</form>
</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"
>
<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>
<i
class=
"icon-truck"
></i>
</a>
</a>
...
...
circle/dashboard/views.py
View file @
cb95f714
...
@@ -231,6 +231,7 @@ class VmDetailView(CheckedDetailView):
...
@@ -231,6 +231,7 @@ class VmDetailView(CheckedDetailView):
'deploy'
:
self
.
__deploy
,
'deploy'
:
self
.
__deploy
,
'reset'
:
self
.
__reset
,
'reset'
:
self
.
__reset
,
'reboot'
:
self
.
__reboot
,
'reboot'
:
self
.
__reboot
,
'shut_off'
:
self
.
__shut_off
,
}
}
for
k
,
v
in
options
.
iteritems
():
for
k
,
v
in
options
.
iteritems
():
if
request
.
POST
.
get
(
k
)
is
not
None
:
if
request
.
POST
.
get
(
k
)
is
not
None
:
...
@@ -465,6 +466,14 @@ class VmDetailView(CheckedDetailView):
...
@@ -465,6 +466,14 @@ class VmDetailView(CheckedDetailView):
self
.
object
.
reboot_async
(
request
.
user
)
self
.
object
.
reboot_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
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
):
class
NodeDetailView
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DetailView
):
template_name
=
"dashboard/node-detail.html"
template_name
=
"dashboard/node-detail.html"
...
...
Kálmán Viktor
@kviktor
mentioned in issue
#100 (closed)
Mar 12, 2014
mentioned in issue
#100 (closed)
mentioned in issue #100
Toggle commit list
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