From 7d50b22e94c7a913d805d5922ed653264570af81 Mon Sep 17 00:00:00 2001 From: Mihaela Stoica Date: Wed, 16 Jul 2014 14:24:49 +0100 Subject: [PATCH] CA-138822: Improvements to the Host/Pool Storage tab, following on from the TRIM work - Show tooltip on "Reclaim freed space" button on multiselect Signed-off-by: Mihaela Stoica --- XenAdmin/Commands/TrimSRCommand.cs | 16 ++++++++++++++++ XenModel/Messages.Designer.cs | 9 +++++++++ XenModel/Messages.resx | 3 +++ 3 files changed, 28 insertions(+) diff --git a/XenAdmin/Commands/TrimSRCommand.cs b/XenAdmin/Commands/TrimSRCommand.cs index 2739bad5a..e1102d7c6 100644 --- a/XenAdmin/Commands/TrimSRCommand.cs +++ b/XenAdmin/Commands/TrimSRCommand.cs @@ -30,6 +30,7 @@ */ using System.Collections.Generic; +using System.Linq; using XenAdmin.Actions; using XenAdmin.Core; using XenAPI; @@ -94,5 +95,20 @@ namespace XenAdmin.Commands } return base.GetCantExecuteReasonCore(item); } + + /// + /// Gets the tool tip text when the command is not able to run. + /// If multiple items and Trim is not supported on all, then return this reason. + /// Otherwise, the default behaviour: CantExectuteReason for single items, null for multiple. + /// + protected override string DisabledToolTipText + { + get + { + var selection = GetSelection(); + var allUnsuported = selection.Count > 1 && selection.Select(item => item.XenObject as SR).All(sr => sr != null && !sr.SupportsTrim); + return allUnsuported ? Messages.TOOLTIP_SR_TRIM_UNSUPPORTED_MULTIPLE : base.DisabledToolTipText; + } + } } } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index f028afa2a..db70c0d35 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -29956,6 +29956,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Reclaiming freed space not supported on these SRs. + /// + public static string TOOLTIP_SR_TRIM_UNSUPPORTED_MULTIPLE { + get { + return ResourceManager.GetString("TOOLTIP_SR_TRIM_UNSUPPORTED_MULTIPLE", resourceCulture); + } + } + /// /// Looks up a localized string similar to Views and Saved Searches. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 9ffa087ae..3399d0a0f 100644 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -10376,6 +10376,9 @@ Do you want to connect to the pool master '{1}'? Reclaiming freed space not supported on this SR + + Reclaiming freed space not supported on these SRs + Views and Saved Searches