Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
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) {
...
@@ -48,9 +48,7 @@ function changeNodeStatus(data) {
if
(
!
data
[
'redirect'
])
{
if
(
!
data
[
'redirect'
])
{
selected
=
[];
selected
=
[];
addMessage
(
re
[
'message'
],
'success'
);
addMessage
(
re
[
'message'
],
'success'
);
$
(
'a[data-'
+
data
[
'type'
]
+
'-pk="'
+
data
[
'pk'
]
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
this
).
remove
();
});
}
else
{
}
else
{
window
.
location
.
replace
(
'/dashboard'
);
window
.
location
.
replace
(
'/dashboard'
);
}
}
...
...
circle/dashboard/static/dashboard/node-list.js
View file @
a6c097d8
...
@@ -132,9 +132,8 @@ $(function() {
...
@@ -132,9 +132,8 @@ $(function() {
return
false
;
return
false
;
});
});
function
enabletableSuccess
(
unit
){
function
statuschangeSuccess
(
tr
){
var
tr
=
$
(
unit
).
closest
(
"tr"
);
var
tspan
=
tr
.
children
(
'.enabled'
).
children
();
var
tspan
=
tr
.
children
(
'.enabled'
).
children
();
var
buttons
=
tr
.
children
(
'.actions'
).
children
(
'.btn-group'
).
children
(
'.dropdown-menu'
).
children
(
'li'
).
children
(
'.node-enable'
);
var
buttons
=
tr
.
children
(
'.actions'
).
children
(
'.btn-group'
).
children
(
'.dropdown-menu'
).
children
(
'li'
).
children
(
'.node-enable'
);
buttons
.
each
(
function
(
index
){
buttons
.
each
(
function
(
index
){
...
@@ -158,29 +157,10 @@ $(function() {
...
@@ -158,29 +157,10 @@ $(function() {
colortable
();
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
()
{
$
(
'#table_container'
).
on
(
'click'
,
'.node-enable'
,
function
()
{
enablenode
(
$
(
this
).
attr
(
'data-node-pk'
),
$
(
this
).
attr
(
'data-status'
),
enabletableSuccess
,
this
);
var
tr
=
$
(
this
).
closest
(
"tr"
);
return
false
;
var
pk
=
$
(
this
).
attr
(
'data-node-pk'
);
});
// 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
url
=
'/dashboard/node/'
+
pk
+
'/'
;
var
url
=
'/dashboard/node/'
+
pk
+
'/'
;
$
.
ajax
({
$
.
ajax
({
method
:
'POST'
,
method
:
'POST'
,
...
@@ -188,13 +168,18 @@ $(function() {
...
@@ -188,13 +168,18 @@ $(function() {
data
:
{
'change_status'
:
''
},
data
:
{
'change_status'
:
''
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
success
:
function
(
data
,
textStatus
,
xhr
)
{
onsuccess
(
params
);
statuschangeSuccess
(
tr
);
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"Error!"
,
"danger"
);
addMessage
(
"Error!"
,
"danger"
);
}
}
});
});
return
false
;
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