mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
Show a different alert message if the user has never synchronized.
Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
parent
cda79820b3
commit
046476cd6e
@ -40,7 +40,7 @@ namespace XenAdmin.Alerts
|
||||
{
|
||||
public class OutOfSyncWithCdnAlert : Alert
|
||||
{
|
||||
private readonly TimeSpan _outOfSyncSpan;
|
||||
private readonly TimeSpan _outOfSyncSpan = TimeSpan.Zero;
|
||||
private readonly Pool _pool;
|
||||
|
||||
private OutOfSyncWithCdnAlert(Pool pool, DateTime timestamp)
|
||||
@ -49,12 +49,19 @@ namespace XenAdmin.Alerts
|
||||
_pool = pool;
|
||||
Connection = _pool.Connection;
|
||||
|
||||
_outOfSyncSpan = _timestamp - _pool.last_update_sync;
|
||||
if (pool.last_update_sync > Util.GetUnixMinDateTime())
|
||||
{
|
||||
_outOfSyncSpan = _timestamp - _pool.last_update_sync;
|
||||
|
||||
if (_outOfSyncSpan >= TimeSpan.FromDays(180))
|
||||
Priority = AlertPriority.Priority1;
|
||||
else if (_outOfSyncSpan >= TimeSpan.FromDays(90))
|
||||
Priority = AlertPriority.Priority2;
|
||||
if (_outOfSyncSpan >= TimeSpan.FromDays(180))
|
||||
Priority = AlertPriority.Priority1;
|
||||
else if (_outOfSyncSpan >= TimeSpan.FromDays(90))
|
||||
Priority = AlertPriority.Priority2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Priority = AlertPriority.Priority3;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TryCreate(IXenConnection connection, out Alert alert)
|
||||
@ -79,8 +86,9 @@ namespace XenAdmin.Alerts
|
||||
|
||||
public override string AppliesTo => Helpers.GetName(_pool);
|
||||
|
||||
public override string Description => string.Format(Messages.ALERT_CDN_OUT_OF_SYNC_DESCRIPTION,
|
||||
AlertExtensions.GetGuiDate(_pool.last_update_sync));
|
||||
public override string Description => _outOfSyncSpan == TimeSpan.Zero
|
||||
? Messages.ALERT_CDN_NEVER_SYNC_TITLE
|
||||
: string.Format(Messages.ALERT_CDN_OUT_OF_SYNC_DESCRIPTION, AlertExtensions.GetGuiDate(_pool.last_update_sync));
|
||||
|
||||
public override Action FixLinkAction
|
||||
{
|
||||
@ -99,7 +107,9 @@ namespace XenAdmin.Alerts
|
||||
|
||||
public override string HelpID => "TODO";
|
||||
|
||||
public override string Title => string.Format(Messages.ALERT_CDN_OUT_OF_SYNC_TITLE, _outOfSyncSpan.Days);
|
||||
public override string Title => _outOfSyncSpan == TimeSpan.Zero
|
||||
? Messages.ALERT_CDN_NEVER_SYNC_TITLE
|
||||
: string.Format(Messages.ALERT_CDN_OUT_OF_SYNC_TITLE, _outOfSyncSpan.Days);
|
||||
}
|
||||
|
||||
|
||||
|
9
XenModel/Messages.Designer.cs
generated
9
XenModel/Messages.Designer.cs
generated
@ -4993,6 +4993,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to You have never synchronized with the update channel..
|
||||
/// </summary>
|
||||
public static string ALERT_CDN_NEVER_SYNC_TITLE {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_CDN_NEVER_SYNC_TITLE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The last synchronization with the update channel took place on {0}..
|
||||
/// </summary>
|
||||
|
@ -1834,6 +1834,9 @@ This alarm is set to be triggered when the total throughput exceeds {4}.</value>
|
||||
<data name="ALERT_CAP_LABEL" xml:space="preserve">
|
||||
<value>(Showing first {0} entries)</value>
|
||||
</data>
|
||||
<data name="ALERT_CDN_NEVER_SYNC_TITLE" xml:space="preserve">
|
||||
<value>You have never synchronized with the update channel.</value>
|
||||
</data>
|
||||
<data name="ALERT_CDN_OUT_OF_SYNC_DESCRIPTION" xml:space="preserve">
|
||||
<value>The last synchronization with the update channel took place on {0}.</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user