Files
080b888e6b feat(studio): slim edge function detail layout and move header to Overview (#50955)
The edge function detail layout is now breadcrumbs plus tabs
(`PageNav`), without the page header, so tabs like Logs and Code get the
full height below the tabs. The function name, invoke URL and last
deploy details move into a header on the Overview tab, which also holds
the chart period selector. Both the new and legacy Overview render it,
and both now default to a 1 hour period instead of 15 minutes.

The Overview sections (invocations, errors, performance and usage) now
sit in one default-width `PageContainer` instead of each nesting a
full-width one, and the invocations chart moves into a chart card.
Invocations has no section heading, since it's the headline metric right
below the page header.

Both overview versions use the same chart periods. Sparse chart data is
filled only between returned API buckets, avoiding synthetic zeros
outside the reported range. Chart navigation uses the full rolling
period, including a full day for the 1 day option.

The selector shows a checkmark for the selected period, and the header
announces loaded details. Self-hosted Studio retains a Copy URL action
in the detail toolbar because it has no Overview tab.

This layer doesn't depend on the logs changes below it.

**Heads-up:** the header now only appears on Overview. Code, Details,
Invocations and Logs show breadcrumbs and tabs only. This change isn't
behind a flag.

### How to test

1. Open an edge function's Overview. The header shows the name, URL
(with copy) and last deploy hover card, and the period selector sits in
the header with 1 hour selected.
2. Switch through the other tabs. Breadcrumbs and tabs stay sticky, and
there's no header.
3. With the `edgeFunctionsOverview` flag off, the legacy Overview
renders with the same header.

### Validation

- 104 focused tests pass with retries disabled and shuffled order (seed
50968). New tests cover both overview versions, period changes, empty
results, header loading and copying, and self-hosted URL copying. Test
names describe observable behavior.
- 12 targeted regression mutations were detected and restored; the
selected-indicator mutation was repeated after the visual alignment fix.
- Browser QA on the staging preview for `3d055c0dc4` covers the header
and deploy details, copied URL, period changes, all detail tabs, sticky
navigation, the legacy overview, and empty results. Temporary local flag
overrides were removed. The final test-only commit `5af6a2896b` has
identical production code; its matching preview also passed header,
URL-copy, period-switching, and Settings smoke checks.
- Independent code review and changed-file formatting checks pass. All
40 executed CI checks pass on `5af6a2896b`, including TypeScript/lint,
unit tests, Next.js and TanStack E2E tests, and builds. All six review
threads are resolved.

### Stack

Merge in order:

1. #50953 — reusable logs table building blocks
2. #50954 — function-scoped unified logs queries
3. #50955 — slimmer function detail layout, header on Overview
4. #50957 — Invocations merged into a function-scoped Logs tab
5. #50958 — Overview errors in the shared logs table
6. #52281 — remove the legacy Overview

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-10-27 09:29:10 +01:00

98 lines
2.9 KiB
TypeScript

import { useMemo } from 'react'
import { ChartMetric } from 'ui-patterns/Chart'
import {
PageSection,
PageSectionContent,
PageSectionMeta,
PageSectionSummary,
PageSectionTitle,
} from 'ui-patterns/PageSection'
import { getExecutionTooltipDetails } from './EdgeFunctionMetricTooltipDetails'
import {
EXECUTION_TIME_CHART_CONFIG,
formatMetric,
getChartEmptyStateCopy,
} from './EdgeFunctionOverview.utils'
import type { EdgeFunctionChartDatum } from './EdgeFunctionOverview.utils'
import { EdgeFunctionTimeSeriesChartCard } from './EdgeFunctionTimeSeriesChartCard'
interface EdgeFunctionPerformanceSectionProps {
data: EdgeFunctionChartDatum[]
dateTimeFormat: string
isLoading: boolean
isError: boolean
errorMessage?: string
averageExecutionTime: number
maxExecutionTime: number
}
export const EdgeFunctionPerformanceSection = ({
data,
dateTimeFormat,
isLoading,
isError,
errorMessage,
averageExecutionTime,
maxExecutionTime,
}: EdgeFunctionPerformanceSectionProps) => {
const emptyStateCopy = getChartEmptyStateCopy('execution time', isError, errorMessage)
const tooltipDetails = useMemo(
() => getExecutionTooltipDetails(averageExecutionTime),
[averageExecutionTime]
)
const metrics = (
<div className="flex flex-wrap gap-x-8 gap-y-4">
<ChartMetric
label="Average Execution Time"
value={formatMetric(averageExecutionTime, 'ms')}
tooltip="Average execution time of function invocations"
/>
<ChartMetric
label="Max Execution Time"
value={formatMetric(maxExecutionTime, 'ms')}
tooltip="Maximum execution time of function invocations"
/>
</div>
)
return (
<PageSection>
<PageSectionMeta>
<PageSectionSummary>
<PageSectionTitle>Performance</PageSectionTitle>
</PageSectionSummary>
</PageSectionMeta>
<PageSectionContent>
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2">
<EdgeFunctionTimeSeriesChartCard
className="lg:col-span-2"
data={data}
dateTimeFormat={dateTimeFormat}
isLoading={isLoading}
isError={isError}
emptyTitle={emptyStateCopy.title}
emptyDescription={emptyStateCopy.description}
metrics={metrics}
dataKey="max_execution_time"
dataKeys={['avg_execution_time', 'max_execution_time']}
config={EXECUTION_TIME_CHART_CONFIG}
tooltipDetails={tooltipDetails}
referenceLines={[
{
y: averageExecutionTime,
label: 'average',
stroke: 'var(--foreground-default)',
strokeWidth: 1.5,
},
]}
yAxisProps={{
tickFormatter: (value: number) => `${Math.round(value)}ms`,
}}
/>
</div>
</PageSectionContent>
</PageSection>
)
}