Commit c4938eb6 by Oláh István Gergely

dashboard: updating js for groups

parent d2c2f0df
...@@ -112,12 +112,12 @@ $(function () { ...@@ -112,12 +112,12 @@ $(function () {
$('.vm-delete').click(function() { $('.vm-delete').click(function() {
var vm_pk = $(this).data('vm-pk'); var vm_pk = $(this).data('vm-pk');
var dir = window.location.pathname.indexOf('list') == -1; var dir = window.location.pathname.indexOf('list') == -1;
addModalConfirmation(deleteVm, addModalConfirmation(deleteObject,
{ 'url': '/dashboard/vm/delete/' + vm_pk + '/', { 'url': '/dashboard/vm/delete/' + vm_pk + '/',
'data': [], 'data': [],
'vm_pk': vm_pk, 'pk': vm_pk,
'type': "vm",
'redirect': dir}); 'redirect': dir});
return false; return false;
}); });
...@@ -125,10 +125,38 @@ $(function () { ...@@ -125,10 +125,38 @@ $(function () {
$('.node-delete').click(function() { $('.node-delete').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(deleteNode, addModalConfirmation(deleteObject,
{ 'url': '/dashboard/node/delete/' + node_pk + '/', { 'url': '/dashboard/node/delete/' + node_pk + '/',
'data': [], 'data': [],
'node_pk': node_pk, 'pk': node_pk,
'type': "node",
'redirect': dir});
return false;
});
/* for Node removes buttons */
$('.group-delete').click(function() {
var group_pk = $(this).data('group-pk');
var dir = window.location.pathname.indexOf('list') == -1;
addModalConfirmation(deleteObject,
{ 'url': '/dashboard/group/delete/' + group_pk + '/',
'data': [],
'type': "group",
'pk': group_pk,
'redirect': dir});
return false;
});
/* for Group removes buttons */
$('.group-delete').click(function() {
var group_pk = $(this).data('group-pk');
var dir = window.location.pathname.indexOf('list') == -1;
addModalConfirmation(deleteGroup,
{ 'url': '/dashboard/group/delete/' + group_pk + '/',
'data': [],
'group_pk': group_pk,
'redirect': dir}); 'redirect': dir});
return false; return false;
...@@ -222,7 +250,7 @@ function refreshSliders() { ...@@ -222,7 +250,7 @@ function refreshSliders() {
/* deletes the VM with the pk /* deletes the VM with the pk
* if dir is true, then redirect to the dashboard landing page * if dir is true, then redirect to the dashboard landing page
* else it adds a success message */ * else it adds a success message */
function deleteVm(data) { function deleteObject(data) {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
data: {'redirect': data['redirect']}, data: {'redirect': data['redirect']},
...@@ -232,7 +260,7 @@ function deleteVm(data) { ...@@ -232,7 +260,7 @@ function deleteVm(data) {
if(!data['redirect']) { if(!data['redirect']) {
selected = []; selected = [];
addMessage(re['message'], 'success'); addMessage(re['message'], 'success');
$('a[data-vm-pk="' + data['vm_pk'] + '"]').closest('tr').fadeOut(function() { $('a[data-'+data['type']+'-pk="' + data['pk'] + '"]').closest('tr').fadeOut(function() {
$(this).remove(); $(this).remove();
}); });
} else { } else {
......
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