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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
996673c3
authored
Nov 26, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: remove NodeStatus view
parent
d9089b12
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
57 deletions
+1
-57
circle/dashboard/urls.py
+1
-3
circle/dashboard/views/node.py
+0
-54
No files found.
circle/dashboard/urls.py
View file @
996673c3
...
...
@@ -25,7 +25,7 @@ from .views import (
GroupDetailView
,
GroupList
,
IndexView
,
InstanceActivityDetail
,
LeaseCreate
,
LeaseDelete
,
LeaseDetail
,
MyPreferencesView
,
NodeAddTraitView
,
NodeCreate
,
NodeDelete
,
NodeDetailView
,
NodeList
,
NodeStatus
,
NodeDetailView
,
NodeList
,
NotificationView
,
TemplateAclUpdateView
,
TemplateCreate
,
TemplateDelete
,
TemplateDetail
,
TemplateList
,
vm_activity
,
VmCreate
,
VmDetailView
,
...
...
@@ -119,8 +119,6 @@ urlpatterns = patterns(
name
=
'dashboard.views.template-transfer-ownership-confirm'
),
url
(
r'^node/delete/(?P<pk>\d+)/$'
,
NodeDelete
.
as_view
(),
name
=
"dashboard.views.delete-node"
),
url
(
r'^node/status/(?P<pk>\d+)/$'
,
NodeStatus
.
as_view
(),
name
=
"dashboard.views.status-node"
),
url
(
r'^node/create/$'
,
NodeCreate
.
as_view
(),
name
=
'dashboard.views.node-create'
),
...
...
circle/dashboard/views/node.py
View file @
996673c3
...
...
@@ -307,57 +307,3 @@ class NodeAddTraitView(SuperuserRequiredMixin, DetailView):
return
redirect
(
self
.
get_success_url
())
else
:
return
self
.
get
(
self
,
request
,
pk
,
*
args
,
**
kwargs
)
class
NodeStatus
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DetailView
):
template_name
=
"dashboard/confirm/node-status.html"
model
=
Node
def
get_template_names
(
self
):
if
self
.
request
.
is_ajax
():
return
[
'dashboard/confirm/ajax-node-status.html'
]
else
:
return
[
'dashboard/confirm/node-status.html'
]
def
get_success_url
(
self
):
next
=
self
.
request
.
GET
.
get
(
'next'
)
if
next
:
return
next
else
:
return
reverse_lazy
(
"dashboard.views.node-detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
})
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
NodeStatus
,
self
)
.
get_context_data
(
**
kwargs
)
if
self
.
object
.
enabled
:
context
[
'status'
]
=
"disable"
else
:
context
[
'status'
]
=
"enable"
return
context
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
request
.
POST
.
get
(
'change_status'
)
is
not
None
:
return
self
.
__set_status
(
request
)
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
kwargs
=
{
'pk'
:
self
.
get_object
()
.
pk
}))
def
__set_status
(
self
,
request
):
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
enabled
:
self
.
object
.
enable
(
user
=
request
.
user
)
else
:
self
.
object
.
disable
(
user
=
request
.
user
)
success_message
=
_
(
"Node successfully changed status."
)
if
request
.
is_ajax
():
response
=
{
'message'
:
success_message
,
'node_pk'
:
self
.
object
.
pk
}
return
HttpResponse
(
json
.
dumps
(
response
),
content_type
=
"application/json"
)
else
:
messages
.
success
(
request
,
success_message
)
return
redirect
(
self
.
get_success_url
())
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