Commit 67e8e3cb authored by Dmytro Bogatov's avatar Dmytro Bogatov 💕

Add links from health reports and discrepancies.

parent 2f438b6f
Pipeline #597 passed with stages
in 6 minutes and 13 seconds
......@@ -207,7 +207,10 @@ export class HealthMetricPage extends MetricPage<Metric<HealthDataPoint>> {
<h4 class="modal-title">
Health report details | Health ${e.detail.health}% | ${timestamp}
<small>
Inspect metric labels at the moment report was generated
Inspect metric labels at the moment report was generated.
<a href="/home/metric/${this.metric.metricType}/${this.metric.source}/${new Date(timestamp.getTime() - 2 * 60 * 1000).getTime()}/${new Date(timestamp.getTime() + 2 * 60 * 1000).getTime()}">
View data at that moment.
</a>
</small>
</h4>
</div>
......@@ -267,10 +270,10 @@ export class HealthMetricPage extends MetricPage<Metric<HealthDataPoint>> {
$(`#modal-details-${timestamp.getTime()}`).modal();
$(`#modal-details-${timestamp.getTime()}`).on(
"hidden.bs.modal",
"hidden.bs.modal",
() => $(".health-details-modal").remove()
);
},
false);
......
......@@ -22,5 +22,9 @@ namespace StatusMonitor.Shared.Extensions
? value.ToString()
: TimeZoneInfo.ConvertTime(value, TimeZoneInfo.FindSystemTimeZoneById(timeZoneId)).ToString();
}
public static long TotalMilliseconds(this DateTime value) =>
Convert.ToInt64((value - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds);
}
}
......@@ -75,7 +75,7 @@ namespace StatusMonitor.Web.Controllers.View
TempData["MessageSeverity"] = "info";
TempData["MessageContent"] = $"You have logged in.";
if (string.IsNullOrEmpty(Request.Query["returnurl"]))
{
return RedirectToAction("Index", "Home");
......
@using StatusMonitor.Shared.Extensions
<div
class="list-group-item media discrepancy-card discrepancy-@(Model.Resolved ? "resolved" : "unresolved")"
data-number="@ViewBag.Number"
......@@ -39,11 +41,20 @@
<div class="media-body">
<div class="lgi-heading">
Discrepancy of type <strong>@Model.Type</strong> from
@{
var start = Convert.ToInt64((Model.DateFirstOffense.AddMinutes(-2) - new DateTime(1970, 1, 1)).TotalMilliseconds);
var end =
Model.Resolved ?
Convert.ToInt64((Model.DateResolved.AddMinutes(2) - new DateTime(1970, 1, 1)).TotalMilliseconds) :
Convert.ToInt64((Model.DateFirstOffense.AddMinutes(15) - new DateTime(1970, 1, 1)).TotalMilliseconds);
}
<a
asp-controller="Home"
asp-action="Metric"
asp-route-type="@Model.MetricType"
asp-route-source="@Model.MetricSource"
asp-route-start="@start"
asp-route-end="@end"
>
<em>@Model.MetricType</em> of <em>@Model.MetricSource</em>
</a>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment