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
Commit
824068e0
authored
Feb 27, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix node status changer
parent
2fc07a8d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
16 deletions
+13
-16
circle/dashboard/static/dashboard/node-details.js
+2
-2
circle/dashboard/templates/dashboard/confirm/ajax-node-status.html
+2
-2
circle/dashboard/templates/dashboard/confirm/node-status.html
+1
-1
circle/dashboard/views.py
+8
-11
No files found.
circle/dashboard/static/dashboard/node-details.js
View file @
824068e0
...
@@ -30,9 +30,9 @@
...
@@ -30,9 +30,9 @@
$
(
'.node-enable'
).
click
(
function
()
{
$
(
'.node-enable'
).
click
(
function
()
{
var
node_pk
=
$
(
this
).
data
(
'node-pk'
);
var
node_pk
=
$
(
this
).
data
(
'node-pk'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
addModalConfirmation
(
deleteObject
,
addModalConfirmation
(
changeNodeStatus
,
{
'url'
:
'/dashboard/node/status/'
+
node_pk
+
'/'
,
{
'url'
:
'/dashboard/node/status/'
+
node_pk
+
'/'
,
'data'
:
{
'change_status'
:
""
}
,
'data'
:
[]
,
'pk'
:
node_pk
,
'pk'
:
node_pk
,
'type'
:
"node"
,
'type'
:
"node"
,
'redirect'
:
dir
});
'redirect'
:
dir
});
...
...
circle/dashboard/templates/dashboard/confirm/ajax-node-status.html
View file @
824068e0
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
<div
class=
"pull-right"
>
<div
class=
"pull-right"
>
<form
action=
""
method=
"POST"
>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
{% csrf_token %}
<
a
class=
"btn btn-default"
>
Back
</a>
<
button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
Cancel
</button>
<input
type=
"hidden"
name=
"
new_status"
value=
"{{ status }}
"
/>
<input
type=
"hidden"
name=
"
change_status"
value=
"_
"
/>
<button
class=
"btn btn-warning"
>
Yes, {{ status }}
</button>
<button
class=
"btn btn-warning"
>
Yes, {{ status }}
</button>
</form>
</form>
</div>
</div>
...
...
circle/dashboard/templates/dashboard/confirm/node-status.html
View file @
824068e0
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
<form
action=
""
method=
"POST"
>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
{% csrf_token %}
<a
class=
"btn btn-default"
>
Back
</a>
<a
class=
"btn btn-default"
>
Back
</a>
<input
type=
"hidden"
name=
"
new_status"
value=
"{{ status }}
"
/>
<input
type=
"hidden"
name=
"
change_status"
value=
"_
"
/>
<button
class=
"btn btn-warning"
>
Yes, {{ status }}
</button>
<button
class=
"btn btn-warning"
>
Yes, {{ status }}
</button>
</form>
</form>
</div>
</div>
...
...
circle/dashboard/views.py
View file @
824068e0
...
@@ -456,8 +456,10 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -456,8 +456,10 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
request
.
POST
.
get
(
'new_name'
):
if
request
.
POST
.
get
(
'new_name'
):
return
self
.
__set_name
(
request
)
return
self
.
__set_name
(
request
)
if
request
.
POST
.
get
(
'
new
_status'
):
if
request
.
POST
.
get
(
'
change
_status'
):
return
self
.
__set_status
(
request
)
return
self
.
__set_status
(
request
)
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
kwargs
=
{
'pk'
:
self
.
get_object
()
.
pk
}))
def
__set_name
(
self
,
request
):
def
__set_name
(
self
,
request
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
...
@@ -469,7 +471,6 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -469,7 +471,6 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
if
request
.
is_ajax
():
if
request
.
is_ajax
():
response
=
{
response
=
{
'message'
:
success_message
,
'message'
:
success_message
,
'new_name'
:
new_name
,
'node_pk'
:
self
.
object
.
pk
'node_pk'
:
self
.
object
.
pk
}
}
return
HttpResponse
(
return
HttpResponse
(
...
@@ -483,19 +484,14 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -483,19 +484,14 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
def
__set_status
(
self
,
request
):
def
__set_status
(
self
,
request
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
new_status
=
request
.
POST
.
get
(
"new_status"
)
if
not
self
.
object
.
enabled
:
if
new_status
==
"enable"
:
self
.
object
.
enable
(
user
=
request
.
user
)
self
.
object
.
enable
(
user
=
request
.
user
)
elif
new_status
==
"disable"
:
self
.
object
.
disable
(
user
=
request
.
user
)
else
:
else
:
return
self
.
object
.
disable
(
user
=
request
.
user
)
success_message
=
_
(
"Node successfully changed status!"
)
success_message
=
_
(
"Node successfully changed status!"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
response
=
{
response
=
{
'message'
:
success_message
,
'message'
:
success_message
,
'new_status'
:
new_status
,
'node_pk'
:
self
.
object
.
pk
'node_pk'
:
self
.
object
.
pk
}
}
return
HttpResponse
(
return
HttpResponse
(
...
@@ -1266,11 +1262,12 @@ class NodeStatus(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -1266,11 +1262,12 @@ class NodeStatus(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
request
.
POST
.
get
(
'change_status'
):
if
request
.
POST
.
get
(
'change_status'
):
return
self
.
__set_status
(
request
)
return
self
.
__set_status
(
request
)
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
kwargs
=
{
'pk'
:
self
.
get_object
()
.
pk
}))
def
__set_status
(
self
,
request
):
def
__set_status
(
self
,
request
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
enabled
:
if
self
.
object
.
enable
:
Node
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
Node
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
**
{
'enabled'
:
True
})
**
{
'enabled'
:
True
})
else
:
else
:
...
...
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