From 497afabcefc0fe921e1ba5979e178a40265df9fc Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Thu, 5 Mar 2015 19:10:54 +0000 Subject: [PATCH] CA-162989: Container Management GUI use-ability/homogeneity fixes Implemented changes as follows (copied from ticket): "I'd suggest the following use-ability/homogeneity fixes for the new container management tabs, if they are quick and easy: Combine "Docker Version" and "Docker Information" on the VM-General-tab into "Container Management - Docker Status" with the following fields only: API version Version Git Commit Driver Index Server Address Execution Driver IPv4 Forwarding In the "Processes" tab, change the name from "Docker Processes" to "Container Processes" In the "Details" tab, change the name from "Docker Detail" to "Container Details" In the "Details" tab, drop the top level element "docker_inspect" (XML requires a single root-node, afaik the Windows form treenode does not), or alternatively open the root node by default and rename it to "Inspect Result" In the "Details" tab, add the "Details"-headline in black on white - just like on the "Processes"-tab Also, on the container's General tab, show Properties button disabled, instead on hiding it (to be consistent to other cases, e.g. disconnected servers) " Signed-off-by: Gabor Apati-Nagy --- .../TabPages/DockerDetailsPage.Designer.cs | 23 ++++- XenAdmin/TabPages/DockerDetailsPage.cs | 29 ++++-- XenAdmin/TabPages/DockerDetailsPage.resx | 90 +++++++++++++++++-- XenAdmin/TabPages/DockerProcessPage.resx | 2 +- XenAdmin/TabPages/GeneralTabPage.cs | 49 +++------- XenAdmin/TabPages/GeneralTabPage.resx | 2 +- XenModel/Messages.Designer.cs | 4 +- XenModel/Messages.resx | 4 +- 8 files changed, 142 insertions(+), 61 deletions(-) diff --git a/XenAdmin/TabPages/DockerDetailsPage.Designer.cs b/XenAdmin/TabPages/DockerDetailsPage.Designer.cs index 2b3120fea..20ec72727 100755 --- a/XenAdmin/TabPages/DockerDetailsPage.Designer.cs +++ b/XenAdmin/TabPages/DockerDetailsPage.Designer.cs @@ -34,11 +34,14 @@ namespace XenAdmin.TabPages this.ButtonPanel = new System.Windows.Forms.Panel(); this.RefreshTime = new System.Windows.Forms.Label(); this.TreePanel = new System.Windows.Forms.Panel(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.DetailtreeView = new System.Windows.Forms.TreeView(); + this.label1 = new System.Windows.Forms.Label(); this.RefreshTimer = new System.Windows.Forms.Timer(this.components); this.pageContainerPanel.SuspendLayout(); this.ButtonPanel.SuspendLayout(); this.TreePanel.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); this.SuspendLayout(); // // pageContainerPanel @@ -68,15 +71,27 @@ namespace XenAdmin.TabPages // TreePanel // resources.ApplyResources(this.TreePanel, "TreePanel"); - this.TreePanel.Controls.Add(this.DetailtreeView); + this.TreePanel.Controls.Add(this.tableLayoutPanel2); this.TreePanel.Controls.Add(this.ButtonPanel); this.TreePanel.Name = "TreePanel"; // + // tableLayoutPanel2 + // + resources.ApplyResources(this.tableLayoutPanel2, "tableLayoutPanel2"); + this.tableLayoutPanel2.Controls.Add(this.DetailtreeView, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.label1, 0, 0); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + // // DetailtreeView // resources.ApplyResources(this.DetailtreeView, "DetailtreeView"); this.DetailtreeView.Name = "DetailtreeView"; // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.label1.Name = "label1"; + // // RefreshTimer // this.RefreshTimer.Tick += new System.EventHandler(this.RefreshTimer_Tick); @@ -91,6 +106,8 @@ namespace XenAdmin.TabPages this.ButtonPanel.ResumeLayout(false); this.ButtonPanel.PerformLayout(); this.TreePanel.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -101,8 +118,10 @@ namespace XenAdmin.TabPages private System.Windows.Forms.Panel TreePanel; private System.Windows.Forms.Panel ButtonPanel; private System.Windows.Forms.Label RefreshTime; - private System.Windows.Forms.TreeView DetailtreeView; private System.Windows.Forms.Timer RefreshTimer; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.TreeView DetailtreeView; + private System.Windows.Forms.Label label1; } } diff --git a/XenAdmin/TabPages/DockerDetailsPage.cs b/XenAdmin/TabPages/DockerDetailsPage.cs index 94f49bacc..13caea6e4 100755 --- a/XenAdmin/TabPages/DockerDetailsPage.cs +++ b/XenAdmin/TabPages/DockerDetailsPage.cs @@ -145,21 +145,34 @@ namespace XenAdmin.TabPages { if (cachedResult == currentResult) return; + cachedResult = currentResult; DetailtreeView.Nodes.Clear(); XmlDocument doc = new XmlDocument(); doc.LoadXml(currentResult); - IEnumerator ienum = doc.GetEnumerator(); - XmlNode docker_inspect; - while (ienum.MoveNext()) + + IEnumerator firstEnum = doc.GetEnumerator(); + XmlNode node; + while (firstEnum.MoveNext()) { - docker_inspect = (XmlNode) ienum.Current; - if (docker_inspect.NodeType != XmlNodeType.XmlDeclaration) + node = (XmlNode)firstEnum.Current; + + if (node.NodeType != XmlNodeType.XmlDeclaration) { - TreeNode rootNode = new TreeNode(); - CreateTree(docker_inspect, rootNode); - DetailtreeView.Nodes.Add(rootNode); + //we are on the root element now (docker_inspect) + //using the following enumerator to iterate through the children nodes and to build related sub-trees + //note that we are intentionally not adding the root node to the tree (UX decision) + var secondEnum = node.GetEnumerator(); + while (secondEnum.MoveNext()) + { + //recursively building the tree + TreeNode rootNode = new TreeNode(); + CreateTree((XmlNode)secondEnum.Current, rootNode); + + //adding the current sub-tree to the TreeView + DetailtreeView.Nodes.Add(rootNode); + } } } } diff --git a/XenAdmin/TabPages/DockerDetailsPage.resx b/XenAdmin/TabPages/DockerDetailsPage.resx index 9b6774bcd..14cb5789c 100755 --- a/XenAdmin/TabPages/DockerDetailsPage.resx +++ b/XenAdmin/TabPages/DockerDetailsPage.resx @@ -125,18 +125,24 @@ True + + 1 + Fill - 0, 0 + 7, 31 + + + 7, 3, 9, 3 - 816, 333 + 803, 299 - 0 + 1 DetailtreeView @@ -145,11 +151,80 @@ System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - TreePanel + tableLayoutPanel2 0 + + True + + + Segoe UI, 11.25pt + + + 3, 0 + + + 3, 0, 0, 2 + + + 0, 6, 10, 0 + + + 65, 26 + + + 2 + + + Details + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel2 + + + 1 + + + Fill + + + 0, 0 + + + 0, 0, 0, 0 + + + 2 + + + 819, 333 + + + 3 + + + tableLayoutPanel2 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TreePanel + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="DetailtreeView" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,Percent,100" /></TableLayoutSettings> + True @@ -180,6 +255,9 @@ 4, 7 + + 9, 3, 3, 3 + 74, 23 @@ -208,7 +286,7 @@ 0, 333 - 816, 42 + 819, 42 2 @@ -229,7 +307,7 @@ 3, 3 - 816, 375 + 819, 375 3 diff --git a/XenAdmin/TabPages/DockerProcessPage.resx b/XenAdmin/TabPages/DockerProcessPage.resx index 6b42e185f..9aae72e1b 100644 --- a/XenAdmin/TabPages/DockerProcessPage.resx +++ b/XenAdmin/TabPages/DockerProcessPage.resx @@ -448,7 +448,7 @@ 27 - Docker Processes + Container Processes MiddleLeft diff --git a/XenAdmin/TabPages/GeneralTabPage.cs b/XenAdmin/TabPages/GeneralTabPage.cs index bb7390e69..8e005732f 100644 --- a/XenAdmin/TabPages/GeneralTabPage.cs +++ b/XenAdmin/TabPages/GeneralTabPage.cs @@ -383,7 +383,10 @@ namespace XenAdmin.TabPages public void EnableDisableEdit() { buttonProperties.Enabled = xenObject != null && !xenObject.Locked && xenObject.Connection != null && xenObject.Connection.IsConnected; - buttonProperties.Visible = !(xenObject is DockerContainer); + + //keeping it seperate + if (xenObject is DockerContainer) + buttonProperties.Enabled = false; } public void BuildList() @@ -468,7 +471,6 @@ namespace XenAdmin.TabPages generateMultipathBootBox(); generateVCPUsBox(); generateDockerInfoBox(); - generateDockerVersionBox(); generateReadCachingBox(); } @@ -1554,50 +1556,19 @@ namespace XenAdmin.TabPages if (info == null) return; - PDSection s = pdSectionDockerInfo; - addStringEntry(s, Messages.DOCKER_INFO_NGOROUTINES, info.NGoroutines); - addStringEntry(s, Messages.DOCKER_INFO_ROOT_DIR, info.DockerRootDir); - addStringEntry(s, Messages.DOCKER_INFO_DRIVER_STATUS, info.DriverStatus); - addStringEntry(s, Messages.OPERATING_SYSTEM, info.OperatingSystem); ; - addStringEntry(s, Messages.CONTAINER, info.Containers); - addStringEntry(s, Messages.MEMORY, Util.MemorySizeString(Convert.ToDouble(info.MemTotal))); - addStringEntry(s, Messages.DOCKER_INFO_DRIVER, info.Driver); - addStringEntry(s, Messages.DOCKER_INFO_INDEX_SERVER_ADDRESS, info.IndexServerAddress); - addStringEntry(s, Messages.DOCKER_INFO_INITIATE_PATH, info.InitPath); - addStringEntry(s, Messages.DOCKER_INFO_EXECUTION_DRIVER, info.ExecutionDriver); - addStringEntry(s, Messages.NAME, info.Name); - addStringEntry(s, Messages.DOCKER_INFO_NCPU, info.NCPU); - addStringEntry(s, Messages.DOCKER_INFO_DEBUG, info.Debug); - addStringEntry(s, Messages.ID, info.ID); - addStringEntry(s, Messages.DOCKER_INFO_IPV4_FORWARDING, info.IPv4Forwarding); - addStringEntry(s, Messages.DOCKER_INFO_KERNEL_VERSION, info.KernelVersion); - addStringEntry(s, Messages.DOCKER_INFO_NFD, info.NFd); - addStringEntry(s, Messages.DOCKER_INFO_INITIATE_SHA1, info.InitSha1); - addStringEntry(s, Messages.DOCKER_INFO_LABELS, info.Labels); - addStringEntry(s, Messages.DOCKER_INFO_MEMORY_LIMIT, Util.MemorySizeString(Convert.ToDouble(info.MemoryLimit))); - addStringEntry(s, Messages.DOCKER_INFO_SWAP_LIMIT, info.SwapLimit); - addStringEntry(s, Messages.CONTAINER_IMAGE, info.Images); - addStringEntry(s, Messages.DOCKER_INFO_NEVENT_LISTENER, info.NEventsListener); - } - - private void generateDockerVersionBox() - { - VM vm = xenObject as VM; - if (vm == null) - return; - VM_Docker_Version version = vm.DockerVersion; if (version == null) return; - PDSection s = pdSectionDockerVersion; - addStringEntry(s, Messages.DOCKER_INFO_KERNEL_VERSION, version.KernelVersion); - addStringEntry(s, Messages.DOCKER_INFO_ARCH, version.Arch); + PDSection s = pdSectionDockerInfo; + addStringEntry(s, Messages.DOCKER_INFO_API_VERSION, version.ApiVersion); addStringEntry(s, Messages.DOCKER_INFO_VERSION, version.Version); addStringEntry(s, Messages.DOCKER_INFO_GIT_COMMIT, version.GitCommit); - addStringEntry(s, Messages.OPERATING_SYSTEM, version.Os); - addStringEntry(s, Messages.DOCKER_INFO_GO_VERSION, version.GoVersion); + addStringEntry(s, Messages.DOCKER_INFO_DRIVER, info.Driver); + addStringEntry(s, Messages.DOCKER_INFO_INDEX_SERVER_ADDRESS, info.IndexServerAddress); + addStringEntry(s, Messages.DOCKER_INFO_EXECUTION_DRIVER, info.ExecutionDriver); + addStringEntry(s, Messages.DOCKER_INFO_IPV4_FORWARDING, info.IPv4Forwarding); } private bool CPUsIdentical(IEnumerable cpus) diff --git a/XenAdmin/TabPages/GeneralTabPage.resx b/XenAdmin/TabPages/GeneralTabPage.resx index 7ba555a7c..0497648c2 100644 --- a/XenAdmin/TabPages/GeneralTabPage.resx +++ b/XenAdmin/TabPages/GeneralTabPage.resx @@ -211,7 +211,7 @@ 1, 1, 1, 1 - Docker Information + Container Management - Docker Status 712, 34 diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index e082fa499..dd50c1dbb 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -10491,7 +10491,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Docker Detail. + /// Looks up a localized string similar to Container Details. /// public static string DOCKER_DETAIL_TAB_TITLE { get { @@ -10698,7 +10698,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Docker Processes. + /// Looks up a localized string similar to Container Processes. /// public static string DOCKER_PROCESS_TAB_TITLE { get { diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index ede2a15cd..dac4b7403 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -3731,10 +3731,10 @@ This will also delete its subfolders. does not use - Docker Detail + Container Details - Docker Processes + Container Processes Api Version