mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
CA-376512: The Destroy item was not available for multiple selection of powered down hosts.
Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
parent
1914a45869
commit
255571496a
@ -32,7 +32,6 @@ using System.Collections.Generic;
|
||||
using XenAdmin.Actions;
|
||||
using XenAdmin.Core;
|
||||
using XenAPI;
|
||||
using System.Linq;
|
||||
|
||||
namespace XenAdmin.Commands
|
||||
{
|
||||
@ -57,6 +56,7 @@ namespace XenAdmin.Commands
|
||||
protected override void RunCore(SelectedItemCollection selection)
|
||||
{
|
||||
List<AsyncAction> actions = new List<AsyncAction>();
|
||||
|
||||
foreach (Host host in selection.AsXenObjects<Host>())
|
||||
{
|
||||
Pool pool = Helpers.GetPool(host.Connection);
|
||||
@ -79,10 +79,13 @@ namespace XenAdmin.Commands
|
||||
|
||||
protected override bool CanRunCore(SelectedItemCollection selection)
|
||||
{
|
||||
if (!selection.AllItemsAre<Host>() || selection.Count > 1)
|
||||
return false;
|
||||
|
||||
return CanRun(selection.AsXenObjects<Host>().FirstOrDefault());
|
||||
foreach (var selectedItem in selection)
|
||||
{
|
||||
if (!(selectedItem.XenObject is Host host) || !CanRun(host))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ContextMenuText => Messages.DESTROY_HOST_CONTEXT_MENU_ITEM_TEXT;
|
||||
@ -94,17 +97,35 @@ namespace XenAdmin.Commands
|
||||
get
|
||||
{
|
||||
SelectedItemCollection selection = GetSelection();
|
||||
if (selection.Count > 0)
|
||||
|
||||
if (selection.Count == 1)
|
||||
{
|
||||
Host host = (Host)selection[0].XenObject;
|
||||
|
||||
return string.Format(Messages.CONFIRM_DESTROY_HOST, host.Name());
|
||||
}
|
||||
|
||||
if (selection.Count > 1)
|
||||
return Messages.CONFIRM_DESTROY_HOST_MANY;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override string ConfirmationDialogTitle => Messages.CONFIRM_DESTROY_HOST_TITLE;
|
||||
protected override string ConfirmationDialogTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
SelectedItemCollection selection = GetSelection();
|
||||
|
||||
if (selection.Count == 1)
|
||||
return Messages.CONFIRM_DESTROY_HOST_TITLE;
|
||||
|
||||
if (selection.Count > 1)
|
||||
return Messages.CONFIRM_DESTROY_HOST_TITLE_MANY;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override string ConfirmationDialogYesButtonLabel => Messages.CONFIRM_DESTROY_HOST_YES_BUTTON_LABEL;
|
||||
|
||||
|
25
XenModel/Messages.Designer.cs
generated
25
XenModel/Messages.Designer.cs
generated
@ -8438,7 +8438,7 @@ namespace XenAdmin {
|
||||
/// Looks up a localized string similar to Are you sure you want to destroy '{0}'?
|
||||
///
|
||||
///You should only need to destroy a server if it has physically failed.
|
||||
///Destroying this server will permanently remove it from the pool along with its local SRs, DVD drives and removable storage. The server will need to be reinstalled before it can be used again.
|
||||
///Destroying a server will permanently remove it from the pool along with its local SRs, DVD drives and removable storage. The server will need to be reinstalled before it can be used again.
|
||||
///
|
||||
///This action is final and unrecoverable..
|
||||
/// </summary>
|
||||
@ -8448,6 +8448,20 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Are you sure you want to destroy the selected servers?
|
||||
///
|
||||
///You should only need to destroy servers if they have physically failed.
|
||||
///Destroying servers will permanently remove them from the pool along with their local SRs, DVD drives and removable storage. The servers will need to be reinstalled before they can be used again.
|
||||
///
|
||||
///This action is final and unrecoverable..
|
||||
/// </summary>
|
||||
public static string CONFIRM_DESTROY_HOST_MANY {
|
||||
get {
|
||||
return ResourceManager.GetString("CONFIRM_DESTROY_HOST_MANY", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Destroy Server.
|
||||
/// </summary>
|
||||
@ -8457,6 +8471,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Destroy Multiple Servers.
|
||||
/// </summary>
|
||||
public static string CONFIRM_DESTROY_HOST_TITLE_MANY {
|
||||
get {
|
||||
return ResourceManager.GetString("CONFIRM_DESTROY_HOST_TITLE_MANY", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to &Yes, Destroy.
|
||||
/// </summary>
|
||||
|
@ -3053,13 +3053,24 @@ This will also delete its VMs.</value>
|
||||
<value>Are you sure you want to destroy '{0}'?
|
||||
|
||||
You should only need to destroy a server if it has physically failed.
|
||||
Destroying this server will permanently remove it from the pool along with its local SRs, DVD drives and removable storage. The server will need to be reinstalled before it can be used again.
|
||||
Destroying a server will permanently remove it from the pool along with its local SRs, DVD drives and removable storage. The server will need to be reinstalled before it can be used again.
|
||||
|
||||
This action is final and unrecoverable.</value>
|
||||
</data>
|
||||
<data name="CONFIRM_DESTROY_HOST_MANY" xml:space="preserve">
|
||||
<value>Are you sure you want to destroy the selected servers?
|
||||
|
||||
You should only need to destroy servers if they have physically failed.
|
||||
Destroying servers will permanently remove them from the pool along with their local SRs, DVD drives and removable storage. The servers will need to be reinstalled before they can be used again.
|
||||
|
||||
This action is final and unrecoverable.</value>
|
||||
</data>
|
||||
<data name="CONFIRM_DESTROY_HOST_TITLE" xml:space="preserve">
|
||||
<value>Destroy Server</value>
|
||||
</data>
|
||||
<data name="CONFIRM_DESTROY_HOST_TITLE_MANY" xml:space="preserve">
|
||||
<value>Destroy Multiple Servers</value>
|
||||
</data>
|
||||
<data name="CONFIRM_DESTROY_HOST_YES_BUTTON_LABEL" xml:space="preserve">
|
||||
<value>&Yes, Destroy</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user