Skip to content

Commit 8fd8746

Browse files
committed
Minor fixes
1 parent 9ee8a9e commit 8fd8746

File tree

3 files changed

+65
-55
lines changed

3 files changed

+65
-55
lines changed

.editorconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[*.{cs,csx,vb,vbx,razor,html,htm,js,md,cshtml,xaml,vbhtml,aspx,txt,asax,ashx,asmx,master,config}]
33
charset = utf-8-bom
44

5-
[*.cs]
5+
[*.{cs,cshtml}]
66

77
roslynator_accessibility_modifiers = explicit
88
roslynator_enum_has_flag_style = operator
@@ -143,7 +143,7 @@ dotnet_diagnostic.S2971.severity = suggestion
143143
dotnet_diagnostic.S1135.severity = suggestion
144144

145145
# S2479: Replace the control character at position 7 by its escape sequence
146-
dotnet_diagnostic.S2479.severity = suggestion
146+
dotnet_diagnostic.S2479.severity = none
147147

148148
# CA2007: Consider calling ConfigureAwait on the awaited task
149149
dotnet_diagnostic.CA2007.severity = none

Directory.Build.props

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
CA1054: Change the type of parameter of the method to allow a Uri to be passed as a 'System.Uri' object
2020
CA1055: Change the return type of method from 'string' to 'System.Uri'
2121
-->
22-
<NoWarn>$(NoWarn);CA2007;CA1056;CA1054;CA1055;MA0004;RCS1090</NoWarn>
23-
<NoError>$(NoError);CA2007;CA1056;CA1054;CA1055;MA0004;RCS1090</NoError>
22+
<NoWarn>$(NoWarn);CA2007;CA1056;CA1054;CA1055;MA0004;RCS1090;S2479</NoWarn>
23+
<NoError>$(NoError);CA2007;CA1056;CA1054;CA1055;MA0004;RCS1090;S2479</NoError>
2424
<Deterministic>true</Deterministic>
2525
<Features>strict</Features>
2626
<ReportAnalyzer>true</ReportAnalyzer>

src/ASPNETCoreIdentitySample/Areas/Identity/Views/SystemLog/Index.cshtml

+61-51
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
@inject IUnitOfWork Uow
33

44
@{
5-
ViewData["Title"] = "گزارش رخ‌دادهای سیستم";
5+
ViewData[index: "Title"] = "گزارش رخ‌دادهای سیستم";
66
}
77

88
@functions
99
{
10-
public string GetClassFromLogLevel(string logLevel)
10+
private static string GetClassFromLogLevel(string logLevel)
1111
{
1212
switch (logLevel)
1313
{
@@ -24,7 +24,7 @@
2424
}
2525
}
2626

27-
public string GetButtonClass(string logLevel, string buttonLogLevel)
27+
public static string GetButtonClass(string logLevel, string buttonLogLevel)
2828
{
2929
switch (logLevel)
3030
{
@@ -34,77 +34,86 @@
3434
{
3535
return "btn btn-danger";
3636
}
37+
3738
return "btn btn-secondary";
3839

3940
case "Warning":
4041
if (buttonLogLevel == logLevel)
4142
{
4243
return "btn btn-warning";
4344
}
45+
4446
return "btn btn-secondary";
4547

46-
case "Information":
47-
case "":
4848
default:
4949
if (buttonLogLevel == logLevel)
5050
{
5151
return "btn btn-info";
5252
}
53+
5354
return "btn btn-secondary";
5455
}
5556
}
5657
}
5758

58-
<h2>@ViewData["Title"] <span class="label label-info">@Model.Paging.TotalItems.ToPersianNumbers()</span></h2>
59+
<h2>@ViewData[index: "Title"] <span class="label label-info">@Model.Paging.TotalItems.ToPersianNumbers()</span></h2>
5960

6061

6162
@if (Model.AppLogItems.Any())
6263
{
63-
<div class="row justify-content-center">
64-
<div class="mt-4 justify-content-center">
65-
<a class="@GetButtonClass(Model.LogLevel, "Critical")" role="button" asp-controller="SystemLog" asp-action="Index" asp-route-logLevel="Critical">Critical</a>
66-
<a class="@GetButtonClass(Model.LogLevel, "Error")" role="button" asp-controller="SystemLog" asp-action="Index" asp-route-logLevel="Error">Error</a>
67-
<a class="@GetButtonClass(Model.LogLevel, "Warning")" role="button" asp-controller="SystemLog" asp-action="Index" asp-route-logLevel="Warning">Warning</a>
68-
<a class="@GetButtonClass(Model.LogLevel, "Information")" role="button" asp-controller="SystemLog" asp-action="Index" asp-route-logLevel="Information">Information</a>
69-
<a class="@GetButtonClass(Model.LogLevel, "Debug")" role="button" asp-controller="SystemLog" asp-action="Index" asp-route-logLevel="Debug">Debug</a>
70-
<a class="@GetButtonClass(Model.LogLevel, "Trace")" role="button" asp-controller="SystemLog" asp-action="Index" asp-route-logLevel="Trace">Trace</a>
71-
<a class="@GetButtonClass(Model.LogLevel, "")" role="button" asp-controller="SystemLog" asp-action="Index">All</a>
64+
<div class="row justify-content-center">
65+
<div class="mt-4 justify-content-center">
66+
<a class="@GetButtonClass(Model.LogLevel, buttonLogLevel: "Critical")" role="button" asp-controller="SystemLog"
67+
asp-action="Index" asp-route-logLevel="Critical">Critical</a>
68+
<a class="@GetButtonClass(Model.LogLevel, buttonLogLevel: "Error")" role="button" asp-controller="SystemLog"
69+
asp-action="Index" asp-route-logLevel="Error">Error</a>
70+
<a class="@GetButtonClass(Model.LogLevel, buttonLogLevel: "Warning")" role="button" asp-controller="SystemLog"
71+
asp-action="Index" asp-route-logLevel="Warning">Warning</a>
72+
<a class="@GetButtonClass(Model.LogLevel, buttonLogLevel: "Information")" role="button" asp-controller="SystemLog"
73+
asp-action="Index" asp-route-logLevel="Information">Information</a>
74+
<a class="@GetButtonClass(Model.LogLevel, buttonLogLevel: "Debug")" role="button" asp-controller="SystemLog"
75+
asp-action="Index" asp-route-logLevel="Debug">Debug</a>
76+
<a class="@GetButtonClass(Model.LogLevel, buttonLogLevel: "Trace")" role="button" asp-controller="SystemLog"
77+
asp-action="Index" asp-route-logLevel="Trace">Trace</a>
78+
<a class="@GetButtonClass(Model.LogLevel, buttonLogLevel: "")" role="button" asp-controller="SystemLog" asp-action="Index">All</a>
79+
</div>
7280
</div>
73-
</div>
74-
<div class="row">
75-
@foreach (var item in Model.AppLogItems)
76-
{
77-
var userId = Uow.GetShadowPropertyValue(item, AuditableShadowProperties.CreatedByUserId);
78-
<div dir="ltr" class="card mt-5 text-left">
79-
<div class="card-header @GetClassFromLogLevel(item.LogLevel)">
80-
<h5 class="card-title" dir="ltr">
81-
@item.LogLevel [@item.Logger]
82-
</h5>
83-
</div>
84-
<div class="card-body" dir="ltr">
85-
<div>URL: @item.Url</div>
86-
<div>
87-
<a asp-controller="UserCard" asp-action="Index" asp-route-id="@userId">
88-
User @userId
89-
</a>
81+
82+
<div class="row">
83+
@foreach (var item in Model.AppLogItems)
84+
{
85+
var userId = Uow.GetShadowPropertyValue(item, AuditableShadowProperties.CreatedByUserId);
86+
87+
<div dir="ltr" class="card mt-5 text-left">
88+
<div class="card-header @GetClassFromLogLevel(item.LogLevel)">
89+
<h5 class="card-title" dir="ltr">
90+
@item.LogLevel [@item.Logger]
91+
</h5>
9092
</div>
91-
<pre>@item.Message</pre>
92-
<pre>@item.StateJson</pre>
93-
</div>
94-
<footer class="card-footer" dir="ltr">
95-
<form role="form" class="form-inline" asp-controller="SystemLog" asp-action="LogItemDelete">
96-
<input type="hidden" id="id" name="id" value="@item.Id" />
97-
<input type="submit" value='حذف' class="btn btn-sm btn-danger text-right" />
98-
<div class="mr-2">
99-
<span>@item.CreatedDateTime.ToShortPersianDateTimeString()</span>
100-
<span class="text-right">
93+
<div class="card-body" dir="ltr">
94+
<div>URL: @item.Url</div>
95+
<div>
96+
<a asp-controller="UserCard" asp-action="Index" asp-route-id="@userId">
97+
User @userId
98+
</a>
99+
</div>
100+
<pre>@item.Message</pre>
101+
<pre>@item.StateJson</pre>
102+
</div>
103+
<footer class="card-footer" dir="ltr">
104+
<form role="form" class="form-inline" asp-controller="SystemLog" asp-action="LogItemDelete">
105+
<input type="hidden" id="id" name="id" value="@item.Id"/>
106+
<input type="submit" value='حذف' class="btn btn-sm btn-danger text-right"/>
107+
<div class="mr-2">
108+
<span>@item.CreatedDateTime.ToShortPersianDateTimeString()</span>
109+
<span class="text-right">
101110
@Uow.GetShadowPropertyValue(item, AuditableShadowProperties.CreatedByIp)
102111
</span>
103-
</div>
104-
</form>
105-
</footer>
106-
</div>
107-
}
112+
</div>
113+
</form>
114+
</footer>
115+
</div>
116+
}
108117
</div>
109118

110119
<div class="row mt-4 justify-content-center">
@@ -126,15 +135,16 @@
126135
cs-pager-link-current-class="page-link"
127136
cs-pager-link-other-class="page-link"></cs-pager>
128137
</div>
138+
129139
<div class="row justify-content-center">
130140
<form role="form" class="form-inline" asp-controller="SystemLog" asp-action="LogDeleteAll">
131141
<a asp-action="Index" class="btn btn-sm btn-secondary">به روز رسانی</a>
132-
<input type="hidden" asp-for="@Model.LogLevel" />
133-
<input type="submit" value='حذف تمام رکوردهای لاگ' class="btn btn-sm btn-danger ml-3" />
142+
<input type="hidden" asp-for="@Model.LogLevel"/>
143+
<input type="submit" value='حذف تمام رکوردهای لاگ' class="btn btn-sm btn-danger ml-3"/>
134144
</form>
135145
<form role="form" class="form-inline ml-3" asp-controller="SystemLog" asp-action="LogDeleteOlderThan">
136-
<input type="hidden" asp-for="@Model.LogLevel" />
137-
<input type="submit" value='حذف رکوردهای قدیمی‌تر از' class="btn btn-sm btn-danger" />
146+
<input type="hidden" asp-for="@Model.LogLevel"/>
147+
<input type="submit" value='حذف رکوردهای قدیمی‌تر از' class="btn btn-sm btn-danger"/>
138148
<select class="form-control ml-1" name="days" id="days">
139149
<option>1</option>
140150
<option>5</option>

0 commit comments

Comments
 (0)