mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CA-381502: Show the disabled reason in a new column because the tooltips are obscure.
Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
parent
218d910b0a
commit
143974e93d
@ -41,6 +41,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
this.ColumnExpander = new System.Windows.Forms.DataGridViewImageColumn();
|
this.ColumnExpander = new System.Windows.Forms.DataGridViewImageColumn();
|
||||||
this.ColumnPoolIconHostCheck = new System.Windows.Forms.DataGridViewImageColumn();
|
this.ColumnPoolIconHostCheck = new System.Windows.Forms.DataGridViewImageColumn();
|
||||||
this.ColumnName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.ColumnName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.ColumnNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.ColumnVersion = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.ColumnVersion = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.buttonSelectAll = new System.Windows.Forms.Button();
|
this.buttonSelectAll = new System.Windows.Forms.Button();
|
||||||
@ -77,6 +78,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
this.ColumnExpander,
|
this.ColumnExpander,
|
||||||
this.ColumnPoolIconHostCheck,
|
this.ColumnPoolIconHostCheck,
|
||||||
this.ColumnName,
|
this.ColumnName,
|
||||||
|
this.ColumnNotes,
|
||||||
this.ColumnVersion});
|
this.ColumnVersion});
|
||||||
this.tableLayoutPanel1.SetColumnSpan(this.dataGridViewHosts, 2);
|
this.tableLayoutPanel1.SetColumnSpan(this.dataGridViewHosts, 2);
|
||||||
this.dataGridViewHosts.Name = "dataGridViewHosts";
|
this.dataGridViewHosts.Name = "dataGridViewHosts";
|
||||||
@ -105,11 +107,15 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
//
|
//
|
||||||
// ColumnName
|
// ColumnName
|
||||||
//
|
//
|
||||||
this.ColumnName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
this.ColumnName.FillWeight = 110.2538F;
|
|
||||||
resources.ApplyResources(this.ColumnName, "ColumnName");
|
resources.ApplyResources(this.ColumnName, "ColumnName");
|
||||||
this.ColumnName.Name = "ColumnName";
|
this.ColumnName.Name = "ColumnName";
|
||||||
//
|
//
|
||||||
|
// ColumnNotes
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.ColumnNotes, "ColumnNotes");
|
||||||
|
this.ColumnNotes.Name = "ColumnNotes";
|
||||||
|
this.ColumnNotes.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||||
|
//
|
||||||
// ColumnVersion
|
// ColumnVersion
|
||||||
//
|
//
|
||||||
this.ColumnVersion.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
|
this.ColumnVersion.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
|
||||||
@ -161,6 +167,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
private DataGridViewImageColumn ColumnExpander;
|
private DataGridViewImageColumn ColumnExpander;
|
||||||
private DataGridViewImageColumn ColumnPoolIconHostCheck;
|
private DataGridViewImageColumn ColumnPoolIconHostCheck;
|
||||||
private DataGridViewTextBoxColumn ColumnName;
|
private DataGridViewTextBoxColumn ColumnName;
|
||||||
|
private DataGridViewTextBoxColumn ColumnNotes;
|
||||||
private DataGridViewTextBoxColumn ColumnVersion;
|
private DataGridViewTextBoxColumn ColumnVersion;
|
||||||
private Label label1;
|
private Label label1;
|
||||||
private CheckBox applyUpdatesCheckBox;
|
private CheckBox applyUpdatesCheckBox;
|
||||||
|
@ -152,9 +152,8 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
{
|
{
|
||||||
var hostRow = new PatchingHostsDataGridViewRow(host, hasPool, !poolSelectionOnly) {ParentPoolRow = poolRow};
|
var hostRow = new PatchingHostsDataGridViewRow(host, hasPool, !poolSelectionOnly) {ParentPoolRow = poolRow};
|
||||||
dataGridViewHosts.Rows.Add(hostRow);
|
dataGridViewHosts.Rows.Add(hostRow);
|
||||||
string tooltipText;
|
hostRow.Enabled = CanEnableRow(host, out var cannotEnableReason);
|
||||||
hostRow.Enabled = CanEnableRow(host, out tooltipText);
|
hostRow.Notes = cannotEnableReason;
|
||||||
hostRow.Cells[3].ToolTipText = tooltipText;
|
|
||||||
|
|
||||||
//Enable the pool row
|
//Enable the pool row
|
||||||
if (poolRow != null && hostRow.Enabled)
|
if (poolRow != null && hostRow.Enabled)
|
||||||
@ -165,7 +164,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (poolRow != null && !poolRow.Enabled && coordinatorRow != null)
|
if (poolRow != null && !poolRow.Enabled && coordinatorRow != null)
|
||||||
poolRow.Cells[3].ToolTipText = coordinatorRow.Cells[3].ToolTipText;
|
poolRow.Notes = coordinatorRow.Notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore server selection
|
// restore server selection
|
||||||
@ -276,8 +275,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string reason;
|
if (!IsHostAmongApplicable(host, out var reason))
|
||||||
if (!IsHostAmongApplicable(host, out reason))
|
|
||||||
{
|
{
|
||||||
tooltipText = reason;
|
tooltipText = reason;
|
||||||
return false;
|
return false;
|
||||||
@ -349,7 +347,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
{
|
{
|
||||||
var nonApplicables = host.Connection.Cache.Hosts.Count(h =>
|
var nonApplicables = host.Connection.Cache.Hosts.Count(h =>
|
||||||
!applicableHosts.Contains(h) && !string.IsNullOrEmpty(patchUuidFromAlert) &&
|
!applicableHosts.Contains(h) && !string.IsNullOrEmpty(patchUuidFromAlert) &&
|
||||||
!isPatchApplied(patchUuidFromAlert, h));
|
!IsPatchApplied(patchUuidFromAlert, h));
|
||||||
|
|
||||||
if (0 < nonApplicables && nonApplicables < host.Connection.Cache.Hosts.Length)
|
if (0 < nonApplicables && nonApplicables < host.Connection.Cache.Hosts.Length)
|
||||||
{
|
{
|
||||||
@ -361,7 +359,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
|
|
||||||
if (!applicableHosts.Contains(host) && !string.IsNullOrEmpty(patchUuidFromAlert))
|
if (!applicableHosts.Contains(host) && !string.IsNullOrEmpty(patchUuidFromAlert))
|
||||||
{
|
{
|
||||||
if (isPatchApplied(patchUuidFromAlert, host))
|
if (IsPatchApplied(patchUuidFromAlert, host))
|
||||||
{
|
{
|
||||||
if (ApplyUpdatesToNewVersion)
|
if (ApplyUpdatesToNewVersion)
|
||||||
return CanEnableRowAutomatedUpdates(host, out tooltipText);
|
return CanEnableRowAutomatedUpdates(host, out tooltipText);
|
||||||
@ -377,7 +375,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool isPatchApplied(string uuid, Host host)
|
private bool IsPatchApplied(string uuid, Host host)
|
||||||
{
|
{
|
||||||
if (Helpers.ElyOrGreater(host))
|
if (Helpers.ElyOrGreater(host))
|
||||||
{
|
{
|
||||||
@ -654,26 +652,24 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
|
|
||||||
foreach (PatchingHostsDataGridViewRow row in dataGridViewHosts.Rows)
|
foreach (PatchingHostsDataGridViewRow row in dataGridViewHosts.Rows)
|
||||||
{
|
{
|
||||||
var host = row.Tag as Host;
|
if (row.Tag is Host host)
|
||||||
if (host != null)
|
|
||||||
{
|
{
|
||||||
string tooltipText;
|
row.Enabled = CanEnableRow(host, out var cannotEnableReason);
|
||||||
row.Enabled = CanEnableRow(host, out tooltipText);
|
row.Notes = cannotEnableReason;
|
||||||
row.Cells[3].ToolTipText = tooltipText;
|
|
||||||
|
|
||||||
if (row.ParentPoolRow != null)
|
if (row.ParentPoolRow != null)
|
||||||
{
|
{
|
||||||
if (row.Enabled)
|
if (row.Enabled)
|
||||||
{
|
{
|
||||||
row.ParentPoolRow.Enabled = true;
|
row.ParentPoolRow.Enabled = true;
|
||||||
row.ParentPoolRow.Cells[3].ToolTipText = null;
|
row.Notes = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masterRow == null)
|
if (masterRow == null)
|
||||||
{
|
{
|
||||||
masterRow = row;
|
masterRow = row;
|
||||||
if (!row.Enabled)
|
if (!row.Enabled)
|
||||||
row.ParentPoolRow.Cells[3].ToolTipText = row.Cells[3].ToolTipText;
|
row.ParentPoolRow.Notes = row.Notes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -841,53 +837,49 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
{
|
{
|
||||||
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
|
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
|
||||||
{
|
{
|
||||||
Pool pool = value as Pool;
|
if (value is Pool)
|
||||||
|
|
||||||
if (pool != null)
|
|
||||||
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Host host = value as Host;
|
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
|
||||||
if (host != null)
|
}
|
||||||
|
else if (value is Host host)
|
||||||
|
{
|
||||||
|
PatchingHostsDataGridViewRow row = (PatchingHostsDataGridViewRow)DataGridView.Rows[RowIndex];
|
||||||
|
if (row.HasPool)
|
||||||
{
|
{
|
||||||
PatchingHostsDataGridViewRow row = (PatchingHostsDataGridViewRow)this.DataGridView.Rows[this.RowIndex];
|
Image hostIcon = Images.GetImage16For(host);
|
||||||
if (row.HasPool)
|
base.Paint(graphics, clipBounds,
|
||||||
|
new Rectangle(cellBounds.X + 16, cellBounds.Y, cellBounds.Width - 16,
|
||||||
|
cellBounds.Height), rowIndex, cellState, value, formattedValue,
|
||||||
|
errorText, cellStyle, advancedBorderStyle, paintParts);
|
||||||
|
|
||||||
|
if ((cellState & DataGridViewElementStates.Selected) != 0 && row.Enabled)
|
||||||
{
|
{
|
||||||
Image hostIcon = Images.GetImage16For(host);
|
using (var brush = new SolidBrush(DataGridView.DefaultCellStyle.SelectionBackColor))
|
||||||
base.Paint(graphics, clipBounds,
|
graphics.FillRectangle(
|
||||||
new Rectangle(cellBounds.X + 16, cellBounds.Y, cellBounds.Width - 16,
|
brush, cellBounds.X,
|
||||||
cellBounds.Height), rowIndex, cellState, value, formattedValue,
|
cellBounds.Y, hostIcon.Width, cellBounds.Height);
|
||||||
errorText, cellStyle, advancedBorderStyle, paintParts);
|
|
||||||
|
|
||||||
if ((cellState & DataGridViewElementStates.Selected) != 0 && row.Enabled)
|
|
||||||
{
|
|
||||||
using (var brush = new SolidBrush(DataGridView.DefaultCellStyle.SelectionBackColor))
|
|
||||||
graphics.FillRectangle(
|
|
||||||
brush, cellBounds.X,
|
|
||||||
cellBounds.Y, hostIcon.Width, cellBounds.Height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
using (var brush = new SolidBrush(DataGridView.DefaultCellStyle.BackColor))
|
|
||||||
graphics.FillRectangle(brush,
|
|
||||||
cellBounds.X, cellBounds.Y, hostIcon.Width, cellBounds.Height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (row.Enabled)
|
|
||||||
graphics.DrawImage(hostIcon, cellBounds.X, cellBounds.Y + 3, hostIcon.Width,
|
|
||||||
hostIcon.Height);
|
|
||||||
else
|
|
||||||
graphics.DrawImage(hostIcon,
|
|
||||||
new Rectangle(cellBounds.X, cellBounds.Y + 3,
|
|
||||||
hostIcon.Width, hostIcon.Height),
|
|
||||||
0, 0, hostIcon.Width, hostIcon.Height, GraphicsUnit.Pixel,
|
|
||||||
Drawing.GreyScaleAttributes);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue,
|
using (var brush = new SolidBrush(DataGridView.DefaultCellStyle.BackColor))
|
||||||
errorText, cellStyle, advancedBorderStyle, paintParts);
|
graphics.FillRectangle(brush,
|
||||||
|
cellBounds.X, cellBounds.Y, hostIcon.Width, cellBounds.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (row.Enabled)
|
||||||
|
graphics.DrawImage(hostIcon, cellBounds.X, cellBounds.Y + 3, hostIcon.Width,
|
||||||
|
hostIcon.Height);
|
||||||
|
else
|
||||||
|
graphics.DrawImage(hostIcon,
|
||||||
|
new Rectangle(cellBounds.X, cellBounds.Y + 3,
|
||||||
|
hostIcon.Width, hostIcon.Height),
|
||||||
|
0, 0, hostIcon.Width, hostIcon.Height, GraphicsUnit.Pixel,
|
||||||
|
Drawing.GreyScaleAttributes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue,
|
||||||
|
errorText, cellStyle, advancedBorderStyle, paintParts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -927,7 +919,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
|
|
||||||
private DataGridViewCell _poolIconHostCheckCell;
|
private DataGridViewCell _poolIconHostCheckCell;
|
||||||
private DataGridViewTextBoxCell _versionCell;
|
private DataGridViewTextBoxCell _versionCell;
|
||||||
|
private DataGridViewTextBoxCell _notesCell;
|
||||||
private readonly bool _showHostCheckBox = true;
|
private readonly bool _showHostCheckBox = true;
|
||||||
|
|
||||||
public PatchingHostsDataGridViewRow(Pool pool)
|
public PatchingHostsDataGridViewRow(Pool pool)
|
||||||
@ -943,22 +935,15 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
SetupCells();
|
SetupCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int VersionCellIndex
|
public PatchingHostsDataGridViewRow ParentPoolRow { get; set; }
|
||||||
{
|
|
||||||
get { return Cells.IndexOf(_versionCell); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsCheckable
|
public int VersionCellIndex => Cells.IndexOf(_versionCell);
|
||||||
{
|
|
||||||
get { return !HasPool; }
|
public override bool IsCheckable => !HasPool;
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Enabled
|
public override bool Enabled
|
||||||
{
|
{
|
||||||
get
|
get => base.Enabled;
|
||||||
{
|
|
||||||
return base.Enabled;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
base.Enabled = value;
|
base.Enabled = value;
|
||||||
@ -966,23 +951,18 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CheckValue
|
public int CheckValue => IsPoolOrStandaloneHost
|
||||||
{
|
? (int)Cells[POOL_CHECKBOX_COL].Value
|
||||||
get {
|
: (int)Cells[POOL_ICON_HOST_CHECKBOX_COL].Value;
|
||||||
return IsPoolOrStandaloneHost
|
|
||||||
? (int) Cells[POOL_CHECKBOX_COL].Value
|
|
||||||
: (int) Cells[POOL_ICON_HOST_CHECKBOX_COL].Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSelectableHost
|
public bool IsSelectableHost => IsAHostRow && Enabled && (_showHostCheckBox || !HasPool);
|
||||||
{
|
|
||||||
get { return IsAHostRow && Enabled && (_showHostCheckBox || !HasPool); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSelectablePool
|
public bool IsSelectablePool => IsAPoolRow && Enabled;
|
||||||
|
|
||||||
|
public string Notes
|
||||||
{
|
{
|
||||||
get { return IsAPoolRow && Enabled; }
|
get => _notesCell.Value as string;
|
||||||
|
set => _notesCell.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupCells()
|
private void SetupCells()
|
||||||
@ -996,10 +976,11 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
|
|
||||||
_nameCell = new DataGridViewNameCell();
|
_nameCell = new DataGridViewNameCell();
|
||||||
_versionCell = new DataGridViewTextBoxCell();
|
_versionCell = new DataGridViewTextBoxCell();
|
||||||
|
_notesCell = new DataGridViewTextBoxCell();
|
||||||
|
|
||||||
Cells.AddRange(_expansionCell, _poolCheckBoxCell, _poolIconHostCheckCell, _nameCell, _versionCell);
|
Cells.AddRange(_expansionCell, _poolCheckBoxCell, _poolIconHostCheckCell, _nameCell, _notesCell, _versionCell);
|
||||||
|
|
||||||
this.UpdateDetails();
|
UpdateDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateDetails()
|
private void UpdateDetails()
|
||||||
@ -1040,8 +1021,6 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
_poolIconHostCheckCell.Value = Images.GetImage16For((IXenObject)Tag);
|
_poolIconHostCheckCell.Value = Images.GetImage16For((IXenObject)Tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PatchingHostsDataGridViewRow ParentPoolRow { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -198,6 +198,12 @@
|
|||||||
<data name="ColumnName.HeaderText" xml:space="preserve">
|
<data name="ColumnName.HeaderText" xml:space="preserve">
|
||||||
<value>Name</value>
|
<value>Name</value>
|
||||||
</data>
|
</data>
|
||||||
|
<metadata name="ColumnNotes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<data name="ColumnNotes.HeaderText" xml:space="preserve">
|
||||||
|
<value>Notes</value>
|
||||||
|
</data>
|
||||||
<metadata name="ColumnVersion.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="ColumnVersion.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
@ -378,6 +384,12 @@
|
|||||||
<data name=">>ColumnName.Type" xml:space="preserve">
|
<data name=">>ColumnName.Type" xml:space="preserve">
|
||||||
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name=">>ColumnNotes.Name" xml:space="preserve">
|
||||||
|
<value>ColumnNotes</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>ColumnNotes.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
<data name=">>ColumnVersion.Name" xml:space="preserve">
|
<data name=">>ColumnVersion.Name" xml:space="preserve">
|
||||||
<value>ColumnVersion</value>
|
<value>ColumnVersion</value>
|
||||||
</data>
|
</data>
|
||||||
|
Loading…
Reference in New Issue
Block a user