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
2fc07a8d
authored
Feb 26, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix set_status in NodeStatus
parent
e7672078
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
20 deletions
+9
-20
circle/dashboard/static/dashboard/dashboard.js
+0
-1
circle/dashboard/static/dashboard/node-details.js
+2
-4
circle/dashboard/templates/dashboard/node-detail.html
+4
-4
circle/dashboard/views.py
+3
-11
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
2fc07a8d
...
...
@@ -298,7 +298,6 @@ function addModalConfirmation(func, data) {
url
:
data
[
'url'
],
data
:
jQuery
.
param
(
data
[
'data'
]),
success
:
function
(
result
)
{
console
.
log
(
result
);
$
(
'body'
).
append
(
result
);
$
(
'#confirmation-modal'
).
modal
(
'show'
);
$
(
'#confirmation-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
...
...
circle/dashboard/static/dashboard/node-details.js
View file @
2fc07a8d
...
...
@@ -29,13 +29,11 @@
/* for Node removes buttons */
$
(
'.node-enable'
).
click
(
function
()
{
var
node_pk
=
$
(
this
).
data
(
'node-pk'
);
var
node_status
=
$
(
this
).
data
(
'status'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
addModalConfirmation
(
deleteObject
,
{
'url'
:
'/dashboard/node/status/'
+
node_pk
+
'/
?status='
+
node_status
,
'data'
:
{
'
new_status'
:
node_status
},
{
'url'
:
'/dashboard/node/status/'
+
node_pk
+
'/
'
,
'data'
:
{
'
change_status'
:
""
},
'pk'
:
node_pk
,
'status'
:
node_status
,
'type'
:
"node"
,
'redirect'
:
dir
});
...
...
circle/dashboard/templates/dashboard/node-detail.html
View file @
2fc07a8d
...
...
@@ -32,12 +32,12 @@
<li><a
href=
"#"
class=
"node-details-rename-button"
><i
class=
"icon-pencil"
></i>
{% trans "Rename" %}
</a></li>
<li><a
href=
"#"
><i
class=
"icon-cloud-upload"
></i>
Flush
</a></li>
{% if node.enabled %}
<li><a
style=
"display:none"
data-
status=
"enable"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}&
status=
enable
"
><i
class=
"icon-check"
></i>
Enable
</a>
<a
style=
"display:block"
data-status=
"disable"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}&
status=
disable
"
><i
class=
"icon-remove"
></i>
Disable
</a></li>
<li><a
style=
"display:none"
data-
node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}
"
><i
class=
"icon-check"
></i>
Enable
</a>
<a
style=
"display:block"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}
"
><i
class=
"icon-remove"
></i>
Disable
</a></li>
{% else %}
<li><a
style=
"display:block"
data-
status=
"enable"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}&
status=
enable
"
>
<li><a
style=
"display:block"
data-
node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}
"
>
<i
class=
"icon-check"
></i>
Enable
</a>
<a
style=
"display:none"
data-
status=
"disable"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}&
status=
disable
"
><i
class=
"icon-remove"
></i>
Disable
</a></li>
<a
style=
"display:none"
data-
node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}
"
><i
class=
"icon-remove"
></i>
Disable
</a></li>
{% endif %}
<li><a
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-delete"
href=
"{% url "
dashboard
.
views
.
delete-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-trash"
></i>
Delete
</a></li>
</ul>
...
...
circle/dashboard/views.py
View file @
2fc07a8d
...
...
@@ -1264,32 +1264,24 @@ class NodeStatus(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
return
context
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
request
.
POST
.
get
(
'
new
_status'
):
if
request
.
POST
.
get
(
'
change
_status'
):
return
self
.
__set_status
(
request
)
def
__set_status
(
self
,
request
):
self
.
object
=
self
.
get_object
()
new_status
=
request
.
POST
.
get
(
"new_status"
)
if
new_status
==
"enable"
:
if
self
.
object
.
enable
:
Node
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
**
{
'enabled'
:
True
})
el
if
new_status
==
"disable"
:
el
se
:
Node
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
**
{
'enabled'
:
False
})
else
:
if
request
.
is_ajax
():
return
HttpResponse
(
content_type
=
"application/json"
)
else
:
return
redirect
(
self
.
get_success_url
())
success_message
=
_
(
"Node successfully changed status!"
)
if
request
.
is_ajax
():
response
=
{
'message'
:
success_message
,
'new_status'
:
new_status
,
'node_pk'
:
self
.
object
.
pk
}
return
HttpResponse
(
...
...
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