CP-13123: Add two buttons on General Tab of docker container.

1. Add "View Console" and "View Log" on general tab of docker container.
2. Grey the two buttons if the container is on Windows (Server 2016) VM.
3. Enable the two buttons when the container is running on Linux VM.

Signed-off-by: Hui Zhang <hui.zhang@citrix.com>
This commit is contained in:
Hui Zhang 2016-02-03 18:12:05 +08:00
parent 6cff4d546a
commit 73c8bf4604
3 changed files with 150 additions and 2 deletions

View File

@ -35,6 +35,9 @@ namespace XenAdmin.TabPages
this.buttonProperties = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.buttonPanel = new System.Windows.Forms.FlowLayoutPanel();
this.buttonViewConsole = new System.Windows.Forms.Button();
this.buttonViewLog = new System.Windows.Forms.Button();
this.linkLabelExpand = new System.Windows.Forms.LinkLabel();
this.linkLabelCollapse = new System.Windows.Forms.LinkLabel();
this.panel2 = new XenAdmin.Controls.PanelNoFocusScroll();
@ -79,6 +82,7 @@ namespace XenAdmin.TabPages
this.pageContainerPanel.SuspendLayout();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
this.buttonPanel.SuspendLayout();
this.panel2.SuspendLayout();
this.panelReadCaching.SuspendLayout();
this.panelDockerInfo.SuspendLayout();
@ -122,12 +126,34 @@ namespace XenAdmin.TabPages
//
// panel3
//
this.panel3.Controls.Add(this.buttonProperties);
this.panel3.Controls.Add(this.buttonPanel);
this.panel3.Controls.Add(this.linkLabelExpand);
this.panel3.Controls.Add(this.linkLabelCollapse);
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Name = "panel3";
//
// buttonPanel
//
this.buttonPanel.Controls.Add(this.buttonProperties);
this.buttonPanel.Controls.Add(this.buttonViewConsole);
this.buttonPanel.Controls.Add(this.buttonViewLog);
resources.ApplyResources(this.buttonPanel, "buttonPanel");
this.buttonPanel.Name = "buttonPanel";
//
// buttonViewConsole
//
resources.ApplyResources(this.buttonViewConsole, "buttonViewConsole");
this.buttonViewConsole.Name = "buttonViewConsole";
this.buttonViewConsole.UseVisualStyleBackColor = true;
this.buttonViewConsole.Click += new System.EventHandler(this.buttonViewConsole_Click);
//
// buttonViewLog
//
resources.ApplyResources(this.buttonViewLog, "buttonViewLog");
this.buttonViewLog.Name = "buttonViewLog";
this.buttonViewLog.UseVisualStyleBackColor = true;
this.buttonViewLog.Click += new System.EventHandler(this.buttonViewLog_Click);
//
// linkLabelExpand
//
resources.ApplyResources(this.linkLabelExpand, "linkLabelExpand");
@ -438,6 +464,7 @@ namespace XenAdmin.TabPages
this.panel1.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.buttonPanel.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panelReadCaching.ResumeLayout(false);
@ -510,5 +537,8 @@ namespace XenAdmin.TabPages
private Controls.PDSection pdSectionDockerInfo;
private System.Windows.Forms.Panel panelReadCaching;
private Controls.PDSection pdSectionReadCaching;
private System.Windows.Forms.Button buttonViewConsole;
private System.Windows.Forms.Button buttonViewLog;
private System.Windows.Forms.FlowLayoutPanel buttonPanel;
}
}

View File

@ -395,7 +395,31 @@ namespace XenAdmin.TabPages
//keeping it separate
if (xenObject is DockerContainer)
{
buttonProperties.Enabled = false;
DockerContainer container = (DockerContainer)xenObject;
buttonViewConsole.Visible = true;
buttonViewLog.Visible = true;
// Grey out the buttons if the Container management VM is Windows.
// For Linux VM, enable the buttons only when the docker is running.
if (container.Parent.IsWindows)
{
buttonViewConsole.Enabled = false;
buttonViewLog.Enabled = false;
}
else
{
buttonViewConsole.Enabled = buttonViewLog.Enabled = container.power_state == vm_power_state.Running;
}
}
else
{
buttonViewConsole.Visible = false;
buttonViewLog.Visible = false;
}
}
public void BuildList()
@ -1766,5 +1790,15 @@ namespace XenAdmin.TabPages
linkLabelExpand.Enabled = anyCollapsed;
linkLabelCollapse.Enabled = anyExpanded;
}
private void buttonViewConsole_Click(object sender, EventArgs e)
{
}
private void buttonViewLog_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -1404,6 +1404,9 @@
<data name="buttonProperties.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 2</value>
</data>
<data name="buttonProperties.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 2, 0, 0</value>
</data>
<data name="buttonProperties.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
@ -1420,11 +1423,92 @@
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;buttonProperties.Parent" xml:space="preserve">
<value>panel3</value>
<value>buttonPanel</value>
</data>
<data name="&gt;&gt;buttonProperties.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="buttonViewConsole.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="buttonViewConsole.Location" type="System.Drawing.Point, System.Drawing">
<value>80, 2</value>
</data>
<data name="buttonViewConsole.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>5, 2, 0, 0</value>
</data>
<data name="buttonViewConsole.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 23</value>
</data>
<data name="buttonViewConsole.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="buttonViewConsole.Text" xml:space="preserve">
<value>View &amp;Console</value>
</data>
<data name="&gt;&gt;buttonViewConsole.Name" xml:space="preserve">
<value>buttonViewConsole</value>
</data>
<data name="&gt;&gt;buttonViewConsole.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;buttonViewConsole.Parent" xml:space="preserve">
<value>buttonPanel</value>
</data>
<data name="&gt;&gt;buttonViewConsole.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="buttonViewLog.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="buttonViewLog.Location" type="System.Drawing.Point, System.Drawing">
<value>175, 2</value>
</data>
<data name="buttonViewLog.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>5, 2, 0, 0</value>
</data>
<data name="buttonViewLog.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 23</value>
</data>
<data name="buttonViewLog.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="buttonViewLog.Text" xml:space="preserve">
<value>View &amp;Log</value>
</data>
<data name="&gt;&gt;buttonViewLog.Name" xml:space="preserve">
<value>buttonViewLog</value>
</data>
<data name="&gt;&gt;buttonViewLog.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;buttonViewLog.Parent" xml:space="preserve">
<value>buttonPanel</value>
</data>
<data name="&gt;&gt;buttonViewLog.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="buttonPanel.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="buttonPanel.Size" type="System.Drawing.Size, System.Drawing">
<value>300, 28</value>
</data>
<data name="buttonPanel.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;buttonPanel.Name" xml:space="preserve">
<value>buttonPanel</value>
</data>
<data name="&gt;&gt;buttonPanel.Type" xml:space="preserve">
<value>System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;buttonPanel.Parent" xml:space="preserve">
<value>panel3</value>
</data>
<data name="&gt;&gt;buttonPanel.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="linkLabelExpand.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>