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
753e8827
authored
Jul 30, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: remove DeleteVmView
parent
b600d912
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
90 deletions
+2
-90
circle/dashboard/tables.py
+0
-37
circle/dashboard/templates/dashboard/vm-list/column-actions.html
+1
-3
circle/dashboard/urls.py
+1
-3
circle/dashboard/views.py
+0
-47
No files found.
circle/dashboard/tables.py
View file @
753e8827
...
@@ -27,43 +27,6 @@ from django.utils.translation import ugettext_lazy as _
...
@@ -27,43 +27,6 @@ from django.utils.translation import ugettext_lazy as _
from
django_sshkey.models
import
UserKey
from
django_sshkey.models
import
UserKey
class
VmListTable
(
Table
):
pk
=
TemplateColumn
(
template_name
=
'dashboard/vm-list/column-id.html'
,
verbose_name
=
"ID"
,
attrs
=
{
'th'
:
{
'class'
:
'vm-list-table-thin'
}},
)
name
=
TemplateColumn
(
template_name
=
"dashboard/vm-list/column-name.html"
)
admin
=
TemplateColumn
(
template_name
=
'dashboard/vm-list/column-admin.html'
,
attrs
=
{
'th'
:
{
'class'
:
'vm-list-table-admin'
}},
)
details
=
TemplateColumn
(
template_name
=
'dashboard/vm-list/column-details.html'
,
attrs
=
{
'th'
:
{
'class'
:
'vm-list-table-thin'
}},
)
actions
=
TemplateColumn
(
template_name
=
'dashboard/vm-list/column-actions.html'
,
attrs
=
{
'th'
:
{
'class'
:
'vm-list-table-thin'
}},
)
time_of_suspend
=
TemplateColumn
(
'{{ record.time_of_suspend|timeuntil }}'
,
verbose_name
=
_
(
"Suspend in"
))
time_of_delete
=
TemplateColumn
(
'{{ record.time_of_delete|timeuntil }}'
,
verbose_name
=
_
(
"Delete in"
))
class
Meta
:
model
=
Instance
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover '
'vm-list-table'
)}
fields
=
(
'pk'
,
'name'
,
'state'
,
'time_of_suspend'
,
'time_of_delete'
,
)
class
NodeListTable
(
Table
):
class
NodeListTable
(
Table
):
pk
=
Column
(
pk
=
Column
(
...
...
circle/dashboard/templates/dashboard/vm-list/column-actions.html
View file @
753e8827
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
<div
class=
"btn-group"
>
<div
class=
"btn-group"
>
<button
type=
"button"
class=
"btn btn-xs btn-warning nojs-dropdown-toogle dropdown-toggle"
data-toggle=
"dropdown"
>
Action
<i
class=
"fa fa-caret-down"
></i></button>
<button
type=
"button"
class=
"btn btn-xs btn-warning nojs-dropdown-toogle dropdown-toggle"
data-toggle=
"dropdown"
>
Action
<i
class=
"fa fa-caret-down"
></i></button>
<ul
class=
"nojs-dropdown-toogle dropdown-menu"
role=
"menu"
>
<ul
class=
"nojs-dropdown-toogle dropdown-menu"
role=
"menu"
>
<li><a
href=
"#"
><i
class=
"fa fa-refresh"
></i>
Reboot
</a></li>
<li><a
class=
"real-link"
href=
"{%url "
dashboard
.
vm
.
op
.
destroy
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"fa fa-times"
></i>
Discard
</a></li>
<li><a
href=
"#"
><i
class=
"fa fa-off"
></i>
Shutdown
</a></li>
<li><a
data-vm-pk=
"{{ record.pk }}"
class=
"real-link vm-delete"
href=
"{% url "
dashboard
.
views
.
delete-vm
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"fa fa-times"
></i>
Discard
</a></li>
</ul>
</ul>
</div>
</div>
circle/dashboard/urls.py
View file @
753e8827
...
@@ -28,7 +28,7 @@ from .views import (
...
@@ -28,7 +28,7 @@ from .views import (
NodeDetailView
,
NodeFlushView
,
NodeGraphView
,
NodeList
,
NodeStatus
,
NodeDetailView
,
NodeFlushView
,
NodeGraphView
,
NodeList
,
NodeStatus
,
NotificationView
,
PortDelete
,
TemplateAclUpdateView
,
TemplateCreate
,
NotificationView
,
PortDelete
,
TemplateAclUpdateView
,
TemplateCreate
,
TemplateDelete
,
TemplateDetail
,
TemplateList
,
TransferOwnershipConfirmView
,
TemplateDelete
,
TemplateDetail
,
TemplateList
,
TransferOwnershipConfirmView
,
TransferOwnershipView
,
vm_activity
,
VmCreate
,
VmDe
lete
,
VmDe
tailView
,
TransferOwnershipView
,
vm_activity
,
VmCreate
,
VmDetailView
,
VmDetailVncTokenView
,
VmGraphView
,
VmList
,
VmMassDelete
,
VmDetailVncTokenView
,
VmGraphView
,
VmList
,
VmMassDelete
,
DiskRemoveView
,
get_disk_download_status
,
InterfaceDeleteView
,
DiskRemoveView
,
get_disk_download_status
,
InterfaceDeleteView
,
GroupRemoveUserView
,
GroupRemoveUserView
,
...
@@ -86,8 +86,6 @@ urlpatterns = patterns(
...
@@ -86,8 +86,6 @@ urlpatterns = patterns(
url
(
r'^vm/list/$'
,
VmList
.
as_view
(),
name
=
'dashboard.views.vm-list'
),
url
(
r'^vm/list/$'
,
VmList
.
as_view
(),
name
=
'dashboard.views.vm-list'
),
url
(
r'^vm/create/$'
,
VmCreate
.
as_view
(),
url
(
r'^vm/create/$'
,
VmCreate
.
as_view
(),
name
=
'dashboard.views.vm-create'
),
name
=
'dashboard.views.vm-create'
),
url
(
r'^vm/delete/(?P<pk>\d+)/$'
,
VmDelete
.
as_view
(),
name
=
"dashboard.views.delete-vm"
),
url
(
r'^vm/mass-delete/'
,
VmMassDelete
.
as_view
(),
url
(
r'^vm/mass-delete/'
,
VmMassDelete
.
as_view
(),
name
=
'dashboard.view.mass-delete-vm'
),
name
=
'dashboard.view.mass-delete-vm'
),
url
(
r'^vm/(?P<pk>\d+)/activity/$'
,
vm_activity
),
url
(
r'^vm/(?P<pk>\d+)/activity/$'
,
vm_activity
),
...
...
circle/dashboard/views.py
View file @
753e8827
...
@@ -2064,53 +2064,6 @@ class GroupProfileUpdate(SuccessMessageMixin, GroupCodeMixin,
...
@@ -2064,53 +2064,6 @@ class GroupProfileUpdate(SuccessMessageMixin, GroupCodeMixin,
return
self
.
form_valid
(
form
)
return
self
.
form_valid
(
form
)
class
VmDelete
(
LoginRequiredMixin
,
DeleteView
):
model
=
Instance
template_name
=
"dashboard/confirm/base-delete.html"
def
get_template_names
(
self
):
if
self
.
request
.
is_ajax
():
return
[
'dashboard/confirm/ajax-delete.html'
]
else
:
return
[
'dashboard/confirm/base-delete.html'
]
def
get_success_url
(
self
):
next
=
self
.
request
.
POST
.
get
(
'next'
)
if
next
:
return
next
else
:
return
reverse_lazy
(
'dashboard.index'
)
def
get_context_data
(
self
,
**
kwargs
):
object
=
self
.
get_object
()
if
not
object
.
has_level
(
self
.
request
.
user
,
'owner'
):
raise
PermissionDenied
()
context
=
super
(
VmDelete
,
self
)
.
get_context_data
(
**
kwargs
)
return
context
# github.com/django/django/blob/master/django/views/generic/edit.py#L245
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
object
=
self
.
get_object
()
if
not
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
object
.
destroy
.
async
(
user
=
request
.
user
)
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"VM successfully deleted."
)
if
request
.
is_ajax
():
if
request
.
POST
.
get
(
'redirect'
)
.
lower
()
==
"true"
:
messages
.
success
(
request
,
success_message
)
return
HttpResponse
(
json
.
dumps
({
'message'
:
success_message
}),
content_type
=
"application/json"
,
)
else
:
messages
.
success
(
request
,
success_message
)
return
HttpResponseRedirect
(
success_url
)
class
NodeDelete
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DeleteView
):
class
NodeDelete
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DeleteView
):
"""This stuff deletes the node.
"""This stuff deletes the node.
...
...
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