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
851d534a
authored
Nov 11, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: vm delete
parent
5325758b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
circle/dashboard/templates/dashboard/vm-detail.html
+1
-1
circle/dashboard/urls.py
+5
-3
circle/dashboard/views.py
+14
-0
No files found.
circle/dashboard/templates/dashboard/vm-detail.html
View file @
851d534a
...
...
@@ -15,7 +15,7 @@
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li><a
href=
"#"
><i
class=
"icon-refresh"
></i>
Reboot
</a></li>
<li><a
href=
"#"
><i
class=
"icon-off"
></i>
Shutdown
</a></li>
<li><a
href=
"
#
"
><i
class=
"icon-remove"
></i>
Discard
</a></li>
<li><a
href=
"
{% url "
dashboard
.
views
.
delete-vm
"
pk=
instance.pk
%}
"
><i
class=
"icon-remove"
></i>
Discard
</a></li>
</ul>
</div>
</div>
...
...
circle/dashboard/urls.py
View file @
851d534a
...
...
@@ -2,12 +2,12 @@ from django.conf.urls import patterns, url
from
vm.models
import
Instance
from
.views
import
(
IndexView
,
VmDetailView
,
VmList
,
VmCreate
,
TemplateDetail
,
AclUpdateView
)
IndexView
,
VmDetailView
,
VmList
,
VmCreate
,
TemplateDetail
,
AclUpdateView
,
delete_vm
)
urlpatterns
=
patterns
(
''
,
url
(
r'^$'
,
IndexView
.
as_view
()),
url
(
r'^$'
,
IndexView
.
as_view
()
,
name
=
"dashboard.index"
),
url
(
r'^template/(?P<pk>\d+)/$'
,
TemplateDetail
.
as_view
(),
name
=
'dashboard.views.template-detail'
),
url
(
r'^vm/(?P<pk>\d+)/$'
,
VmDetailView
.
as_view
(),
...
...
@@ -17,4 +17,6 @@ urlpatterns = patterns(
url
(
r'^vm/list/$'
,
VmList
.
as_view
(),
name
=
'dashboard.views.vm-list'
),
url
(
r'^vm/create/$'
,
VmCreate
.
as_view
(),
name
=
'dashboard.views.vm-create'
),
url
(
r'^vm/delete/(?P<pk>\d+)/$'
,
delete_vm
,
name
=
"dashboard.views.delete-vm"
),
)
circle/dashboard/views.py
View file @
851d534a
...
...
@@ -234,3 +234,17 @@ class VmCreate(TemplateView):
status
=
500
if
resp
.
get
(
'error'
)
else
200
)
else
:
return
redirect
(
reverse_lazy
(
'dashboard.views.detail'
,
resp
))
def
delete_vm
(
request
,
**
kwargs
):
vm_pk
=
kwargs
[
'pk'
]
vm
=
Instance
.
objects
.
get
(
pk
=
vm_pk
)
print
vm
vm
.
destroy_async
()
if
request
.
is_ajax
():
return
HttpResponse
(
"ok"
)
else
:
next
=
request
.
GET
.
get
(
'next'
)
return
redirect
(
next
if
next
else
reverse_lazy
(
'dashboard.index'
))
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