CA-218719: Context menu: confusing "(empty)" pool item when there are no connected pools

This commit is contained in:
Stephen Turner 2016-11-11 17:04:08 +00:00
parent 081a6302d3
commit ebd408a227
4 changed files with 15 additions and 29 deletions

View File

@ -114,17 +114,11 @@ namespace XenAdmin.Commands
base.DropDownItems.Add(hostMenuItem);
}
if (base.DropDownItems.Count <= 0)
{
ToolStripMenuItem hostMenuItem = new ToolStripMenuItem(Messages.HOST_MENU_EMPTY);
hostMenuItem.Enabled = false;
hostMenuItem.Font = Program.DefaultFont;
base.DropDownItems.Add(hostMenuItem);
}
if (Helpers.GetPool(connection) != null)
{
base.DropDownItems.Add(new ToolStripSeparator());
if (base.DropDownItems.Count > 0)
base.DropDownItems.Add(new ToolStripSeparator());
// Add a final option for connecting a new server and adding it to the pool in one action
AddNewHostToPoolCommand cmd = new AddNewHostToPoolCommand(Command.MainWindowCommandInterface, Helpers.GetPool(connection));
CommandToolStripMenuItem connectAndAddToPoolMenuItem = new CommandToolStripMenuItem(cmd);

View File

@ -84,15 +84,9 @@ namespace XenAdmin.Commands
}
}
if (base.DropDownItems.Count <= 0)
{
ToolStripMenuItem hostMenuItem = new ToolStripMenuItem(Messages.HOST_MENU_EMPTY);
hostMenuItem.Font = Program.DefaultFont;
hostMenuItem.Enabled = false;
base.DropDownItems.Add(hostMenuItem);
}
if (base.DropDownItems.Count > 0)
base.DropDownItems.Add(new ToolStripSeparator());
base.DropDownItems.Add(new ToolStripSeparator());
base.DropDownItems.Add(new CommandToolStripMenuItem(new NewPoolCommand(Command.MainWindowCommandInterface, selection)));
}

View File

@ -177,7 +177,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
@ -291,7 +291,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
@ -405,7 +405,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
@ -520,7 +520,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
@ -637,7 +637,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
@ -1364,7 +1364,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
@ -1476,7 +1476,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
@ -1590,7 +1590,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
@ -1732,7 +1732,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
@ -1860,7 +1860,7 @@ namespace XenAdminTests.TabsAndMenus
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),

View File

@ -319,8 +319,6 @@ namespace XenAdminTests.TabsAndMenus
new ExpectedTextMenuItem("&Add Server", true, false,
new ExpectedMenuItem[]
{
new ExpectedTextMenuItem("(empty)", false),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add New Server...", true)
}),
new ExpectedTextMenuItem("&Disconnect", true),