From 8e051620f35d846d65abe12536b2b28c26b9cad2 Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 23 Nov 2011 17:59:48 +0000 Subject: [PATCH] Renamed Guide page to Help page. Added checks in KVM/ESX provision page. Group fields into fieldsets in z/VM provision page. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11039 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/css/style.css | 2 +- xCAT-UI/js/custom/esx.js | 27 ++++++++++++++-- xCAT-UI/js/custom/kvm.js | 27 ++++++++++++++-- xCAT-UI/js/custom/zvm.js | 9 ++++-- xCAT-UI/js/custom/zvmUtils.js | 61 +++++++++++++++++++++++++---------- xCAT-UI/js/nodes/nodes.js | 2 +- xCAT-UI/js/ui.js | 8 +++-- xCAT-UI/js/xcatauth.js | 2 +- xCAT-UI/lib/ui.php | 2 +- xCAT-UI/xcat/plugins/web.pm | 8 ++++- 10 files changed, 115 insertions(+), 33 deletions(-) diff --git a/xCAT-UI/css/style.css b/xCAT-UI/css/style.css index ab1c5c6b1..ecc2fcd9f 100644 --- a/xCAT-UI/css/style.css +++ b/xCAT-UI/css/style.css @@ -277,7 +277,7 @@ fieldset { margin-bottom: 5px; border-width: 1px 0 0 0; border-style: solid none none none; - border-color: #D8D8D8; + border-color: gray; } .tab label { diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js index 9a73a90be..903a2941d 100644 --- a/xCAT-UI/js/custom/esx.js +++ b/xCAT-UI/js/custom/esx.js @@ -376,9 +376,30 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); var ready = true; var errorMessage = ''; - - // Get provision tab ID - var thisTabId = 'esxProvisionTab' + inst; + + // Get tab ID + var thisTabId = $(this).parents('.ui-tabs-panel').attr('id'); + + // Check if fields are properly filled in + var inputs = $('#' + thisTabId + ' input:visible'); + for ( var i = 0; i < inputs.length; i++) { + if (!inputs.eq(i).val()) { + inputs.eq(i).css('border', 'solid #FF0000 1px'); + ready = false; + } else { + inputs.eq(i).css('border', 'solid #BDBDBD 1px'); + } + } + + var selects = $('#' + thisTabId + ' select:visible'); + for ( var i = 0; i < selects.length; i++) { + if (!selects.eq(i).val()) { + selects.eq(i).css('border', 'solid #FF0000 1px'); + ready = false; + } else { + selects.eq(i).css('border', 'solid #BDBDBD 1px'); + } + } }); provForm.append(provisionBtn); }; diff --git a/xCAT-UI/js/custom/kvm.js b/xCAT-UI/js/custom/kvm.js index 39c7ca8f2..62f330c6d 100644 --- a/xCAT-UI/js/custom/kvm.js +++ b/xCAT-UI/js/custom/kvm.js @@ -376,9 +376,30 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); var ready = true; var errorMessage = ''; - - // Get provision tab ID - var thisTabId = 'kvmProvisionTab' + inst; + + // Get tab ID + var thisTabId = $(this).parents('.ui-tabs-panel').attr('id'); + + // Check if fields are properly filled in + var inputs = $('#' + thisTabId + ' input:visible'); + for ( var i = 0; i < inputs.length; i++) { + if (!inputs.eq(i).val()) { + inputs.eq(i).css('border', 'solid #FF0000 1px'); + ready = false; + } else { + inputs.eq(i).css('border', 'solid #BDBDBD 1px'); + } + } + + var selects = $('#' + thisTabId + ' select:visible'); + for ( var i = 0; i < selects.length; i++) { + if (!selects.eq(i).val()) { + selects.eq(i).css('border', 'solid #FF0000 1px'); + ready = false; + } else { + selects.eq(i).css('border', 'solid #BDBDBD 1px'); + } + } }); provForm.append(provisionBtn); }; diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 3aa6ae261..207100c36 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -1294,9 +1294,14 @@ zvmPlugin.prototype.loadProvisionPage = function(tabId) { // Append to provision tab $('#' + tabId).append(provForm); + var typeFS = $('
'); + var typeLegend = $('Type'); + typeFS.append(typeLegend); + provForm.append(typeFS); + // Create provision type drop down var provType = $('
'); - var typeLabel = $(''); + var typeLabel = $(''); var typeSelect = $(''); var provNewNode = $(''); var provExistNode = $(''); @@ -1304,7 +1309,7 @@ zvmPlugin.prototype.loadProvisionPage = function(tabId) { typeSelect.append(provExistNode); provType.append(typeLabel); provType.append(typeSelect); - provForm.append(provType); + typeFS.append(provType); /** * Create provision new node division diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 57c619d9c..b5d2ce23a 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -1817,7 +1817,7 @@ function loadDiskPoolTable(data) { var tableID = 'zDiskDataTable'; var table = new DataTable(tableID); // Resource headers: volume ID, device type, start address, and size - table.init( [ 'Hardware control point', 'Pool', 'Status', 'Volume ID', 'Device type', 'Start address', 'Size' ]); + table.init( [ 'HCP', 'Pool', 'Status', 'Volume ID', 'Device type', 'Start address', 'Size' ]); // Append datatable to tab fieldSet.append(table.object()); @@ -1877,7 +1877,7 @@ function loadNetworkTable(data) { // Create table var tableId = 'zNetworkDataTable'; var table = new DataTable(tableId); - table.init( [ 'Hardware control point', 'Type', 'Name', 'Details' ]); + table.init( [ 'HCP', 'Type', 'Name', 'Details' ]); // Append datatable to tab fieldSet.append(table.object()); @@ -1892,14 +1892,16 @@ function loadNetworkTable(data) { cols.eq(0).css('width', '20px'); // HCP column cols.eq(1).css('width', '20px'); // Type column cols.eq(2).css('width', '20px'); // Name column - cols.eq(3).css('width', '600px'); // Details column + cols.eq(3).css({'width': '600px'}); // Details column } // Skip index 0 because it contains nothing - var details = ''; + var details = '
';
 	for ( var i = 1; i < tmp.length; i++) {
-		details += tmp[i] + '
'; + details += tmp[i]; } + details += '
'; + dTable.fnAddData( [ hcp, type, name, details ]); } @@ -1981,6 +1983,16 @@ function connect2VSwitch(data) { function createZProvisionExisting(inst) { // Create provision existing and hide it var provExisting = $('
').hide(); + + var vmFS = $('
'); + var vmLegend = $('Virtual Machine'); + vmFS.append(vmLegend); + provExisting.append(vmFS); + + var osFS = $('
'); + var osLegend = $('Operating System'); + osFS.append(osLegend); + provExisting.append(osFS); // Create group input var group = $('
'); @@ -2017,7 +2029,7 @@ function createZProvisionExisting(inst) { var groupInput = $(''); group.append(groupInput); } - provExisting.append(group); + vmFS.append(group); // Create node input var node = $('
'); @@ -2025,7 +2037,7 @@ function createZProvisionExisting(inst) { var nodeDatatable = $('

Select a group to view its nodes

'); node.append(nodeLabel); node.append(nodeDatatable); - provExisting.append(node); + vmFS.append(node); // Create operating system image input var os = $('
'); @@ -2043,7 +2055,7 @@ function createZProvisionExisting(inst) { }); os.append(osLabel); os.append(osInput); - provExisting.append(os); + osFS.append(os); // Create boot method drop down var bootMethod = $('
'); @@ -2057,7 +2069,7 @@ function createZProvisionExisting(inst) { ); bootMethod.append(methoddLabel); bootMethod.append(methodSelect); - provExisting.append(bootMethod); + osFS.append(bootMethod); // Generate tooltips provExisting.find('div input[title]').tooltip({ @@ -2168,6 +2180,21 @@ function createZProvisionExisting(inst) { function createZProvisionNew(inst) { // Create provision new node division var provNew = $('
'); + + var vmFS = $('
'); + var vmLegend = $('Virtual Machine'); + vmFS.append(vmLegend); + provNew.append(vmFS); + + var hwFS = $('
'); + var hwLegend = $('Hardware'); + hwFS.append(hwLegend); + provNew.append(hwFS); + + var osFS = $('
'); + var osLegend = $('Operating System'); + osFS.append(osLegend); + provNew.append(osFS); // Create group input var group = $('
'); @@ -2185,7 +2212,7 @@ function createZProvisionNew(inst) { }); group.append(groupLabel); group.append(groupInput); - provNew.append(group); + vmFS.append(group); // Create node input var nodeName = $('
'); @@ -2193,11 +2220,11 @@ function createZProvisionNew(inst) { var nodeInput = $(''); nodeName.append(nodeLabel); nodeName.append(nodeInput); - provNew.append(nodeName); + vmFS.append(nodeName); // Create user ID input var userId = $('
'); - provNew.append(userId); + vmFS.append(userId); // Create hardware control point input var hcpDiv = $('
'); @@ -2225,7 +2252,7 @@ function createZProvisionNew(inst) { }); hcpDiv.append(hcpLabel); hcpDiv.append(hcpInput); - provNew.append(hcpDiv); + vmFS.append(hcpDiv); // Create operating system image input var os = $('
'); @@ -2243,7 +2270,7 @@ function createZProvisionNew(inst) { }); os.append(osLabel); os.append(osInput); - provNew.append(os); + osFS.append(os); // Create user entry input var defaultChkbox = $('').click(function() { @@ -2308,7 +2335,7 @@ function createZProvisionNew(inst) { }); var userEntry = $('
'); userEntry.append($('').append(defaultChkbox, 'Use default')); - provNew.append(userEntry); + hwFS.append(userEntry); // Create disk table var diskDiv = $('
'); @@ -2373,7 +2400,7 @@ function createZProvisionNew(inst) { diskRow.append(diskMode); // Get list of disk pools - var thisTabId = $(this).parent().parent().parent().parent().parent().parent().attr('id'); + var thisTabId = $(this).parents('.tab').attr('id'); var thisHcp = $('#' + thisTabId + ' input[name=hcp]').val(); var definedPools; if (thisHcp) { @@ -2420,7 +2447,7 @@ function createZProvisionNew(inst) { diskDiv.append(diskLabel); diskDiv.append(diskTable); - provNew.append(diskDiv); + hwFS.append(diskDiv); // Generate tooltips provNew.find('div input[title]').tooltip({ diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index de63b0e18..c6292164b 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -647,7 +647,7 @@ function loadNodes(data) { $('#nodesTab').children().remove(); // Create info bar for nodes tab - var info = createInfoBar('Double-click on a cell to edit. Click outside the table to save changes. Hit the Escape key to ignore changes.'); + var info = createInfoBar('Double-click on a cell to edit a node\'s properties. Click outside the table to save changes. Hit the Escape key to ignore changes.'); $('#nodesTab').append(info); // Create action bar diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index 6c2267016..7e5b7c8d6 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -613,10 +613,10 @@ function initPage() { includeJs("js/monitor/gangliamon.js"); headers.eq(3).css(style); loadMonitorPage(); - } else if (page == 'guide.php') { - includeJs("js/guide/guide.js"); + } else if (page == 'help.php') { + includeJs("js/help/help.js"); headers.eq(4).css(style); - loadGuidePage(); + loadHelpPage(); } else { // Load nodes page by default includeJs("js/jquery/jquery.topzindex.min.js"); @@ -822,6 +822,8 @@ function openSettings() { if ($.cookie('xcat_theme')) { // Select theme oList.find('input[value="' + $.cookie('xcat_theme') + '"]').attr('checked', true); + } else { + oList.find('input[value="start"]').attr('checked', true); } // Open form as a dialog diff --git a/xCAT-UI/js/xcatauth.js b/xCAT-UI/js/xcatauth.js index 9c2bf54a6..d481f2c25 100644 --- a/xCAT-UI/js/xcatauth.js +++ b/xCAT-UI/js/xcatauth.js @@ -71,7 +71,7 @@ function onlogin(data, txtStatus) { // Remembered what page they were trying to go to window.location = window.location.pathname; } else { - window.location = 'guide.php'; + window.location = 'help.php'; } // Set the logonflag diff --git a/xCAT-UI/lib/ui.php b/xCAT-UI/lib/ui.php index 80588725d..163785eb8 100644 --- a/xCAT-UI/lib/ui.php +++ b/xCAT-UI/lib/ui.php @@ -29,7 +29,7 @@ function loadPage() {
  • Configure
  • Provision
  • Monitor
  • -
  • Guide
  • +
  • Help
  • '; // User name and log out section diff --git a/xCAT-UI/xcat/plugins/web.pm b/xCAT-UI/xcat/plugins/web.pm index 27e41c0dc..7466db59f 100644 --- a/xCAT-UI/xcat/plugins/web.pm +++ b/xCAT-UI/xcat/plugins/web.pm @@ -2181,7 +2181,13 @@ sub web_getdefaultuserentry { $group = 'default'; } - my $entry = `ssh $hcp "cat /opt/zhcp/conf/$group.direct"`; + my $entry; + if (!(`ssh $hcp "test -e /opt/zhcp/conf/$group.direct && echo 'File exists'"`)) { + $entry = `ssh $hcp "cat /opt/zhcp/conf/default.direct"`; + } else { + $entry = `ssh $hcp "cat /opt/zhcp/conf/$group.direct"`; + } + $callback->( { data => $entry } ); } 1;