Skip to content

Commit

Permalink
fix: Don't show logout button when auth is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
codablock committed Aug 23, 2023
1 parent 5a0b008 commit 8f1be95
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/webui/ui/src/components/LeftDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ListItemButton from '@mui/material/ListItemButton';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import { Link, useLocation } from "react-router-dom";
import { AppOutletContext } from "./App";
import { AppOutletContext, useAppContext } from "./App";
import { KluctlLogo, KluctlText, LogoutIcon, TargetsIcon } from '../icons/Icons';
import { dark } from './theme';
import { Typography } from '@mui/material';
Expand Down Expand Up @@ -141,6 +141,7 @@ export default function LeftDrawer(props: {
context: AppOutletContext,
logout: () => void
}) {
const appCtx = useAppContext()
const [open, setOpen] = useState(true);
const location = useLocation()
const theme = useTheme();
Expand Down Expand Up @@ -186,11 +187,11 @@ export default function LeftDrawer(props: {
<Item text={"Targets"} open={open} icon={<TargetsIcon />} to={"targets"} selected />
</List>
</Box>
<Box flex='0 0 auto'>
{appCtx.authInfo.authEnabled && <Box flex='0 0 auto'>
<List sx={{ padding: 0 }}>
<Item text={"Log Out"} open={open} icon={<LogoutIcon />} onClick={props.logout} />
</List>
</Box>
</Box>}
</Box>
</Drawer>
</ThemeProvider>
Expand Down

0 comments on commit 8f1be95

Please sign in to comment.