CP-10929: Add per-container General-Tab to XC

1.Add ports and command in DockerContainer object
2.All labels in General box are internationalized.
3.Add UUID, command, ports in General box
4.Export DockerContainer in ICache
5.Modify tab title to "Container General Properties"
6.Remove properties button

Signed-off-by: Cheng Zhang <cheng.zhang@citrix.com>
This commit is contained in:
Cheng Zhang 2015-02-10 11:03:53 +08:00
parent d79ad010ac
commit c1403c1a92
8 changed files with 176 additions and 15 deletions

View File

@ -427,6 +427,11 @@ namespace XenAdmin.TabPages
base.Text = Messages.STORAGELINKSYSTEM_GENERAL_TAB_TITLE;
else if (xenObject is StorageLinkRepository)
base.Text = Messages.SR_GENERAL_TAB_TITLE;
else if (xenObject is DockerContainer)
{
buttonProperties.Visible = false;
base.Text = Messages.CONTAINER_GENERAL_TAB_TITLE;
}
panel2.SuspendLayout();
// Clear all the data from the sections (visible and non visible)
@ -1352,11 +1357,14 @@ namespace XenAdmin.TabPages
{
PDSection s = pdSectionGeneral;
DockerContainer dockerContainer = (DockerContainer)xenObject;
s.AddEntry(FriendlyName("host.name_label"), Helpers.GetName(dockerContainer));
s.AddEntry(Messages.STATUS, dockerContainer.status);
s.AddEntry("Created", dockerContainer.created);
s.AddEntry("Image", dockerContainer.image);
s.AddEntry("Container", dockerContainer.container);
s.AddEntry(Messages.NAME, dockerContainer.Name.Length != 0 ? dockerContainer.Name : Messages.NONE);
s.AddEntry(Messages.STATUS, dockerContainer.status.Length != 0 ? dockerContainer.status : Messages.NONE);
s.AddEntry(Messages.CONTAINER_CREATED, dockerContainer.created.Length != 0 ? dockerContainer.created : Messages.NONE);
s.AddEntry(Messages.CONTAINER_IMAGE, dockerContainer.image.Length != 0 ? dockerContainer.image : Messages.NONE);
s.AddEntry(Messages.CONTAINER, dockerContainer.container.Length != 0 ? dockerContainer.container : Messages.NONE);
s.AddEntry(Messages.CONTAINER_COMMAND, dockerContainer.command.Length != 0 ? dockerContainer.command : Messages.NONE);
s.AddEntry(Messages.CONTAINER_PORTS, dockerContainer.ports.Length != 0 ? dockerContainer.ports : Messages.NONE);
s.AddEntry(Messages.UUID, dockerContainer.uuid.Length != 0 ? dockerContainer.uuid : Messages.NONE);
}
}

View File

@ -41,8 +41,8 @@ namespace XenAdmin.Model
{
}
public DockerContainer(VM parent, string uuid, string name, string description, string status, string container,
string created, string image)
public DockerContainer(VM parent, string uuid, string name, string description, string status, string container,
string created, string image, string command, string ports)
: this()
{
this.parent = parent;
@ -53,8 +53,10 @@ namespace XenAdmin.Model
this.name_description = description;
this.status = status;
this.container = container;
this.created = created;
this.image = image;
this.created = created;
this.image = image;
this.command = command;
this.ports = ports;
}
public VM Parent
@ -187,7 +189,37 @@ namespace XenAdmin.Model
}
}
}
private string _image;
private string _image;
public virtual string command
{
get { return _command; }
set
{
if (!Helper.AreEqual(value, _command))
{
_command = value;
Changed = true;
NotifyPropertyChanged("command");
}
}
}
private string _command;
public virtual string ports
{
get { return _ports; }
set
{
if (!Helper.AreEqual(value, _ports))
{
_ports = value;
Changed = true;
NotifyPropertyChanged("ports");
}
}
}
private string _ports;
public override string ToString()
{
@ -232,7 +264,9 @@ namespace XenAdmin.Model
status = update.status;
container = update.container;
created = update.created;
image = update.image;
image = update.image;
command = update.command;
ports = update.ports;
}
public override string SaveChanges(Session session, string _serverOpaqueRef, DockerContainer serverObject)

View File

@ -220,9 +220,19 @@ namespace XenAdmin.Model
string image = "";
propertyNode = entry.ChildNodes.Cast<XmlNode>().FirstOrDefault(node => node.Name == "image");
if (propertyNode != null)
image = propertyNode.InnerText;
DockerContainer dockerContainer = new DockerContainer(vm, id, name, string.Empty, status, container, created, image);
image = propertyNode.InnerText;
string command = "";
propertyNode = entry.ChildNodes.Cast<XmlNode>().FirstOrDefault(node => node.Name == "command");
if (propertyNode != null)
command = propertyNode.InnerText;
string ports = "";
propertyNode = entry.ChildNodes.Cast<XmlNode>().FirstOrDefault(node => node.Name == "ports");
if (propertyNode != null)
ports = propertyNode.InnerText;
DockerContainer dockerContainer = new DockerContainer(vm, id, name, string.Empty, status, container, created, image, command, ports);
// update existing container or add a new one
DockerContainer existingContainer = vm.Connection.Resolve(new XenRef<DockerContainer>(id));

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -7644,6 +7644,60 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Container.
/// </summary>
public static string CONTAINER {
get {
return ResourceManager.GetString("CONTAINER", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Command.
/// </summary>
public static string CONTAINER_COMMAND {
get {
return ResourceManager.GetString("CONTAINER_COMMAND", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Created.
/// </summary>
public static string CONTAINER_CREATED {
get {
return ResourceManager.GetString("CONTAINER_CREATED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Container General Properties.
/// </summary>
public static string CONTAINER_GENERAL_TAB_TITLE {
get {
return ResourceManager.GetString("CONTAINER_GENERAL_TAB_TITLE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Image.
/// </summary>
public static string CONTAINER_IMAGE {
get {
return ResourceManager.GetString("CONTAINER_IMAGE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ports.
/// </summary>
public static string CONTAINER_PORTS {
get {
return ResourceManager.GetString("CONTAINER_PORTS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to contains.
/// </summary>

View File

@ -2747,6 +2747,24 @@ VM {2} をエクスポートしてもよろしいですか?</value>
<data name="CONTAINED_IN" xml:space="preserve">
<value>以下に含まれる</value>
</data>
<data name="CONTAINER" xml:space="preserve">
<value>Container</value>
</data>
<data name="CONTAINER_COMMAND" xml:space="preserve">
<value>Command</value>
</data>
<data name="CONTAINER_CREATED" xml:space="preserve">
<value>Created</value>
</data>
<data name="CONTAINER_GENERAL_TAB_TITLE" xml:space="preserve">
<value>Container General Properties</value>
</data>
<data name="CONTAINER_PORTS" xml:space="preserve">
<value>Ports</value>
</data>
<data name="CONTAINER_IMAGE" xml:space="preserve">
<value>Image</value>
</data>
<data name="CONTAINS" xml:space="preserve">
<value>以下を含む</value>
</data>

View File

@ -2771,6 +2771,24 @@ You can only connect to a single Citrix XenServer Express Edition server at a ti
<data name="CONTAINED_IN" xml:space="preserve">
<value>contained in</value>
</data>
<data name="CONTAINER" xml:space="preserve">
<value>Container</value>
</data>
<data name="CONTAINER_COMMAND" xml:space="preserve">
<value>Command</value>
</data>
<data name="CONTAINER_CREATED" xml:space="preserve">
<value>Created</value>
</data>
<data name="CONTAINER_GENERAL_TAB_TITLE" xml:space="preserve">
<value>Container General Properties</value>
</data>
<data name="CONTAINER_PORTS" xml:space="preserve">
<value>Ports</value>
</data>
<data name="CONTAINER_IMAGE" xml:space="preserve">
<value>Image</value>
</data>
<data name="CONTAINS" xml:space="preserve">
<value>contains</value>
</data>

View File

@ -2747,6 +2747,24 @@ XenServer 可以重新启动服务器并将服务器的 CPU 级别降至池中
<data name="CONTAINED_IN" xml:space="preserve">
<value>包含于</value>
</data>
<data name="CONTAINER" xml:space="preserve">
<value>Container</value>
</data>
<data name="CONTAINER_COMMAND" xml:space="preserve">
<value>Command</value>
</data>
<data name="CONTAINER_CREATED" xml:space="preserve">
<value>Created</value>
</data>
<data name="CONTAINER_GENERAL_TAB_TITLE" xml:space="preserve">
<value>Container General Properties</value>
</data>
<data name="CONTAINER_PORTS" xml:space="preserve">
<value>Ports</value>
</data>
<data name="CONTAINER_IMAGE" xml:space="preserve">
<value>Image</value>
</data>
<data name="CONTAINS" xml:space="preserve">
<value>包含</value>
</data>

View File

@ -81,6 +81,7 @@ namespace XenAdmin.Network
VM_appliance[] VM_appliances { get; }
VM[] VMs { get; }
IEnumerable<IXenObject> XenSearchableObjects { get; }
DockerContainer[] DockerContainers { get; }
void UpdateDockerContainersForVM(IEnumerable<DockerContainer> d, VM v);
void CheckDockerContainersBatchChange();
}