mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CA-326341: Refresh the hotfix eligibility alerts after a check for updates is completed
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
3f5125b293
commit
b7c64bddb2
@ -980,5 +980,31 @@ namespace XenAdmin.Core
|
||||
else
|
||||
Alert.RefreshAlertAt(alertIndex);
|
||||
}
|
||||
|
||||
public static void CheckHotfixEligibility()
|
||||
{
|
||||
var alerts = new List<HotfixEligibilityAlert>();
|
||||
|
||||
foreach (var connection in ConnectionsManager.XenConnectionsCopy)
|
||||
{
|
||||
if (!connection.IsConnected)
|
||||
continue;
|
||||
|
||||
var master = Helpers.GetMaster(connection);
|
||||
if (master == null)
|
||||
continue;
|
||||
|
||||
var hotfixEligibility = HotfixEligibility(master, out var xenServerVersion);
|
||||
|
||||
if (xenServerVersion == null || hotfixEligibility == hotfix_eligibility.all ||
|
||||
hotfixEligibility == hotfix_eligibility.premium && !master.IsFreeLicenseOrExpired())
|
||||
continue;
|
||||
|
||||
alerts.Add(new HotfixEligibilityAlert(connection, xenServerVersion));
|
||||
}
|
||||
|
||||
Alert.RemoveAlert(a => a is HotfixEligibilityAlert);
|
||||
Alert.AddAlertRange(alerts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
XenAdmin/TabPages/AlertSummaryPage.Designer.cs
generated
1
XenAdmin/TabPages/AlertSummaryPage.Designer.cs
generated
@ -16,6 +16,7 @@ namespace XenAdmin.TabPages
|
||||
if (disposing)
|
||||
{
|
||||
DeregisterEventHandlers();
|
||||
DeregisterCheckForUpdatesEvents();
|
||||
|
||||
if (components != null)
|
||||
components.Dispose();
|
||||
|
@ -69,6 +69,7 @@ namespace XenAdmin.TabPages
|
||||
UpdateActionEnablement();
|
||||
|
||||
m_alertCollectionChangedWithInvoke = Program.ProgramInvokeHandler(AlertsCollectionChanged);
|
||||
RegisterCheckForUpdatesEvents();
|
||||
|
||||
toolStripSplitButtonDismiss.DefaultItem = tsmiDismissAll;
|
||||
toolStripSplitButtonDismiss.Text = tsmiDismissAll.Text;
|
||||
@ -834,5 +835,22 @@ namespace XenAdmin.TabPages
|
||||
|
||||
Clip.SetClipboardText(alert.GetUpdateDetailsCSVQuotes());
|
||||
}
|
||||
|
||||
#region CheckForUpdates events
|
||||
private void RegisterCheckForUpdatesEvents()
|
||||
{
|
||||
Updates.CheckForUpdatesCompleted += CheckForUpdatesCompleted;
|
||||
}
|
||||
|
||||
private void DeregisterCheckForUpdatesEvents()
|
||||
{
|
||||
Updates.CheckForUpdatesCompleted -= CheckForUpdatesCompleted;
|
||||
}
|
||||
|
||||
private void CheckForUpdatesCompleted(bool succeeded, string errorMessage)
|
||||
{
|
||||
Updates.CheckHotfixEligibility();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,18 @@ namespace XenAdmin.Alerts
|
||||
log.Error("Failed to add incoming alert", e);
|
||||
}
|
||||
}
|
||||
public static void AddAlertRange(IEnumerable<Alert> collection)
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (XenCenterAlertsLock)
|
||||
XenCenterAlerts.AddRange(collection);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.Error("Failed to add incoming alerts", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveAlert(Alert a)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user