mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CP-5750: Removed ActionType; the actions should be categorised by status (in progress,
succeeded, failed; cancelled at the moment counts as failed, we may need to distinguish in future). As a consequence the filter checkboxes from the top of the Log tab were removed and some temporary changes were made to the drawing of action rows (the controls will change completely in a subsequent commit). Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
38ab6b8ffa
commit
62586ef89c
@ -47,7 +47,7 @@ namespace XenAdmin.Actions.GUIActions
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public MeddlingAction(Task task)
|
||||
: base(ActionType.Meddling, task.MeddlingActionTitle ?? task.Title, task.Description, false, false)
|
||||
: base(task.MeddlingActionTitle ?? task.Title, task.Description, false, false)
|
||||
{
|
||||
RelatedTask = new XenRef<Task>(task.opaque_ref);
|
||||
Started = (task.created + task.Connection.ServerTimeOffset).ToLocalTime();
|
||||
|
@ -142,7 +142,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
string msg = string.Format(Messages.CONNECTION_CLOSED_NOTICE_TEXT, connection.Hostname);
|
||||
log.Warn(msg);
|
||||
ActionBase notice = new ActionBase(ActionType.Information, msg, msg, false);
|
||||
ActionBase notice = new ActionBase(msg, msg, false, true);
|
||||
notice.Pool = Helpers.GetPoolOfOne(connection);
|
||||
notice.Host = Helpers.GetMaster(connection);
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
string msg = string.Format(Messages.MAINWINDOW_LOG_REMOVECONNECTION, host.Connection.Hostname);
|
||||
log.Info(msg);
|
||||
new ActionBase(ActionType.Information, msg, msg, false);
|
||||
new ActionBase(msg, msg, false, true);
|
||||
MainWindowCommandInterface.CloseActiveWizards(host.Connection);
|
||||
host.Connection.EndConnect();
|
||||
MainWindowCommandInterface.RemoveConnection(host.Connection);
|
||||
|
@ -47,7 +47,6 @@ namespace XenAdmin.Controls
|
||||
/// </summary>
|
||||
public ActionBase Action;
|
||||
public List<string> AppliesTo = new List<string>();
|
||||
public ActionType Type;
|
||||
|
||||
private DateTime finished = DateTime.MinValue;
|
||||
|
||||
@ -72,7 +71,6 @@ namespace XenAdmin.Controls
|
||||
|
||||
public ActionRow(ActionBase action)
|
||||
{
|
||||
Type = action.Type;
|
||||
AppliesTo = action.AppliesTo;
|
||||
Action = action;
|
||||
this.Image = getImage();
|
||||
@ -153,11 +151,11 @@ namespace XenAdmin.Controls
|
||||
this.Title = Action.Title;
|
||||
}
|
||||
|
||||
Error = (Action.Exception != null || Action.Type == ActionType.Error) && !(Action.Exception is CancelledException);
|
||||
Error = (Action.Exception != null) && !(Action.Exception is CancelledException);
|
||||
|
||||
Image = getImage();
|
||||
|
||||
ShowTime = Action.Type == ActionType.Action || Action.Type == ActionType.Meddling || Action.Type == ActionType.Error;
|
||||
ShowTime = Action.Finished - Action.Started >= TimeSpan.FromSeconds(1);
|
||||
|
||||
if (Action.Exception == null)
|
||||
{
|
||||
@ -182,7 +180,6 @@ namespace XenAdmin.Controls
|
||||
|
||||
if (Action.IsCompleted)
|
||||
{
|
||||
Type = Action.Type;
|
||||
finished = Action.Finished;
|
||||
if (ParentPanel != null)
|
||||
{
|
||||
@ -203,18 +200,31 @@ namespace XenAdmin.Controls
|
||||
|
||||
private Image getImage()
|
||||
{
|
||||
switch (Action.Type)
|
||||
{
|
||||
case ActionType.Information:
|
||||
return Properties.Resources._000_Info3_h32bit_16;
|
||||
case ActionType.Action:
|
||||
case ActionType.Meddling:
|
||||
return Properties.Resources.commands_16;
|
||||
case ActionType.Error:
|
||||
return Properties.Resources._000_error_h32bit_16;
|
||||
default:
|
||||
throw new InvalidEnumArgumentException();
|
||||
}
|
||||
if (Action.IsCompleted)
|
||||
return Action.Succeeded
|
||||
? Properties.Resources._000_Tick_h32bit_16
|
||||
: Properties.Resources._000_error_h32bit_16;
|
||||
|
||||
if (Action.PercentComplete < 10)
|
||||
return Properties.Resources.usagebar_0;
|
||||
if (Action.PercentComplete < 20)
|
||||
return Properties.Resources.usagebar_1;
|
||||
if (Action.PercentComplete < 30)
|
||||
return Properties.Resources.usagebar_2;
|
||||
if (Action.PercentComplete < 40)
|
||||
return Properties.Resources.usagebar_3;
|
||||
if (Action.PercentComplete < 50)
|
||||
return Properties.Resources.usagebar_4;
|
||||
if (Action.PercentComplete < 60)
|
||||
return Properties.Resources.usagebar_5;
|
||||
if (Action.PercentComplete < 70)
|
||||
return Properties.Resources.usagebar_6;
|
||||
if (Action.PercentComplete < 80)
|
||||
return Properties.Resources.usagebar_7;
|
||||
if (Action.PercentComplete < 90)
|
||||
return Properties.Resources.usagebar_8;
|
||||
|
||||
return Properties.Resources.usagebar_9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,12 +46,8 @@ namespace XenAdmin.Controls
|
||||
{
|
||||
public readonly ChangeableList<CustomHistoryRow> Rows = new ChangeableList<CustomHistoryRow>();
|
||||
|
||||
internal const int col1 = 35;
|
||||
internal int col2 = -1;
|
||||
private int col4;
|
||||
|
||||
internal int col3;
|
||||
|
||||
internal int col4;
|
||||
public bool SuspendDraw = false;
|
||||
|
||||
public int ScrollTop = 0;
|
||||
@ -79,8 +75,6 @@ namespace XenAdmin.Controls
|
||||
col4 = 10 + (int)Drawing.MeasureText(g, HelpersGUI.DateTimeToString(new DateTime(9999, 12, 30, 20, 58, 58), Messages.DATEFORMAT_DMY_HMS, true), Font).Width;
|
||||
}
|
||||
|
||||
col3 = Width - (6 + col1 + col2 + col4);
|
||||
|
||||
g.FillRectangle(Application.RenderWithVisualStyles ? SystemBrushes.ControlLightLight : SystemBrushes.Control, Bounds);
|
||||
|
||||
int top = 0;
|
||||
@ -182,7 +176,7 @@ namespace XenAdmin.Controls
|
||||
ToolStripMenuItem copyItem = new ToolStripMenuItem(Messages.COPY, Properties.Resources.copy_16);
|
||||
copyItem.Click += new EventHandler(delegate(object sender, EventArgs eve)
|
||||
{
|
||||
Clipboard.SetText(string.Format(Messages.HISTORYPANEL_COPY_FORMAT, Core.PropertyManager.GetFriendlyName(string.Format("Label-Action.{0}", clickedRow.Type.ToString())), clickedRow.Title, clickedRow.Description, clickedRow.TimeOccurred));
|
||||
Clipboard.SetText(string.Format(Messages.HISTORYPANEL_COPY_FORMAT, Core.PropertyManager.GetFriendlyName("Label-Action.Action"), clickedRow.Title, clickedRow.Description, clickedRow.TimeOccurred));
|
||||
});
|
||||
menu.Items.Add(copyItem);
|
||||
menu.Show(this, PointToClient(MousePosition));
|
||||
|
@ -45,6 +45,20 @@ namespace XenAdmin.Controls
|
||||
{
|
||||
public static readonly Padding Margin = new Padding(3);
|
||||
|
||||
private int col1
|
||||
{
|
||||
get { return Image == null ? 89 : Image.Width + 19; }
|
||||
}
|
||||
private int col3
|
||||
{
|
||||
get
|
||||
{
|
||||
return ParentPanel == null
|
||||
? 0
|
||||
: ParentPanel.Width - (6 + col1 + ParentPanel.col2 + ParentPanel.col4);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly string DescriptionLabel = Messages.HISTORYROW_DETAILS;
|
||||
private static readonly string ErrorLabel = Messages.HISTORYROW_ERROR;
|
||||
private static readonly string TimeLabel = Messages.HISTORYROW_TIME;
|
||||
@ -66,7 +80,7 @@ namespace XenAdmin.Controls
|
||||
public string Title;
|
||||
public string Description;
|
||||
public string TimeOccurred;
|
||||
public CustomHistoryPanel ParentPanel = null;
|
||||
public CustomHistoryPanel ParentPanel;
|
||||
public bool ButtonPressed = false;
|
||||
public bool Visible = true;
|
||||
public bool ShowCancel = true;
|
||||
@ -104,18 +118,18 @@ namespace XenAdmin.Controls
|
||||
int top = Bounds.Top + ItemPadding.Top + InternalPadding.Top;
|
||||
int left = Bounds.Left + InternalPadding.Left;
|
||||
|
||||
int rowheight1 = HeightRow1() + ItemPadding.Vertical;
|
||||
int rowheight2 = HeightRow2() + ItemPadding.Vertical;
|
||||
int rowheight3 = ShowTime ? HeightRow3() + ItemPadding.Vertical : 0;
|
||||
int rowheight1 = HeightOf(Title, TitleFont, ParentPanel.col2 + col3) + ItemPadding.Vertical;
|
||||
int rowheight2 = HeightOf(Description, Font, col3) + ItemPadding.Vertical;
|
||||
int rowheight3 = ShowTime ? HeightOf(TimeTaken, Font, col3) + ItemPadding.Vertical : 0;
|
||||
int rowheight4 = ShowProgress ? 17 + ItemPadding.Vertical : 0;
|
||||
RowHeight = rowheight1 + rowheight2 + rowheight3 + rowheight4 + InternalPadding.Vertical;
|
||||
RowWidth = Bounds.Width;
|
||||
|
||||
if (g != null && Bounds.Top < visibleBottom && Bounds.Top + RowHeight > visibleTop && Bounds.Top + RowHeight <= Int16.MaxValue)
|
||||
{
|
||||
int left1 = left + CustomHistoryPanel.col1;
|
||||
int left1 = left + col1;
|
||||
int left2 = left1 + ParentPanel.col2;
|
||||
int left3 = left2 + ParentPanel.col3;
|
||||
int left3 = left2 + col3;
|
||||
int top1 = top + rowheight1;
|
||||
int top2 = top1 + rowheight2;
|
||||
int top3 = top2 + rowheight3;
|
||||
@ -133,15 +147,15 @@ namespace XenAdmin.Controls
|
||||
g.DrawLine(ErrorPenThick, Bounds.Left, Bounds.Top, Bounds.Left, Bounds.Top + RowHeight + 1);
|
||||
}
|
||||
|
||||
g.DrawImage(Image, left + ((CustomHistoryPanel.col1 - Image.Width) / 2), top, Image.Width, Image.Height);
|
||||
Drawing.DrawText(g, Title, TitleFont, new Rectangle(left1, top, ParentPanel.col2 + ParentPanel.col3, rowheight1), TitleColor, TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl);
|
||||
g.DrawImage(Image, left + ((col1 - Image.Width) / 2), top, Image.Width, Image.Height);
|
||||
Drawing.DrawText(g, Title, TitleFont, new Rectangle(left1, top, ParentPanel.col2 + col3, rowheight1), TitleColor, TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl);
|
||||
Drawing.DrawText(g, TimeOccurred, Font, new Point(left3, top), TextColor);
|
||||
if(!Error)
|
||||
Drawing.DrawText(g, DescriptionLabel, Font, new Point(left1, top1), TextColor);
|
||||
else
|
||||
Drawing.DrawText(g, ErrorLabel, Font, new Point(left1, top1), ErrorColor);
|
||||
|
||||
Drawing.DrawText(g, Description, Font, new Rectangle(left2, top1, ParentPanel.col3, rowheight2), TextColor, TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl);
|
||||
Drawing.DrawText(g, Description, Font, new Rectangle(left2, top1, col3, rowheight2), TextColor, TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl);
|
||||
|
||||
if (ShowCancel)
|
||||
{
|
||||
@ -185,7 +199,7 @@ namespace XenAdmin.Controls
|
||||
if (ShowTime)
|
||||
{
|
||||
Drawing.DrawText(g, TimeLabel, Font, new Point(left1, top2), TextColor);
|
||||
Drawing.DrawText(g, TimeTaken, Font, new Rectangle(left2, top2, ParentPanel.col3, rowheight3), TextColor, TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl);
|
||||
Drawing.DrawText(g, TimeTaken, Font, new Rectangle(left2, top2, col3, rowheight3), TextColor, TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl);
|
||||
}
|
||||
|
||||
if (ShowProgress)
|
||||
@ -193,16 +207,16 @@ namespace XenAdmin.Controls
|
||||
if (Application.RenderWithVisualStyles)
|
||||
{
|
||||
Drawing.DrawText(g, ProgressLabel, Font, new Point(left1, top3), TextColor);
|
||||
ProgressBarRenderer.DrawHorizontalBar(g, new Rectangle(left2, top3, ParentPanel.col3, 17));
|
||||
ProgressBarRenderer.DrawHorizontalChunks(g, new Rectangle(left2 + 4, top3 + 3, (Progress * (ParentPanel.col3 - 8) / 100), 12));
|
||||
ProgressBarRenderer.DrawHorizontalBar(g, new Rectangle(left2, top3, col3, 17));
|
||||
ProgressBarRenderer.DrawHorizontalChunks(g, new Rectangle(left2 + 4, top3 + 3, (Progress * (col3 - 8) / 100), 12));
|
||||
}
|
||||
else
|
||||
{
|
||||
Drawing.DrawText(g, ProgressLabel, Font, new Point(left1, top3), TextColor);
|
||||
g.FillRectangle(SystemBrushes.ButtonShadow, new Rectangle(left2, top3, ParentPanel.col3, 17));
|
||||
g.FillRectangle(SystemBrushes.ButtonHighlight, new Rectangle(left2 + 1, top3 + 1, ParentPanel.col3 - 1, 16));
|
||||
g.FillRectangle(SystemBrushes.ButtonFace, new Rectangle(left2 + 1, top3 + 1, ParentPanel.col3 - 2, 15));
|
||||
int barwidth = (Progress * (ParentPanel.col3 - 4) / 100);
|
||||
g.FillRectangle(SystemBrushes.ButtonShadow, new Rectangle(left2, top3, col3, 17));
|
||||
g.FillRectangle(SystemBrushes.ButtonHighlight, new Rectangle(left2 + 1, top3 + 1, col3 - 1, 16));
|
||||
g.FillRectangle(SystemBrushes.ButtonFace, new Rectangle(left2 + 1, top3 + 1, col3 - 2, 15));
|
||||
int barwidth = (Progress * (col3 - 4) / 100);
|
||||
int chunkwidth = 7;
|
||||
int chunkgap = 2;
|
||||
int progleft = 0;
|
||||
@ -218,21 +232,6 @@ namespace XenAdmin.Controls
|
||||
}
|
||||
g.FillRectangle(SystemBrushes.ActiveCaption, new Rectangle(left2 + 2 + progleft, top3 + 2, chunkwidth - progleft, 13));
|
||||
}
|
||||
/*int barwidth = (Progress * (ParentPanel.col3 - 8) / 100);
|
||||
int chunkwidth = 7;
|
||||
int chunkgap = 1;
|
||||
int progleft = 0;
|
||||
while (true)
|
||||
{
|
||||
if (progleft + chunkwidth + chunkgap < barwidth)
|
||||
{
|
||||
ChunkRenderer.DrawBackground(g, new Rectangle(left2 + 4 + progleft, t + rowheight2 + rowheight3 + 3, chunkwidth, 12));
|
||||
progleft += chunkwidth + chunkgap;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
ChunkRenderer.DrawBackground(g, new Rectangle(left2 + 4 + progleft, t + rowheight2 + rowheight3 + 3, chunkwidth - progleft, 12));*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,21 +244,6 @@ namespace XenAdmin.Controls
|
||||
return h > 0 ? h : 12;
|
||||
}
|
||||
|
||||
private int HeightRow3()
|
||||
{
|
||||
return HeightOf(TimeTaken, Font, ParentPanel.col3);
|
||||
}
|
||||
|
||||
private int HeightRow2()
|
||||
{
|
||||
return HeightOf(Description, Font, ParentPanel.col3);
|
||||
}
|
||||
|
||||
private int HeightRow1()
|
||||
{
|
||||
return HeightOf(Title, TitleFont, ParentPanel.col2 + ParentPanel.col3);
|
||||
}
|
||||
|
||||
internal void Click(Point p, MouseButtons button)
|
||||
{
|
||||
if (button == MouseButtons.Left && ShowCancel && CancelEnabled)
|
||||
@ -290,8 +274,8 @@ namespace XenAdmin.Controls
|
||||
|
||||
private Rectangle CancelButtonRect()
|
||||
{
|
||||
return new Rectangle(Margin.Left + InternalPadding.Left + CustomHistoryPanel.col1 + ParentPanel.col2 + ParentPanel.col3,
|
||||
Margin.Left + InternalPadding.Top + ItemPadding.Top + ItemPadding.Vertical + HeightRow1(), 75, 23);
|
||||
return new Rectangle(Margin.Left + InternalPadding.Left + col1 + ParentPanel.col2 + col3,
|
||||
Margin.Left + InternalPadding.Top + ItemPadding.Top + ItemPadding.Vertical + HeightOf(Title, TitleFont, ParentPanel.col2 + col3), 75, 23);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,8 @@ namespace XenAdmin.Dialogs.OptionsPages
|
||||
|
||||
// set password
|
||||
Program.MasterPassword = TemporaryMasterPassword;
|
||||
new ActionBase(ActionType.Information, Messages.CHANGED_MASTER_PASSWORD, Messages.CHANGED_MASTER_PASSWORD_LONG, false, true);
|
||||
new ActionBase(Messages.CHANGED_MASTER_PASSWORD,
|
||||
Messages.CHANGED_MASTER_PASSWORD_LONG, false, true);
|
||||
}
|
||||
if (SaveAllAfter)
|
||||
Settings.SaveServerList();
|
||||
|
@ -71,7 +71,7 @@ namespace XenAdmin.Dialogs.WarningDialogs
|
||||
foreach (ActionBase action in ConnectionsManager.History)
|
||||
{
|
||||
AsyncAction a = action as AsyncAction;
|
||||
if (action.Type == ActionType.Action && !action.IsCompleted && (a == null || !a.Cancelling))
|
||||
if (!action.IsCompleted && (a == null || !a.Cancelling))
|
||||
{
|
||||
IXenObject xo = (action.Pool as IXenObject) ?? (action.Host as IXenObject) ?? (action.VM as IXenObject) ?? (action.SR as IXenObject);
|
||||
if (xo == null || xo.Connection != connection)
|
||||
@ -86,7 +86,7 @@ namespace XenAdmin.Dialogs.WarningDialogs
|
||||
{
|
||||
foreach (ActionBase action in ConnectionsManager.History)
|
||||
{
|
||||
if (action.Type == ActionType.Action && !action.IsCompleted)
|
||||
if (!action.IsCompleted)
|
||||
{
|
||||
AddRow(action);
|
||||
}
|
||||
|
@ -380,19 +380,15 @@ namespace XenAdmin
|
||||
if (Program.Exiting)
|
||||
return;
|
||||
|
||||
//Program.AssertOnEventThread();
|
||||
Program.BeginInvoke(Program.MainWindow, () =>
|
||||
{
|
||||
ActionBase action = (ActionBase)e.Element;
|
||||
if (action == null)
|
||||
return;
|
||||
|
||||
if (action.Type == ActionType.Action)
|
||||
{
|
||||
action.Changed += actionChanged;
|
||||
action.Completed += actionChanged;
|
||||
actionChanged(action);
|
||||
}
|
||||
action.Changed += actionChanged;
|
||||
action.Completed += actionChanged;
|
||||
actionChanged(action);
|
||||
});
|
||||
}
|
||||
|
||||
@ -803,10 +799,7 @@ namespace XenAdmin
|
||||
new ThreeButtonDialog(
|
||||
new ThreeButtonDialog.Details(SystemIcons.Error, message, linkStart, linkLength, linkUrl, Messages.CONNECTION_REFUSED_TITLE)).ShowDialog(this);
|
||||
|
||||
ActionBase failedAction = new ActionBase(ActionType.Error, Messages.CONNECTION_REFUSED, message, false, false);
|
||||
failedAction.IsCompleted = true;
|
||||
failedAction.PercentComplete = 100;
|
||||
failedAction.Finished = DateTime.Now;
|
||||
new ActionBase(Messages.CONNECTION_REFUSED, message, false, true, Messages.CONNECTION_REFUSED_TITLE);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -2877,7 +2870,7 @@ namespace XenAdmin
|
||||
bool currentTasks = false;
|
||||
foreach (ActionBase a in ConnectionsManager.History)
|
||||
{
|
||||
if (a.Type == ActionType.Action && !a.IsCompleted)
|
||||
if (!a.IsCompleted)
|
||||
{
|
||||
currentTasks = true;
|
||||
break;
|
||||
|
45
XenAdmin/TabPages/HistoryPage.Designer.cs
generated
45
XenAdmin/TabPages/HistoryPage.Designer.cs
generated
@ -35,9 +35,6 @@ namespace XenAdmin.TabPages
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.gradientPanel1 = new XenAdmin.Controls.GradientPanel.GradientPanel();
|
||||
this.errorsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.informationCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.actionsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.customHistoryContainer1 = new XenAdmin.Controls.CustomHistoryContainer();
|
||||
this.gradientPanel1.SuspendLayout();
|
||||
@ -55,49 +52,10 @@ namespace XenAdmin.TabPages
|
||||
//
|
||||
resources.ApplyResources(this.gradientPanel1, "gradientPanel1");
|
||||
this.gradientPanel1.Controls.Add(this.button1);
|
||||
this.gradientPanel1.Controls.Add(this.errorsCheckBox);
|
||||
this.gradientPanel1.Controls.Add(this.informationCheckBox);
|
||||
this.gradientPanel1.Controls.Add(this.actionsCheckBox);
|
||||
this.gradientPanel1.Controls.Add(this.label1);
|
||||
this.gradientPanel1.Name = "gradientPanel1";
|
||||
this.gradientPanel1.Scheme = XenAdmin.Controls.GradientPanel.GradientPanel.Schemes.Tab;
|
||||
//
|
||||
// errorsCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.errorsCheckBox, "errorsCheckBox");
|
||||
this.errorsCheckBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.errorsCheckBox.Checked = true;
|
||||
this.errorsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.errorsCheckBox.ForeColor = System.Drawing.Color.White;
|
||||
this.errorsCheckBox.Image = global::XenAdmin.Properties.Resources._000_error_h32bit_16;
|
||||
this.errorsCheckBox.Name = "errorsCheckBox";
|
||||
this.errorsCheckBox.UseVisualStyleBackColor = false;
|
||||
this.errorsCheckBox.CheckedChanged += new System.EventHandler(this.errorsCheckBox_CheckedChanged);
|
||||
//
|
||||
// informationCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.informationCheckBox, "informationCheckBox");
|
||||
this.informationCheckBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.informationCheckBox.Checked = true;
|
||||
this.informationCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.informationCheckBox.ForeColor = System.Drawing.Color.White;
|
||||
this.informationCheckBox.Image = global::XenAdmin.Properties.Resources._000_Info3_h32bit_16;
|
||||
this.informationCheckBox.Name = "informationCheckBox";
|
||||
this.informationCheckBox.UseVisualStyleBackColor = false;
|
||||
this.informationCheckBox.CheckedChanged += new System.EventHandler(this.informationCheckBox_CheckedChanged);
|
||||
//
|
||||
// actionsCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.actionsCheckBox, "actionsCheckBox");
|
||||
this.actionsCheckBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.actionsCheckBox.Checked = true;
|
||||
this.actionsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.actionsCheckBox.ForeColor = System.Drawing.Color.White;
|
||||
this.actionsCheckBox.Image = global::XenAdmin.Properties.Resources.commands_16;
|
||||
this.actionsCheckBox.Name = "actionsCheckBox";
|
||||
this.actionsCheckBox.UseVisualStyleBackColor = false;
|
||||
this.actionsCheckBox.CheckedChanged += new System.EventHandler(this.actionsCheckBox_CheckedChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.BackColor = System.Drawing.Color.Transparent;
|
||||
@ -127,9 +85,6 @@ namespace XenAdmin.TabPages
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.CheckBox informationCheckBox;
|
||||
private System.Windows.Forms.CheckBox actionsCheckBox;
|
||||
private System.Windows.Forms.CheckBox errorsCheckBox;
|
||||
private XenAdmin.Controls.CustomHistoryContainer customHistoryContainer1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
|
@ -61,10 +61,6 @@ namespace XenAdmin.TabPages
|
||||
|
||||
label1.ForeColor = Program.HeaderGradientForeColor;
|
||||
label1.Font = Program.HeaderGradientFont;
|
||||
|
||||
actionsCheckBox.ForeColor = Program.HeaderGradientForeColor;
|
||||
errorsCheckBox.ForeColor = Program.HeaderGradientForeColor;
|
||||
informationCheckBox.ForeColor = Program.HeaderGradientForeColor;
|
||||
}
|
||||
|
||||
public void SetXenObjects(IEnumerable<IXenObject> xenObjects)
|
||||
@ -181,38 +177,9 @@ namespace XenAdmin.TabPages
|
||||
if (!ShowAll && _xenObjects.Find(x => row.AppliesTo.Contains(x.opaque_ref)) == null)
|
||||
return false;
|
||||
|
||||
if (!actionsCheckBox.Checked && (row.Type == ActionType.Action || row.Type == ActionType.Meddling))
|
||||
return false;
|
||||
|
||||
if (!errorsCheckBox.Checked && (row.Type == ActionType.Error || row.Error))
|
||||
return false;
|
||||
|
||||
if (!informationCheckBox.Checked && row.Type == ActionType.Information)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void actionsCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
BuildRowList();
|
||||
}
|
||||
|
||||
private void alertsCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
BuildRowList();
|
||||
}
|
||||
|
||||
private void informationCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
BuildRowList();
|
||||
}
|
||||
|
||||
private void errorsCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
BuildRowList();
|
||||
}
|
||||
|
||||
private void action_Changed(ActionBase sender)
|
||||
{
|
||||
Program.Invoke(this, delegate
|
||||
|
@ -165,105 +165,6 @@
|
||||
<data name="gradientPanel1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="errorsCheckBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="errorsCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="errorsCheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>379, 5</value>
|
||||
</data>
|
||||
<data name="errorsCheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>72, 26</value>
|
||||
</data>
|
||||
<data name="errorsCheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="errorsCheckBox.Text" xml:space="preserve">
|
||||
<value>&Errors</value>
|
||||
</data>
|
||||
<data name="errorsCheckBox.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
|
||||
<value>ImageBeforeText</value>
|
||||
</data>
|
||||
<data name=">>errorsCheckBox.Name" xml:space="preserve">
|
||||
<value>errorsCheckBox</value>
|
||||
</data>
|
||||
<data name=">>errorsCheckBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>errorsCheckBox.Parent" xml:space="preserve">
|
||||
<value>gradientPanel1</value>
|
||||
</data>
|
||||
<data name=">>errorsCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="informationCheckBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="informationCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="informationCheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>549, 5</value>
|
||||
</data>
|
||||
<data name="informationCheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>113, 26</value>
|
||||
</data>
|
||||
<data name="informationCheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="informationCheckBox.Text" xml:space="preserve">
|
||||
<value>&Information</value>
|
||||
</data>
|
||||
<data name="informationCheckBox.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
|
||||
<value>ImageBeforeText</value>
|
||||
</data>
|
||||
<data name=">>informationCheckBox.Name" xml:space="preserve">
|
||||
<value>informationCheckBox</value>
|
||||
</data>
|
||||
<data name=">>informationCheckBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>informationCheckBox.Parent" xml:space="preserve">
|
||||
<value>gradientPanel1</value>
|
||||
</data>
|
||||
<data name=">>informationCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="actionsCheckBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="actionsCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="actionsCheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>457, 5</value>
|
||||
</data>
|
||||
<data name="actionsCheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>86, 26</value>
|
||||
</data>
|
||||
<data name="actionsCheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="actionsCheckBox.Text" xml:space="preserve">
|
||||
<value>Actio&ns</value>
|
||||
</data>
|
||||
<data name="actionsCheckBox.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
|
||||
<value>ImageBeforeText</value>
|
||||
</data>
|
||||
<data name=">>actionsCheckBox.Name" xml:space="preserve">
|
||||
<value>actionsCheckBox</value>
|
||||
</data>
|
||||
<data name=">>actionsCheckBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>actionsCheckBox.Parent" xml:space="preserve">
|
||||
<value>gradientPanel1</value>
|
||||
</data>
|
||||
<data name=">>actionsCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="label1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
@ -301,7 +202,7 @@
|
||||
<value>gradientPanel1</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="gradientPanel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
|
@ -93,7 +93,7 @@ namespace XenAdminTests.FolderTests
|
||||
{
|
||||
foreach (XenAdmin.Actions.ActionBase a in ConnectionsManager.History)
|
||||
{
|
||||
if (a.Type == ActionType.Action && !a.IsCompleted)
|
||||
if (!a.IsCompleted)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -38,13 +38,10 @@ using XenAdmin.Core;
|
||||
|
||||
namespace XenAdmin.Actions
|
||||
{
|
||||
public enum ActionType { Error, Information, Action, Meddling };
|
||||
|
||||
public class ActionBase
|
||||
{
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public ActionType Type;
|
||||
public string Title;
|
||||
|
||||
/// <summary>
|
||||
@ -265,27 +262,32 @@ namespace XenAdmin.Actions
|
||||
|
||||
public const int MAX_HISTORY_ITEM = 1000;
|
||||
|
||||
public ActionBase(ActionType type, string title, string description, bool SuppressHistory)
|
||||
: this(type, title, description, SuppressHistory, true)
|
||||
public ActionBase(string title, string description, bool suppressHistory)
|
||||
: this(title, description, suppressHistory, false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ActionBase(ActionType type, string title, string description, bool SuppressHistory, bool non_action_completed)
|
||||
public ActionBase(string title, string description, bool suppressHistory, bool completeImmediately)
|
||||
: this(title, description, suppressHistory, completeImmediately, null)
|
||||
{}
|
||||
|
||||
public ActionBase(string title, string description, bool suppressHistory, bool completeImmediately, string error)
|
||||
{
|
||||
Type = type;
|
||||
Title = title;
|
||||
_description = description;
|
||||
log.Debug(_description);
|
||||
if (type != ActionType.Action && non_action_completed)
|
||||
if (completeImmediately)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
_exception = new Exception(error);
|
||||
|
||||
Finished = DateTime.Now;
|
||||
_percentComplete = 100;
|
||||
_isCompleted = true;
|
||||
}
|
||||
if (NewAction != null && !SuppressHistory)
|
||||
if (NewAction != null && !suppressHistory)
|
||||
NewAction(this);
|
||||
|
||||
}
|
||||
|
||||
public string Description
|
||||
@ -344,11 +346,6 @@ namespace XenAdmin.Actions
|
||||
get { return _exception; }
|
||||
protected set
|
||||
{
|
||||
if (!(value is CancelledException))
|
||||
{
|
||||
// Only set to error if not cancelled by user
|
||||
this.Type = ActionType.Error;
|
||||
}
|
||||
_exception = value;
|
||||
OnChanged();
|
||||
}
|
||||
@ -431,7 +428,7 @@ namespace XenAdmin.Actions
|
||||
MarkCompletedCore();
|
||||
}
|
||||
|
||||
protected void MarkCompletedCore()
|
||||
private void MarkCompletedCore()
|
||||
{
|
||||
Finished = DateTime.Now;
|
||||
PercentComplete = 100;
|
||||
|
@ -51,8 +51,8 @@ namespace XenAdmin.Actions
|
||||
|
||||
private string _result;
|
||||
|
||||
protected AsyncAction(IXenConnection connection, string title, string description, bool SuppressHistory)
|
||||
: base(ActionType.Action, title, description, SuppressHistory)
|
||||
protected AsyncAction(IXenConnection connection, string title, string description, bool suppressHistory)
|
||||
: base(title, description, suppressHistory)
|
||||
{
|
||||
this.Connection = connection;
|
||||
}
|
||||
@ -370,7 +370,7 @@ namespace XenAdmin.Actions
|
||||
continue;
|
||||
|
||||
AsyncAction a = action as AsyncAction;
|
||||
if (action.Type == ActionType.Action && !action.IsCompleted && (a == null || !a.Cancelling))
|
||||
if (!action.IsCompleted && (a == null || !a.Cancelling))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -59,13 +59,13 @@ namespace XenAdmin.Actions
|
||||
/// </summary>
|
||||
private volatile bool cancelled = false;
|
||||
|
||||
public CancellingAction(ActionType type, string title, string description, bool SuppressHistory)
|
||||
: base(type, title, description, SuppressHistory)
|
||||
public CancellingAction(string title, string description, bool suppressHistory)
|
||||
: base(title, description, suppressHistory)
|
||||
{
|
||||
}
|
||||
|
||||
public CancellingAction(ActionType type, string title, string description, bool SuppressHistory, bool non_action_completed)
|
||||
: base(type, title, description, SuppressHistory, non_action_completed)
|
||||
public CancellingAction(string title, string description, bool suppressHistory, bool completeImmediately)
|
||||
: base(title, description, suppressHistory, completeImmediately)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ namespace XenAdmin
|
||||
if (xo == null || xo.Connection != connection)
|
||||
continue;
|
||||
|
||||
if (action.Type == ActionType.Action && !action.IsCompleted)
|
||||
if (!action.IsCompleted)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -139,7 +139,7 @@ namespace XenAdmin
|
||||
if (xo == null || xo.Connection != connection)
|
||||
continue;
|
||||
|
||||
if (action.Type == ActionType.Action && !action.IsCompleted)
|
||||
if (!action.IsCompleted)
|
||||
{
|
||||
action.Cancel();
|
||||
}
|
||||
|
@ -1000,7 +1000,7 @@ namespace XenAdmin.Network
|
||||
string msg = string.Format(Messages.CONNECTING_NOTICE_TEXT, name);
|
||||
log.Info(msg);
|
||||
|
||||
ConnectAction = new ActionBase(ActionType.Information, title, msg, false, false);
|
||||
ConnectAction = new ActionBase(title, msg, false, false);
|
||||
|
||||
ExpectPasswordIsCorrect = true;
|
||||
OnConnectionResult(true, null, null);
|
||||
@ -1479,8 +1479,9 @@ namespace XenAdmin.Network
|
||||
string msg = string.Format(Messages.CONNECTION_RESTRICTED_MESSAGE, e.HostName, e.ExistingHostName);
|
||||
log.Info(msg);
|
||||
// Add an informational log message saying why the connection attempt failed
|
||||
ActionBase action = new ActionBase(ActionType.Error,
|
||||
string.Format(Messages.CONNECTION_RESTRICTED_NOTICE_TITLE, e.HostName), msg, false);
|
||||
ActionBase action = new ActionBase(
|
||||
string.Format(Messages.CONNECTION_RESTRICTED_NOTICE_TITLE, e.HostName),
|
||||
msg, false, true, Messages.CONNECTION_RESTRICTED_NOTICE_TITLE);
|
||||
SetPoolAndHostInAction(action, pool, PoolOpaqueRef);
|
||||
|
||||
OnConnectionResult(false, Messages.CONNECTION_RESTRICTED_MESSAGE, error);
|
||||
@ -1509,7 +1510,8 @@ namespace XenAdmin.Network
|
||||
log.WarnFormat("IXenConnection: failed to connect to {0}: {1}", this.HostnameWithPort, reason);
|
||||
|
||||
// Create a new log message to say the connection attempt failed
|
||||
ActionBase n = new ActionBase(ActionType.Information, string.Format(Messages.CONNECTION_FAILED_TITLE, HostnameWithPort), reason, false);
|
||||
string title = string.Format(Messages.CONNECTION_FAILED_TITLE, HostnameWithPort);
|
||||
ActionBase n = new ActionBase(title, reason, false, true, title);
|
||||
SetPoolAndHostInAction(n, pool, PoolOpaqueRef);
|
||||
|
||||
Failure f = error as Failure;
|
||||
@ -1654,10 +1656,10 @@ namespace XenAdmin.Network
|
||||
description = string.Format(Messages.CONNECTION_LOST_RECONNECT_IN_X_SECONDS, LastConnectionFullName, ReconnectHostTimeoutMs / 1000);
|
||||
}
|
||||
|
||||
ActionBase n = new ActionBase(ActionType.Information, string.Format(Messages.CONNECTION_LOST_NOTICE_TITLE, LastConnectionFullName),
|
||||
description, false);
|
||||
string title = string.Format(Messages.CONNECTION_LOST_NOTICE_TITLE,
|
||||
LastConnectionFullName);
|
||||
ActionBase n = new ActionBase(title, description, false, true, title);
|
||||
SetPoolAndHostInAction(n, pool, poolopaqueref);
|
||||
|
||||
OnConnectionLost();
|
||||
}
|
||||
|
||||
@ -1808,8 +1810,10 @@ namespace XenAdmin.Network
|
||||
private void ReconnectMaster()
|
||||
{
|
||||
// Add an informational entry to the log
|
||||
ActionBase action = new ActionBase(ActionType.Information, string.Format(Messages.CONNECTION_FINDING_MASTER_TITLE, LastConnectionFullName),
|
||||
string.Format(Messages.CONNECTION_FINDING_MASTER_DESCRIPTION, LastConnectionFullName, Hostname), false);
|
||||
ActionBase action = new ActionBase(
|
||||
string.Format(Messages.CONNECTION_FINDING_MASTER_TITLE, LastConnectionFullName),
|
||||
string.Format(Messages.CONNECTION_FINDING_MASTER_DESCRIPTION, LastConnectionFullName, Hostname),
|
||||
false, true);
|
||||
SetPoolAndHostInAction(action, null, PoolOpaqueRef);
|
||||
log.DebugFormat("Looking for master for {0} on {1}...", LastConnectionFullName, Hostname);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user