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
3b92a4c0
authored
Jul 30, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-remove-garbage' into 'master'
Feature remove garbage
parents
f678f975
1d83afee
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
2 additions
and
112 deletions
+2
-112
circle/dashboard/static/grafikon.png
+0
-0
circle/dashboard/tables.py
+0
-37
circle/dashboard/templates/dashboard/vm-list/column-actions.html
+1
-3
circle/dashboard/tests/test_views.py
+0
-22
circle/dashboard/urls.py
+1
-3
circle/dashboard/views.py
+0
-47
No files found.
circle/dashboard/static/grafikon.png
deleted
100644 → 0
View file @
f678f975
9.24 KB
circle/dashboard/tables.py
View file @
3b92a4c0
...
...
@@ -27,43 +27,6 @@ from django.utils.translation import ugettext_lazy as _
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
):
pk
=
Column
(
...
...
circle/dashboard/templates/dashboard/vm-list/column-actions.html
View file @
3b92a4c0
...
...
@@ -2,8 +2,6 @@
<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>
<ul
class=
"nojs-dropdown-toogle dropdown-menu"
role=
"menu"
>
<li><a
href=
"#"
><i
class=
"fa fa-refresh"
></i>
Reboot
</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>
<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>
</ul>
</div>
circle/dashboard/tests/test_views.py
View file @
3b92a4c0
...
...
@@ -107,28 +107,6 @@ class VmDetailTest(LoginMixin, TestCase):
response
=
c
.
get
(
'/dashboard/vm/1/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_permitted_vm_delete
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user2'
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
.
set_level
(
self
.
u2
,
'owner'
)
response
=
c
.
post
(
'/dashboard/vm/delete/1/'
)
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_not_permitted_vm_delete
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user2'
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
.
set_level
(
self
.
u2
,
'operator'
)
response
=
c
.
post
(
'/dashboard/vm/delete/1/'
)
self
.
assertEqual
(
response
.
status_code
,
403
)
def
test_unpermitted_vm_delete
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user1'
)
response
=
c
.
post
(
'/dashboard/vm/delete/1/'
)
self
.
assertEqual
(
response
.
status_code
,
403
)
def
test_unpermitted_vm_mass_delete
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user1'
)
...
...
circle/dashboard/urls.py
View file @
3b92a4c0
...
...
@@ -28,7 +28,7 @@ from .views import (
NodeDetailView
,
NodeFlushView
,
NodeGraphView
,
NodeList
,
NodeStatus
,
NotificationView
,
PortDelete
,
TemplateAclUpdateView
,
TemplateCreate
,
TemplateDelete
,
TemplateDetail
,
TemplateList
,
TransferOwnershipConfirmView
,
TransferOwnershipView
,
vm_activity
,
VmCreate
,
VmDe
lete
,
VmDe
tailView
,
TransferOwnershipView
,
vm_activity
,
VmCreate
,
VmDetailView
,
VmDetailVncTokenView
,
VmGraphView
,
VmList
,
VmMassDelete
,
DiskRemoveView
,
get_disk_download_status
,
InterfaceDeleteView
,
GroupRemoveUserView
,
...
...
@@ -86,8 +86,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+)/$'
,
VmDelete
.
as_view
(),
name
=
"dashboard.views.delete-vm"
),
url
(
r'^vm/mass-delete/'
,
VmMassDelete
.
as_view
(),
name
=
'dashboard.view.mass-delete-vm'
),
url
(
r'^vm/(?P<pk>\d+)/activity/$'
,
vm_activity
),
...
...
circle/dashboard/views.py
View file @
3b92a4c0
...
...
@@ -2064,53 +2064,6 @@ class GroupProfileUpdate(SuccessMessageMixin, GroupCodeMixin,
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
):
"""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