Files
Saxon FletcherandClaude Opus 5 71a252a445 feat(studio): show overview and raw JSON tabs for every log (#50687)
<img width="1086" height="810" alt="image"
src="https://github.com/user-attachments/assets/8a9f0c64-145e-4475-a3df-67bd815e2200"
/>

Stack 2/4 · previous: #50686 · next: #50688

## Problem

The detail panel only showed an Overview tab for log types that have an
inspection query. Every other type opened straight to Raw JSON. The
panel also had no header saying which log was open.

## Solution

- Adds `LogDetail`, which owns the inspection query, loading and error
states, and the Raw JSON view. Errors now use `AlertError`.
- Adds `LogOverview`, which maps each log type to its overview renderer.
Types without one fall back to the new `LogFields`, a generic tree of
expandable key/value rows built on `LogFieldRow`.
- `ServiceFlowPanel` now shows a header (level dot + event message)
above Overview / Raw JSON tabs for every log.
- Moves `getLogDataForMetadataVisibility` to `ServiceFlowPanel.utils.ts`
and adds `LogLevelDot`.

## Review instructions

1. Select a Realtime (or any other non-inspected) log. The Overview tab
should list its fields, with nested objects that expand.
2. Select a Postgres log. The overview should look as before, and Raw
JSON should still show the enriched log.
3. Switch between logs and confirm the tabs reset their scroll.

## Checklist

- [ ] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added structured log overviews for Postgres, PostgREST, Auth, Storage,
and Edge Functions, with a Raw JSON view for log details.
- Added expandable log fields with filtering and copy actions, plus
visual indicators for log severity.
- **Bug Fixes**
  - Improved display of scalar, nested, date, and empty log values.
- **Privacy**
  - Raw log data respects metadata visibility settings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-24 08:56:22 +10:00

28 lines
842 B
TypeScript

import { describe, expect, it } from 'vitest'
import { getLogDataForMetadataVisibility } from './ServiceFlowPanel.utils'
describe('getLogDataForMetadataVisibility', () => {
const logData = {
id: 'worker-log',
metadata: { source: 'worker_guest_logs', worker: 'api' },
raw_log_data: {
event_message: 'Worker failed',
metadata: { request_id: 'request-id' },
},
}
it('redacts top-level and nested metadata when metadata is hidden', () => {
const visibleData = JSON.parse(JSON.stringify(getLogDataForMetadataVisibility(logData, false)))
expect(visibleData).toEqual({
id: 'worker-log',
raw_log_data: { event_message: 'Worker failed' },
})
})
it('preserves metadata when metadata is visible', () => {
expect(getLogDataForMetadataVisibility(logData, true)).toBe(logData)
})
})