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
d4f0e64c
authored
Feb 07, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: shut down button
parent
cd68ac0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
circle/dashboard/templates/dashboard/vm-detail.html
+5
-1
circle/dashboard/views.py
+10
-0
No files found.
circle/dashboard/templates/dashboard/vm-detail.html
View file @
d4f0e64c
...
...
@@ -13,7 +13,11 @@
<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=
"Shut down"
href=
"#"
class=
"btn btn-default btn-xs"
><i
class=
"icon-off"
></i></a>
<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>
</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 %}
...
...
circle/dashboard/views.py
View file @
d4f0e64c
...
...
@@ -174,6 +174,7 @@ class VmDetailView(CheckedDetailView):
'new_network_vlan'
:
self
.
__new_network
,
'save_as'
:
self
.
__save_as
,
'disk-name'
:
self
.
__add_disk
,
'shut_down'
:
self
.
__shut_down
,
}
for
k
,
v
in
options
.
iteritems
():
...
...
@@ -360,6 +361,15 @@ class VmDetailView(CheckedDetailView):
return
redirect
(
"
%
s#resources"
%
reverse_lazy
(
"dashboard.views.detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
def
__shut_down
(
self
,
request
):
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
self
.
object
.
shutdown_async
(
request
.
user
)
return
redirect
(
"
%
s#activity"
%
reverse_lazy
(
"dashboard.views.detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
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