+
+
+ @if (loading)
+ {
+
+
+ Loading mailbox configuration…
+
+ }
+ else if (!loaded)
+ {
+
+ @loadError
+ Retry
+
+ }
+ else
+ {
+
+
+
+
+ Mailbox connection
+ Connection details used to read incoming mail.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Provider credentials
+ These identify the mail provider; Tenant ID is not a RatelDesk organization selection.
+
+
+
+
+
+ @if (model.HasClientSecret)
+ {
+ A client secret is configured. Leave this field blank to keep it.
+ }
+ else
+ {
+ No client secret is configured.
+ }
+
+
+
+
+
+
+
+ Ingestion
+ Mailbox availability and background processing are saved independently.
+
+
+
+
+
+
+
+
+ @if (!model.Enabled)
+ {
+ This mailbox is disabled. No email will be ingested until it is enabled and saved.
+ }
+ else if (!model.BackgroundSyncEnabled)
+ {
+ Background ingestion is disabled. The saved mailbox will not process mail.
+ }
+
+
+
+
+ @if (testResult is not null)
+ {
+
+ @testResult.Message
+
+ }
+
+
+ Discard changes
+
+ @if (testing)
+ {
+
+ }
+ Test Connection
+
+
+ @if (saving)
+ {
+
+ }
+ Save
+
+
+
+ }
+
+
+@code {
+ private readonly CancellationTokenSource disposeCts = new();
+ private MudForm form = default!;
+ private EmailInboxSettingsForm model = new();
+ private EmailInboxSettingsForm? savedBaseline;
+ private ConnectionTestResult? testResult;
+ private bool loading = true;
+ private bool loaded;
+ private bool saving;
+ private bool testing;
+ private bool isDirty;
+ private bool disposed;
+ private string loadError = "Mailbox settings could not be loaded.";
+
+ private HttpClient HelpdeskApi => HttpClientFactory.CreateClient("HelpdeskApi");
+ private bool mutationsDisabled => loading || !loaded || saving || testing;
+
+ protected override Task OnInitializedAsync() => LoadAsync();
+
+ private async Task LoadAsync()
+ {
+ if (loading && loaded)
+ {
+ return;
+ }
+
+ loading = true;
+ loaded = false;
+ testResult = null;
+ try
+ {
+ var settings = await HelpdeskApi.GetFromJsonAsync