Merge pull request #1061 from kc284/car-2217

Do not show the CVM's own name on its console, but rather a description including the host's name.
This commit is contained in:
Mihaela Stoica 2016-07-08 13:36:08 +01:00 committed by GitHub
commit 4ea4ea8d0b
7 changed files with 43 additions and 23 deletions

View File

@ -118,7 +118,7 @@ namespace XenAdmin.ConsoleView
VM_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(VM_CollectionChanged);
source.Connection.Cache.RegisterCollectionChanged<VM>(VM_CollectionChangedWithInvoke);
if (source.IsControlDomainZero)
if (source.is_control_domain)
{
Host host = source.Connection.Resolve(source.resident_on);
if (host != null)
@ -133,7 +133,7 @@ namespace XenAdmin.ConsoleView
hostMetrics.PropertyChanged += Server_PropertyChanged;
}
HostLabel.Text = string.Format(Messages.CONSOLE_HOST, host.Name);
HostLabel.Text = string.Format(source.IsControlDomainZero ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, host.Name);
HostLabel.Visible = true;
}
}
@ -524,11 +524,13 @@ namespace XenAdmin.ConsoleView
UpdateOpenSSHConsoleButtonState();
}
if (source.IsControlDomainZero && e.PropertyName == "name_label")
if (source.is_control_domain && e.PropertyName == "name_label")
{
HostLabel.Text = string.Format(Messages.CONSOLE_HOST, source.AffinityServerString);
string text = string.Format(source.IsControlDomainZero ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, source.AffinityServerString);
HostLabel.Text = text;
if (parentVNCView != null && parentVNCView.undockedForm != null)
parentVNCView.undockedForm.Text = source.AffinityServerString;
parentVNCView.undockedForm.Text = text;
}
}

View File

@ -121,7 +121,7 @@ namespace XenAdmin.ConsoleView
oldScaledSetting = vncTabView.IsScaled;
vncTabView.showHeaderBar(!source.IsControlDomainZero, !source.is_control_domain);
vncTabView.showHeaderBar(!source.is_control_domain, true);
undockedForm.ClientSize = vncTabView.GrowToFit();
@ -178,10 +178,13 @@ namespace XenAdmin.ConsoleView
private string UndockedWindowTitle(VM source)
{
if (source.IsControlDomainZero)
if (source.is_control_domain)
{
Host host = source.Connection.Resolve(source.resident_on);
return host == null ? source.Name : string.Format(Messages.CONSOLE_HOST, host.Name);
if (host == null)
return source.Name;
return string.Format(source.IsControlDomainZero ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, host.Name);
}
else
{

View File

@ -68,11 +68,15 @@ namespace XenAdmin.Controls.ConsoleTab
private void DisplayConnectionName()
{
if (_selectedScreen == null) //screen not assigned yet
return;
return;
string connectionName = _selectedScreen.Source.IsControlDomainZero
? _selectedScreen.Source.AffinityServerString
: _selectedScreen.Source.Name;
string connectionName;
if (_selectedScreen.Source.IsControlDomainZero)
connectionName = _selectedScreen.Source.AffinityServerString;
else if (_selectedScreen.Source.is_control_domain)
connectionName = string.Format(Messages.CONSOLE_HOST_NUTANIX, _selectedScreen.Source.AffinityServerString);
else
connectionName = _selectedScreen.Source.Name;
using (Graphics g = toolStrip1.CreateGraphics())
{
@ -169,7 +173,7 @@ namespace XenAdmin.Controls.ConsoleTab
}
public void ShowAnimated()
private void ShowAnimated()
{
if (state == Animating.Open)
return;
@ -239,8 +243,7 @@ namespace XenAdmin.Controls.ConsoleTab
{
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { }
protected override void OnRenderToolStripBackground(
ToolStripRenderEventArgs e)
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
{
using (var brush = new LinearGradientBrush(e.AffectedBounds, Color.FromArgb(64, 64, 64), Color.Gray, 90))
{

View File

@ -70,6 +70,7 @@ namespace XenAdmin
this.TabPageBallooning = new System.Windows.Forms.TabPage();
this.TabPageBallooningUpsell = new System.Windows.Forms.TabPage();
this.TabPageConsole = new System.Windows.Forms.TabPage();
this.TabPageCvmConsole = new System.Windows.Forms.TabPage();
this.TabPageStorage = new System.Windows.Forms.TabPage();
this.TabPagePhysicalStorage = new System.Windows.Forms.TabPage();
this.TabPageSR = new System.Windows.Forms.TabPage();
@ -281,7 +282,6 @@ namespace XenAdmin
this.StatusStrip = new System.Windows.Forms.StatusStrip();
this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.statusProgressBar = new System.Windows.Forms.ToolStripProgressBar();
this.TabPageCvmConsole = new System.Windows.Forms.TabPage();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -394,6 +394,12 @@ namespace XenAdmin
this.TabPageConsole.Name = "TabPageConsole";
this.TabPageConsole.UseVisualStyleBackColor = true;
//
// TabPageCvmConsole
//
resources.ApplyResources(this.TabPageCvmConsole, "TabPageCvmConsole");
this.TabPageCvmConsole.Name = "TabPageCvmConsole";
this.TabPageCvmConsole.UseVisualStyleBackColor = true;
//
// TabPageStorage
//
resources.ApplyResources(this.TabPageStorage, "TabPageStorage");
@ -1847,12 +1853,6 @@ namespace XenAdmin
this.statusProgressBar.Name = "statusProgressBar";
this.statusProgressBar.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
//
// TabPageCvmConsole
//
resources.ApplyResources(this.TabPageCvmConsole, "TabPageCvmConsole");
this.TabPageCvmConsole.Name = "TabPageCvmConsole";
this.TabPageCvmConsole.UseVisualStyleBackColor = true;
//
// MainWindow
//
resources.ApplyResources(this, "$this");

View File

@ -328,7 +328,7 @@
<value>22</value>
</data>
<data name="TabPageCvmConsole.Text" xml:space="preserve">
<value>CVM Console</value>
<value>Nutanix CVM Console</value>
</data>
<data name="&gt;&gt;TabPageCvmConsole.Name" xml:space="preserve">
<value>TabPageCvmConsole</value>

View File

@ -8083,6 +8083,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to {0} Nutanix CVM console.
/// </summary>
public static string CONSOLE_HOST_NUTANIX {
get {
return ResourceManager.GetString("CONSOLE_HOST_NUTANIX", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This VM is currently shut down..
/// </summary>

View File

@ -2946,6 +2946,9 @@ You can only connect to a single [Citrix] [XenServer product] Express Edition se
<data name="CONSOLE_HOST_DEAD" xml:space="preserve">
<value>This server is unavailable.</value>
</data>
<data name="CONSOLE_HOST_NUTANIX" xml:space="preserve">
<value>{0} Nutanix CVM console</value>
</data>
<data name="CONSOLE_POWER_STATE_HALTED" xml:space="preserve">
<value>This VM is currently shut down.</value>
</data>