Skip to content

Commit

Permalink
feat: add view logs to HeaderSystemMenu (ENG-55440)
Browse files Browse the repository at this point in the history
  • Loading branch information
abartella-bc committed Apr 11, 2024
1 parent c7fc72b commit cb4f541
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/header/HeaderSystemMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,18 @@ import './HeaderSystemMenu.less';
const HeaderSystemMenu = ({ className }) => {
const { data } = usePlatformData();
const canDownloadLogs = data?.user?.permissions.download_logs;
const canViewLogs = data?.user?.permissions.view_logs;
const downloadLogs = () =>
window.open('/admin/logs/download', '_blank').focus();
const viewLogs = () => window.open('admin/logs/view', '_blank').focus();

const { expanded, buttonProps, menuProps, guardProps } = useMenuHandler();

resizeButtonMenu(expanded, 'systemMenuButton', 'systemMenu');

return (
<>
{canDownloadLogs && (
{(canDownloadLogs || canViewLogs) && (
<div className={className}>
<button
id='systemMenuButton'
Expand All @@ -81,11 +83,20 @@ const HeaderSystemMenu = ({ className }) => {
aria-label={`System Menu`}>
<div tabIndex={0} {...guardProps} />
<Menu {...menuProps}>
<MenuItem
id='systemMenu-dl_logs'
onClick={
downloadLogs
}>{t`Download logs`}</MenuItem>
{canDownloadLogs && (
<MenuItem
id='systemMenu-dl_logs'
onClick={
downloadLogs
}>{t`Download logs`}</MenuItem>
)}
{canViewLogs && (
<MenuItem
id='systemMenu-vw_logs'
onClick={
viewLogs
}>{t`View logs`}</MenuItem>
)}
</Menu>
<div tabIndex={0} {...guardProps} />
</Layer>
Expand Down

0 comments on commit cb4f541

Please sign in to comment.