Skip to content

Commit 582d917

Browse files
authored
Merge pull request #121 from Lan2Play/feature/SystemInfoView
implement system info view
2 parents 793bfe8 + 068c0d5 commit 582d917

47 files changed

Lines changed: 855 additions & 262 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NetEvent/Client/Pages/Administration/AdminMenu.razor

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@
1616
<MudDivider />
1717
</Authorized>
1818
</AuthorizeView>
19+
<MudDivider />
20+
<AuthorizeView Policy="Admin.SystemInfo.*">
21+
<Authorized>
22+
<MudButton Variant="Variant.Text" DisableElevation="true" Color="Color.Default" Href="administration/systeminfo" Match="NavLinkMatch.Prefix">@Localize["Administration.AdminMenu.SystemInfo"]</MudButton>
23+
<MudDivider />
24+
</Authorized>
25+
</AuthorizeView>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
@page "/administration/systeminfo"
2+
@attribute [Authorize(Policy = "Admin.SystemInfo.*")]
3+
4+
@using Microsoft.AspNetCore.Authorization
5+
@using Microsoft.AspNetCore.Identity
6+
@using NetEvent.Client.Components
7+
@using NetEvent.Shared.Dto
8+
@using NetEvent.Shared.Dto.Administration
9+
@using NetEvent.Shared.Policy
10+
11+
@inject Microsoft.Extensions.Localization.IStringLocalizer<App> Localize
12+
13+
<MudTabs Elevation="1" Rounded="true">
14+
<MudTabPanel Text="@Localize["Administration.Systeminfo.Health"]">
15+
<MudTable Items="@_SystemInfos.Health" Dense="true" Hover="true" Bordered="false" Striped="true" Filter="new Func<SystemInfoHealthEntryDto,bool>(FilterFuncHealth1)">
16+
<ToolBarContent>
17+
<MudSpacer />
18+
<MudTextField @bind-Value="searchStringHealth" Placeholder="@Localize["Administration.Systeminfo.Health.SearchPlaceholder"]" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
19+
</ToolBarContent>
20+
<HeaderContent>
21+
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<SystemInfoHealthEntryDto, object>(x=>x.Component)">@Localize["Administration.Systeminfo.Health.Component"]</MudTableSortLabel></MudTh>
22+
<MudTh><MudTableSortLabel SortBy="new Func<SystemInfoHealthEntryDto, object>(x=>x.Value)">@Localize["Administration.Systeminfo.Health.Value"]</MudTableSortLabel></MudTh>
23+
<MudTh><MudTableSortLabel SortBy="new Func<SystemInfoHealthEntryDto, object>(x=>x.Healthy)">@Localize["Administration.Systeminfo.Health.Healthy"]</MudTableSortLabel></MudTh>
24+
</HeaderContent>
25+
<RowTemplate>
26+
<MudTd DataLabel="Component">@context.Component</MudTd>
27+
<MudTd DataLabel="Value">@context.Value</MudTd>
28+
<MudTd DataLabel="Healthy">
29+
@if (context.Healthy)
30+
{
31+
<MudIcon Icon="@Icons.Filled.CheckCircle" Color="Color.Success" />
32+
}
33+
else
34+
{
35+
<MudIcon Icon="@Icons.Filled.Error" Color="Color.Error" />
36+
}
37+
</MudTd>
38+
</RowTemplate>
39+
</MudTable>
40+
</MudTabPanel>
41+
<MudTabPanel Text="@Localize["Administration.Systeminfo.Versions"]">
42+
<MudTable Items="@_SystemInfos.Versions" Dense="true" Hover="true" Bordered="false" Striped="true" Filter="new Func<SystemInfoVersionEntryDto,bool>(FilterFuncVersions1)">
43+
<ToolBarContent>
44+
<MudSpacer />
45+
<MudTextField @bind-Value="searchStringVersions" Placeholder="@Localize["Administration.Systeminfo.Versions.SearchPlaceholder"]" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
46+
</ToolBarContent>
47+
<HeaderContent>
48+
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<SystemInfoVersionEntryDto, object>(x=>x.Component)">@Localize["Administration.Systeminfo.Versions.Component"]</MudTableSortLabel></MudTh>
49+
<MudTh><MudTableSortLabel SortBy="new Func<SystemInfoVersionEntryDto, object>(x=>x.Version)">@Localize["Administration.Systeminfo.Versions.Version"]</MudTableSortLabel></MudTh>
50+
</HeaderContent>
51+
<RowTemplate>
52+
<MudTd DataLabel="Component">@context.Component</MudTd>
53+
<MudTd DataLabel="Version">@context.Version</MudTd>
54+
</RowTemplate>
55+
</MudTable>
56+
</MudTabPanel>
57+
<MudTabPanel Text="@Localize["Administration.Systeminfo.Components"]">
58+
<MudTable Items="@_SystemInfos.Components" Dense="true" Hover="true" Bordered="false" Striped="true" Filter="new Func<SystemInfoComponentEntryDto,bool>(FilterFuncComponents1)">
59+
<ToolBarContent>
60+
<MudSpacer />
61+
<MudTextField @bind-Value="searchStringComponents" Placeholder="@Localize["Administration.Systeminfo.Components.SearchPlaceholder"]" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
62+
</ToolBarContent>
63+
<HeaderContent>
64+
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<SystemInfoComponentEntryDto, object>(x=>x.Component)">@Localize["Administration.Systeminfo.Components.Component"]</MudTableSortLabel></MudTh>
65+
<MudTh><MudTableSortLabel SortBy="new Func<SystemInfoComponentEntryDto, object>(x=>x.Version)">@Localize["Administration.Systeminfo.Components.Version"]</MudTableSortLabel></MudTh>
66+
</HeaderContent>
67+
<RowTemplate>
68+
<MudTd DataLabel="Component">@context.Component</MudTd>
69+
<MudTd DataLabel="Version">@context.Version</MudTd>
70+
</RowTemplate>
71+
</MudTable>
72+
</MudTabPanel>
73+
<MudTabPanel Text="@Localize["Administration.Systeminfo.ClientComponents"]">
74+
<MudTable Items="@_ClientComponents" Dense="true" Hover="true" Bordered="false" Striped="true" Filter="new Func<SystemInfoComponentEntryDto,bool>(FilterFuncComponents1)">
75+
<ToolBarContent>
76+
<MudSpacer />
77+
<MudTextField @bind-Value="searchStringClientComponents" Placeholder="@Localize["Administration.Systeminfo.ClientComponents.SearchPlaceholder"]" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
78+
</ToolBarContent>
79+
<HeaderContent>
80+
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<SystemInfoComponentEntryDto, object>(x=>x.Component)">@Localize["Administration.Systeminfo.ClientComponents.Component"]</MudTableSortLabel></MudTh>
81+
<MudTh><MudTableSortLabel SortBy="new Func<SystemInfoComponentEntryDto, object>(x=>x.Version)">@Localize["Administration.Systeminfo.ClientComponents.Version"]</MudTableSortLabel></MudTh>
82+
</HeaderContent>
83+
<RowTemplate>
84+
<MudTd DataLabel="Component">@context.Component</MudTd>
85+
<MudTd DataLabel="Version">@context.Version</MudTd>
86+
</RowTemplate>
87+
</MudTable>
88+
</MudTabPanel>
89+
</MudTabs>
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Reflection;
4+
using System.Threading;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Components;
7+
using NetEvent.Client.Services;
8+
using NetEvent.Shared.Dto;
9+
10+
namespace NetEvent.Client.Pages.Administration
11+
{
12+
public partial class SystemInfo
13+
{
14+
#region Injects
15+
16+
[Inject]
17+
private ISystemInfoDataService _SystemInfoDataService { get; set; } = default!;
18+
19+
#endregion
20+
private readonly IList<SystemInfoComponentEntryDto> _ClientComponents = new List<SystemInfoComponentEntryDto>();
21+
private SystemInfoDto _SystemInfos = new SystemInfoDto();
22+
private string searchStringComponents = string.Empty;
23+
private string searchStringClientComponents = string.Empty;
24+
private string searchStringVersions = string.Empty;
25+
private string searchStringHealth = string.Empty;
26+
27+
protected override async Task OnInitializedAsync()
28+
{
29+
var cts = new CancellationTokenSource();
30+
_SystemInfos = await _SystemInfoDataService.GetSystemInfoDataAsync(cts.Token);
31+
32+
AppDomain currentDomain = AppDomain.CurrentDomain;
33+
Assembly[] assems = currentDomain.GetAssemblies();
34+
foreach (Assembly assem in assems)
35+
{
36+
_ClientComponents.Add(new SystemInfoComponentEntryDto(assem.ManifestModule.Name.ToString(), assem.ToString()));
37+
}
38+
}
39+
40+
private bool FilterFuncComponents1(SystemInfoComponentEntryDto systeminfocomponententry) => FilterFuncComponents(systeminfocomponententry, searchStringComponents);
41+
42+
private static bool FilterFuncComponents(SystemInfoComponentEntryDto systeminfocomponententry, string searchString)
43+
{
44+
if (string.IsNullOrWhiteSpace(searchString))
45+
{
46+
return true;
47+
}
48+
49+
if (systeminfocomponententry.Component.Contains(searchString, StringComparison.OrdinalIgnoreCase))
50+
{
51+
return true;
52+
}
53+
54+
if (systeminfocomponententry.Version.Contains(searchString, StringComparison.OrdinalIgnoreCase))
55+
{
56+
return true;
57+
}
58+
59+
return false;
60+
}
61+
62+
private bool FilterFuncVersions1(SystemInfoVersionEntryDto systeminfoversionentry) => FilterFuncVersions(systeminfoversionentry, searchStringVersions);
63+
64+
private static bool FilterFuncVersions(SystemInfoVersionEntryDto systeminfoversionentry, string searchString)
65+
{
66+
if (string.IsNullOrWhiteSpace(searchString))
67+
{
68+
return true;
69+
}
70+
71+
if (systeminfoversionentry.Component.Contains(searchString, StringComparison.OrdinalIgnoreCase))
72+
{
73+
return true;
74+
}
75+
76+
if (!string.IsNullOrEmpty(systeminfoversionentry.Version) && systeminfoversionentry.Version.Contains(searchString, StringComparison.OrdinalIgnoreCase))
77+
{
78+
return true;
79+
}
80+
81+
return false;
82+
}
83+
84+
private bool FilterFuncHealth1(SystemInfoHealthEntryDto systeminfohealthentry) => FilterFuncHealth(systeminfohealthentry, searchStringHealth);
85+
86+
private static bool FilterFuncHealth(SystemInfoHealthEntryDto systeminfohealthentry, string searchString)
87+
{
88+
if (string.IsNullOrWhiteSpace(searchString))
89+
{
90+
return true;
91+
}
92+
93+
if (systeminfohealthentry.Component.Contains(searchString, StringComparison.OrdinalIgnoreCase))
94+
{
95+
return true;
96+
}
97+
98+
if (systeminfohealthentry.Value.Contains(searchString, StringComparison.OrdinalIgnoreCase))
99+
{
100+
return true;
101+
}
102+
103+
return false;
104+
}
105+
}
106+
}

NetEvent/Client/Pages/Register.razor.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
32
using Microsoft.AspNetCore.Components;
43
using Microsoft.Extensions.Localization;
54
using MudBlazor;

NetEvent/Client/Program.cs

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,56 @@
1-
using System;
2-
using Microsoft.AspNetCore.Components.Authorization;
3-
using Microsoft.AspNetCore.Components.Web;
4-
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
5-
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
6-
using Microsoft.Extensions.DependencyInjection;
7-
using MudBlazor;
8-
using MudBlazor.Services;
9-
using NetEvent.Client;
10-
using NetEvent.Client.Extensions;
11-
using NetEvent.Client.Services;
12-
using NetEvent.Shared.Policy;
13-
14-
var builder = WebAssemblyHostBuilder.CreateDefault(args);
15-
16-
builder.RootComponents.Add<App>("#app");
17-
builder.RootComponents.Add<HeadOutlet>("head::after");
18-
19-
builder.Services.AddOptions();
20-
builder.Services.AddAuthorizationCore(config => config.AddPolicies());
21-
builder.Services.AddScoped<NetEventAuthenticationStateProvider>();
22-
builder.Services.AddScoped<AuthenticationStateProvider>(s => s.GetRequiredService<NetEventAuthenticationStateProvider>());
23-
builder.Services.AddScoped<IAuthService, AuthService>();
24-
25-
builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
26-
builder.Services.AddScoped<ISystemSettingsDataService, SystemSettingsService>();
27-
builder.Services.AddScoped<IUserService, UserService>();
28-
builder.Services.AddScoped<IThemeService, ThemeService>();
29-
builder.Services.AddScoped<IRoleService, RoleService>();
30-
31-
builder.Services.AddHttpClient(Constants.BackendApiHttpClientName)
32-
.ConfigureHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress));
33-
34-
builder.Services.AddHttpClient(Constants.BackendApiSecuredHttpClientName)
35-
.ConfigureHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
36-
.AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>();
37-
38-
builder.Services.AddMudServices(config =>
39-
{
40-
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomCenter;
41-
42-
config.SnackbarConfiguration.PreventDuplicates = false;
43-
config.SnackbarConfiguration.MaxDisplayedSnackbars = 5;
44-
config.SnackbarConfiguration.NewestOnTop = false;
45-
config.SnackbarConfiguration.ShowCloseIcon = true;
46-
config.SnackbarConfiguration.VisibleStateDuration = 10000;
47-
config.SnackbarConfiguration.HideTransitionDuration = 400;
48-
config.SnackbarConfiguration.ShowTransitionDuration = 400;
49-
config.SnackbarConfiguration.SnackbarVariant = Variant.Filled;
50-
});
51-
52-
var app = builder.Build();
53-
await app.SetDefaultCultureAsync();
54-
55-
await app.RunAsync();
1+
using System;
2+
using Microsoft.AspNetCore.Components.Authorization;
3+
using Microsoft.AspNetCore.Components.Web;
4+
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
5+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
6+
using Microsoft.Extensions.DependencyInjection;
7+
using MudBlazor;
8+
using MudBlazor.Services;
9+
using NetEvent.Client;
10+
using NetEvent.Client.Extensions;
11+
using NetEvent.Client.Services;
12+
using NetEvent.Shared.Policy;
13+
14+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
15+
16+
builder.RootComponents.Add<App>("#app");
17+
builder.RootComponents.Add<HeadOutlet>("head::after");
18+
19+
builder.Services.AddOptions();
20+
builder.Services.AddAuthorizationCore(config => config.AddPolicies());
21+
builder.Services.AddScoped<NetEventAuthenticationStateProvider>();
22+
builder.Services.AddScoped<AuthenticationStateProvider>(s => s.GetRequiredService<NetEventAuthenticationStateProvider>());
23+
builder.Services.AddScoped<IAuthService, AuthService>();
24+
25+
builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
26+
builder.Services.AddScoped<ISystemSettingsDataService, SystemSettingsService>();
27+
builder.Services.AddScoped<ISystemInfoDataService, SystemInfoDataService>();
28+
builder.Services.AddScoped<IUserService, UserService>();
29+
builder.Services.AddScoped<IThemeService, ThemeService>();
30+
builder.Services.AddScoped<IRoleService, RoleService>();
31+
32+
builder.Services.AddHttpClient(Constants.BackendApiHttpClientName)
33+
.ConfigureHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress));
34+
35+
builder.Services.AddHttpClient(Constants.BackendApiSecuredHttpClientName)
36+
.ConfigureHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
37+
.AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>();
38+
39+
builder.Services.AddMudServices(config =>
40+
{
41+
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomCenter;
42+
43+
config.SnackbarConfiguration.PreventDuplicates = false;
44+
config.SnackbarConfiguration.MaxDisplayedSnackbars = 5;
45+
config.SnackbarConfiguration.NewestOnTop = false;
46+
config.SnackbarConfiguration.ShowCloseIcon = true;
47+
config.SnackbarConfiguration.VisibleStateDuration = 10000;
48+
config.SnackbarConfiguration.HideTransitionDuration = 400;
49+
config.SnackbarConfiguration.ShowTransitionDuration = 400;
50+
config.SnackbarConfiguration.SnackbarVariant = Variant.Filled;
51+
});
52+
53+
var app = builder.Build();
54+
await app.SetDefaultCultureAsync();
55+
56+
await app.RunAsync();

NetEvent/Client/Resources/App.resx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,4 +357,58 @@
357357
<data name="SystemSetting.OrganizationData.DataCultureInfo.Hint" xml:space="preserve">
358358
<value>Systemwide language. Changing forces page reload.</value>
359359
</data>
360+
<data name="Administration.AdminMenu.SystemInfo" xml:space="preserve">
361+
<value>System Info</value>
362+
</data>
363+
<data name="Administration.Systeminfo.Components" xml:space="preserve">
364+
<value>Components</value>
365+
</data>
366+
<data name="Administration.Systeminfo.Components.Component" xml:space="preserve">
367+
<value>Component</value>
368+
</data>
369+
<data name="Administration.Systeminfo.Components.SearchPlaceholder" xml:space="preserve">
370+
<value>Search component</value>
371+
</data>
372+
<data name="Administration.Systeminfo.Components.Version" xml:space="preserve">
373+
<value>Version</value>
374+
</data>
375+
<data name="Administration.Systeminfo.Health" xml:space="preserve">
376+
<value>Health</value>
377+
</data>
378+
<data name="Administration.Systeminfo.Versions" xml:space="preserve">
379+
<value>Versions</value>
380+
</data>
381+
<data name="Administration.Systeminfo.Versions.Component" xml:space="preserve">
382+
<value>Component</value>
383+
</data>
384+
<data name="Administration.Systeminfo.Versions.Version" xml:space="preserve">
385+
<value>Version</value>
386+
</data>
387+
<data name="Administration.Systeminfo.ClientComponents" xml:space="preserve">
388+
<value>Client components</value>
389+
</data>
390+
<data name="Administration.Systeminfo.ClientComponents.Component" xml:space="preserve">
391+
<value>Component</value>
392+
</data>
393+
<data name="Administration.Systeminfo.ClientComponents.SearchPlaceholder" xml:space="preserve">
394+
<value>Search client component</value>
395+
</data>
396+
<data name="Administration.Systeminfo.ClientComponents.Version" xml:space="preserve">
397+
<value>Version</value>
398+
</data>
399+
<data name="Administration.Systeminfo.Versions.SearchPlaceholder" xml:space="preserve">
400+
<value>Search version</value>
401+
</data>
402+
<data name="Administration.Systeminfo.Health.Component" xml:space="preserve">
403+
<value>Component</value>
404+
</data>
405+
<data name="Administration.Systeminfo.Health.Healthy" xml:space="preserve">
406+
<value>Healthy</value>
407+
</data>
408+
<data name="Administration.Systeminfo.Health.SearchPlaceholder" xml:space="preserve">
409+
<value>Search health</value>
410+
</data>
411+
<data name="Administration.Systeminfo.Health.Value" xml:space="preserve">
412+
<value>Value</value>
413+
</data>
360414
</root>

NetEvent/Client/Services/IRoleService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Collections.Generic;
22
using System.Threading;
33
using System.Threading.Tasks;
4-
using Microsoft.AspNetCore.Identity;
54
using NetEvent.Shared.Dto;
65

76
namespace NetEvent.Client.Services

0 commit comments

Comments
 (0)