Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.storage_main.js | 13 +++++++++----
ui/pages/tabs/storage.html.tmpl | 6 +++---
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 9eaaa51..5312388 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -180,11 +180,19 @@ kimchi.storageBindClick = function() {
event.preventDefault();
var storage_action = $(this);
var deleteButton = storage_action.find('.pool-delete');
- if ('active' === deleteButton.data('stat')) {
+ var deactivateButton = storage_action.find('.pool-deactivate');
+ var in_use = deleteButton.data('inuse');
+ if ('active' === deleteButton.data('stat') || in_use) {
deleteButton.parent().addClass('disabled');
} else {
deleteButton.parent().removeClass('disabled');
}
+
+ if (in_use) {
+ deactivateButton.parent().addClass('disabled');
+ } else {
+ deactivateButton.parent().removeClass('disabled');
+ }
});
$('.pool-extend').on('click', function(event) {
@@ -194,9 +202,6 @@ kimchi.storageBindClick = function() {
partitions = $(this).data('name');
//$("#logicalPoolExtend").dialog("option",
"poolName", $(this).data('name'));
});
-
-
-
}
$('.wok-datagrid-row .handle ').on('click', function(event) {
diff --git a/ui/pages/tabs/storage.html.tmpl b/ui/pages/tabs/storage.html.tmpl
index 5ffdc97..fa51e48 100644
--- a/ui/pages/tabs/storage.html.tmpl
+++ b/ui/pages/tabs/storage.html.tmpl
@@ -123,7 +123,7 @@
<button class="btn btn-primary dropdown-toggle"
type="button" data-toggle="dropdown" aria-expanded="false"
aria-haspopup="true"><span
class="edit-alt"></span>$_("Actions")<span
class="caret"></span></button>
<ul class="dropdown-menu actionsheet">
<li role="presentation">
- <a href="#" class="pool-deactivate"
data-stat="{state}" data-name="{name}"
data-persistent="{persistent}" href="#"><i class="fa
fa-minus-circle"></i>$_("Deactivate")</a>
+ <a href="#" class="pool-deactivate"
data-inuse="{in_use}" data-stat="{state}" data-name="{name}"
data-persistent="{persistent}" href="#"><i class="fa
fa-minus-circle"></i>$_("Deactivate")</a>
</li>
<li role="presentation">
<a href="#" class="pool-activate"
data-stat="{state}" data-name="{name}"><i class="fa
fa-power-off"></i>$_("Activate")</a>
@@ -135,7 +135,7 @@
<a href="#" class="pool-extend"
data-stat="{state}" data-name="{name}" data-toggle="modal"
data-target="#logicalPoolExtend"><i class="fa
fa-external-link-square"></i>$_("Extend")</a>
</li>
<li role="presentation"
class="critical">
- <a href="#" class="pool-delete"
data-stat="{state}" data-name="{name}"><i class="fa
fa-ban"></i>$_("Undefine")</a>
+ <a href="#" class="pool-delete"
data-inuse="{in_use}" data-stat="{state}"
data-name="{name}"><i class="fa
fa-ban"></i>$_("Undefine")</a>
</li>
</ul>
</div>
@@ -203,4 +203,4 @@
</script>
<div id="modalWindow" class="modal fade storage-modal"
tabindex="-1" role="dialog"
aria-labelledby="storageModalLabel" aria-hidden="true">
</div>
</body>
-</html>
\ No newline at end of file
+</html>
--
1.9.1