mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CA-84876: Show more infrastructure information for objects
Instead of showing just the name, this code is showing name with location information in title for all objects that appear in the tree view. (A new property (NameWithLocation) with a getter accessor defined in IXenObject and has been implemented as virtual in XenObject and overridden at several child classes.) Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
e4729a6402
commit
5abe4e109c
@ -2622,7 +2622,7 @@ namespace XenAdmin
|
||||
else if (!SearchMode && SelectionManager.Selection.ContainsOneItemOfType<IXenObject>())
|
||||
{
|
||||
IXenObject xenObject = SelectionManager.Selection[0].XenObject;
|
||||
TitleLabel.Text = GetTitleLabel(xenObject);
|
||||
TitleLabel.Text = xenObject.NameWithLocation;
|
||||
TitleIcon.Image = Images.GetImage16For(xenObject);
|
||||
// When in folder view only show the logged in label if it is clear to which connection the object belongs (most likely pools and hosts)
|
||||
|
||||
@ -2677,22 +2677,6 @@ namespace XenAdmin
|
||||
pluginMenuItemStartIndexes[viewToolStripMenuItem] = viewToolStripMenuItem.DropDownItems.IndexOf(toolStripSeparator24) + 1;
|
||||
}
|
||||
|
||||
string GetTitleLabel(IXenObject xenObject)
|
||||
{
|
||||
string name = Helpers.GetName(xenObject);
|
||||
VM vm = xenObject as VM;
|
||||
if (vm != null && vm.is_a_real_vm)
|
||||
{
|
||||
Host server = vm.Home();
|
||||
if (server != null)
|
||||
return string.Format(Messages.VM_ON_SERVER, name, server);
|
||||
Pool pool = Helpers.GetPool(vm.Connection);
|
||||
if (pool != null)
|
||||
return string.Format(Messages.VM_IN_POOL, name, pool);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
void navigationPane_DragDropCommandActivated(string cmdText)
|
||||
{
|
||||
SetStatusBar(null, cmdText);
|
||||
|
81
XenModel/Messages.Designer.cs
generated
81
XenModel/Messages.Designer.cs
generated
@ -16949,6 +16949,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to in '{0}'.
|
||||
/// </summary>
|
||||
public static string IN_POOL {
|
||||
get {
|
||||
return ResourceManager.GetString("IN_POOL", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to In progress.
|
||||
/// </summary>
|
||||
@ -20486,6 +20495,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} {1}.
|
||||
/// </summary>
|
||||
public static string NAME_WITH_LOCATION {
|
||||
get {
|
||||
return ResourceManager.GetString("NAME_WITH_LOCATION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select the SR to reattach or create a new SR.
|
||||
/// </summary>
|
||||
@ -23402,6 +23420,24 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} in '{1}'.
|
||||
/// </summary>
|
||||
public static string OBJECT_IN_POOL {
|
||||
get {
|
||||
return ResourceManager.GetString("OBJECT_IN_POOL", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} on '{1}'.
|
||||
/// </summary>
|
||||
public static string OBJECT_ON_SERVER {
|
||||
get {
|
||||
return ResourceManager.GetString("OBJECT_ON_SERVER", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Objects with tag '{0}'.
|
||||
/// </summary>
|
||||
@ -23493,6 +23529,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to on '{0}'.
|
||||
/// </summary>
|
||||
public static string ON_SERVER {
|
||||
get {
|
||||
return ResourceManager.GetString("ON_SERVER", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 1 VM selected.
|
||||
/// </summary>
|
||||
@ -28052,6 +28097,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} (snapshot of '{1}' {2}).
|
||||
/// </summary>
|
||||
public static string SNAPSHOT_OF_TITLE {
|
||||
get {
|
||||
return ResourceManager.GetString("SNAPSHOT_OF_TITLE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Snapshots require XenServer 5.5 or later.
|
||||
/// </summary>
|
||||
@ -32105,6 +32159,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} on '{1}' {2}.
|
||||
/// </summary>
|
||||
public static string VDI_ON_SR_TITLE {
|
||||
get {
|
||||
return ResourceManager.GetString("VDI_ON_SR_TITLE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Vendor.
|
||||
/// </summary>
|
||||
@ -32519,15 +32582,6 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} in '{1}'.
|
||||
/// </summary>
|
||||
public static string VM_IN_POOL {
|
||||
get {
|
||||
return ResourceManager.GetString("VM_IN_POOL", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Memory and/or VCPU changes will take effect when you restart the VM..
|
||||
/// </summary>
|
||||
@ -32627,15 +32681,6 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} on '{1}'.
|
||||
/// </summary>
|
||||
public static string VM_ON_SERVER {
|
||||
get {
|
||||
return ResourceManager.GetString("VM_ON_SERVER", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to This VM is paused..
|
||||
/// </summary>
|
||||
|
@ -11271,8 +11271,8 @@ To learn more about the XenServer Dynamic Workload Balancing feature or to start
|
||||
<data name="VM_GENERAL_TAB_TITLE" xml:space="preserve">
|
||||
<value>VM General Properties</value>
|
||||
</data>
|
||||
<data name="VM_IN_POOL" xml:space="preserve">
|
||||
<value>{0} in '{1}'</value>
|
||||
<data name="IN_POOL" xml:space="preserve">
|
||||
<value>in '{0}'</value>
|
||||
</data>
|
||||
<data name="VM_LIVE_CHANGES_NOT_SUPPORTED_MESSAGE" xml:space="preserve">
|
||||
<value>Memory and/or VCPU changes will take effect when you restart the VM.</value>
|
||||
@ -11307,8 +11307,8 @@ To learn more about the XenServer Dynamic Workload Balancing feature or to start
|
||||
<data name="VM_NOT_SUSPENDED" xml:space="preserve">
|
||||
<value>This VM is not suspended.</value>
|
||||
</data>
|
||||
<data name="VM_ON_SERVER" xml:space="preserve">
|
||||
<value>{0} on '{1}'</value>
|
||||
<data name="ON_SERVER" xml:space="preserve">
|
||||
<value>on '{0}'</value>
|
||||
</data>
|
||||
<data name="VM_PAUSED" xml:space="preserve">
|
||||
<value>This VM is paused.</value>
|
||||
@ -12252,4 +12252,19 @@ You will need to navigate to the Console on each of the selected VMs to complete
|
||||
<data name="YOU_ARE_HERE" xml:space="preserve">
|
||||
<value>You are here</value>
|
||||
</data>
|
||||
<data name="SNAPSHOT_OF_TITLE" xml:space="preserve">
|
||||
<value>{0} (snapshot of '{1}' {2})</value>
|
||||
</data>
|
||||
<data name="NAME_WITH_LOCATION" xml:space="preserve">
|
||||
<value>{0} {1}</value>
|
||||
</data>
|
||||
<data name="OBJECT_IN_POOL" xml:space="preserve">
|
||||
<value>{0} in '{1}'</value>
|
||||
</data>
|
||||
<data name="OBJECT_ON_SERVER" xml:space="preserve">
|
||||
<value>{0} on '{1}'</value>
|
||||
</data>
|
||||
<data name="VDI_ON_SR_TITLE" xml:space="preserve">
|
||||
<value>{0} on '{1}' {2}</value>
|
||||
</data>
|
||||
</root>
|
@ -1324,6 +1324,15 @@ namespace XenAPI
|
||||
get { return license_params.ContainsKey("grace"); }
|
||||
}
|
||||
|
||||
internal override string LocationString
|
||||
{
|
||||
get
|
||||
{
|
||||
//for standalone hosts we do not show redundant location info
|
||||
return Helpers.GetPool(Connection) == null ? string.Empty : base.LocationString;
|
||||
}
|
||||
}
|
||||
|
||||
#region Supplemental Packs
|
||||
|
||||
// From http://scale.uk.xensource.com/confluence/display/engp/Supplemental+Pack+product+design+notes#SupplementalPackproductdesignnotes-XenAPI:
|
||||
|
@ -65,5 +65,6 @@ namespace XenAPI
|
||||
string SaveChanges(Session session, IXenObject beforeObject);
|
||||
|
||||
string Description { get; }
|
||||
string NameWithLocation { get; }
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,14 @@ namespace XenAPI
|
||||
}
|
||||
}
|
||||
|
||||
internal override string LocationString
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public List<SR> GetHAHeartbeatSRs()
|
||||
{
|
||||
List<SR> result = new List<SR>();
|
||||
|
@ -760,6 +760,28 @@ namespace XenAPI
|
||||
}
|
||||
}
|
||||
|
||||
public override string NameWithLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
//return only the Name for local SRs
|
||||
if (Connection != null && !shared)
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
return base.NameWithLocation;
|
||||
}
|
||||
}
|
||||
|
||||
internal override string LocationString
|
||||
{
|
||||
get
|
||||
{
|
||||
return Home != null ? Home.LocationString : base.LocationString;
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckMultipathString(String status)
|
||||
{
|
||||
int current;
|
||||
|
@ -201,7 +201,21 @@ namespace XenAPI
|
||||
return Util.DiskSizeString(virtual_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override string NameWithLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Connection != null)
|
||||
{
|
||||
var srOfVdi = Connection.Resolve(SR);
|
||||
return string.Format(Messages.VDI_ON_SR_TITLE, Name, srOfVdi.Name, srOfVdi.LocationString);
|
||||
}
|
||||
|
||||
return base.NameWithLocation;
|
||||
}
|
||||
}
|
||||
|
||||
#region IEquatable<VDI> Members
|
||||
|
||||
/// <summary>
|
||||
|
@ -1086,6 +1086,51 @@ namespace XenAPI
|
||||
}
|
||||
}
|
||||
|
||||
public override string NameWithLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.Connection != null)
|
||||
{
|
||||
if (this.is_a_real_vm)
|
||||
{
|
||||
return base.NameWithLocation;
|
||||
}
|
||||
else if (this.is_a_snapshot)
|
||||
{
|
||||
var snapshotOf = this.Connection.Resolve(this.snapshot_of);
|
||||
return string.Format(Messages.SNAPSHOT_OF_TITLE, Name, snapshotOf.Name, LocationString);
|
||||
}
|
||||
else if (this.is_a_template)
|
||||
{
|
||||
if (Helpers.IsPool(Connection))
|
||||
return string.Format(Messages.OBJECT_IN_POOL, Name, Connection.Name);
|
||||
|
||||
return string.Format(Messages.OBJECT_ON_SERVER, Name, Connection.Name);
|
||||
}
|
||||
}
|
||||
|
||||
return NameWithLocation;
|
||||
}
|
||||
}
|
||||
|
||||
internal override string LocationString
|
||||
{
|
||||
get
|
||||
{
|
||||
Host server = this.Home();
|
||||
if (server != null)
|
||||
return string.Format(Messages.ON_SERVER, server);
|
||||
|
||||
Pool pool = Helpers.GetPool(this.Connection);
|
||||
if (pool != null)
|
||||
return string.Format(Messages.IN_POOL, pool);
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static List<HA_Restart_Priority> GetAvailableRestartPriorities(IXenConnection connection)
|
||||
{
|
||||
var restartPriorities = new List<HA_Restart_Priority>();
|
||||
|
@ -34,6 +34,7 @@ using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Network;
|
||||
using XenAdmin;
|
||||
|
||||
namespace XenAPI
|
||||
{
|
||||
@ -267,5 +268,27 @@ namespace XenAPI
|
||||
{
|
||||
get { return ""; }
|
||||
}
|
||||
|
||||
public virtual string NameWithLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(Messages.NAME_WITH_LOCATION, Name, LocationString);
|
||||
}
|
||||
}
|
||||
|
||||
internal virtual string LocationString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Connection == null)
|
||||
return string.Empty;
|
||||
|
||||
if (Helpers.IsPool(Connection))
|
||||
return string.Format(Messages.IN_POOL, Connection.Name);
|
||||
|
||||
return string.Format(Messages.ON_SERVER, Connection.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user