From eb7d137e597e4b0dfb19d9edae2b2bd66b596973 Mon Sep 17 00:00:00 2001 From: Dmytro Bogatov Date: Sun, 6 Aug 2017 23:33:35 +0300 Subject: [PATCH] Fix. --- client/ts/modules/utility.ts | 22 +++++++++++++++------- src/shared/Services/NotificationService.cs | 2 +- src/web/TagHelpers/UtcTimeTagHelper.cs | 5 ++++- src/web/Views/Admin/Index.cshtml | 8 +++++++- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/client/ts/modules/utility.ts b/client/ts/modules/utility.ts index 0a320f2..44d31eb 100644 --- a/client/ts/modules/utility.ts +++ b/client/ts/modules/utility.ts @@ -161,16 +161,24 @@ export class Utility { ); }); + $(".utc-date").each(function () { + $(this).text( + Utility.toLocalTimezone( + new Date($(this).text()) + ).toString() + ); + }); + } - public static toUtcDate(date : Date): number { + public static toUtcDate(date: Date): number { return Date.UTC( - date.getUTCFullYear(), - date.getUTCMonth(), - date.getUTCDate(), - date.getUTCHours(), - date.getUTCMinutes(), - date.getUTCSeconds(), + date.getUTCFullYear(), + date.getUTCMonth(), + date.getUTCDate(), + date.getUTCHours(), + date.getUTCMinutes(), + date.getUTCSeconds(), date.getUTCMilliseconds() ); } diff --git a/src/shared/Services/NotificationService.cs b/src/shared/Services/NotificationService.cs index 229a82a..88b4b43 100644 --- a/src/shared/Services/NotificationService.cs +++ b/src/shared/Services/NotificationService.cs @@ -154,7 +154,7 @@ namespace StatusMonitor.Shared.Services return unresolved == 0 ? "There are no outstanding issues. Well done." : - $"There {(unresolved == 1 ? "is" : "are")} still outstanding {unresolved} issue{(unresolved == 1 ? "" : "s")}." + $"There {(unresolved == 1 ? "is" : "are")} still outstanding {unresolved} issue{(unresolved == 1 ? "" : "s")}. See admin panel." ; } diff --git a/src/web/TagHelpers/UtcTimeTagHelper.cs b/src/web/TagHelpers/UtcTimeTagHelper.cs index f098874..2b7bfc3 100644 --- a/src/web/TagHelpers/UtcTimeTagHelper.cs +++ b/src/web/TagHelpers/UtcTimeTagHelper.cs @@ -12,6 +12,8 @@ namespace StatusMonitor.Web.TagHelpers /// public class UtcTimeTagHelper : TagHelper { + public bool ShowDate { get; set; } = false; + public DateTime Time { get; set; } [ViewContext] @@ -26,7 +28,8 @@ namespace StatusMonitor.Web.TagHelpers output.TagMode = TagMode.StartTagAndEndTag; output.Attributes.Clear(); - output.Attributes.Add("class", "utc-time"); + + output.Attributes.Add("class", ShowDate ? "utc-date" : "utc-time"); output.Content.SetHtmlContent(Time.ToString()); diff --git a/src/web/Views/Admin/Index.cshtml b/src/web/Views/Admin/Index.cshtml index bc134a6..25dc3ba 100644 --- a/src/web/Views/Admin/Index.cshtml +++ b/src/web/Views/Admin/Index.cshtml @@ -1,4 +1,7 @@ @using StatusMonitor.Shared.Models.Entities +@using Microsoft.Extensions.Configuration + +@inject IConfiguration Config @{ ViewData["Title"] = "Admin panel"; @@ -111,7 +114,10 @@

Discrepancies - View the list of resolved and unresolved dicrepancies from TODO until now + @{ + var discrepancyDataStartDate = DateTime.UtcNow - new TimeSpan(0, 0, Convert.ToInt32(Config["ServiceManager:CleanService:MaxAge"])); + } + View the list of resolved and unresolved dicrepancies from until now.

-- GitLab