Allowed tabs to be closeable or not.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6957 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2010-08-03 14:58:08 +00:00
parent c2e97df2f1
commit 287da8ead8
9 changed files with 27 additions and 21 deletions

View File

@ -72,10 +72,10 @@ function loadConfigPage() {
loader = $('<center></center>').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( {

View File

@ -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);

View File

@ -61,7 +61,7 @@ function loadMonitorPage() {
// Hardware available to provision - ipmi, blade, hmc, ivm, fsp, and zvm
var div = $('<div></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 = $('<center></center>').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);
}

View File

@ -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 = $('<center></center>').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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -29,9 +29,7 @@ Tab.prototype.init = function() {
this.tab.append(tabList);
// Create a template with close button
var tabs = this.tab.tabs( {
tabTemplate : "<li><a href=\"#{href}\">#{label}</a><span class=\"tab-close ui-icon ui-icon-close\"></span></li>"
});
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('<span class=\"tab-close ui-icon ui-icon-close\"></span>');
}
};
/**