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
a6c097d8
authored
Mar 24, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: modify node status change in node-list
parent
b28159d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
28 deletions
+11
-28
circle/dashboard/static/dashboard/node-details.js
+1
-3
circle/dashboard/static/dashboard/node-list.js
+10
-25
No files found.
circle/dashboard/static/dashboard/node-details.js
View file @
a6c097d8
...
...
@@ -48,9 +48,7 @@ function changeNodeStatus(data) {
if
(
!
data
[
'redirect'
])
{
selected
=
[];
addMessage
(
re
[
'message'
],
'success'
);
$
(
'a[data-'
+
data
[
'type'
]
+
'-pk="'
+
data
[
'pk'
]
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
this
).
remove
();
});
}
else
{
window
.
location
.
replace
(
'/dashboard'
);
}
...
...
circle/dashboard/static/dashboard/node-list.js
View file @
a6c097d8
...
...
@@ -132,9 +132,8 @@ $(function() {
return
false
;
});
function
enabletableSuccess
(
unit
){
var
tr
=
$
(
unit
).
closest
(
"tr"
);
var
tspan
=
tr
.
children
(
'.enabled'
).
children
();
function
statuschangeSuccess
(
tr
){
var
tspan
=
tr
.
children
(
'.enabled'
).
children
();
var
buttons
=
tr
.
children
(
'.actions'
).
children
(
'.btn-group'
).
children
(
'.dropdown-menu'
).
children
(
'li'
).
children
(
'.node-enable'
);
buttons
.
each
(
function
(
index
){
...
...
@@ -158,29 +157,10 @@ $(function() {
colortable
();
}
function
enabledetailsSuccess
(){
// change big status span
$
(
'#node-info-pane'
).
load
(
location
.
href
+
" #node-info-data"
);
$
(
'#activity-timeline-wrapper'
).
load
(
location
.
href
+
" #activity-timeline"
);
}
$
(
'#table_container'
).
on
(
'click'
,
'.node-enable'
,
function
()
{
enablenode
(
$
(
this
).
attr
(
'data-node-pk'
),
$
(
this
).
attr
(
'data-status'
),
enabletableSuccess
,
this
);
return
false
;
});
// on node details, change node status, with calling enable node, refresh status span, resources div
$
(
'#node-info-pane'
).
on
(
'click'
,
'.node-enable'
,
function
(){
// post, change node status
enablenode
(
$
(
this
).
attr
(
'data-node-pk'
),
$
(
this
).
attr
(
'data-status'
),
enabledetailsSuccess
);
return
false
;
});
// enabling / disabling node
function
enablenode
(
pk
,
new_status
,
onsuccess
,
params
)
{
var
tr
=
$
(
this
).
closest
(
"tr"
);
var
pk
=
$
(
this
).
attr
(
'data-node-pk'
);
var
url
=
'/dashboard/node/'
+
pk
+
'/'
;
$
.
ajax
({
method
:
'POST'
,
...
...
@@ -188,13 +168,18 @@ $(function() {
data
:
{
'change_status'
:
''
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
onsuccess
(
params
);
statuschangeSuccess
(
tr
);
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"Error!"
,
"danger"
);
}
});
return
false
;
});
// enabling / disabling node
function
enablenode
(
pk
,
new_status
,
onsuccess
,
params
)
{
}
...
...
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