From: Socorro <socorro(a)linux.vnet.ibm.com>
This patch fixes the behavior of the actions - Deactivate and Undefine -
taken on the storage pools listed in the Storage tab. Prior to the patch,
even if the menu item was disabled, the user is still able to click on it
and perform the action. Now clicking on those disabled menu items does not
do anything which is the intended behavior.
Signed-off-by: Socorro <socorro(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.storage_main.js | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 18e6eea..0d7a6d7 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -312,6 +312,13 @@ kimchi.storageBindClick = function() {
var $pool = $(this);
var poolName = $pool.data('name');
var confirmMessage = i18n['KCHPOOL6001M'].replace('%1',
'<strong>'+poolName+'</strong>');
+ var in_use = $pool.data('inuse');
+ if ('active' === $pool.data('stat') || in_use) {
+ $pool.parent().addClass('disabled');
+ return false;
+ } else {
+ $pool.parent().removeClass('disabled');
+ }
var settings = {
title : i18n['KCHAPI6001M'],
content : confirmMessage,
@@ -341,6 +348,14 @@ kimchi.storageBindClick = function() {
event.preventDefault();
var poolName = $(this).data('name');
var confirmMessage = i18n['KCHPOOL6012M'].replace('%1',
'<strong>'+poolName+'</strong>');
+ var $poolDeactivate = $(this);
+ var in_use = $poolDeactivate.data('inuse');
+ if (in_use) {
+ $poolDeactivate.parent().addClass('disabled');
+ return false;
+ } else {
+ $poolDeactivate.parent().removeClass('disabled');
+ }
var settings = {
title : i18n['KCHAPI6001M'],
content : confirmMessage,
--
2.7.4