Skip to content

Commit bf8cff7

Browse files
committed
updates for 8.5
1 parent 5c84597 commit bf8cff7

30 files changed

+984
-73
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Build
22

33
env:
4-
BUILD_VERSION: "8.0.${{github.run_number}}${{github.ref != 'refs/heads/master' && '-beta' || ''}}"
5-
BUILD_INFORMATION: "8.0.${{github.run_number}}${{github.ref != 'refs/heads/master' && '-beta' || ''}}+Branch.${{github.ref_name}}.Sha.${{github.sha}}"
4+
BUILD_VERSION: "8.5.${{github.run_number}}${{github.ref != 'refs/heads/master' && '-beta' || ''}}"
5+
BUILD_INFORMATION: "8.5.${{github.run_number}}${{github.ref != 'refs/heads/master' && '-beta' || ''}}+Branch.${{github.ref_name}}.Sha.${{github.sha}}"
66

77
on:
88
push:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,4 @@ FakesAssemblies/
185185

186186
.vscode/
187187

188+
*.txt

CHANGES.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
8.5.0
2+
* Add option for partition key rounding
3+
* Move IKeyGenertor from options
4+
* Add DateTime extension methods for partition key and row key
5+
* Add sample web project
6+
17
8.0.0
28
* Breaking: major refactor to simplify code base
39
* Removed: AzureTableStorageWithProperties extension removed, use equivalent AzureTableStorage
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Azure;
2+
using Azure.Data.Tables;
3+
4+
namespace SampleWebApplication.Models;
5+
6+
public class LogEventModel : ITableEntity
7+
{
8+
public string PartitionKey { get; set; } = string.Empty;
9+
10+
public string RowKey { get; set; } = string.Empty;
11+
12+
public DateTimeOffset? Timestamp { get; set; }
13+
14+
public ETag ETag { get; set; }
15+
16+
public string Level { get; set; } = string.Empty;
17+
18+
public string? MessageTemplate { get; set; }
19+
20+
public string RenderedMessage { get; set; } = string.Empty;
21+
22+
public string? Exception { get; set; }
23+
24+
public string? Data { get; set; }
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@page
2+
@model ErrorModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
26+
</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Diagnostics;
2+
3+
using Microsoft.AspNetCore.Mvc;
4+
using Microsoft.AspNetCore.Mvc.RazorPages;
5+
6+
namespace SampleWebApplication.Pages;
7+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8+
[IgnoreAntiforgeryToken]
9+
public class ErrorModel : PageModel
10+
{
11+
public string? RequestId { get; set; }
12+
13+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
14+
15+
private readonly ILogger<ErrorModel> _logger;
16+
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
21+
22+
public void OnGet()
23+
{
24+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
25+
}
26+
}
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@page
2+
@model IndexModel
3+
@{
4+
ViewData["Title"] = "Home page";
5+
}
6+
7+
<div class="text-center">
8+
<h1 class="display-4">Welcome</h1>
9+
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
10+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
4+
namespace SampleWebApplication.Pages;
5+
public class IndexModel : PageModel
6+
{
7+
private readonly ILogger<IndexModel> _logger;
8+
9+
public IndexModel(ILogger<IndexModel> logger)
10+
{
11+
_logger = logger;
12+
}
13+
14+
public void OnGet()
15+
{
16+
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
@page
2+
@model SampleWebApplication.Pages.LogsModel
3+
@{
4+
ViewData["Title"] = "Logs";
5+
}
6+
7+
<form id="log-search-form"
8+
name="log-search-form"
9+
role="form"
10+
method="get">
11+
12+
<div class="card mb-5">
13+
<div class="card-header">
14+
<div class="row no-gutters">
15+
<div class="col">
16+
<i class="fa-solid fa-file-lines mr-2"></i> Logs
17+
</div>
18+
<div class="col-sm-2">
19+
<select class="form-select form-select-sm"
20+
name="l"
21+
asp-for="Level"
22+
onchange="this.form.submit()">
23+
<option value="">- Level -</option>
24+
<option value="Trace">Trace</option>
25+
<option value="Debug">Debug</option>
26+
<option value="Information">Information</option>
27+
<option value="Warning">Warning</option>
28+
<option value="Error">Error</option>
29+
<option value="Critical">Critical</option>
30+
</select>
31+
</div>
32+
<div class="col-sm-3">
33+
<div class="input-group input-group-sm mr-2">
34+
<div class="input-group-prepend">
35+
<button class="btn btn-sm btn-outline-secondary"
36+
type="button"
37+
title="Previous Date"
38+
onclick="previousDate()">
39+
<i class="fa-solid fa-chevron-left"></i>
40+
</button>
41+
</div>
42+
<input type="date"
43+
name="d"
44+
asp-for="Date"
45+
class="form-control form-control-sm"
46+
placeholder="Date" />
47+
<div class="input-group-append">
48+
<button class="btn btn-sm btn-outline-secondary"
49+
type="button"
50+
title="Next Date"
51+
onclick="nextDate()">
52+
<i class="fa-solid fa-chevron-right"></i>
53+
</button>
54+
<button class="btn btn-sm btn-outline-secondary"
55+
type="submit">
56+
<i class="fa-solid fa-magnifying-glass"></i>
57+
</button>
58+
</div>
59+
</div>
60+
</div>
61+
</div>
62+
</div>
63+
64+
<div class="card-body p-0">
65+
<table class="table table-bordered table-sm">
66+
<colgroup>
67+
<col style="width: 30px" />
68+
<col style="width: 30px" />
69+
<col style="width: 200px" />
70+
<col style="width: 120px" />
71+
<col style="" />
72+
</colgroup>
73+
<thead>
74+
<tr>
75+
<th scope="col"></th>
76+
<th scope="col"></th>
77+
<th scope="col">Date</th>
78+
<th scope="col">Level</th>
79+
<th scope="col">Message</th>
80+
</tr>
81+
</thead>
82+
<tbody>
83+
@foreach (var log in Model.Logs)
84+
{
85+
<tr>
86+
<td style="text-align: center;">
87+
<a class="caret-toggle d-block collapsed"
88+
data-bs-toggle="collapse"
89+
90+
role="button"
91+
aria-expanded="false"
92+
aria-controls="[email protected]">
93+
<i class="fa-solid fa-caret-down text-body"></i>
94+
</a>
95+
</td>
96+
<td style="text-align: center;">
97+
@switch (log.Level)
98+
{
99+
case "Warning":
100+
<i class="fa-solid fa-triangle-exclamation text-warning"></i>
101+
break;
102+
case "Error":
103+
case "Critical":
104+
<i class="fa-solid fa-circle-xmark text-danger"></i>
105+
break;
106+
case "Information":
107+
<i class="fa-solid fa-circle-info text-primary"></i>
108+
break;
109+
default:
110+
<i class="fa-solid fa-circle-info text-secondary"></i>
111+
break;
112+
}
113+
</td>
114+
<td>@log.Timestamp?.ToString("g")</td>
115+
<td>@log.Level</td>
116+
<td>@log.RenderedMessage</td>
117+
</tr>
118+
<tr class="collapse" id="[email protected]" style="background-color: #f9f9f9;">
119+
<td colspan="5">
120+
<div class="tab-container">
121+
<ul class="nav nav-tabs" id="[email protected]" role="tablist">
122+
<li class="nav-item" role="presentation">
123+
<a class="nav-link active"
124+
125+
126+
data-toggle="tab"
127+
aria-controls="[email protected]"
128+
aria-selected="true"
129+
role="tab">Properties</a>
130+
</li>
131+
@if (!string.IsNullOrWhiteSpace(log.Exception))
132+
{
133+
<li class="nav-item" role="presentation">
134+
<a class="nav-link"
135+
136+
137+
data-toggle="tab"
138+
aria-controls="[email protected]"
139+
role="tab">Exception</a>
140+
</li>
141+
}
142+
</ul>
143+
<div class="tab-content" id="myTabContent">
144+
<div class="tab-pane fade show active"
145+
146+
aria-labelledby="[email protected]"
147+
role="tabpanel">
148+
<json-display>@log.Data</json-display>
149+
</div>
150+
@if (!string.IsNullOrWhiteSpace(log.Exception))
151+
{
152+
<div class="tab-pane fade"
153+
154+
aria-labelledby="[email protected]"
155+
role="tabpanel">
156+
<pre style="overflow: auto; max-height: 400px; font-family: Courier New">@log.Exception</pre>
157+
</div>
158+
}
159+
</div>
160+
</div>
161+
</td>
162+
</tr>
163+
}
164+
</tbody>
165+
</table>
166+
</div>
167+
168+
<div class="card-footer p-0">
169+
170+
<div class="row">
171+
<div class="col-md-6"></div>
172+
<div class="col-md-6">
173+
<nav aria-label="Log Pagination">
174+
<ul class="justify-content-md-end m-3 pagination">
175+
@if (!string.IsNullOrWhiteSpace(Model.ContinuationToken))
176+
{
177+
<li class="page-item">
178+
<a class="page-link"
179+
asp-page="/Logs"
180+
asp-route-z="@Model.PageSize"
181+
asp-route-l="@Model.Level"
182+
asp-route-d="@Model.Date.Date"
183+
asp-route-t="">First</a>
184+
</li>
185+
}
186+
else
187+
{
188+
<li class="page-item disabled">
189+
<span class="page-link">First</span>
190+
</li>
191+
}
192+
@if (!string.IsNullOrWhiteSpace(Model.NextToken))
193+
{
194+
<li class="page-item">
195+
<a class="page-link"
196+
asp-page="/Logs"
197+
asp-route-z="@Model.PageSize"
198+
asp-route-l="@Model.Level"
199+
asp-route-d="@Model.Date.Date"
200+
asp-route-t="@Model.NextToken">Next</a>
201+
</li>
202+
}
203+
else
204+
{
205+
<li class="page-item disabled">
206+
<span class="page-link">Next</span>
207+
</li>
208+
}
209+
</ul>
210+
</nav>
211+
</div>
212+
</div>
213+
</div>
214+
</div>
215+
</form>
216+
217+
@section Scripts {
218+
<script>
219+
function previousDate() {
220+
$('#@Html.IdFor(p => p.Date)').val('@Model.Date.AddDays(-1).ToString("yyyy-MM-dd")');
221+
$('#log-search-form').submit();
222+
}
223+
function nextDate() {
224+
$('#@Html.IdFor(p => p.Date)').val('@Model.Date.AddDays(1).ToString("yyyy-MM-dd")');
225+
$('#log-search-form').submit();
226+
}
227+
</script>
228+
}

0 commit comments

Comments
 (0)