Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

feat(webv2): rebuild the diagnostics widget on platform logging

Josh Corbett2b83ef74f9cc
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.json
index 9b079c35a7..1f3d858163 100644
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@ -3978,6 +3978,55 @@
"removeReference": "Remove reference",
"staleReferences": "References are set but the selected model cannot use them.",
"uploadVideoReference": "Upload video or audio"
+ },
+ "diagnostics": {
+ "chipClean": "Clean",
+ "chipLabel": "Diagnostics: {{label}}",
+ "chipProblems_one": "{{count}} problem",
+ "chipProblems_other": "{{count}} problems",
+ "clearFilters": "Clear filters",
+ "clearScope": "Clear: {{scope}}",
+ "consoleOn": "Console on",
+ "copied_one": "Copied {{count}} event as JSON",
+ "copied_other": "Copied {{count}} events as JSON",
+ "copyEntry": "Copy event JSON",
+ "copyFailed": "Could not copy events to the clipboard.",
+ "copyFiltered": "Copy JSON ({{count}})",
+ "details": "Details",
+ "detailsLabel": "Event details",
+ "downloadFailed": "Could not download the events.",
+ "downloadFiltered": "Download JSON ({{count}})",
+ "downloaded_one": "Downloaded {{count}} event as JSON",
+ "downloaded_other": "Downloaded {{count}} events as JSON",
+ "emptyScope": "No events recorded in this scope yet.",
+ "entryTruncated": "Truncated",
+ "evicted_one": "{{count}} evicted",
+ "evicted_other": "{{count}} evicted",
+ "hideDetails": "Hide details",
+ "listLabel": "Diagnostic events",
+ "namespace": "Namespace",
+ "namespaceAll": "All namespaces",
+ "noMatches": "No events match the current filters.",
+ "openDeveloperSettings": "Open developer settings",
+ "page": "Page {{page}} of {{total}}",
+ "performanceNamespace": "Performance timings",
+ "recordingOff": "Recording off",
+ "recordingOffHint": "Turn on “Record diagnostic logs” in Developer settings to capture events here.",
+ "recordingStatus": "Recording {{level}}+ in {{count}} of {{total}} namespaces",
+ "retention": "{{problems}}/{{problemLimit}} problems · {{verbose}}/{{verboseLimit}} events · {{timings}}/{{timingLimit}} timings",
+ "scope": "Scope",
+ "scopes": {
+ "all": "All account events",
+ "project": "Current project",
+ "projectAndApplication": "Current project + application"
+ },
+ "search": "Search events",
+ "severity": "Minimum severity",
+ "severityAll": "All severities",
+ "severityAtLeast": "{{level}} and above",
+ "timingsOn": "Timings on",
+ "truncated_one": "{{count}} truncated",
+ "truncated_other": "{{count}} truncated"
}
},
"workflowLibrary": {
diff --git a/invokeai/frontend/webv2/src/platform/ui/JsonPreview.tsx b/invokeai/frontend/webv2/src/platform/ui/JsonPreview.tsx
index 1f4b3d4246..b1cc9b501e 100644
--- a/invokeai/frontend/webv2/src/platform/ui/JsonPreview.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/JsonPreview.tsx
@@ -8,12 +8,18 @@ import { useScrollAreaPhantomHeal } from './useScrollAreaPhantomHeal';
/** Pass text for byte-preserving copy, or value to serialize. Owns both scroll axes; maxH controls the bound. */
export const JsonPreview = ({
+ copyFailedLabel = 'Failed to copy JSON',
+ copyLabel = 'Copy JSON',
h,
label = 'JSON preview',
maxH = '24rem',
text,
value,
}: {
+ /** Localized failure toast title. */
+ copyFailedLabel?: string;
+ /** Localized accessible name for the copy control. */
+ copyLabel?: string;
h?: string;
/** Accessible name for the scroll viewport. */
label?: string;
@@ -49,8 +55,8 @@ export const JsonPreview = ({
copyResetTimerRef.current = setTimeout(() => setHasCopied(false), 1500);
})
- .catch(() => toaster.create({ title: 'Failed to copy JSON', type: 'error' }));
- }, [json]);
+ .catch(() => toaster.create({ title: copyFailedLabel, type: 'error' }));
+ }, [copyFailedLabel, json]);
return (
<Box
@@ -67,12 +73,12 @@ export const JsonPreview = ({
w="full"
>
<IconButton
- aria-label="Copy JSON"
+ aria-label={copyLabel}
bg="bg.muted"
position="absolute"
right="1.5"
size="2xs"
- title="Copy JSON"
+ title={copyLabel}
top="1.5"
variant="ghost"
zIndex="1"
diff --git a/invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.browser.test.tsx
new file mode 100644
index 0000000000..34744bf82f
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.browser.test.tsx
@@ -0,0 +1,281 @@
+import { ChakraProvider } from '@chakra-ui/react';
+import { auditAccessibility } from '@platform/browser/auditAccessibility.testing';
+import { DEFAULT_LOGGING_CONFIG, type LoggingConfig } from '@platform/logging/contracts';
+import { clearLogs, configureLogging, createLogger, getLogSnapshot, resetLogging } from '@platform/logging/logger';
+import { AppToaster } from '@platform/ui/toaster';
+import { applyThemeToRoot } from '@theme/applyTheme';
+import { DEFAULT_THEME_ID, system } from '@theme/system';
+import { createInstance } from 'i18next';
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { I18nextProvider, initReactI18next } from 'react-i18next';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { page, userEvent } from 'vitest/browser';
+
+import { DiagnosticsPanel } from './DiagnosticsPanel';
+
+const download = vi.hoisted(() => ({ downloadText: vi.fn() }));
+
+vi.mock('@platform/browser/downloadBlob', () => download);
+
+const i18n = createInstance();
+await i18n.use(initReactI18next).init({
+ fallbackNS: 'translation',
+ interpolation: { escapeValue: false },
+ lng: 'en',
+ resources: { en: { translation: await fetch('/locales/en.json').then((response) => response.json()) } },
+});
+(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+
+let root: Root | undefined;
+let host: HTMLDivElement | undefined;
+const originalClipboard = Object.getOwnPropertyDescriptor(navigator, 'clipboard');
+
+const settle = () =>
+ act(async () => {
+ await new Promise<void>((resolve) => {
+ globalThis.setTimeout(resolve, 20);
+ });
+ });
+
+const configure = (overrides: Partial<LoggingConfig> = {}) =>
+ configureLogging({ ...DEFAULT_LOGGING_CONFIG, level: 'trace', ...overrides });
+
+const render = async (projectId: string | null, width = '720px') => {
+ if (!host) {
+ host = document.createElement('div');
+ host.style.display = 'flex';
+ host.style.flexDirection = 'column';
+ host.style.height = '600px';
+ document.body.append(host);
+ root = createRoot(host);
+ }
+ host.style.width = width;
+ await act(() =>
+ root!.render(
+ <ChakraProvider value={system}>
+ <I18nextProvider i18n={i18n}>
+ <AppToaster />
+ <DiagnosticsPanel projectId={projectId} />
+ </I18nextProvider>
+ </ChakraProvider>
+ )
+ );
+ await settle();
+};
+
+const stubClipboard = (writeText: (text: string) => Promise<void>) => {
+ Object.defineProperty(navigator, 'clipboard', { configurable: true, value: { writeText } });
+};
+
+const seed = () => {
+ createLogger({ area: 'boot', namespace: 'app' }).info('Application starting');
+ createLogger({ area: 'autosave', namespace: 'persistence', projectId: 'project-a' }).error({
+ error: new Error('revision rejected'),
+ message: 'Autosave failed',
+ name: 'persistence.autosave-failed',
+ });
+ createLogger({ area: 'history', namespace: 'queue', projectId: 'project-a' }).debug('Queue item pending');
+ createLogger({ area: 'history', namespace: 'queue', projectId: 'project-b' }).warn('Other project warning');
+};
+
+const entryRows = () => [...(host?.querySelectorAll<HTMLElement>('[data-log-entry-id]') ?? [])];
+const combobox = (name: string) => page.getByRole('combobox', { name, exact: true });
+const choose = async (name: string, option: string) => {
+ await act(() => combobox(name).click());
+ await expect.element(page.getByRole('option', { name: option, exact: true })).toBeVisible();
+ await act(() => page.getByRole('option', { name: option, exact: true }).click());
+ await settle();
+};
+
+beforeEach(async () => {
+ await page.viewport(1200, 800);
+ applyThemeToRoot(DEFAULT_THEME_ID);
+ resetLogging();
+ configure();
+ download.downloadText.mockReset();
+});
+
+afterEach(async () => {
+ await act(() => root?.unmount());
+ host?.remove();
+ root = undefined;
+ host = undefined;
+ if (originalClipboard) {
+ Object.defineProperty(navigator, 'clipboard', originalClipboard);
+ }
+ resetLogging();
+});
+
+describe('DiagnosticsPanel', () => {
+ it('shows project plus application events by default and switches scope', async () => {
+ seed();
+ await render('project-a');
+
+ expect(entryRows().map((row) => row.dataset.logLevel)).toEqual(['debug', 'error', 'info']);
+ expect(host?.textContent).toContain('Recording Trace+ in 15 of 15 namespaces');
+ expect(host?.textContent).toContain('2/500 problems');
+
+ await choose('Scope', 'Current project');
+ expect(entryRows().map((row) => row.dataset.logLevel)).toEqual(['debug', 'error']);
+
+ await choose('Scope', 'All account events');
+ expect(entryRows()).toHaveLength(4);
+ expect(host?.textContent).toContain('project-b');
+
+ await expect(auditAccessibility(host!)).resolves.toEqual([]);
+ });
+
+ it('applies display-only severity, namespace and text filters without changing recording', async () => {
+ seed();
+ await render('project-a');
+
+ await choose('Minimum severity', 'Warn and above');
+ expect(entryRows().map((row) => row.dataset.logLevel)).toEqual(['error']);
+ expect(getLogSnapshot().entries).toHaveLength(4);
+
+ await choose('Minimum severity', 'All severities');
+ await choose('Namespace', 'queue');
+ expect(entryRows()).toHaveLength(1);
+ expect(host?.textContent).toContain('Queue item pending');
+
+ await act(() => page.getByRole('textbox', { name: 'Search events' }).fill('revision'));
+ await settle();
+ expect(entryRows()).toHaveLength(0);
+ expect(host?.textContent).toContain('No events match the current filters.');
+
+ await act(() => page.getByRole('button', { name: 'Clear filters' }).click());
+ await settle();
+ expect(entryRows()).toHaveLength(3);
+ });
+
+ it('pages newest-first at 100 entries and expands raw details with the keyboard', async () => {
+ const logger = createLogger({ area: 'history', namespace: 'queue', projectId: 'project-a' });
+
+ for (let index = 0; index < 150; index += 1) {
+ logger.warn(`Warning ${index}`);
+ }
+ await render('project-a');
+
+ expect(entryRows()).toHaveLength(100);
+ expect(host?.textContent).toContain('Warning 149');
+ expect(host?.textContent).not.toContain('Warning 49');
+ expect(host?.textContent).toContain('Page 1 of 2');
+
+ await act(() => page.getByRole('button', { name: 'Next page' }).click());
+ await settle();
+ expect(entryRows()).toHaveLength(50);
+ expect(host?.textContent).toContain('Page 2 of 2');
+ expect(host?.textContent).toContain('Warning 0');
+
+ const details = entryRows()[0]?.querySelector<HTMLButtonElement>('button[aria-expanded]');
+
+ details?.focus();
+ await act(() => userEvent.keyboard('{Enter}'));
+ await settle();
+ expect(entryRows()[0]?.querySelector('[data-log-entry-details]')?.textContent).toContain('"name": "history"');
+ expect(details?.getAttribute('aria-expanded')).toBe('true');
+ });
+
+ it('copies and downloads the filtered view as a versioned envelope and reports failures', async () => {
+ seed();
+ const writeText = vi.fn().mockResolvedValue(undefined);
+
+ stubClipboard(writeText);
+ await render('project-a');
+ await choose('Minimum severity', 'Warn and above');
+
+ await act(() => page.getByRole('button', { name: 'Copy JSON (1)' }).click());
+ await settle();
+ const envelope = JSON.parse(writeText.mock.calls[0]?.[0] as string) as {
+ capture: LoggingConfig;
+ entries: { message: string }[];
+ format: string;
+ scope: unknown;
+ version: number;
+ };
+
+ expect(envelope).toMatchObject({
+ capture: { level: 'trace' },
+ format: 'invokeai-webv2-logs',
+ scope: { kind: 'project-and-application', projectId: 'project-a' },
+ version: 1,
+ });
+ expect(envelope.entries.map((entry) => entry.message)).toEqual(['Autosave failed']);
+ await expect.element(page.getByText('Copied 1 event as JSON')).toBeVisible();
+
+ await act(() => page.getByRole('button', { name: 'Download JSON (1)' }).click());
+ await settle();
+ expect(download.downloadText).toHaveBeenCalledWith(
+ expect.stringContaining('"format": "invokeai-webv2-logs"'),
+ expect.stringMatching(/^invoke-logs-.*\.json$/),
+ 'application/json'
+ );
+ await expect.element(page.getByText('Downloaded 1 event as JSON')).toBeVisible();
+
+ stubClipboard(vi.fn().mockRejectedValue(new Error('denied')));
+ download.downloadText.mockImplementation(() => {
+ throw new Error('blocked');
+ });
+ await act(() => page.getByRole('button', { name: 'Copy JSON (1)' }).click());
+ await act(() => page.getByRole('button', { name: 'Download JSON (1)' }).click());
+ await settle();
+ await expect.element(page.getByText('Could not copy events to the clipboard.')).toBeVisible();
+ await expect.element(page.getByText('Could not download the events.')).toBeVisible();
+ });
+
+ it('clears only the selected scope independently of display filters', async () => {
+ seed();
+ await render('project-a');
+ await act(() => page.getByRole('textbox', { name: 'Search events' }).fill('nothing-matches'));
+ await settle();
+ expect(entryRows()).toHaveLength(0);
+
+ await act(() => page.getByRole('button', { name: 'Clear: Current project + application' }).click());
+ await settle();
+
+ expect(getLogSnapshot().entries.map((entry) => entry.message)).toEqual(['Other project warning']);
+ // An empty scope reads as empty even while a text filter is set; the filter no longer matters.
+ expect(host?.textContent).toContain('No events recorded in this scope yet.');
+ expect(host?.textContent).not.toContain('Clear filters');
+ });
+
+ it('distinguishes disabled recording from an empty history and follows project switches', async () => {
+ configure({ enabled: false });
+ await render('project-a');
+
+ expect(host?.textContent).toContain('Recording off');
+ expect(host?.textContent).toContain('Turn on “Record diagnostic logs”');
+ await expect.element(page.getByRole('button', { name: 'Open developer settings' })).toBeVisible();
+
+ configure();
+ seed();
+ await settle();
+ expect(entryRows()).toHaveLength(3);
+
+ await render('project-b');
+ expect(entryRows().map((row) => row.dataset.logLevel)).toEqual(['warn', 'info']);
+
+ clearLogs();
+ await settle();
+ expect(host?.textContent).toContain('No events recorded in this scope yet.');
+ });
+
+ it('stays usable in a narrow dock and in the dark theme', async () => {
+ seed();
+ createLogger({ area: 'upload', namespace: 'gallery', projectId: 'project-a' }).warn(
+ `Uploaded ${'a-very-long-file-name-'.repeat(8)}.png to the board`
+ );
+ applyThemeToRoot('ultradark');
+ try {
+ await render('project-a', '340px');
+
+ expect(host!.scrollWidth).toBeLessThanOrEqual(host!.clientWidth);
+ await expect.element(combobox('Scope')).toBeVisible();
+ await expect.element(page.getByRole('button', { name: 'Copy JSON (4)' })).toBeVisible();
+ await expect(auditAccessibility(host!)).resolves.toEqual([]);
+ } finally {
+ applyThemeToRoot(DEFAULT_THEME_ID);
+ }
+ });
+});
diff --git a/invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx b/invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx
new file mode 100644
index 0000000000..03e0348826
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx
@@ -0,0 +1,540 @@
+import type {
+ LogEntry,
+ LoggingConfig,
+ LogLevel,
+ LogNamespace,
+ LogScope,
+ LogSnapshot,
+} from '@platform/logging/contracts';
+
+import { Badge, Box, createListCollection, HStack, Icon, Input, InputGroup, Stack, Text } from '@chakra-ui/react';
+import { downloadText } from '@platform/browser/downloadBlob';
+import { LOG_LEVEL_ORDER, LOG_NAMESPACES, matchesLogScope } from '@platform/logging/contracts';
+import { createLogExport } from '@platform/logging/export';
+import { clearLogs } from '@platform/logging/logger';
+import { useLoggingConfig, useLogSnapshot } from '@platform/logging/react';
+import { APP_VERSION } from '@platform/runtime/appMetadata';
+import { Button, IconButton, JsonPreview, Panel, Scrollable, Select, Tooltip } from '@platform/ui';
+import { toaster } from '@platform/ui/toaster';
+import { openWorkbenchSettings } from '@workbench/settings/settingsDialogStore';
+import { ChevronLeftIcon, ChevronRightIcon, SearchIcon } from 'lucide-react';
+import { memo, useCallback, useMemo, useState, type ChangeEvent } from 'react';
+import { useTranslation } from 'react-i18next';
+
+export const DIAGNOSTICS_PAGE_SIZE = 100;
+
+type ScopeKind = LogScope['kind'];
+type SeverityFilter = 'all' | Exclude<LogLevel, 'trace'>;
+type NamespaceFilter = 'all' | LogNamespace | 'performance';
+
+interface DiagnosticsFilters {
+ namespace: NamespaceFilter;
+ page: number;
+ query: string;
+ scope: ScopeKind;
+ severity: SeverityFilter;
+}
+
+const SEVERITY_FILTERS: readonly SeverityFilter[] = ['all', 'debug', 'info', 'warn', 'error'];
+const NAMESPACE_FILTERS: readonly NamespaceFilter[] = ['all', ...LOG_NAMESPACES, 'performance'];
+const SEARCH_START_ELEMENT = <Icon as={SearchIcon} boxSize="3.5" color="fg.muted" />;
+const SELECT_POSITIONING = { sameWidth: false } as const;
+const LEVEL_COLOR_PALETTE: Record<LogLevel, string> = {
+ debug: 'purple',
+ error: 'red',
+ fatal: 'red',
+ info: 'blue',
+ trace: 'gray',
+ warn: 'orange',
+};
+
+const resolveScope = (kind: ScopeKind, projectId: string | null): LogScope =>
+ projectId === null || kind === 'all' ? { kind: 'all' } : { kind, projectId };
+
+const matchesQuery = (entry: LogEntry, query: string): boolean => {
+ const haystack = [
+ entry.message,
+ entry.name,
+ entry.namespace,
+ entry.source.area,
+ entry.source.projectId,
+ entry.source.operationId,
+ entry.source.widget?.typeId,
+ entry.source.widget?.instanceId,
+ entry.error?.name,
+ entry.error?.message,
+ ]
+ .filter((part): part is string => typeof part === 'string' && part.length > 0)
+ .join('\n')
+ .toLowerCase();
+
+ return haystack.includes(query);
+};
+
+const filterEntries = (
+ entries: readonly LogEntry[],
+ scope: LogScope,
+ filters: DiagnosticsFilters
+): { matched: LogEntry[]; scopedCount: number } => {
+ const query = filters.query.trim().toLowerCase();
+ const minimum = filters.severity === 'all' ? 0 : LOG_LEVEL_ORDER[filters.severity];
+ let scopedCount = 0;
+ const matched: LogEntry[] = [];
+
+ for (const entry of entries) {
+ if (!matchesLogScope(entry, scope)) {
+ continue;
+ }
+
+ scopedCount += 1;
+
+ if (LOG_LEVEL_ORDER[entry.level] < minimum) {
+ continue;
+ }
+ if (filters.namespace !== 'all' && entry.namespace !== filters.namespace) {
+ continue;
+ }
+ if (query && !matchesQuery(entry, query)) {
+ continue;
+ }
+
+ matched.push(entry);
+ }
+
+ return { matched, scopedCount };
+};
+
+const formatSource = (entry: LogEntry, showProject: boolean): string => {
+ const parts = [`${entry.namespace}/${entry.source.area}`];
+
+ if (entry.source.widget) {
+ parts.push(`${entry.source.widget.typeId}:${entry.source.widget.instanceId}`);
+ }
+ if (showProject && entry.source.projectId) {
+ parts.push(entry.source.projectId);
+ }
+ if (entry.source.operationId) {
+ parts.push(entry.source.operationId);
+ }
+
+ return parts.join(' · ');
+};
+
+/**
+ * Lists recorded events for one scope with display-only filters, paging and export. Callers supply the project
+ * the viewer belongs to; Launchpad-style hosts pass null and see account-wide events only.
+ */
+export const DiagnosticsPanel = ({ projectId }: { projectId: string | null }) => {
+ const { t } = useTranslation();
+ const snapshot = useLogSnapshot();
+ const config = useLoggingConfig();
+ const [filters, setFilters] = useState<DiagnosticsFilters>({
+ namespace: 'all',
+ page: 1,
+ query: '',
+ scope: 'project-and-application',
+ severity: 'all',
+ });
+ const scope = useMemo(() => resolveScope(filters.scope, projectId), [filters.scope, projectId]);
+ const { matched, scopedCount } = useMemo(
+ () => filterEntries(snapshot.entries, scope, filters),
+ [filters, scope, snapshot.entries]
+ );
+ const pageCount = Math.max(1, Math.ceil(matched.length / DIAGNOSTICS_PAGE_SIZE));
+ const page = Math.min(filters.page, pageCount);
+ const pageEntries = useMemo(
+ () => matched.slice((page - 1) * DIAGNOSTICS_PAGE_SIZE, page * DIAGNOSTICS_PAGE_SIZE),
+ [matched, page]
+ );
+ const hasFilters = filters.query.trim() !== '' || filters.severity !== 'all' || filters.namespace !== 'all';
+
+ const levelLabel = useCallback((level: LogLevel) => t(`settings.catalog.options.${level}`), [t]);
+ const scopeLabel = useCallback(
+ (kind: ScopeKind) =>
+ kind === 'all'
+ ? t('widgets.diagnostics.scopes.all')
+ : kind === 'project'
+ ? t('widgets.diagnostics.scopes.project')
+ : t('widgets.diagnostics.scopes.projectAndApplication'),
+ [t]
+ );
+ const scopeCollection = useMemo(
+ () =>
+ createListCollection<{ label: string; value: ScopeKind }>({
+ items: (projectId === null ? (['all'] as const) : (['project-and-application', 'project', 'all'] as const)).map(
+ (kind) => ({ label: scopeLabel(kind), value: kind })
+ ),
+ }),
+ [projectId, scopeLabel]
+ );
+ const severityCollection = useMemo(
+ () =>
+ createListCollection<{ label: string; value: SeverityFilter }>({
+ items: SEVERITY_FILTERS.map((severity) => ({
+ label:
+ severity === 'all'
+ ? t('widgets.diagnostics.severityAll')
+ : t('widgets.diagnostics.severityAtLeast', { level: levelLabel(severity) }),
+ value: severity,
+ })),
+ }),
+ [levelLabel, t]
+ );
+ const namespaceCollection = useMemo(
+ () =>
+ createListCollection<{ label: string; value: NamespaceFilter }>({
+ items: NAMESPACE_FILTERS.map((namespace) => ({
+ label:
+ namespace === 'all'
+ ? t('widgets.diagnostics.namespaceAll')
+ : namespace === 'performance'
+ ? t('widgets.diagnostics.performanceNamespace')
+ : namespace,
+ value: namespace,
+ })),
+ }),
+ [t]
+ );
+ const scopeValue = useMemo(() => [scope.kind], [scope.kind]);
+ const severityValue = useMemo(() => [filters.severity], [filters.severity]);
+ const namespaceValue = useMemo(() => [filters.namespace], [filters.namespace]);
+
+ const changeScope = useCallback(({ value }: { value: string[] }) => {
+ const next = value[0] as ScopeKind | undefined;
+
+ if (next) {
+ setFilters((current) => ({ ...current, page: 1, scope: next }));
+ }
+ }, []);
+ const changeSeverity = useCallback(({ value }: { value: string[] }) => {
+ const next = value[0] as SeverityFilter | undefined;
+
+ if (next) {
+ setFilters((current) => ({ ...current, page: 1, severity: next }));
+ }
+ }, []);
+ const changeNamespace = useCallback(({ value }: { value: string[] }) => {
+ const next = value[0] as NamespaceFilter | undefined;
+
+ if (next) {
+ setFilters((current) => ({ ...current, namespace: next, page: 1 }));
+ }
+ }, []);
+ const changeQuery = useCallback((event: ChangeEvent<HTMLInputElement>) => {
+ const query = event.currentTarget.value;
+
+ setFilters((current) => ({ ...current, page: 1, query }));
+ }, []);
+ const clearFilters = useCallback(
+ () => setFilters((current) => ({ ...current, namespace: 'all', page: 1, query: '', severity: 'all' })),
+ []
+ );
+ const previousPage = useCallback(
+ () => setFilters((current) => ({ ...current, page: Math.max(1, page - 1) })),
+ [page]
+ );
+ const nextPage = useCallback(
+ () => setFilters((current) => ({ ...current, page: Math.min(pageCount, page + 1) })),
+ [page, pageCount]
+ );
+
+ const buildExport = useCallback(
+ () =>
+ JSON.stringify(
+ createLogExport(matched, { appVersion: APP_VERSION, capture: config, retention: snapshot.retention, scope }),
+ null,
+ 2
+ ),
+ [config, matched, scope, snapshot.retention]
+ );
+ const copyFiltered = useCallback(() => {
+ const count = matched.length;
+ const clipboard = navigator.clipboard;
+
+ if (!clipboard) {
+ toaster.create({ title: t('widgets.diagnostics.copyFailed'), type: 'error' });
+
+ return;
+ }
+
+ clipboard.writeText(buildExport()).then(
+ () => toaster.create({ duration: 2500, title: t('widgets.diagnostics.copied', { count }), type: 'success' }),
+ () => toaster.create({ title: t('widgets.diagnostics.copyFailed'), type: 'error' })
+ );
+ }, [buildExport, matched.length, t]);
+ const downloadFiltered = useCallback(() => {
+ try {
+ downloadText(
+ buildExport(),
+ `invoke-logs-${new Date().toISOString().replace(/[:.]/g, '-')}.json`,
+ 'application/json'
+ );
+ toaster.create({
+ duration: 2500,
+ title: t('widgets.diagnostics.downloaded', { count: matched.length }),
+ type: 'success',
+ });
+ } catch {
+ toaster.create({ title: t('widgets.diagnostics.downloadFailed'), type: 'error' });
+ }
+ }, [buildExport, matched.length, t]);
+ const clearScope = useCallback(() => clearLogs(scope), [scope]);
+ const openDeveloperSettings = useCallback(() => openWorkbenchSettings('developer'), []);
+
+ const showProject = scope.kind === 'all';
+ const currentScopeLabel = scopeLabel(scope.kind);
+
+ return (
+ <Stack data-diagnostics-panel flex="1" gap="2" minH="0" p="2">
+ <HStack flexWrap="wrap" gap="2">
+ <Select
+ aria-label={t('widgets.diagnostics.scope')}
+ collection={scopeCollection}
+ flex="1 1 13rem"
+ minW="0"
+ positioning={SELECT_POSITIONING}
+ size="xs"
+ value={scopeValue}
+ valueText={currentScopeLabel}
+ onValueChange={changeScope}
+ />
+ <Select
+ aria-label={t('widgets.diagnostics.severity')}
+ collection={severityCollection}
+ flex="1 1 9rem"
+ minW="0"
+ positioning={SELECT_POSITIONING}
+ size="xs"
+ value={severityValue}
+ valueText={severityCollection.items.find((item) => item.value === filters.severity)?.label}
+ onValueChange={changeSeverity}
+ />
+ <Select
+ aria-label={t('widgets.diagnostics.namespace')}
+ collection={namespaceCollection}
+ flex="1 1 9rem"
+ minW="0"
+ positioning={SELECT_POSITIONING}
+ size="xs"
+ value={namespaceValue}
+ valueText={namespaceCollection.items.find((item) => item.value === filters.namespace)?.label}
+ onValueChange={changeNamespace}
+ />
+ <InputGroup flex="1 1 100%" startElement={SEARCH_START_ELEMENT}>
+ <Input
+ aria-label={t('widgets.diagnostics.search')}
+ placeholder={t('widgets.diagnostics.search')}
+ size="xs"
+ value={filters.query}
+ onChange={changeQuery}
+ />
+ </InputGroup>
+ </HStack>
+ <RecordingStatus config={config} snapshot={snapshot} />
+ <HStack flexWrap="wrap" gap="2" justify="space-between">
+ <HStack flexWrap="wrap" gap="2">
+ <Button disabled={matched.length === 0} size="2xs" variant="outline" onClick={copyFiltered}>
+ {t('widgets.diagnostics.copyFiltered', { count: matched.length })}
+ </Button>
+ <Button disabled={matched.length === 0} size="2xs" variant="outline" onClick={downloadFiltered}>
+ {t('widgets.diagnostics.downloadFiltered', { count: matched.length })}
+ </Button>
+ <Button disabled={scopedCount === 0} size="2xs" variant="outline" onClick={clearScope}>
+ {t('widgets.diagnostics.clearScope', { scope: currentScopeLabel })}
+ </Button>
+ </HStack>
+ {pageCount > 1 ? (
+ <HStack gap="1">
+ <Tooltip content={t('common.previousPage')}>
+ <IconButton
+ aria-label={t('common.previousPage')}
+ disabled={page <= 1}
+ size="2xs"
+ variant="ghost"
+ onClick={previousPage}
+ >
+ <ChevronLeftIcon />
+ </IconButton>
+ </Tooltip>
+ <Text color="fg.muted" fontSize="2xs" role="status">
+ {t('widgets.diagnostics.page', { page, total: pageCount })}
+ </Text>
+ <Tooltip content={t('common.nextPage')}>
+ <IconButton
+ aria-label={t('common.nextPage')}
+ disabled={page >= pageCount}
+ size="2xs"
+ variant="ghost"
+ onClick={nextPage}
+ >
+ <ChevronRightIcon />
+ </IconButton>
+ </Tooltip>
+ </HStack>
+ ) : null}
+ </HStack>
+ {pageEntries.length === 0 ? (
+ <Stack gap="2" py="4">
+ {!config.enabled && scopedCount === 0 ? (
+ <>
+ <Text color="fg" fontSize="xs" fontWeight="600" role="status">
+ {t('widgets.diagnostics.recordingOff')}
+ </Text>
+ <Text color="fg.muted" fontSize="2xs">
+ {t('widgets.diagnostics.recordingOffHint')}
+ </Text>
+ <Button alignSelf="start" size="2xs" variant="outline" onClick={openDeveloperSettings}>
+ {t('widgets.diagnostics.openDeveloperSettings')}
+ </Button>
+ </>
+ ) : scopedCount === 0 ? (
+ <Text color="fg.muted" fontSize="2xs" role="status">
+ {t('widgets.diagnostics.emptyScope')}
+ </Text>
+ ) : (
+ <>
+ <Text color="fg.muted" fontSize="2xs" role="status">
+ {t('widgets.diagnostics.noMatches')}
+ </Text>
+ {hasFilters ? (
+ <Button alignSelf="start" size="2xs" variant="outline" onClick={clearFilters}>
+ {t('widgets.diagnostics.clearFilters')}
+ </Button>
+ ) : null}
+ </>
+ )}
+ </Stack>
+ ) : (
+ <Scrollable flex="1" label={t('widgets.diagnostics.listLabel')} minH="0">
+ <Stack gap="2" pe="2">
+ {pageEntries.map((entry) => (
+ <DiagnosticsEntryRow key={entry.id} entry={entry} showProject={showProject} />
+ ))}
+ </Stack>
+ </Scrollable>
+ )}
+ </Stack>
+ );
+};
+
+const RecordingStatus = ({ config, snapshot }: { config: LoggingConfig; snapshot: LogSnapshot }) => {
+ const { t } = useTranslation();
+ const { retention, truncatedCount } = snapshot;
+ const evicted = retention.problems.evicted + retention.verbose.evicted + retention.timings.evicted;
+
+ return (
+ <HStack flexWrap="wrap" gap="1.5">
+ {config.enabled ? (
+ <Badge colorPalette="green" size="xs">
+ {t('widgets.diagnostics.recordingStatus', {
+ count: config.namespaces.length,
+ level: t(`settings.catalog.options.${config.level}`),
+ total: LOG_NAMESPACES.length,
+ })}
+ </Badge>
+ ) : (
+ <Badge colorPalette="gray" size="xs">
+ {t('widgets.diagnostics.recordingOff')}
+ </Badge>
+ )}
+ {config.performanceTimingsEnabled ? (
+ <Badge colorPalette="purple" size="xs">
+ {t('widgets.diagnostics.timingsOn')}
+ </Badge>
+ ) : null}
+ {config.consoleOutputEnabled ? (
+ <Badge colorPalette="blue" size="xs">
+ {t('widgets.diagnostics.consoleOn')}
+ </Badge>
+ ) : null}
+ <Text color="fg.muted" fontSize="2xs">
+ {t('widgets.diagnostics.retention', {
+ problemLimit: retention.problems.limit,
+ problems: retention.problems.count,
+ timingLimit: retention.timings.limit,
+ timings: retention.timings.count,
+ verbose: retention.verbose.count,
+ verboseLimit: retention.verbose.limit,
+ })}
+ </Text>
+ {evicted > 0 ? (
+ <Badge colorPalette="orange" size="xs">
+ {t('widgets.diagnostics.evicted', { count: evicted })}
+ </Badge>
+ ) : null}
+ {truncatedCount > 0 ? (
+ <Badge colorPalette="orange" size="xs">
+ {t('widgets.diagnostics.truncated', { count: truncatedCount })}
+ </Badge>
+ ) : null}
+ </HStack>
+ );
+};
+
+const DiagnosticsEntryRow = memo(({ entry, showProject }: { entry: LogEntry; showProject: boolean }) => {
+ const { t } = useTranslation();
+ const [isExpanded, setIsExpanded] = useState(false);
+ const toggle = useCallback(() => setIsExpanded((current) => !current), []);
+ const isProblem = entry.level === 'warn' || entry.level === 'error' || entry.level === 'fatal';
+
+ return (
+ <Panel
+ borderColor={isProblem ? (entry.level === 'warn' ? 'fg.warning' : 'border.error') : undefined}
+ data-log-entry-id={entry.id}
+ data-log-level={entry.level}
+ p="2"
+ >
+ <Stack gap="1.5">
+ <HStack align="start" gap="2" justify="space-between">
+ <Stack flex="1" gap="1" minW="0">
+ <HStack flexWrap="wrap" gap="1.5">
+ <Badge colorPalette={LEVEL_COLOR_PALETTE[entry.level]} size="xs">
+ {t(`settings.catalog.options.${entry.level}`)}
+ </Badge>
+ {entry.durationMs !== undefined ? (
+ <Badge colorPalette="purple" size="xs">
+ {entry.durationMs.toFixed(1)}ms
+ </Badge>
+ ) : null}
+ {entry.truncated ? (
+ <Badge colorPalette="orange" size="xs">
+ {t('widgets.diagnostics.entryTruncated')}
+ </Badge>
+ ) : null}
+ <Text color="fg.muted" fontFamily="mono" fontSize="2xs" minW="0" wordBreak="break-all">
+ {formatSource(entry, showProject)}
+ </Text>
+ </HStack>
+ <Text color="fg" fontSize="xs" fontWeight="600" wordBreak="break-word">
+ {entry.message || entry.name}
+ </Text>
+ {entry.error ? (
+ <Text color="fg.muted" fontFamily="mono" fontSize="2xs" wordBreak="break-word">
+ {entry.error.name}: {entry.error.message}
+ </Text>
+ ) : null}
+ <Text color="fg.muted" fontSize="2xs">
+ {new Date(entry.createdAt).toLocaleTimeString()} · {entry.name}
+ </Text>
+ </Stack>
+ <Button aria-expanded={isExpanded} flexShrink="0" size="2xs" variant="ghost" onClick={toggle}>
+ {isExpanded ? t('widgets.diagnostics.hideDetails') : t('widgets.diagnostics.details')}
+ </Button>
+ </HStack>
+ {isExpanded ? (
+ <Box data-log-entry-details>
+ <JsonPreview
+ copyFailedLabel={t('widgets.diagnostics.copyFailed')}
+ copyLabel={t('widgets.diagnostics.copyEntry')}
+ label={t('widgets.diagnostics.detailsLabel')}
+ maxH="16rem"
+ value={entry}
+ />
+ </Box>
+ ) : null}
+ </Stack>
+ </Panel>
+ );
+});
+
+DiagnosticsEntryRow.displayName = 'DiagnosticsEntryRow';
diff --git a/invokeai/frontend/webv2/src/workbench/diagnostics/useProblemCount.test.ts b/invokeai/frontend/webv2/src/workbench/diagnostics/useProblemCount.test.ts
new file mode 100644
index 0000000000..3e9a46fc5a
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/diagnostics/useProblemCount.test.ts
@@ -0,0 +1,23 @@
+import { DEFAULT_LOGGING_CONFIG } from '@platform/logging/contracts';
+import { configureLogging, createLogger, getLogSnapshot, resetLogging } from '@platform/logging/logger';
+import { beforeEach, describe, expect, it } from 'vitest';
+
+import { countProblems } from './useProblemCount';
+
+beforeEach(() => {
+ resetLogging();
+ configureLogging({ ...DEFAULT_LOGGING_CONFIG, level: 'trace' });
+});
+
+describe('countProblems', () => {
+ it('counts warnings and above for the project and unattributed application events only', () => {
+ createLogger({ area: 'browser', namespace: 'app' }).error('uncaught');
+ createLogger({ area: 'autosave', namespace: 'persistence', projectId: 'project-a' }).warn('slow');
+ createLogger({ area: 'autosave', namespace: 'persistence', projectId: 'project-a' }).info('saved');
+ createLogger({ area: 'history', namespace: 'queue', projectId: 'project-b' }).error('other project');
+
+ expect(countProblems(getLogSnapshot().entries, 'project-a')).toBe(2);
+ expect(countProblems(getLogSnapshot().entries, 'project-b')).toBe(2);
+ expect(countProblems(getLogSnapshot().entries, 'project-c')).toBe(1);
+ });
+});
diff --git a/invokeai/frontend/webv2/src/workbench/diagnostics/useProblemCount.ts b/invokeai/frontend/webv2/src/workbench/diagnostics/useProblemCount.ts
new file mode 100644
index 0000000000..e0f2d5b20a
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/diagnostics/useProblemCount.ts
@@ -0,0 +1,26 @@
+import type { LogEntry } from '@platform/logging/contracts';
+
+import { LOG_LEVEL_ORDER, matchesLogScope } from '@platform/logging/contracts';
+import { getLogSnapshot, subscribeLogs } from '@platform/logging/logger';
+import { useCallback, useSyncExternalStore } from 'react';
+
+/** Warnings and above for the project plus application events. */
+export const countProblems = (entries: readonly LogEntry[], projectId: string): number => {
+ const scope = { kind: 'project-and-application', projectId } as const;
+ let count = 0;
+
+ for (const entry of entries) {
+ if (LOG_LEVEL_ORDER[entry.level] >= LOG_LEVEL_ORDER.warn && matchesLogScope(entry, scope)) {
+ count += 1;
+ }
+ }
+
+ return count;
+};
+
+/** The widget chip and header badge share this count. */
+export const useProblemCount = (projectId: string): number => {
+ const read = useCallback(() => countProblems(getLogSnapshot().entries, projectId), [projectId]);
+
+ return useSyncExternalStore(subscribeLogs, read, read);
+};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/diagnostics/DiagnosticsHeaderActions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/diagnostics/DiagnosticsHeaderActions.tsx
index 417d173923..1050e952a9 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/diagnostics/DiagnosticsHeaderActions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/diagnostics/DiagnosticsHeaderActions.tsx
@@ -1,26 +1,22 @@
-import { Badge } from '@chakra-ui/react';
-import { Button } from '@platform/ui';
-import { clearProjectDiagnostics, useProjectDiagnostics } from '@workbench/diagnostics/logger';
-import { useActiveProjectSelector } from '@workbench/WorkbenchContext';
+import { Badge, VisuallyHidden } from '@chakra-ui/react';
+import { useProblemCount } from '@workbench/diagnostics/useProblemCount';
+import { useActiveProjectId } from '@workbench/WorkbenchContext';
import { BugIcon } from 'lucide-react';
-import { useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
export const DiagnosticsHeaderActions = () => {
- const projectId = useActiveProjectSelector((project) => project.id);
- const entries = useProjectDiagnostics(projectId);
- const clearEntries = useCallback(() => clearProjectDiagnostics(projectId), [projectId]);
+ const { t } = useTranslation();
+ const problemCount = useProblemCount(useActiveProjectId());
+
+ if (problemCount === 0) {
+ return null;
+ }
return (
- <>
- {entries.length ? (
- <Badge colorPalette="red" size="xs">
- <BugIcon />
- {entries.length}
- </Badge>
- ) : null}
- <Button disabled={entries.length === 0} size="2xs" variant="outline" onClick={clearEntries}>
- Clear
- </Button>
- </>
+ <Badge colorPalette="red" size="xs">
+ <BugIcon />
+ <span aria-hidden>{problemCount}</span>
+ <VisuallyHidden>{t('widgets.diagnostics.chipProblems', { count: problemCount })}</VisuallyHidden>
+ </Badge>
);
};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/diagnostics/DiagnosticsWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/diagnostics/DiagnosticsWidgetView.tsx
index f59e625988..ab66456eb7 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/diagnostics/DiagnosticsWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/diagnostics/DiagnosticsWidgetView.tsx
@@ -1,147 +1,29 @@
-import type { DiagnosticEntry } from '@workbench/diagnostics/logger';
import type { WidgetViewProps } from '@workbench/widgetContracts';
-import { Badge, Box, HStack, Stack, Text } from '@chakra-ui/react';
-import { Button, Panel } from '@platform/ui';
-import { clearProjectDiagnostics, useProjectDiagnostics } from '@workbench/diagnostics/logger';
+import { DiagnosticsPanel } from '@workbench/diagnostics/DiagnosticsPanel';
+import { useProblemCount } from '@workbench/diagnostics/useProblemCount';
import { StatusWidgetChip } from '@workbench/widget-frame';
-import { useActiveProjectSelector } from '@workbench/WorkbenchContext';
+import { useActiveProjectId } from '@workbench/WorkbenchContext';
import { BugIcon, ClipboardListIcon } from 'lucide-react';
-import { memo, useCallback, useState } from 'react';
+import { useTranslation } from 'react-i18next';
export const DiagnosticsWidgetView = ({ presentation, region }: WidgetViewProps) => {
- const projectId = useActiveProjectSelector((project) => project.id);
- const entries = useProjectDiagnostics(projectId);
- const label = entries.length === 0 ? 'Clean' : `${entries.length} event${entries.length === 1 ? '' : 's'}`;
+ const { t } = useTranslation();
+ const projectId = useActiveProjectId();
+ const problemCount = useProblemCount(projectId);
if (region === 'bottom' && presentation !== 'expanded') {
+ const label =
+ problemCount === 0
+ ? t('widgets.diagnostics.chipClean')
+ : t('widgets.diagnostics.chipProblems', { count: problemCount });
+
return (
- <StatusWidgetChip icon={entries.length > 0 ? BugIcon : ClipboardListIcon}>Diagnostics: {label}</StatusWidgetChip>
+ <StatusWidgetChip icon={problemCount > 0 ? BugIcon : ClipboardListIcon}>
+ {t('widgets.diagnostics.chipLabel', { label })}
+ </StatusWidgetChip>
);
}
- return <DiagnosticsPanel entries={entries} projectId={projectId} />;
-};
-
-const DiagnosticsPanel = ({ entries, projectId }: { entries: DiagnosticEntry[]; projectId: string }) => {
- const copyAll = useCallback(() => void navigator.clipboard?.writeText(JSON.stringify(entries, null, 2)), [entries]);
- const clearEntries = useCallback(() => clearProjectDiagnostics(projectId), [projectId]);
-
- return (
- <Stack gap="3" p="2">
- <HStack justify="space-between">
- <Text color="fg.subtle" fontSize="2xs">
- Project-scoped diagnostic events from workbench and widget loggers.
- </Text>
- <HStack gap="2">
- <Button disabled={entries.length === 0} size="2xs" variant="outline" onClick={copyAll}>
- Copy JSON
- </Button>
- <Button disabled={entries.length === 0} size="2xs" variant="outline" onClick={clearEntries}>
- Clear
- </Button>
- </HStack>
- </HStack>
- {entries.length === 0 ? (
- <Text color="fg.subtle" fontSize="2xs">
- Logger events and performance timings will appear here without covering the workbench.
- </Text>
- ) : (
- <Stack gap="2">
- {entries.map((entry) => (
- <DiagnosticsEntryRow key={entry.id} entry={entry} />
- ))}
- </Stack>
- )}
- </Stack>
- );
-};
-
-const DiagnosticsEntryRow = memo(({ entry }: { entry: DiagnosticEntry }) => {
- const [isRawVisible, setIsRawVisible] = useState(false);
- const copyEntry = useCallback(() => void navigator.clipboard?.writeText(JSON.stringify(entry, null, 2)), [entry]);
- const toggleRaw = useCallback(() => setIsRawVisible((current) => !current), []);
-
- return (
- <Panel gap="2" p="2">
- <Stack gap="2">
- <HStack align="start" gap="2" justify="space-between">
- <Stack gap="1" minW="0">
- <HStack gap="1.5" wrap="wrap">
- <Badge colorPalette={getLevelColorPalette(entry.level)} size="xs">
- {entry.level}
- </Badge>
- <Badge colorPalette="gray" size="xs">
- {entry.namespace}
- </Badge>
- {entry.durationMs !== undefined ? (
- <Badge colorPalette="purple" size="xs">
- {entry.durationMs.toFixed(1)}ms
- </Badge>
- ) : null}
- <Text color="fg.muted" fontFamily="mono" fontSize="2xs">
- {formatSource(entry)}
- </Text>
- </HStack>
- <Text color="fg" fontSize="xs" fontWeight="600">
- {entry.message || '(no message)'}
- </Text>
- <Text color="fg.subtle" fontSize="2xs">
- {new Date(entry.createdAt).toLocaleTimeString()}
- </Text>
- </Stack>
- <Button size="2xs" variant="outline" onClick={copyEntry}>
- Copy
- </Button>
- </HStack>
- <Button alignSelf="start" size="2xs" variant="ghost" onClick={toggleRaw}>
- {isRawVisible ? 'Hide raw entry' : 'Raw entry'}
- </Button>
- {isRawVisible ? (
- <Box
- as="pre"
- bg="bg.inset"
- borderColor="border.subtle"
- borderWidth="1px"
- color="fg.muted"
- fontFamily="mono"
- fontSize="2xs"
- maxH="16rem"
- overflow="auto"
- p="2"
- rounded="md"
- whiteSpace="pre-wrap"
- >
- {JSON.stringify(entry, null, 2)}
- </Box>
- ) : null}
- </Stack>
- </Panel>
- );
-});
-
-DiagnosticsEntryRow.displayName = 'DiagnosticsEntryRow';
-
-const formatSource = (entry: DiagnosticEntry): string => {
- if (entry.source.kind === 'widget') {
- return `${entry.source.typeId}:${entry.source.instanceId}:${entry.source.region}`;
- }
-
- return `workbench:${entry.source.area}`;
-};
-
-const getLevelColorPalette = (level: DiagnosticEntry['level']): string => {
- switch (level) {
- case 'fatal':
- case 'error':
- return 'red';
- case 'warn':
- return 'orange';
- case 'info':
- return 'blue';
- case 'debug':
- return 'purple';
- case 'trace':
- return 'gray';
- }
+ return <DiagnosticsPanel projectId={projectId} />;
};