fix: correct response field mappings and add logout button
- SearchResult uses 'data' not 'items', 'total' not 'totalCount' - ExecutionStats uses 'p99LatencyMs' not 'p99DurationMs' - TimeseriesBucket uses 'time' not 'timestamp' - Add user Dropdown with logout action to LayoutShell Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Outlet, useNavigate, useLocation } from 'react-router';
|
||||
import { AppShell, Sidebar, TopBar, CommandPalette, CommandPaletteProvider, GlobalFilterProvider, useCommandPalette } from '@cameleer/design-system';
|
||||
import { AppShell, Sidebar, TopBar, CommandPalette, CommandPaletteProvider, GlobalFilterProvider, useCommandPalette, Dropdown, Avatar } from '@cameleer/design-system';
|
||||
import { useRouteCatalog } from '../api/queries/catalog';
|
||||
import { useAuthStore } from '../auth/auth-store';
|
||||
import { useMemo, useCallback } from 'react';
|
||||
@@ -9,7 +9,7 @@ function LayoutContent() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { data: catalog } = useRouteCatalog();
|
||||
const { username, roles } = useAuthStore();
|
||||
const { username, roles, logout } = useAuthStore();
|
||||
const { open: paletteOpen, setOpen: setPaletteOpen } = useCommandPalette();
|
||||
|
||||
const sidebarApps: SidebarApp[] = useMemo(() => {
|
||||
@@ -56,10 +56,22 @@ function LayoutContent() {
|
||||
/>
|
||||
}
|
||||
>
|
||||
<TopBar
|
||||
breadcrumb={breadcrumb}
|
||||
user={username ? { name: username } : undefined}
|
||||
/>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<TopBar
|
||||
breadcrumb={breadcrumb}
|
||||
user={username ? { name: username } : undefined}
|
||||
/>
|
||||
{username && (
|
||||
<Dropdown
|
||||
trigger={<Avatar name={username} size="sm" />}
|
||||
items={[
|
||||
{ label: `Signed in as ${username}`, disabled: true },
|
||||
{ divider: true, label: '' },
|
||||
{ label: 'Logout', onClick: () => { logout(); navigate('/login'); } },
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<CommandPalette
|
||||
open={paletteOpen}
|
||||
onClose={() => setPaletteOpen(false)}
|
||||
|
||||
Reference in New Issue
Block a user