Core DevPre-alpha
SWC notifications
Workspace toasts are rendered by NotificationService (core/swc/src/services/notification.ts). They appear in the top-right stack (#sum-toast-stack), follow Sumeru sum-toast-* CSS, and need no extra library.
Use env.services.notification from any SWC component. Do not POST to removed /web/record/save routes for save feedback.
API
const n = this.env.services.notification;
n.show({ kind: "info", title: "Queued", body: "Export started." });
n.success("Saved", "Record saved successfully.");
n.error("Save failed", err.message);
n.warning(result.warning.title, result.warning.message, result.warning.details);
| Method | Kind class |
|---|---|
show({ kind, title, body, details? }, timeoutMs?) | sum-toast--${kind} (info if omitted) |
success(title, body, details?) | success |
error(title, body, details?) | error |
warning(title, body, details?) | warning |
bootstrap(messages?) | Replays window.__SWC_BOOTSTRAP__.toasts |
kind values in CSS: success, info, warning, error. Markup uses .sum-toast-title, .sum-toast-body, optional .sum-toast-details, and .sum-toast-close.
Behaviour
- Stack is
position: fixedtop-right witharia-live="polite". - Auto-dismiss after 6 seconds (override with
timeoutMsonshow). Hover pauses the timer. - Close (
×) or timeout playssum-toast-out, then the node is removed. - At most 5 live toasts; the oldest dismisses first.
CRUD vs validation
| Path | Feedback |
|---|---|
| Form save / delete / duplicate | Success toast; RPC/network → error toast |
Form required-field check (SwcError code validation) | Inline .sum-flash — not a toast |
| Object buttons (header/footer) | Success toast, unless the RPC result is {close}, {open}, or {redirect} |
| List bulk delete | Success or error toast; button disabled while in flight |
| List header object buttons (selection ≥ 2) | Same as form object buttons; call may pass active_ids |
| Kanban quick-create | Success toast; create/move RPC errors toast |
Onchange warnings call notification.warning. Server flash toasts still work via bootstrap toasts (legacy HTML workspace ?msg= is separate — see HTTP routes).
What not to do
- Do not document or rely on a separate
toast.jsscript; SWC owns the stack. - Do not toast client validation — keep required-field errors on the form.
- Mail/SMTP user notifications are a different stack and are not this API.