Files
supabase/apps/studio/components/ui/JsonCodeBlock.tsx
671594c69c feat(studio): group log overviews and standardize raw JSON (#50835)
Logs without a service-specific overview now show common fields and
attributes in collapsible groups. Existing service overviews use the
same section layout, with the first section open. Configured fields
share one renderer across service overviews. Raw JSON uses shared
presentation for single-log, multi-log, and downstream Auth views, with
copy controls supplied by each view.

Attribute lookups are scoped to the selected log's source, ID, and
timestamp window and respect metadata visibility. It's based on the
#50953 stack; request correlation, timeline UI, and Auth changes are
separate layers. Sections use the `CollapsibleDetailSection` that master
now shares with the audit log pages, and the new Supavisor overview
follows the same layout: no separate time header, first section open.

### How to test

1. With Unified Logs and `otelUnifiedLogs` enabled, open an API Gateway
log and a Postgres or Auth log. Check the overview sections,
expand/collapse groups, and try copying a field.
2. Open Raw JSON on a log with enough metadata to scroll. Confirm the
copy button stays visible and copies the complete JSON.
3. Select multiple logs and confirm their combined JSON still renders
correctly.

### Validation

- Synced with master; verified head
`663ebfd13117ae3c5aa0de52e4488253a317d59f`.
- Focused local unit/MSW suite: 246 tests passed across 19 files with
retries disabled, both normally and with `--sequence.shuffle
--sequence.seed=50835`. Independent focused run: 24 tests passed with
seed 5083528.
- Browser QA on the matching studio-staging preview passed: API Gateway
and Postgres section expansion/collapse, field copying, scrolling and
copying complete Raw JSON, and copying multiple selected logs.
- All four unit-test shards, all four E2E shards, typecheck, formatting,
lint ratchet, and Studio Docker build passed. The Next.js E2E report
includes one storage-folder test that passed on retry.
- Independent code review found no actionable issues. Working tree
clean.

### Stack

Based on the logs table building blocks stack, which merges first:
#50953 → #50954 → #50955 → #50957 → #50958 → #52281. Then merge in
order:

1. #50835 — grouped log overviews and raw JSON
2. #50840 — request correlation queries
3. #50836 — request timeline UI and folding
4. #50841 — shared Auth user details
5. #50837 — log user correlation and Auth activity

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-10-28 14:07:04 +01:00

15 lines
426 B
TypeScript

import { CodeBlock } from 'ui-patterns/CodeBlock'
export function JsonCodeBlock({ children }: { children: string }) {
return (
<CodeBlock
language="json"
hideCopy
wrapperClassName="!overflow-visible bg-surface-100/50 [&_pre]:!bg-surface-100/50"
className="rounded-none border-none !overflow-x-visible [&_code]:!leading-tight [&_pre]:!leading-tight"
>
{children}
</CodeBlock>
)
}