diff --git a/UserService.DatabaseLayer/Repository/Repository.cs b/UserService.DatabaseLayer/Repository/Repository.cs index 346cea0..fbde753 100644 --- a/UserService.DatabaseLayer/Repository/Repository.cs +++ b/UserService.DatabaseLayer/Repository/Repository.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Linq.Expressions; using System.Runtime.CompilerServices; using System.Threading; @@ -33,15 +32,8 @@ namespace UserService.DatabaseLayer.Repository public class NodesRepository : INodesRepository { - private readonly IUsersRepository _users; - private readonly ISecurityGroupsRepository _securityGroups; - private readonly IOrganizationUnitsRepository _organizationUnits; - - public NodesRepository(IUsersRepository users, ISecurityGroupsRepository securityGroups, IOrganizationUnitsRepository organizationUnits) + public NodesRepository() { - _users = users; - _securityGroups = securityGroups; - _organizationUnits = organizationUnits; } public static async IAsyncEnumerable GetNodesAsync([EnumeratorCancellation] CancellationToken token = default) diff --git a/UserService.Test/Startup.DevExpress.cs b/UserService.Test/Startup.DevExpress.cs new file mode 100644 index 0000000..dc1ede5 --- /dev/null +++ b/UserService.Test/Startup.DevExpress.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// Generated by the DevExpress.Blazor package. +// To prevent this operation, add the DxExtendStartupHost property to the project and set this property to False. +// +// UserService.Test.csproj: +// +// +// +// netcoreapp3.1 +// False +// +//------------------------------------------------------------------------------ +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Hosting; + +[assembly: HostingStartup(typeof(UserService.Test.DevExpressHostingStartup))] + +namespace UserService.Test { + public partial class DevExpressHostingStartup : IHostingStartup { + void IHostingStartup.Configure(IWebHostBuilder builder) { + builder.ConfigureServices((serviceCollection) => { + serviceCollection.AddDevExpressBlazor(); + }); + } + } +} diff --git a/UserService.db b/UserService.db index e7d1466..d2cb7d3 100644 Binary files a/UserService.db and b/UserService.db differ diff --git a/UserService/Pages/Counter.razor b/UserService/Pages/Counter.razor index 974a852..e90f305 100644 --- a/UserService/Pages/Counter.razor +++ b/UserService/Pages/Counter.razor @@ -1,6 +1,7 @@ @page "/counter" @using UserService.DatabaseLayer.DataModels @using UserService.DatabaseLayer.Repository +@using System.Collections @inject IOrganizationUnitsRepository OuRepository

Tree

@@ -13,18 +14,52 @@ } else { - - @foreach (var unit in _organizationUnits) - { - - } - + + + + + + + + + + + } @code { private IReadOnlyList _organizationUnits; + private OrganizationUnit _selectedOu; protected override async Task OnInitializedAsync() { - _organizationUnits = await OuRepository.GetAllAsync().ConfigureAwait(false); + _organizationUnits = (await OuRepository.GetAllAsync().ConfigureAwait(false)).Where(x=> x.Parent is null).ToList(); } + + private void OnSelectionChanged(TreeViewNodeEventArgs args) + { + _selectedOu = args.NodeInfo.DataItem as OrganizationUnit; + } + + private IEnumerable GetNodeChildren(object dataItem) + { + if (dataItem is OrganizationUnit organizationUnit) + { + foreach (var organizationUnitChild in organizationUnit.Children) + { + yield return organizationUnitChild; + } + } + } + } \ No newline at end of file diff --git a/UserService/Pages/_Host.cshtml b/UserService/Pages/_Host.cshtml index daa62cf..69260ac 100644 --- a/UserService/Pages/_Host.cshtml +++ b/UserService/Pages/_Host.cshtml @@ -8,31 +8,34 @@ - - + + UserService - - - + + + - + + - - - + + + -
- - An error has occurred. This application may no longer respond until reloaded. - - - An unhandled exception has occurred. See browser dev tools for details. - - Reload - 🗙 -
- - +
+ + An error has occurred. This application may no longer respond until reloaded. + + + An unhandled exception has occurred. See browser dev tools for details. + + Reload + 🗙 +
+ + + + - + \ No newline at end of file diff --git a/UserService/Program.cs b/UserService/Program.cs index 7038d68..c911c91 100644 --- a/UserService/Program.cs +++ b/UserService/Program.cs @@ -1,13 +1,5 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; namespace UserService { diff --git a/UserService/Startup.DevExpress.cs b/UserService/Startup.DevExpress.cs new file mode 100644 index 0000000..be84994 --- /dev/null +++ b/UserService/Startup.DevExpress.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// Generated by the DevExpress.Blazor package. +// To prevent this operation, add the DxExtendStartupHost property to the project and set this property to False. +// +// UserService.csproj: +// +// +// +// netcoreapp3.1 +// False +// +//------------------------------------------------------------------------------ +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Hosting; + +[assembly: HostingStartup(typeof(UserService.DevExpressHostingStartup))] + +namespace UserService { + public partial class DevExpressHostingStartup : IHostingStartup { + void IHostingStartup.Configure(IWebHostBuilder builder) { + builder.ConfigureServices((serviceCollection) => { + serviceCollection.AddDevExpressBlazor(); + }); + } + } +} diff --git a/UserService/UserService.csproj b/UserService/UserService.csproj index 5633dec..6788a02 100644 --- a/UserService/UserService.csproj +++ b/UserService/UserService.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -6,6 +6,7 @@ + diff --git a/UserService/_Imports.razor b/UserService/_Imports.razor index 2e8ba2a..1fcb4a1 100644 --- a/UserService/_Imports.razor +++ b/UserService/_Imports.razor @@ -7,4 +7,5 @@ @using Microsoft.JSInterop @using UserService @using UserService.Shared -@using MatBlazor \ No newline at end of file +@using MatBlazor +@using DevExpress.Blazor \ No newline at end of file