Skip to content

Commit f6b24c7

Browse files
Dashboard remove status report if item delete
1 parent 940e012 commit f6b24c7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Certify.Core/Management/CertifyManager/CertifyManager.ManagedCertificates.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ private async Task UpdateManagedCertificateStatus(ManagedCertificate managedCert
251251
/// </summary>
252252
/// <param name="managedCertificate"></param>
253253
/// <returns></returns>
254-
private async Task ReportManagedCertificateStatus(ManagedCertificate managedCertificate)
254+
private async Task ReportManagedCertificateStatus(ManagedCertificate managedCertificate, bool removeReport = false)
255255
{
256256

257257
var reportedCert = Newtonsoft.Json.JsonConvert.DeserializeObject<ManagedCertificate>(Newtonsoft.Json.JsonConvert.SerializeObject(managedCertificate));
@@ -273,7 +273,8 @@ private async Task ReportManagedCertificateStatus(ManagedCertificate managedCert
273273
PrimaryContactEmail = (await GetAccountDetails(managedCertificate, allowFailover: false))?.Email,
274274
ManagedSite = reportedCert,
275275
AppName = _isMgtmHubBackend ? "Certify Management Hub" : "Certify Certificate Manager",
276-
AppVersion = Util.GetAppVersion().ToString()
276+
AppVersion = Util.GetAppVersion().ToString(),
277+
IsRemoved = removeReport
277278
};
278279

279280
if (!_useStatusReportQueue)
@@ -344,6 +345,12 @@ public async Task<ActionResult> DeleteManagedCertificate(string id)
344345
if (item != null)
345346
{
346347
await _itemManager.Delete(item);
348+
349+
if (item.RequestConfig?.EnableFailureNotifications == true && CoreAppSettings.Current.EnableStatusReporting)
350+
{
351+
await ReportManagedCertificateStatus(item, removeReport: true);
352+
}
353+
347354
return new ActionResult { IsSuccess = true, Message = "Deleted" };
348355
}
349356
}

src/Certify.Models/Shared/RenewalStatusReport.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@ public class RenewalStatusReport
1111
public string? AppName { get; set; }
1212
public string? AppVersion { get; set; }
1313
public DateTime? DateReported { get; set; }
14+
15+
/// <summary>
16+
/// If true, report should be removed from dashboard.
17+
/// </summary>
18+
public bool IsRemoved { get; set; }
1419
}
1520
}

0 commit comments

Comments
 (0)