logs.tsx37 lines · main
| 1 | import { useParams } from 'common' |
| 2 | |
| 3 | import { LogsPreviewer } from '@/components/interfaces/Settings/Logs/LogsPreviewer' |
| 4 | import DefaultLayout from '@/components/layouts/DefaultLayout' |
| 5 | import EdgeFunctionDetailsLayout from '@/components/layouts/EdgeFunctionsLayout/EdgeFunctionDetailsLayout' |
| 6 | import { useEdgeFunctionQuery } from '@/data/edge-functions/edge-function-query' |
| 7 | import type { NextPageWithLayout } from '@/types' |
| 8 | |
| 9 | export const LogPage: NextPageWithLayout = () => { |
| 10 | const { ref, functionSlug } = useParams() |
| 11 | |
| 12 | const { data: selectedFunction, isPending: isLoading } = useEdgeFunctionQuery({ |
| 13 | projectRef: ref, |
| 14 | slug: functionSlug, |
| 15 | }) |
| 16 | |
| 17 | if (selectedFunction === undefined || isLoading) return null |
| 18 | |
| 19 | return ( |
| 20 | <div className="flex-1"> |
| 21 | <LogsPreviewer |
| 22 | condensedLayout |
| 23 | projectRef={ref as string} |
| 24 | queryType="functions" |
| 25 | filterOverride={{ 'metadata.function_id': selectedFunction.id }} |
| 26 | /> |
| 27 | </div> |
| 28 | ) |
| 29 | } |
| 30 | |
| 31 | LogPage.getLayout = (page) => ( |
| 32 | <DefaultLayout> |
| 33 | <EdgeFunctionDetailsLayout title="Logs">{page}</EdgeFunctionDetailsLayout> |
| 34 | </DefaultLayout> |
| 35 | ) |
| 36 | |
| 37 | export default LogPage |