mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-27 02:56:01 +01:00
Renamed dialog to match containing file name. Minor refactoring.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
9cfb714322
commit
e34cf30168
@ -107,27 +107,28 @@ namespace XenAdmin.Commands
|
||||
|
||||
private void ExitMaintenanceMode(Host host)
|
||||
{
|
||||
List<VM> vmsToUnEvacuate = new List<VM>();
|
||||
vmsToUnEvacuate.AddRange(host.GetHaltedEvacuatedVMs());
|
||||
vmsToUnEvacuate.AddRange(host.GetMigratedEvacuatedVMs());
|
||||
vmsToUnEvacuate.AddRange(host.GetSuspendedEvacuatedVMs());
|
||||
var vmsToRestore = new List<VM>();
|
||||
vmsToRestore.AddRange(host.GetHaltedEvacuatedVMs());
|
||||
vmsToRestore.AddRange(host.GetMigratedEvacuatedVMs());
|
||||
vmsToRestore.AddRange(host.GetSuspendedEvacuatedVMs());
|
||||
|
||||
List<VM> to_remove = new List<VM>();
|
||||
foreach (VM vm in vmsToUnEvacuate)
|
||||
foreach (VM vm in vmsToRestore)
|
||||
{
|
||||
if (vm.resident_on == host.opaque_ref)
|
||||
to_remove.Add(vm);
|
||||
}
|
||||
foreach (VM vm in to_remove)
|
||||
{
|
||||
vmsToUnEvacuate.Remove(vm);
|
||||
vmsToRestore.Remove(vm);
|
||||
}
|
||||
|
||||
DialogResult result = DialogResult.No;
|
||||
|
||||
if (vmsToUnEvacuate.Count > 0 && !MainWindowCommandInterface.RunInAutomatedTestMode)
|
||||
if (vmsToRestore.Count > 0 && !MainWindowCommandInterface.RunInAutomatedTestMode)
|
||||
{
|
||||
result = new RestoreVMsDialog(vmsToUnEvacuate, host).ShowDialog();
|
||||
using (var dlg = new ExitMaintenanceModeDialog(vmsToRestore, host))
|
||||
result = dlg.ShowDialog();
|
||||
|
||||
if (result == DialogResult.Cancel)
|
||||
return;
|
||||
@ -140,7 +141,7 @@ namespace XenAdmin.Commands
|
||||
}
|
||||
|
||||
MainWindowCommandInterface.CloseActiveWizards(host.Connection);
|
||||
var action = new EnableHostAction(host, result == DialogResult.Yes,AddHostToPoolCommand.EnableNtolDialog);
|
||||
var action = new EnableHostAction(host, result == DialogResult.Yes, AddHostToPoolCommand.EnableNtolDialog);
|
||||
action.Completed += Program.MainWindow.action_Completed;
|
||||
action.RunAsync();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace XenAdmin.Dialogs
|
||||
{
|
||||
partial class RestoreVMsDialog
|
||||
partial class ExitMaintenanceModeDialog
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -28,7 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RestoreVMsDialog));
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExitMaintenanceModeDialog));
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.tableLayoutPanelBody = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.labelBlurb = new System.Windows.Forms.Label();
|
||||
|
@ -38,16 +38,19 @@ using XenAdmin.Core;
|
||||
|
||||
namespace XenAdmin.Dialogs
|
||||
{
|
||||
public partial class RestoreVMsDialog : XenDialogBase
|
||||
public partial class ExitMaintenanceModeDialog : XenDialogBase
|
||||
{
|
||||
private List<VM> VMsToRestore;
|
||||
private Host TargetHost;
|
||||
|
||||
/// <summary>
|
||||
/// A dialog which shows a list of VMs, their current locations and state and asks the user whether they want to restore them to their original locations.
|
||||
/// A dialog which shows a list of VMs with their current locations and state,
|
||||
/// and asks the user whether they want to restore them to their original locations.
|
||||
/// </summary>
|
||||
/// <param name="VMsToRestore">List of VMs that would be restored. Do not pass null or an empty list, this dialog makes no sense otherwise.</param>
|
||||
/// <param name="VMsToRestore">List of VMs to be restored. Do not pass null or an
|
||||
/// empty list, this dialog makes no sense otherwise.</param>
|
||||
/// <param name="Host">The host which is exiting maintenance mode</param>
|
||||
public RestoreVMsDialog(List<VM> VMsToRestore, Host Host)
|
||||
public ExitMaintenanceModeDialog(List<VM> VMsToRestore, Host Host)
|
||||
{
|
||||
InitializeComponent();
|
||||
System.Diagnostics.Trace.Assert(VMsToRestore != null && VMsToRestore.Count > 0, "There are no VMs to restore");
|
||||
@ -91,24 +94,15 @@ namespace XenAdmin.Dialogs
|
||||
}
|
||||
}
|
||||
|
||||
protected class VMRestoreRow : DataGridViewRow
|
||||
private class VMRestoreRow : DataGridViewRow
|
||||
{
|
||||
public VMRestoreRow(VM vm)
|
||||
{
|
||||
// The image cell, shows the current state of the VM
|
||||
DataGridViewImageCell iconCell = new DataGridViewImageCell();
|
||||
iconCell.Value = Images.GetImage16For(vm);
|
||||
Cells.Add(iconCell);
|
||||
|
||||
// The VM name cell
|
||||
DataGridViewTextBoxCell nameCell = new DataGridViewTextBoxCell();
|
||||
nameCell.Value = Helpers.GetName(vm);
|
||||
Cells.Add(nameCell);
|
||||
var iconCell = new DataGridViewImageCell {Value = Images.GetImage16For(vm)};
|
||||
var nameCell = new DataGridViewTextBoxCell {Value = Helpers.GetName(vm)};
|
||||
var locationCell = new DataGridViewTextBoxCell {Value = Helpers.GetName(vm.Connection.Resolve(vm.resident_on))};
|
||||
|
||||
// The current location cell
|
||||
DataGridViewTextBoxCell locationCell = new DataGridViewTextBoxCell();
|
||||
locationCell.Value = Helpers.GetName(vm.Connection.Resolve(vm.resident_on));
|
||||
Cells.Add(locationCell);
|
||||
Cells.AddRange(iconCell, nameCell, locationCell);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ VMs to restore:</value>
|
||||
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>RestoreVMsDialog</value>
|
||||
<value>ExitMaintenanceModeDialog</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Dialogs.XenDialogBase, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
|
Loading…
Reference in New Issue
Block a user