Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

fix schema browser not subscribing to query client #64

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 72 additions & 87 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,128 +23,113 @@ const router = createBrowserRouter([
children: [
{
path: '/',
Component() {
return <CatalogsList />;
},
element: <CatalogsList />,
},
{
path: '/data/:catalog',
Component() {
return <CatalogDetails />;
},
element: <CatalogDetails />,
},
{
path: '/data/:catalog/:schema',
Component() {
return <SchemaDetails />;
},
element: <SchemaDetails />,
},
{
path: '/data/:catalog/:schema/:table',
Component() {
return <TableDetails />;
},
element: <TableDetails />,
},
{
path: '/volumes/:catalog/:schema/:volume',
Component() {
return <VolumeDetails />;
},
element: <VolumeDetails />,
},
{
path: '/functions/:catalog/:schema/:ucFunction',
Component() {
return <FunctionDetails />;
},
element: <FunctionDetails />,
},
],
},
]);

function AppProvider() {
const navigate = useNavigate();
const queryClient = new QueryClient({
defaultOptions: { queries: { staleTime: 1000 * 5 * 60 } },
});

return (
<QueryClientProvider client={queryClient}>
<ConfigProvider
theme={{
components: {
Typography: {
titleMarginBottom: 0,
titleMarginTop: 0,
},
<ConfigProvider
theme={{
components: {
Typography: {
titleMarginBottom: 0,
titleMarginTop: 0,
},
}}
>
<Layout>
{/* Header */}
<Layout.Header style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ marginRight: 24 }} onClick={() => navigate('/')}>
<img
src="/uc-logo-reverse.png"
height={32}
alt="uc-logo-reverse"
/>
</div>
<Menu
theme="dark"
mode="horizontal"
defaultSelectedKeys={['catalogs']}
items={[
{
key: 'catalogs',
label: 'Catalogs',
onClick: () => navigate('/'),
},
]}
style={{ flex: 1, minWidth: 0 }}
/>
</Layout.Header>
{/* Content */}
<Layout.Content
},
}}
>
<Layout>
{/* Header */}
<Layout.Header style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ marginRight: 24 }} onClick={() => navigate('/')}>
<img src="/uc-logo-reverse.png" height={32} alt="uc-logo-reverse" />
</div>
<Menu
theme="dark"
mode="horizontal"
defaultSelectedKeys={['catalogs']}
items={[
{
key: 'catalogs',
label: 'Catalogs',
onClick: () => navigate('/'),
},
]}
style={{ flex: 1, minWidth: 0 }}
/>
</Layout.Header>
{/* Content */}
<Layout.Content
style={{
height: 'calc(100vh - 64px)',
backgroundColor: '#fff',
display: 'flex',
}}
>
{/* Left: Schema Browser */}
<div
style={{
height: 'calc(100vh - 64px)',
backgroundColor: '#fff',
display: 'flex',
width: '30%',
minWidth: 260,
maxWidth: 400,
borderRight: '1px solid lightgrey',
}}
>
{/* Left: Schema Browser */}
<div
style={{
width: '30%',
minWidth: 260,
maxWidth: 400,
borderRight: '1px solid lightgrey',
}}
>
<SchemaBrowser />
</div>
<SchemaBrowser />
</div>

{/* Right: Main details content */}
<div
style={{
overflowY: 'auto',
flex: 1,
padding: 16,
display: 'flex',
}}
>
<Outlet />
</div>
</Layout.Content>
</Layout>
</ConfigProvider>
</QueryClientProvider>
{/* Right: Main details content */}
<div
style={{
overflowY: 'auto',
flex: 1,
padding: 16,
display: 'flex',
}}
>
<Outlet />
</div>
</Layout.Content>
</Layout>
</ConfigProvider>
);
}

function App() {
const queryClient = new QueryClient({
defaultOptions: { queries: { staleTime: 1000 * 5 * 60 } },
});

return (
<NotificationProvider>
<RouterProvider router={router} fallbackElement={<p>Loading...</p>} />
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} fallbackElement={<p>Loading...</p>} />
</QueryClientProvider>
</NotificationProvider>
);
}
Expand Down
Loading