mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-12-03 16:41:04 +01:00
Fixes issue where the Finish page of the NewVM wizard was not showing the selected home server correctly.
This commit is contained in:
parent
0d70266173
commit
940b1580b9
1
XenAdmin/Controls/AffinityPicker.Designer.cs
generated
1
XenAdmin/Controls/AffinityPicker.Designer.cs
generated
@ -109,6 +109,7 @@ namespace XenAdmin.Controls
|
|||||||
this.ReasonColumn});
|
this.ReasonColumn});
|
||||||
resources.ApplyResources(this.ServersGridView, "ServersGridView");
|
resources.ApplyResources(this.ServersGridView, "ServersGridView");
|
||||||
this.ServersGridView.Name = "ServersGridView";
|
this.ServersGridView.Name = "ServersGridView";
|
||||||
|
this.ServersGridView.SelectionChanged += new System.EventHandler(this.ServersGridView_SelectionChanged);
|
||||||
this.ServersGridView.VisibleChanged += new System.EventHandler(this.ServersGridView_VisibleChanged);
|
this.ServersGridView.VisibleChanged += new System.EventHandler(this.ServersGridView_VisibleChanged);
|
||||||
//
|
//
|
||||||
// ImageColumn
|
// ImageColumn
|
||||||
|
@ -48,6 +48,7 @@ namespace XenAdmin.Controls
|
|||||||
private IXenConnection Connection;
|
private IXenConnection Connection;
|
||||||
private Host SrHost;
|
private Host SrHost;
|
||||||
private Host Affinity;
|
private Host Affinity;
|
||||||
|
private bool selectedOnVisibleChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should always be true if the AffinityPicker is used to create a VM.
|
/// Should always be true if the AffinityPicker is used to create a VM.
|
||||||
@ -56,9 +57,7 @@ namespace XenAdmin.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal bool AutoSelectAffinity = true;
|
internal bool AutoSelectAffinity = true;
|
||||||
|
|
||||||
public event EventHandler SelectedAffinityChanged = new EventHandler(OnSelectedAffinityChanged);
|
public event Action SelectedAffinityChanged;
|
||||||
|
|
||||||
private static void OnSelectedAffinityChanged(object obj, EventArgs e) { }
|
|
||||||
|
|
||||||
public AffinityPicker()
|
public AffinityPicker()
|
||||||
{
|
{
|
||||||
@ -72,9 +71,9 @@ namespace XenAdmin.Controls
|
|||||||
SrHost = srhost;
|
SrHost = srhost;
|
||||||
tableLayoutPanelWlbWarning.Visible = Helpers.WlbEnabledAndConfigured(connection);
|
tableLayoutPanelWlbWarning.Visible = Helpers.WlbEnabledAndConfigured(connection);
|
||||||
LoadServers();
|
LoadServers();
|
||||||
_UpdateControl();
|
UpdateControl();
|
||||||
SelectRadioButtons();
|
SelectRadioButtons();
|
||||||
SelectedAffinityChanged(SelectedAffinity, new EventArgs());
|
SelectedAffinityChanged?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadServers()
|
private void LoadServers()
|
||||||
@ -88,16 +87,6 @@ namespace XenAdmin.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateControl()
|
private void UpdateControl()
|
||||||
{
|
|
||||||
_UpdateControl();
|
|
||||||
|
|
||||||
SelectedAffinityChanged(SelectedAffinity, new EventArgs());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// does not fire selected affinity changed event
|
|
||||||
/// </summary>
|
|
||||||
private void _UpdateControl()
|
|
||||||
{
|
{
|
||||||
if (Connection == null)
|
if (Connection == null)
|
||||||
return;
|
return;
|
||||||
@ -126,25 +115,15 @@ namespace XenAdmin.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Host SelectedAffinity
|
public Host SelectedAffinity => DynamicRadioButton.Checked ? null : SelectedServer();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DynamicRadioButton.Checked ? null : SelectedServer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private Host SelectedServer()
|
private Host SelectedServer()
|
||||||
{
|
{
|
||||||
if (ServersGridView.SelectedRows.Count == 0)
|
if (ServersGridView.SelectedRows.Count > 0)
|
||||||
return null;
|
return ((ServerGridRow)ServersGridView.SelectedRows[0]).Server;
|
||||||
|
|
||||||
Host h = ((ServerGridRow)ServersGridView.SelectedRows[0]).Server;
|
|
||||||
if (h == null)
|
|
||||||
return null;
|
return null;
|
||||||
return h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectServer(Host host)
|
private bool SelectServer(Host host)
|
||||||
@ -173,7 +152,6 @@ namespace XenAdmin.Controls
|
|||||||
|
|
||||||
private bool SelectSomething()
|
private bool SelectSomething()
|
||||||
{
|
{
|
||||||
//Now decide if we want to select anything.
|
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
|
|
||||||
if (Affinity != null)
|
if (Affinity != null)
|
||||||
@ -182,9 +160,6 @@ namespace XenAdmin.Controls
|
|||||||
if (!selected && SrHost != null)
|
if (!selected && SrHost != null)
|
||||||
selected = SelectServer(SrHost);
|
selected = SelectServer(SrHost);
|
||||||
|
|
||||||
/* if (!selected)
|
|
||||||
selected = SelectAnyServer();*/
|
|
||||||
|
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,17 +168,14 @@ namespace XenAdmin.Controls
|
|||||||
return SelectedAffinity != null || DynamicRadioButton.Checked;
|
return SelectedAffinity != null || DynamicRadioButton.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void affinityListBox_SelectedValueChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
UpdateControl();
|
|
||||||
}
|
|
||||||
|
|
||||||
// we dont need to bother firing events if the other radio button gets checked or unchecked
|
// we dont need to bother firing events if the other radio button gets checked or unchecked
|
||||||
private void StaticRadioButton_CheckedChanged(object sender, EventArgs e)
|
private void StaticRadioButton_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (StaticRadioButton.Checked && SelectedServer() == null)
|
if (StaticRadioButton.Checked && SelectedServer() == null)
|
||||||
SelectSomething();
|
SelectSomething();
|
||||||
|
|
||||||
UpdateControl();
|
UpdateControl();
|
||||||
|
SelectedAffinityChanged?.Invoke();
|
||||||
|
|
||||||
if (StaticRadioButton.Checked)
|
if (StaticRadioButton.Checked)
|
||||||
ServersGridView.Select();
|
ServersGridView.Select();
|
||||||
@ -217,8 +189,6 @@ namespace XenAdmin.Controls
|
|||||||
ServersGridView.Select();
|
ServersGridView.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool selectedOnVisibleChanged = false;
|
|
||||||
|
|
||||||
private void ServersGridView_VisibleChanged(object sender, EventArgs e)
|
private void ServersGridView_VisibleChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!selectedOnVisibleChanged)
|
if (!selectedOnVisibleChanged)
|
||||||
@ -227,6 +197,12 @@ namespace XenAdmin.Controls
|
|||||||
SelectSomething();//CA-213728
|
SelectSomething();//CA-213728
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ServersGridView_SelectionChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateControl();
|
||||||
|
SelectedAffinityChanged?.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ServerGridRow : DataGridViewExRow
|
internal class ServerGridRow : DataGridViewExRow
|
||||||
|
@ -269,7 +269,7 @@ namespace XenAdmin.Wizards.NewVMWizard
|
|||||||
{
|
{
|
||||||
if (!page_4_HomeServer.DisableStep)
|
if (!page_4_HomeServer.DisableStep)
|
||||||
{
|
{
|
||||||
m_affinity = page_4_HomeServer.SelectedHomeServer;
|
m_affinity = page_4_HomeServer.Affinity;
|
||||||
page_6_Storage.Affinity = m_affinity;
|
page_6_Storage.Affinity = m_affinity;
|
||||||
page_CloudConfigParameters.Affinity = m_affinity;
|
page_CloudConfigParameters.Affinity = m_affinity;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace XenAdmin.Wizards.NewVMWizard
|
|||||||
//
|
//
|
||||||
resources.ApplyResources(this.affinityPicker1, "affinityPicker1");
|
resources.ApplyResources(this.affinityPicker1, "affinityPicker1");
|
||||||
this.affinityPicker1.Name = "affinityPicker1";
|
this.affinityPicker1.Name = "affinityPicker1";
|
||||||
this.affinityPicker1.SelectedAffinityChanged += new System.EventHandler(this.affinityPicker1_SelectedAffinityChanged);
|
this.affinityPicker1.SelectedAffinityChanged += new System.Action(this.affinityPicker1_SelectedAffinityChanged);
|
||||||
//
|
//
|
||||||
// Page_HomeServer
|
// Page_HomeServer
|
||||||
//
|
//
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using XenAdmin.Actions.VMActions;
|
using XenAdmin.Actions.VMActions;
|
||||||
using XenAPI;
|
using XenAPI;
|
||||||
@ -49,31 +50,18 @@ namespace XenAdmin.Wizards.NewVMWizard
|
|||||||
|
|
||||||
#region XenTabPage overrides
|
#region XenTabPage overrides
|
||||||
|
|
||||||
public override string Text
|
public override string Text => Messages.NEWVMWIZARD_HOMESERVERPAGE_NAME;
|
||||||
{
|
|
||||||
get { return Messages.NEWVMWIZARD_HOMESERVERPAGE_NAME; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string PageTitle
|
public override string PageTitle => Messages.NEWVMWIZARD_HOMESERVERPAGE_TITLE;
|
||||||
{
|
|
||||||
get { return Messages.NEWVMWIZARD_HOMESERVERPAGE_TITLE; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string HelpID
|
public override string HelpID => "HomeServer";
|
||||||
{
|
|
||||||
get { return "HomeServer"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override List<KeyValuePair<string, string>> PageSummary
|
public override List<KeyValuePair<string, string>> PageSummary =>
|
||||||
|
new List<KeyValuePair<string, string>>
|
||||||
{
|
{
|
||||||
get
|
new KeyValuePair<string, string>(Messages.NEWVMWIZARD_HOMESERVERPAGE_HOMESERVER,
|
||||||
{
|
Affinity != null ? Affinity.Name() : Messages.NEWVMWIZARD_HOMESERVER_NONE)
|
||||||
List<KeyValuePair<string, string>> sum = new List<KeyValuePair<string, string>>();
|
};
|
||||||
sum.Add(new KeyValuePair<string, string>(Messages.NEWVMWIZARD_HOMESERVERPAGE_HOMESERVER,
|
|
||||||
Affinity != null ? Affinity.Name() : Messages.NEWVMWIZARD_HOMESERVER_NONE));
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool EnableNext()
|
public override bool EnableNext()
|
||||||
{
|
{
|
||||||
@ -122,17 +110,16 @@ namespace XenAdmin.Wizards.NewVMWizard
|
|||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
|
|
||||||
public Host SelectedHomeServer { get { return affinityPicker1.SelectedAffinity; } }
|
public Host Affinity { get; set; }
|
||||||
|
|
||||||
public Host Affinity { private get; set; }
|
|
||||||
public VM SelectedTemplate { private get; set; }
|
public VM SelectedTemplate { private get; set; }
|
||||||
public InstallMethod SelectedInstallMethod { private get; set; }
|
public InstallMethod SelectedInstallMethod { private get; set; }
|
||||||
public VDI SelectedCD { private get; set; }
|
public VDI SelectedCD { private get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void affinityPicker1_SelectedAffinityChanged(object sender, System.EventArgs e)
|
private void affinityPicker1_SelectedAffinityChanged()
|
||||||
{
|
{
|
||||||
|
Affinity = affinityPicker1.SelectedAffinity;
|
||||||
OnPageUpdated();
|
OnPageUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user