Explain disabled mail connection tests
This commit is contained in:
@@ -223,6 +223,10 @@ instead of reproducing their behavior.
|
|||||||
- `help` content is contextual guidance, not the accessible name. The persisted
|
- `help` content is contextual guidance, not the accessible name. The persisted
|
||||||
`show_inline_help_hints` user preference hides only the `InlineHelp` marker by
|
`show_inline_help_hints` user preference hides only the `InlineHelp` marker by
|
||||||
applying `ui-hide-help-hints` at the document root.
|
applying `ui-hide-help-hints` at the document root.
|
||||||
|
- Shared action-bearing components accept an optional disabled reason. In
|
||||||
|
particular, `MailServerSettingsPanel` forwards protocol-specific test
|
||||||
|
blockers into the shared focusable disabled-action tooltip; modules provide
|
||||||
|
the domain-specific required field, permission, or in-progress reason.
|
||||||
- A dirty editor registers once with `useUnsavedDraftGuard`. An explicit
|
- A dirty editor registers once with `useUnsavedDraftGuard`. An explicit
|
||||||
Discard button calls `useUnsavedChanges().requestDiscard(afterResolve)`; SPA
|
Discard button calls `useUnsavedChanges().requestDiscard(afterResolve)`; SPA
|
||||||
navigation uses `useGuardedNavigate` or `requestNavigation`. Both paths show
|
navigation uses `useGuardedNavigate` or `requestNavigation`. Both paths show
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState, type ReactNode } from "react";
|
||||||
import Button from "../Button";
|
import Button from "../Button";
|
||||||
import { CredentialFields } from "../CredentialPanel";
|
import { CredentialFields } from "../CredentialPanel";
|
||||||
import DismissibleAlert from "../DismissibleAlert";
|
import DismissibleAlert from "../DismissibleAlert";
|
||||||
@@ -64,11 +64,13 @@ export type MailServerSettingsPanelProps = {
|
|||||||
smtpPasswordSaved?: boolean;
|
smtpPasswordSaved?: boolean;
|
||||||
smtpSavedPasswordPlaceholder?: string;
|
smtpSavedPasswordPlaceholder?: string;
|
||||||
smtpActionDisabled?: boolean;
|
smtpActionDisabled?: boolean;
|
||||||
|
smtpActionDisabledReason?: ReactNode;
|
||||||
imapServerDisabled?: boolean;
|
imapServerDisabled?: boolean;
|
||||||
imapCredentialDisabled?: boolean;
|
imapCredentialDisabled?: boolean;
|
||||||
imapPasswordSaved?: boolean;
|
imapPasswordSaved?: boolean;
|
||||||
imapSavedPasswordPlaceholder?: string;
|
imapSavedPasswordPlaceholder?: string;
|
||||||
imapActionDisabled?: boolean;
|
imapActionDisabled?: boolean;
|
||||||
|
imapActionDisabledReason?: ReactNode;
|
||||||
smtpTestLabel?: string;
|
smtpTestLabel?: string;
|
||||||
imapTestLabel?: string;
|
imapTestLabel?: string;
|
||||||
busyAction?: "smtp" | "imap" | "folders" | string | null;
|
busyAction?: "smtp" | "imap" | "folders" | string | null;
|
||||||
@@ -209,11 +211,13 @@ export default function MailServerSettingsPanel({
|
|||||||
smtpPasswordSaved = false,
|
smtpPasswordSaved = false,
|
||||||
smtpSavedPasswordPlaceholder = "••••••••",
|
smtpSavedPasswordPlaceholder = "••••••••",
|
||||||
smtpActionDisabled = smtpDisabled,
|
smtpActionDisabled = smtpDisabled,
|
||||||
|
smtpActionDisabledReason,
|
||||||
imapServerDisabled = false,
|
imapServerDisabled = false,
|
||||||
imapCredentialDisabled = imapServerDisabled,
|
imapCredentialDisabled = imapServerDisabled,
|
||||||
imapPasswordSaved = false,
|
imapPasswordSaved = false,
|
||||||
imapSavedPasswordPlaceholder = "••••••••",
|
imapSavedPasswordPlaceholder = "••••••••",
|
||||||
imapActionDisabled = imapServerDisabled,
|
imapActionDisabled = imapServerDisabled,
|
||||||
|
imapActionDisabledReason,
|
||||||
smtpTestLabel = "i18n:govoplan-core.test_smtp.e5697981",
|
smtpTestLabel = "i18n:govoplan-core.test_smtp.e5697981",
|
||||||
imapTestLabel = "i18n:govoplan-core.test_imap.ef1bd79c",
|
imapTestLabel = "i18n:govoplan-core.test_imap.ef1bd79c",
|
||||||
busyAction = null,
|
busyAction = null,
|
||||||
@@ -323,7 +327,7 @@ export default function MailServerSettingsPanel({
|
|||||||
</div>
|
</div>
|
||||||
{onTestSmtp &&
|
{onTestSmtp &&
|
||||||
<div className="button-row compact-actions mail-server-actions">
|
<div className="button-row compact-actions mail-server-actions">
|
||||||
<Button type="button" variant="primary" onClick={onTestSmtp} disabled={smtpActionsDisabled || busyAction === "smtp"}>{busyAction === "smtp" ? "i18n:govoplan-core.testing.15ccc832" : smtpTestLabel}</Button>
|
<Button type="button" variant="primary" onClick={onTestSmtp} disabled={smtpActionsDisabled || busyAction === "smtp"} disabledReason={busyAction === "smtp" ? "SMTP connection testing is already running." : smtpActionsDisabled ? smtpActionDisabledReason : undefined}>{busyAction === "smtp" ? "i18n:govoplan-core.testing.15ccc832" : smtpTestLabel}</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<MailServerActionResult result={smtpTestResult} floating={floatingResults} />
|
<MailServerActionResult result={smtpTestResult} floating={floatingResults} />
|
||||||
@@ -352,7 +356,7 @@ export default function MailServerSettingsPanel({
|
|||||||
</div>
|
</div>
|
||||||
{onTestImap &&
|
{onTestImap &&
|
||||||
<div className="button-row compact-actions mail-server-actions">
|
<div className="button-row compact-actions mail-server-actions">
|
||||||
<Button type="button" variant="primary" onClick={onTestImap} disabled={imapActionsDisabled || busyAction === "imap"}>{busyAction === "imap" ? "i18n:govoplan-core.testing.15ccc832" : imapTestLabel}</Button>
|
<Button type="button" variant="primary" onClick={onTestImap} disabled={imapActionsDisabled || busyAction === "imap"} disabledReason={busyAction === "imap" ? "IMAP connection testing is already running." : imapActionsDisabled ? imapActionDisabledReason : undefined}>{busyAction === "imap" ? "i18n:govoplan-core.testing.15ccc832" : imapTestLabel}</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<MailServerActionResult result={imapTestResult} floating={floatingResults} />
|
<MailServerActionResult result={imapTestResult} floating={floatingResults} />
|
||||||
|
|||||||
@@ -108,6 +108,20 @@ assert(!settingsPanel.includes("i18n:govoplan-core.advanced.4d064726"), "advance
|
|||||||
assert(!settingsPanel.includes("Enable IMAP"), "legacy IMAP enable toggle is not rendered");
|
assert(!settingsPanel.includes("Enable IMAP"), "legacy IMAP enable toggle is not rendered");
|
||||||
assert(settingsPanel.includes('placeholder="Saved SMTP password"'), "SMTP saved credential placeholder is rendered");
|
assert(settingsPanel.includes('placeholder="Saved SMTP password"'), "SMTP saved credential placeholder is rendered");
|
||||||
|
|
||||||
|
const disabledSettingsPanel = renderToStaticMarkup(
|
||||||
|
<MailServerSettingsPanel
|
||||||
|
smtp={{ host: "", port: 587, security: "starttls", timeout_seconds: 30 }}
|
||||||
|
imap={{ host: "", port: 993, security: "tls", sent_folder: "auto", timeout_seconds: 30 }}
|
||||||
|
onSmtpChange={noop}
|
||||||
|
onImapChange={noop}
|
||||||
|
onTestSmtp={noop}
|
||||||
|
smtpActionDisabled
|
||||||
|
smtpActionDisabledReason="Enter an SMTP server hostname before testing the connection."
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
assert(disabledSettingsPanel.includes("disabled-action-tooltip"), "disabled SMTP test reason uses the shared focusable tooltip");
|
||||||
|
assert(disabledSettingsPanel.includes('tabindex="0"'), "disabled SMTP test reason is keyboard focusable");
|
||||||
|
|
||||||
const imapSettingsPanel = renderToStaticMarkup(
|
const imapSettingsPanel = renderToStaticMarkup(
|
||||||
<MailServerSettingsPanel
|
<MailServerSettingsPanel
|
||||||
initialSection="imap"
|
initialSection="imap"
|
||||||
|
|||||||
Reference in New Issue
Block a user