1) Disable "Reset" and "Delete" buttons when using non-persistent VMs
2) Disable "Reset" button when VM is shutdown
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/list.css | 11 +++++++++++
ui/js/src/kimchi.guest_main.js | 7 +++++--
ui/pages/guest.html.tmpl | 10 +++++-----
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/ui/css/theme-default/list.css b/ui/css/theme-default/list.css
index ded18eb..52cccc4 100644
--- a/ui/css/theme-default/list.css
+++ b/ui/css/theme-default/list.css
@@ -228,6 +228,17 @@
padding: 7px 10px;
}
+.guest-actions .top button {
+ display: inline-block;
+ width: 42px;
+ height: 42px;
+}
+
+.guest-actions .top button span {
+ margin-left: -3px;
+ margin-top: -1px;
+}
+
.guest-actions .bottom {
padding: 0 10px;
}
diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index 2fd5c55..21caf1b 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -252,6 +252,7 @@ kimchi.createGuestLi = function(vmObject, prevScreenImage, openMenu)
{
//Setup the VM list entry
var vmRunningBool=(vmObject.state=="running");
+ var vmPersistent = (vmObject.persistent == true);
result.attr('id',vmObject.name);
result.data(vmObject);
@@ -302,8 +303,10 @@ kimchi.createGuestLi = function(vmObject, prevScreenImage, openMenu)
{
//Setup the VM Actions
var guestActions=result.find("div[name=guest-actions]");
- guestActions.find(".shutoff-disabled").prop('disabled',
!vmRunningBool );
- guestActions.find(".running-disabled").prop('disabled',
vmRunningBool );
+ guestActions.find(".shutoff-disabled").prop("disabled",
!vmRunningBool);
+ guestActions.find(".running-disabled").prop("disabled",
vmRunningBool);
+ guestActions.find(".non-persistent-disabled").prop("disabled",
!vmPersistent);
+ guestActions.find(".reset-disabled").prop("disabled",
!vmRunningBool || !vmPersistent);
if (vmRunningBool) {
guestActions.find(".running-hidden").hide();
diff --git a/ui/pages/guest.html.tmpl b/ui/pages/guest.html.tmpl
index ebb5e86..3cc2fad 100644
--- a/ui/pages/guest.html.tmpl
+++ b/ui/pages/guest.html.tmpl
@@ -50,9 +50,9 @@
</div>
<div class="sortable guest-actions"
name="guest-actions">
<div class="top">
- <a class="btn shutoff-disabled"
name="vm-reset" href="javascript:void(0);"
title="$_("Reset")"><span class="icon
reset"></span></a>
- <a class="btn running-hidden" name="vm-start"
href="javascript:void(0);" title="$_("Start")"><span
class="icon power-down"></span></a>
- <a class="btn shutoff-hidden"
name="vm-poweroff" href="javascript:void(0);"
title="$_("Power Off")"><span class="icon
power-up"></span></a>
+ <button class="btn reset-disabled"
name="vm-reset" href="javascript:void(0);"
title="$_("Reset")"><span class="icon
reset"></span></button>
+ <button class="btn running-hidden"
name="vm-start" href="javascript:void(0);"
title="$_("Start")"><span class="icon
power-down"></span></button>
+ <button class="btn shutoff-hidden"
name="vm-poweroff" href="javascript:void(0);"
title="$_("Power Off")"><span class="icon
power-up"></span></button>
</div>
<div class="bottom">
<div name="actionmenu" class="btn dropdown popable
vm-action" style="width: 70px">
@@ -61,11 +61,11 @@
<button class="button-big shutoff-disabled"
name="vm-console" ><span
class="text">$_("Connect")</span></button>
<button class="button-big running-disabled"
name="vm-clone"><span
class="text">$_("Clone")</span></button>
<button class="button-big"
name="vm-edit"><span
class="text">$_("Edit")</span></button>
- <button class="button-big shutoff-hidden"
name="vm-reset"><span
class="text">$_("Reset")</span></button>
+ <button class="button-big shutoff-hidden
non-persistent-disabled" name="vm-reset"><span
class="text">$_("Reset")</span></button>
<button class="button-big shutoff-hidden"
name="vm-shutdown"><span class="text">$_("Shut
Down")</span></button>
<button class="button-big running-hidden"
name="vm-start"><span
class="text">$_("Start")</span></button>
<button class="button-big shutoff-hidden"
name="vm-poweroff"><span class="text">$_("Power
Off")</span></button>
- <a class="button-big red "
name="vm-delete">$_("Delete")</a>
+ <button class="button-big red
non-persistent-disabled"
name="vm-delete">$_("Delete")</button>
</div>
</div>
</div>
--
1.9.3
Show replies by date
Applied. Thanks.
Regards,
Aline Manera