@using LANCommander.Server.Parsers @using LANCommander.Server.Settings.Enums @using LANCommander.Server.Settings.Models
@if (Provider.Type == LoggingProviderType.File) { } @if (Provider.Type == LoggingProviderType.Seq || Provider.Type == LoggingProviderType.ElasticSearch) { }
@code { [Parameter] public LoggingProvider Provider { get; set; } [Parameter] public EventCallback ProviderChanged { get; set; } string _rootPath = Path.GetPathRoot(Directory.GetCurrentDirectory()) ?? string.Empty; public async Task OnChanged(FieldChangedEventArgs args) { await InvokeAsync(StateHasChanged); if (ProviderChanged.HasDelegate) await ProviderChanged.InvokeAsync(Provider); } void ProviderTypeChanged(LoggingProviderType type) { switch (type) { case LoggingProviderType.Seq: Provider.ConnectionString = SeqOptions.DefaultConnectionString; break; } StateHasChanged(); } void OnPathSelected(string path) { var appPath = Directory.GetCurrentDirectory(); if (path != null && path.StartsWith(appPath)) path = path.Substring(appPath.Length).TrimStart(Path.DirectorySeparatorChar).TrimEnd(Path.DirectorySeparatorChar); Provider.ConnectionString = path; StateHasChanged(); } }