Commit a6c097d8 by Oláh István Gergely

dashboard: modify node status change in node-list

parent b28159d2
......@@ -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');
}
......
......@@ -132,8 +132,7 @@ $(function() {
return false;
});
function enabletableSuccess(unit){
var tr= $(unit).closest("tr");
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');
......@@ -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) {
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment