diff --git a/xCAT-UI/js/configure/configure.js b/xCAT-UI/js/configure/configure.js index 245fe43ec..3f67db686 100644 --- a/xCAT-UI/js/configure/configure.js +++ b/xCAT-UI/js/configure/configure.js @@ -72,10 +72,10 @@ function loadConfigPage() { loader = $('
').append(loader); // Configure xCAT datable tables - tab.add('configTablesTab', 'Tables', loader); + tab.add('configTablesTab', 'Tables', loader, false); // Add the update tab - tab.add('updateTab', 'Update'); + tab.add('updateTab', 'Update', '', false); // Get list of tables and their descriptions $.ajax( { @@ -137,7 +137,7 @@ function loadTableNames(data) { // Add a new tab for this table var configTab = getConfigTab(); if (!$('#' + id + 'Tab').length) { - configTab.add(id + 'Tab', id, loader); + configTab.add(id + 'Tab', id, loader, true); // Get contents of selected table $.ajax( { diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index dbf76e771..4dddec20d 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -264,7 +264,7 @@ zvmPlugin.prototype.loadClonePage = function(node) { cloneForm.append(cloneBtn); // Add clone tab - tab.add(newTabId, 'Clone', cloneForm); + tab.add(newTabId, 'Clone', cloneForm, true); } tab.select(newTabId); diff --git a/xCAT-UI/js/monitor/monitor.js b/xCAT-UI/js/monitor/monitor.js index 6da02b0c8..32f4d95aa 100644 --- a/xCAT-UI/js/monitor/monitor.js +++ b/xCAT-UI/js/monitor/monitor.js @@ -61,7 +61,7 @@ function loadMonitorPage() { // Hardware available to provision - ipmi, blade, hmc, ivm, fsp, and zvm var div = $('
'); monitorForm.append(div); - tab.add('monitorTab', 'Monitor', monitorForm); + tab.add('monitorTab', 'Monitor', monitorForm, false); /** * Monitor resources @@ -102,7 +102,7 @@ function loadMonitorPage() { if (!$('#' + newTabId).length) { var loader = createLoader(hw + 'ResourceLoader'); loader = $('
').append(loader); - tab.add(newTabId, hw, loader); + tab.add(newTabId, hw, loader, true); // Create an instance of the plugin var plugin; @@ -135,5 +135,5 @@ function loadMonitorPage() { }); resrcForm.append(okBtn); - tab.add('resourceTab', 'Resources', resrcForm); + tab.add('resourceTab', 'Resources', resrcForm, false); } \ No newline at end of file diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index 8e797a61d..1aaa35123 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -131,7 +131,7 @@ function loadGroups(data) { setNodesTab(tab); tab.init(); $('#nodes').append(tab.object()); - tab.add('nodesTab', 'Nodes', loader); + tab.add('nodesTab', 'Nodes', loader, false); // Get nodes within selected group $.ajax( { @@ -598,7 +598,7 @@ function loadNode(e) { // Add new tab, only if one does not exist var loader = createLoader(newTabId + 'TabLoader'); loader = $('
').append(loader); - myTab.add(newTabId, node, loader); + myTab.add(newTabId, node, loader, true); // Get node inventory var msg = 'out=' + newTabId + ',node=' + node; @@ -695,7 +695,7 @@ function loadUnlockPage(tgtNodes) { }); unlockForm.append(okBtn); - tab.add(newTabId, 'Unlock', unlockForm); + tab.add(newTabId, 'Unlock', unlockForm, true); tab.select(newTabId); } @@ -802,7 +802,7 @@ function loadScriptPage(tgtNodes) { scriptForm.append(runBtn); // Append to discover tab - tab.add(newTabId, 'Script', scriptForm); + tab.add(newTabId, 'Script', scriptForm, true); // Select new tab tab.select(newTabId); @@ -945,7 +945,7 @@ function deleteNode(tgtNodes) { deleteForm.append(deleteBtn); deleteForm.append(cancelBtn); - myTab.add(newTabId, 'Delete', deleteForm); + myTab.add(newTabId, 'Delete', deleteForm, true); myTab.select(newTabId); } diff --git a/xCAT-UI/js/nodes/nodeset.js b/xCAT-UI/js/nodes/nodeset.js index 9b2902522..2f06bcc9d 100644 --- a/xCAT-UI/js/nodes/nodeset.js +++ b/xCAT-UI/js/nodes/nodeset.js @@ -188,7 +188,7 @@ function loadNodesetPage(trgtNodes) { nodesetForm.append(okBtn); // Append to discover tab - tab.add(tabId, 'Nodeset', nodesetForm); + tab.add(tabId, 'Nodeset', nodesetForm, true); // Select new tab tab.select(tabId); diff --git a/xCAT-UI/js/nodes/rnetboot.js b/xCAT-UI/js/nodes/rnetboot.js index 705113d90..7ef6188cd 100644 --- a/xCAT-UI/js/nodes/rnetboot.js +++ b/xCAT-UI/js/nodes/rnetboot.js @@ -166,7 +166,7 @@ function loadNetbootPage(tgtNodes) { netbootForm.append(okBtn); // Append to discover tab - tab.add(newTabId, 'Netboot', netbootForm); + tab.add(newTabId, 'Netboot', netbootForm, true); // Select new tab tab.select(newTabId); diff --git a/xCAT-UI/js/nodes/updatenode.js b/xCAT-UI/js/nodes/updatenode.js index 662ea26b7..95f5c57ce 100644 --- a/xCAT-UI/js/nodes/updatenode.js +++ b/xCAT-UI/js/nodes/updatenode.js @@ -248,7 +248,7 @@ function loadUpdatenodePage(tgtNodes) { updatenodeForm.append(okBtn); // Append to discover tab - tab.add(newTabId, 'Updatenode', updatenodeForm); + tab.add(newTabId, 'Updatenode', updatenodeForm, true); // Select new tab tab.select(newTabId); diff --git a/xCAT-UI/js/provision/provision.js b/xCAT-UI/js/provision/provision.js index 918f9c040..94cba5a5f 100644 --- a/xCAT-UI/js/provision/provision.js +++ b/xCAT-UI/js/provision/provision.js @@ -89,7 +89,7 @@ function loadProvisionPage() { newTabId = hw + 'ProvisionTab' + instance; } - tab.add(newTabId, hw, ''); + tab.add(newTabId, hw, '', true); // Create an instance of the plugin var plugin; @@ -120,5 +120,5 @@ function loadProvisionPage() { }); provForm.append(okBtn); - tab.add('provisionTab', 'Provision', provForm); + tab.add('provisionTab', 'Provision', provForm, false); } \ No newline at end of file diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index 3f35d11da..4603443be 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -29,9 +29,7 @@ Tab.prototype.init = function() { this.tab.append(tabList); // Create a template with close button - var tabs = this.tab.tabs( { - tabTemplate : "
  • #{label}
  • " - }); + var tabs = this.tab.tabs(); // Remove dummy tab this.tab.tabs("remove", 0); @@ -69,9 +67,11 @@ Tab.prototype.object = function() { * New tab name * @param newTabCont * New tab content + * @param closeable + * New tab close button * @return Nothing */ -Tab.prototype.add = function(newTabId, newTabName, newTabCont) { +Tab.prototype.add = function(newTabId, newTabName, newTabCont, closeable) { // Show tab if (this.tab.css("display") == "none") { this.tab.show(); @@ -81,6 +81,12 @@ Tab.prototype.add = function(newTabId, newTabName, newTabCont) { newTab.append(newTabCont); this.tab.append(newTab); this.tab.tabs("add", "#" + newTabId, newTabName); + + // Append close button + if (closeable) { + var header = this.tab.find('ul.ui-tabs-nav a[href="#' + newTabId +'"]').parent(); + header.append(''); + } }; /**