Skip to content

Commit ed684f1

Browse files
committed
Add UI project.
1 parent 95fadb1 commit ed684f1

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Serilog.Ui.Core;
3+
using Serilog.Ui.Web.ViewModel;
4+
using System.Threading.Tasks;
5+
6+
namespace Serilog.Ui.Web.Controllers
7+
{
8+
public class LogsController : Controller
9+
{
10+
private readonly IDataProvider _dataProvider;
11+
12+
public LogsController(IDataProvider dataProvider)
13+
{
14+
_dataProvider = dataProvider;
15+
}
16+
17+
public async Task<IActionResult> Index(int page = 1, int count = 20)
18+
{
19+
var (logs, logCount) = await _dataProvider.FetchDataAsync(page, count);
20+
var viewModel = new LogViewModel
21+
{
22+
LogCount = logCount,
23+
Logs = logs
24+
};
25+
26+
return View(viewModel);
27+
}
28+
}
29+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
using Serilog.Ui.Core;
3+
using System;
4+
5+
namespace Serilog.Ui.Web.Extensions
6+
{
7+
public static class ServiceCollectionExtensions
8+
{
9+
public static IServiceCollection AddSerilogUi(this IServiceCollection services, Action<DataProviderOptionBuilder> optionsBuilder)
10+
{
11+
if (services == null)
12+
throw new ArgumentNullException(nameof(services));
13+
14+
if (optionsBuilder == null)
15+
throw new ArgumentNullException(nameof(optionsBuilder));
16+
17+
var builder = new DataProviderOptionBuilder(services);
18+
optionsBuilder.Invoke(builder);
19+
20+
return services;
21+
}
22+
}
23+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:56039/",
7+
"sslPort": 44329
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"Serilog.Ui.Web": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"environmentVariables": {
22+
"ASPNETCORE_ENVIRONMENT": "Development"
23+
},
24+
"applicationUrl": "https://localhost:5001;http://localhost:5000"
25+
}
26+
}
27+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
9+
</ItemGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\Serilog.Ui.Core\Serilog.Ui.Core.csproj" />
13+
</ItemGroup>
14+
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Serilog.Ui.Core;
2+
using System.Collections.Generic;
3+
4+
namespace Serilog.Ui.Web.ViewModel
5+
{
6+
public class LogViewModel
7+
{
8+
public int LogCount { get; set; }
9+
10+
public IEnumerable<LogModel> Logs { get; set; }
11+
}
12+
}

0 commit comments

Comments
 (0)