Skip to content

Commit 4512342

Browse files
committed
Submit form on log count select option change.
1 parent 6a6010b commit 4512342

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

src/Serilog.Ui.Web/Views/Logs/Index.cshtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<form method="get" asp-action="Index">
2020
<div class="row">
2121
<div class="col-sm-12 col-md-6">
22-
<div class="table-select">
22+
<div class="table-select" id="logCount">
2323
<label>
2424
Show
2525
<select asp-items="@Model.CountSelectListItems" name="count" class="form-control form-control-sm">
@@ -35,7 +35,7 @@
3535
</div>
3636
</div>
3737

38-
<table class="table" id="log-table">
38+
<table class="table" id="logTable">
3939
<thead class="thead-dark">
4040
<tr>
4141
<th scope="col">#</th>
@@ -68,7 +68,7 @@
6868

6969
<tr>
7070
<th scope="row">@log.Id</th>
71-
<td class="text-center"><span style="padding: 5px;" class="@levelClass text-white">@log.Level</span></td>
71+
<td class="text-center"><span class="log-level text-white @levelClass">@log.Level</span></td>
7272
<td class="text-center">@log.Timestamp</td>
7373
<td>
7474
<span class="overflow-auto"> @log.Message</span>

src/Serilog.Ui.Web/Views/Logs/_Paging.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
if (Model.Page == i)
3333
{
3434
<li class="page-item active">
35-
<span class="page-link disabled">
35+
<span data-val="@i" class="page-link disabled">
3636
@i
3737
<span class="sr-only">(current)</span>
3838
</span>

src/Serilog.Ui.Web/wwwroot/css/main.css

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,18 @@ a[data-toggle="collapse"] {
280280
border-color: #3e64ff !important;
281281
}
282282

283-
#log-table tbody tr:nth-of-type(odd) {
283+
#logTable tbody tr:nth-of-type(odd) {
284284
background-color: rgba(0,0,0,.05);
285285
}
286286

287-
#log-table tbody tr:last-child {
288-
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.1);
287+
#logTable tbody tr:last-child {
288+
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
289+
}
290+
291+
#logTable .log-level {
292+
display: inline-block;
293+
padding: 5px;
294+
width: 92px;
289295
}
290296

291297
.table .thead-dark th {

src/Serilog.Ui.Web/wwwroot/js/main.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22
"use strict";
33

44
var fullHeight = function () {
5-
$('.js-fullheight').css('height', $(window).height());
5+
$(".js-fullheight").css("height", $(window).height());
66
$(window).resize(function () {
7-
$('.js-fullheight').css('height', $(window).height());
7+
$(".js-fullheight").css("height", $(window).height());
88
});
99
};
1010
fullHeight();
1111

12-
$('#sidebarCollapse').on('click', function () {
13-
$('#sidebar').toggleClass('active');
12+
$("#sidebarCollapse").on("click", function () {
13+
$("#sidebar").toggleClass("active");
1414
});
1515

16-
$('.page-link').on('click', function (e) {
16+
$(".page-link").on("click", function (e) {
1717
e.preventDefault();
18-
$('#page').val($(this).attr("data-val"));
19-
$('form').submit()
18+
$("#page").val($(this).attr("data-val"));
19+
$("form").submit()
2020
});
21+
22+
$("#logCount").on("change", function () {
23+
$("#page").val($(".page-link.disabled").attr("data-val"));
24+
$("form").submit()
25+
})
2126
})(jQuery);

0 commit comments

Comments
 (0)