From 6336859884653227b9dfd47269018ccc170b9706 Mon Sep 17 00:00:00 2001 From: phamt Date: Tue, 16 Apr 2013 17:49:43 +0000 Subject: [PATCH] Enabled disk and zFCP pool tables to be generated even if no disk or zFCP pools exit. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15986 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/zvmUtils.js | 71 +++++++++++++++++++++------------- xCAT-UI/js/provision/images.js | 4 ++ 2 files changed, 49 insertions(+), 26 deletions(-) diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index f4be52952..6c30ee78d 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -3233,6 +3233,9 @@ function getDiskPool(data) { }); } // End of if } // End of for + } else { + // Load empty table + loadDiskPoolTable(); } } @@ -3268,7 +3271,7 @@ function getZfcpPool(data) { } // End of for } else { // Load empty table - loadZfcpPoolTable(null); + loadZfcpPoolTable(); } } @@ -3315,20 +3318,29 @@ function loadDiskPoolTable(data) { var panelId = 'zvmDiskResource'; $('#' + panelId).find('img[src="images/loader.gif"]').remove(); - // Do not continue if the call failed - if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { - return; - } - - // Obtain mapping for zHCP to zVM system var hcp2zvm = new Object(); - hcp2zvm = getHcpZvmHash(); - - var args = data.msg.split(';'); - var hcp = args[0].replace('hcp=', ''); - var pool = args[1].replace('pool=', ''); - var stat = args[2].replace('stat=', ''); - var tmp = data.rsp[0].split(hcp + ': '); + var args, hcp, pool, stat, tmp; + if (data) { + // Do not continue if the call failed + if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { + return; + } + + // Obtain mapping for zHCP to zVM system + hcp2zvm = getHcpZvmHash(); + + args = data.msg.split(';'); + hcp = args[0].replace('hcp=', ''); + pool = args[1].replace('pool=', ''); + stat = args[2].replace('stat=', ''); + tmp = data.rsp[0].split(hcp + ': '); + } else { + // Provide empty values so the table will be generated + hcp = ''; + pool = ''; + stat = ''; + tmp = new Array(); + } // Resource tab ID var info = $('#' + panelId).find('.ui-state-highlight'); @@ -3500,20 +3512,27 @@ function loadZfcpPoolTable(data) { var panelId = 'zfcpResource'; $('#' + panelId).find('img[src="images/loader.gif"]').remove(); - // Do not continue if the call failed - if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { - return; - } - - // Obtain mapping for zHCP to zVM system var hcp2zvm = new Object(); - hcp2zvm = getHcpZvmHash(); - var args, hcp, pool, tmp; - args = data.msg.split(';'); - hcp = args[0].replace('hcp=', ''); - pool = args[1].replace('pool=', ''); - tmp = data.rsp[0].split(hcp + ': '); + if (data) { + // Do not continue if the call failed + if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { + return; + } + + // Obtain mapping for zHCP to zVM system + hcp2zvm = getHcpZvmHash(); + + args = data.msg.split(';'); + hcp = args[0].replace('hcp=', ''); + pool = args[1].replace('pool=', ''); + tmp = data.rsp[0].split(hcp + ': '); + } else { + // Provide empty values so the table will be generated + hcp = ''; + pool = '' + tmp = new Array(); + } // Resource tab ID var info = $('#' + panelId).find('.ui-state-highlight'); diff --git a/xCAT-UI/js/provision/images.js b/xCAT-UI/js/provision/images.js index 6d4441532..b7962c63d 100644 --- a/xCAT-UI/js/provision/images.js +++ b/xCAT-UI/js/provision/images.js @@ -47,6 +47,10 @@ function loadImagesPage() { function loadImages(data) { // Data returned var rsp = data.rsp; + if (rsp[0].indexOf('Could not find any object definitions') > -1) { + rsp = new Array(); + } + // Image attributes hash var attrs = new Object(); // Image attributes