|
2 | 2 | @inject IUnitOfWork Uow
|
3 | 3 |
|
4 | 4 | @{
|
5 |
| - ViewData["Title"] = "گزارش رخدادهای سیستم"; |
| 5 | + ViewData[index: "Title"] = "گزارش رخدادهای سیستم"; |
6 | 6 | }
|
7 | 7 |
|
8 | 8 | @functions
|
9 | 9 | {
|
10 |
| - public string GetClassFromLogLevel(string logLevel) |
| 10 | + private static string GetClassFromLogLevel(string logLevel) |
11 | 11 | {
|
12 | 12 | switch (logLevel)
|
13 | 13 | {
|
|
24 | 24 | }
|
25 | 25 | }
|
26 | 26 |
|
27 |
| - public string GetButtonClass(string logLevel, string buttonLogLevel) |
| 27 | + public static string GetButtonClass(string logLevel, string buttonLogLevel) |
28 | 28 | {
|
29 | 29 | switch (logLevel)
|
30 | 30 | {
|
|
34 | 34 | {
|
35 | 35 | return "btn btn-danger";
|
36 | 36 | }
|
| 37 | + |
37 | 38 | return "btn btn-secondary";
|
38 | 39 |
|
39 | 40 | case "Warning":
|
40 | 41 | if (buttonLogLevel == logLevel)
|
41 | 42 | {
|
42 | 43 | return "btn btn-warning";
|
43 | 44 | }
|
| 45 | + |
44 | 46 | return "btn btn-secondary";
|
45 | 47 |
|
46 |
| - case "Information": |
47 |
| - case "": |
48 | 48 | default:
|
49 | 49 | if (buttonLogLevel == logLevel)
|
50 | 50 | {
|
51 | 51 | return "btn btn-info";
|
52 | 52 | }
|
| 53 | + |
53 | 54 | return "btn btn-secondary";
|
54 | 55 | }
|
55 | 56 | }
|
56 | 57 | }
|
57 | 58 |
|
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> |
59 | 60 |
|
60 | 61 |
|
61 | 62 | @if (Model.AppLogItems.Any())
|
62 | 63 | {
|
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> |
72 | 80 | </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> |
90 | 92 | </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"> |
101 | 110 | @Uow.GetShadowPropertyValue(item, AuditableShadowProperties.CreatedByIp)
|
102 | 111 | </span>
|
103 |
| - </div> |
104 |
| - </form> |
105 |
| - </footer> |
106 |
| - </div> |
107 |
| - } |
| 112 | + </div> |
| 113 | + </form> |
| 114 | + </footer> |
| 115 | + </div> |
| 116 | + } |
108 | 117 | </div>
|
109 | 118 |
|
110 | 119 | <div class="row mt-4 justify-content-center">
|
|
126 | 135 | cs-pager-link-current-class="page-link"
|
127 | 136 | cs-pager-link-other-class="page-link"></cs-pager>
|
128 | 137 | </div>
|
| 138 | + |
129 | 139 | <div class="row justify-content-center">
|
130 | 140 | <form role="form" class="form-inline" asp-controller="SystemLog" asp-action="LogDeleteAll">
|
131 | 141 | <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"/> |
134 | 144 | </form>
|
135 | 145 | <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"/> |
138 | 148 | <select class="form-control ml-1" name="days" id="days">
|
139 | 149 | <option>1</option>
|
140 | 150 | <option>5</option>
|
|
0 commit comments