fix(webui): stop empty states re-deriving their own titles
A title that states the fact does not need a description that derives it: the log, panels, lifecycle lists, dashboard cards, stages, skills and captures empty states now say the fact once, and keep only the descriptions that carry an action, a cause, or a distinct reading.
This commit is contained in:
43 files changed
+239
-315
No files matched your search
@@ -42,6 +42,13 @@ async function errorMessage(res: Response): Promise<string> {
|
||||
return `${res.status} ${res.statusText}`;
|
||||
}
|
||||
|
||||
let authenticationStateHandler: ((required: boolean) => void) | undefined;
|
||||
|
||||
/** Let the app shell own authentication state without coupling requests to UI. */
|
||||
export function setAuthenticationStateHandler(handler: (required: boolean) => void): void {
|
||||
authenticationStateHandler = handler;
|
||||
}
|
||||
|
||||
export class ApiError extends Error {
|
||||
status: number;
|
||||
|
||||
@@ -77,6 +84,7 @@ export function classifyActionError(err: unknown): { kind: ActionErrorKind; mess
|
||||
// itself.
|
||||
async function send(path: string, init: RequestInit): Promise<Response> {
|
||||
const res = await fetch(path, init);
|
||||
authenticationStateHandler?.(res.status === 401);
|
||||
if (!res.ok) throw new ApiError(await errorMessage(res), res.status);
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user