
On 09/22/2014 04:14 AM, huoyuxin@linux.vnet.ibm.com wrote:
From: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com>
2 Issues: 1. In menu widget, it handle the passin params incorrectly. 2. Filter out storage pools without any available volume.
Signed-off-by: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com> --- ui/js/src/kimchi.guest_storage_add.main.js | 2 +- ui/js/widgets/select-menu.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui/js/src/kimchi.guest_storage_add.main.js b/ui/js/src/kimchi.guest_storage_add.main.js index a8c5acb..6e01d3e 100644 --- a/ui/js/src/kimchi.guest_storage_add.main.js +++ b/ui/js/src/kimchi.guest_storage_add.main.js @@ -61,7 +61,7 @@ kimchi.guest_storage_add_main = function() { var options = []; if (result && result.length) { $.each(result, function(index, storagePool) { - if ((storagePool.state=="active") && (storagePool.type !== 'kimchi-iso')) { + if ((storagePool.state=="active") && (storagePool.type !== 'kimchi-iso') && storagePool.nr_volumes) {
It is not enough to determine if a pool has or not free volumes. For each pool, you need to call: GET /storagepools/<pool>/storagevolumes?ref_count=0 If the response is a list > 0, the pool should be listed as an option, otherwise not.
options.push({ label: storagePool.name, value: storagePool.name diff --git a/ui/js/widgets/select-menu.js b/ui/js/widgets/select-menu.js index ad53200..c4b0209 100644 --- a/ui/js/widgets/select-menu.js +++ b/ui/js/widgets/select-menu.js @@ -36,8 +36,10 @@ var selectedClass = 'active'; var itemTag = 'li'; var item; + that.listControl.find('li').remove(); + that.label.text(""); + that.target.val(""); if (options.length > 0) { - that.listControl.find('li').remove(); $.each(options, function(index, option) { item = $('<' + itemTag + '>' + option.label +'</' + itemTag + '>'); item.data('value', option.value); @@ -58,8 +60,6 @@ that.target.change(); } }); - } else { - kimchi.message.error.code('KCHAPI6006E'); } },