diff --git a/xCAT-UI/js/custom/customUtils.js b/xCAT-UI/js/custom/customUtils.js index 234b61175..92f68bc07 100644 --- a/xCAT-UI/js/custom/customUtils.js +++ b/xCAT-UI/js/custom/customUtils.js @@ -41,7 +41,7 @@ function createNodesDatatable(group, outId) { var headers = new Object(); // Clear nodes datatable division - $('#' + outId).children().remove(); + $('#' + outId).empty(); // Create nodes datatable var node, args; diff --git a/xCAT-UI/js/custom/hmc.js b/xCAT-UI/js/custom/hmc.js index c2e90569f..98159d3c8 100644 --- a/xCAT-UI/js/custom/hmc.js +++ b/xCAT-UI/js/custom/hmc.js @@ -119,32 +119,36 @@ hmcPlugin.prototype.loadClonePage = function(node) { */ hmcPlugin.prototype.loadProvisionPage = function(tabId) { // Get OS image names - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'tabdump', - tgt : '', - args : 'osimage', - msg : '' - }, + if (!$.cookie('imagenames')){ + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'tabdump', + tgt : '', + args : 'osimage', + msg : '' + }, - success : setOSImageCookies - }); + success : setOSImageCookies + }); + } // Get groups - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'extnoderange', - tgt : '/.*', - args : 'subgroups', - msg : '' - }, + if (!$.cookie('groups')){ + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'extnoderange', + tgt : '/.*', + args : 'subgroups', + msg : '' + }, - success : setGroupsCookies - }); + success : setGroupsCookies + }); + } // Get provision tab instance var inst = tabId.replace('hmcProvisionTab', ''); @@ -169,44 +173,43 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) { $('#' + tabId).append(provForm); // Create provision type drop down - var provType = $('
'); - var typeLabel = $(''); - var typeSelect = $(''); - var provNewNode = $(''); - var provExistNode = $(''); - typeSelect.append(provNewNode); - typeSelect.append(provExistNode); - provType.append(typeLabel); - provType.append(typeSelect); - provForm.append(provType); + provForm.append(''); /** * Create provision new node division */ // You should copy whatever is in this function, put it here, and customize it - var provNew = createProvisionNew('hmc', inst); - provForm.append(provNew); + //var provNew = createProvisionNew('hmc', inst); + //provForm.append(provNew); /** * Create provision existing node division */ // You should copy whatever is in this function, put it here, and customize it - var provExisting = createProvisionExisting('hmc', inst); - provForm.append(provExisting); + provForm.append(createHmcProvisionExisting(inst)); - // Toggle provision new/existing on select - typeSelect.change(function() { - var selected = $(this).val(); - if (selected == 'new') { - provNew.toggle(); - provExisting.toggle(); - } else { - provNew.toggle(); - provExisting.toggle(); - } + var hmcProvisionBtn = createButton('Provision'); + hmcProvisionBtn.bind('click', function(event) { + //TODO Insert provision code here + openDialog('info', 'Under construction'); }); + provForm.append(hmcProvisionBtn); + + // update the node table on group select + provForm.find('#groupname').bind('change', function(){ + var groupName = $(this).val(); + var nodeArea = $('#hmcSelectNodesTable' + inst); + nodeArea.empty(); + if (!groupName){ + nodeArea.html('Select a group to view its nodes'); + return; + } + + nodeArea.append(createLoader()); + createNodesArea(groupName, 'hmcSelectNodesTable'+ inst); + }); + // Toggle provision new/existing on select }; - /** * Load resources * @@ -235,4 +238,137 @@ hmcPlugin.prototype.loadResources = function() { */ hmcPlugin.prototype.addNode = function() { openDialog('info', 'Under construction'); -}; \ No newline at end of file +}; + +/** + * Create hmc provision existing form + * + * @return: form content + */ +function createHmcProvisionExisting(inst){ + //create the group area. + var strGroup = ''; + showStr += ' | Node |
---|---|
' + node + ' |