diff --git a/AccessQueuePlayground/Components/Pages/Home.razor b/AccessQueuePlayground/Components/Pages/Home.razor index 813ddb8..756860b 100644 --- a/AccessQueuePlayground/Components/Pages/Home.razor +++ b/AccessQueuePlayground/Components/Pages/Home.razor @@ -6,7 +6,15 @@ @inject IAccessQueueManager Manager AccessQueue Playground - +@if (Config != null) +{ +

Config

+

+ Expiration Seconds: @Config.ExpirationSeconds, + Activity Seconds: @Config.ActivitySeconds, + Capacity Limit: @Config.CapacityLimit +

+}

@@ -73,11 +81,12 @@ @code { public AccessQueueStatus? Status; - + public AccessQueueConfig? Config; protected override void OnInitialized() { Manager.StatusUpdated += OnStatusUpdated; Status = Manager.GetStatus(); + Config = Manager.GetConfig(); } private void OnStatusUpdated() diff --git a/AccessQueuePlayground/Models/AccessQueueConfig.cs b/AccessQueuePlayground/Models/AccessQueueConfig.cs new file mode 100644 index 0000000..3bf62ef --- /dev/null +++ b/AccessQueuePlayground/Models/AccessQueueConfig.cs @@ -0,0 +1,10 @@ +namespace AccessQueuePlayground.Models +{ + public class AccessQueueConfig + { + public int ActivitySeconds { get; set; } + public int ExpirationSeconds { get; set; } + public int CapacityLimit { get; set; } + + } +} diff --git a/AccessQueuePlayground/Services/AccessQueueManager.cs b/AccessQueuePlayground/Services/AccessQueueManager.cs index 15645b1..3a2b2ea 100644 --- a/AccessQueuePlayground/Services/AccessQueueManager.cs +++ b/AccessQueuePlayground/Services/AccessQueueManager.cs @@ -2,12 +2,14 @@ using AccessQueuePlayground.Models; using AccessQueueService.Models; using AccessQueueService.Services; +using Microsoft.Extensions.Configuration; namespace AccessQueuePlayground.Services { public class AccessQueueManager : IAccessQueueManager { private readonly IAccessService _accessService; + private readonly IConfiguration _config; private ConcurrentDictionary _users; private AccessQueueStatus _status; public event Action? StatusUpdated; @@ -17,15 +19,23 @@ namespace AccessQueuePlayground.Services StatusUpdated?.Invoke(); } - public AccessQueueManager(IAccessService accessService) + public AccessQueueManager(IAccessService accessService, IConfiguration config) { _accessService = accessService; _users = new ConcurrentDictionary(); _status = new AccessQueueStatus(); + _config = config; } public AccessQueueStatus GetStatus() => _status; + public AccessQueueConfig GetConfig() => new AccessQueueConfig + { + ActivitySeconds = _config.GetValue("AccessQueue:ActivitySeconds"), + ExpirationSeconds = _config.GetValue("AccessQueue:ExpirationSeconds"), + CapacityLimit = _config.GetValue("AccessQueue:CapacityLimit") + }; + public Guid AddUser() { var id = Guid.NewGuid(); diff --git a/AccessQueuePlayground/Services/IAccessQueueManager.cs b/AccessQueuePlayground/Services/IAccessQueueManager.cs index 137e45b..5c16ff1 100644 --- a/AccessQueuePlayground/Services/IAccessQueueManager.cs +++ b/AccessQueuePlayground/Services/IAccessQueueManager.cs @@ -5,6 +5,7 @@ namespace AccessQueuePlayground.Services public interface IAccessQueueManager { public event Action? StatusUpdated; + public AccessQueueConfig GetConfig(); public Task RecalculateStatus(); public AccessQueueStatus GetStatus(); public Guid AddUser();