diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 7900b624b..fedbb3255 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -1881,7 +1881,7 @@ function loadDiskPoolTable(data) { for ( var i = 2; i < tmp.length; i++) { tmp[i] = jQuery.trim(tmp[i]); var diskAttrs = tmp[i].split(' '); - dTable.fnAddData( [ '', hcp, pool, stat, diskAttrs[0], diskAttrs[1], diskAttrs[2], diskAttrs[3] ]); + dTable.fnAddData( [ '', hcp, pool, stat, diskAttrs[0], diskAttrs[1], diskAttrs[2], diskAttrs[3] ]); } // Create actions menu @@ -1898,13 +1898,38 @@ function loadDiskPoolTable(data) { // Delete disk from pool var deleteLnk = $('Delete'); deleteLnk.bind('click', function(event){ - openDeleteDiskFromPoolDialog(); + var disks = getNodesChecked(tableId); + openDeleteDiskFromPoolDialog(disks); }); // Refresh table var refreshLnk = $('Refresh'); refreshLnk.bind('click', function(event){ + $('#zvmDiskResource').empty().append(createLoader('')); + setDiskDataTable(''); + // Create a array for hardware control points + var hcps = new Array(); + if ($.cookie('hcp').indexOf(',') > -1) + hcps = $.cookie('hcp').split(','); + else + hcps.push($.cookie('hcp')); + + // Query the disk pools for each + for (var i in hcps) { + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'lsvm', + tgt : hcps[i], + args : '--diskpoolnames', + msg : hcps[i] + }, + + success : getDiskPool + }); + } }); // Create action bar @@ -1998,8 +2023,12 @@ function loadDiskPoolTable(data) { /** * Open dialog to delete disk from pool + * + * @param disks2delete + * Disks selected in table + * @return Nothing */ -function openDeleteDiskFromPoolDialog() { +function openDeleteDiskFromPoolDialog(disks2delete) { // Create form to delete disk to pool var dialogId = 'zvmDeleteDiskFromPool'; var deleteDiskForm = $('
'); @@ -2019,7 +2048,9 @@ function openDeleteDiskFromPoolDialog() { var hcp = $('
'); var hcpSelect = $(''); hcp.append(hcpSelect); - var region = $('
'); + + // Set region input based on those selected on table (if any) + var region = $('
'); var group = $('
'); deleteDiskForm.append(action, hcp, region, group); @@ -2048,7 +2079,7 @@ function openDeleteDiskFromPoolDialog() { group.show(); } }); - + // Open dialog to delete disk deleteDiskForm.dialog({ title:'Delete disk from pool', diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index 42f9a7cf3..e7d92a566 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -2305,34 +2305,6 @@ function setGroupsCookies(data) { $.cookie('groups', rsp); } -/** - * Get nodes that are checked in a given datatable - * - * @param datatableId - * The datatable ID - * @return Nodes that were checked - */ -function getNodesChecked(datatableId) { - var tgts = ''; - - // Get nodes that were checked - var nodes = $('#' + datatableId + ' input[type=checkbox]:checked'); - for (var i in nodes) { - var tgtNode = nodes.eq(i).attr('name'); - - if (tgtNode){ - tgts += tgtNode; - - // Add a comma at the end - if (i < nodes.length - 1) { - tgts += ','; - } - } - } - - return tgts; -} - /** * Find the row index containing a column with a given string * diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index 74938adc2..dabf71a90 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -1063,4 +1063,32 @@ function setMenu2Normal(menu) { // Change back to normal menu.css('background', ''); menu.find('a:eq(0)').css('color', ''); +} + +/** + * Get nodes that are checked in a given datatable + * + * @param datatableId + * The datatable ID + * @return Nodes that were checked + */ +function getNodesChecked(datatableId) { + var tgts = ''; + + // Get nodes that were checked + var nodes = $('#' + datatableId + ' input[type=checkbox]:checked'); + for (var i in nodes) { + var tgtNode = nodes.eq(i).attr('name'); + + if (tgtNode){ + tgts += tgtNode; + + // Add a comma at the end + if (i < nodes.length - 1) { + tgts += ','; + } + } + } + + return tgts; } \ No newline at end of file