feat(ui) Show Glossary and Domains header links to everyone (#5506)

Co-authored-by: Chris Collins <chriscollins@Chriss-MBP-2.lan>
This commit is contained in:
Chris Collins 2022-07-27 17:55:27 -04:00 committed by GitHub
parent 64e7da8a68
commit be296d69a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 43 deletions

View File

@ -14,7 +14,7 @@ import {
} from '../../graphql/search.generated'; } from '../../graphql/search.generated';
import { EntityType } from '../../types.generated'; import { EntityType } from '../../types.generated';
import analytics, { EventType } from '../analytics'; import analytics, { EventType } from '../analytics';
import { AdminHeaderLinks } from '../shared/admin/AdminHeaderLinks'; import { HeaderLinks } from '../shared/admin/HeaderLinks';
import { ANTD_GRAY } from '../entity/shared/constants'; import { ANTD_GRAY } from '../entity/shared/constants';
import { useAppConfig } from '../useAppConfig'; import { useAppConfig } from '../useAppConfig';
import { DEFAULT_APP_CONFIG } from '../../appConfigContext'; import { DEFAULT_APP_CONFIG } from '../../appConfigContext';
@ -188,7 +188,7 @@ export const HomePageHeader = () => {
)} )}
</WelcomeText> </WelcomeText>
<NavGroup> <NavGroup>
<AdminHeaderLinks /> <HeaderLinks />
<ManageAccount <ManageAccount
urn={user?.urn || ''} urn={user?.urn || ''}
pictureLink={user?.editableProperties?.pictureLink || ''} pictureLink={user?.editableProperties?.pictureLink || ''}

View File

@ -8,7 +8,7 @@ import { ManageAccount } from '../shared/ManageAccount';
import { AutoCompleteResultForEntity, EntityType } from '../../types.generated'; import { AutoCompleteResultForEntity, EntityType } from '../../types.generated';
import EntityRegistry from '../entity/EntityRegistry'; import EntityRegistry from '../entity/EntityRegistry';
import { ANTD_GRAY } from '../entity/shared/constants'; import { ANTD_GRAY } from '../entity/shared/constants';
import { AdminHeaderLinks } from '../shared/admin/AdminHeaderLinks'; import { HeaderLinks } from '../shared/admin/HeaderLinks';
import { useAppConfig } from '../useAppConfig'; import { useAppConfig } from '../useAppConfig';
import { DEFAULT_APP_CONFIG } from '../../appConfigContext'; import { DEFAULT_APP_CONFIG } from '../../appConfigContext';
@ -104,7 +104,7 @@ export const SearchHeader = ({
/> />
</LogoSearchContainer> </LogoSearchContainer>
<NavGroup> <NavGroup>
<AdminHeaderLinks areLinksHidden={isSearchBarFocused} /> <HeaderLinks areLinksHidden={isSearchBarFocused} />
<ManageAccount urn={authenticatedUserUrn} pictureLink={authenticatedUserPictureLink || ''} /> <ManageAccount urn={authenticatedUserUrn} pictureLink={authenticatedUserPictureLink || ''} />
</NavGroup> </NavGroup>
</Header> </Header>

View File

@ -14,7 +14,7 @@ import { Button, Dropdown, Menu } from 'antd';
import { useAppConfig } from '../../useAppConfig'; import { useAppConfig } from '../../useAppConfig';
import { useGetAuthenticatedUser } from '../../useGetAuthenticatedUser'; import { useGetAuthenticatedUser } from '../../useGetAuthenticatedUser';
const AdminLink = styled.span` const LinkWrapper = styled.span`
margin-right: 0px; margin-right: 0px;
`; `;
@ -40,7 +40,7 @@ interface Props {
areLinksHidden?: boolean; areLinksHidden?: boolean;
} }
export function AdminHeaderLinks(props: Props) { export function HeaderLinks(props: Props) {
const { areLinksHidden } = props; const { areLinksHidden } = props;
const me = useGetAuthenticatedUser(); const me = useGetAuthenticatedUser();
const { config } = useAppConfig(); const { config } = useAppConfig();
@ -52,66 +52,58 @@ export function AdminHeaderLinks(props: Props) {
const showSettings = true; const showSettings = true;
const showIngestion = const showIngestion =
isIngestionEnabled && me && me.platformPrivileges.manageIngestion && me.platformPrivileges.manageSecrets; isIngestionEnabled && me && me.platformPrivileges.manageIngestion && me.platformPrivileges.manageSecrets;
const showDomains = me?.platformPrivileges?.manageDomains || false;
const showGlossary = me?.platformPrivileges?.manageGlossaries || false;
return ( return (
<LinksWrapper areLinksHidden={areLinksHidden}> <LinksWrapper areLinksHidden={areLinksHidden}>
{showAnalytics && ( {showAnalytics && (
<AdminLink> <LinkWrapper>
<Link to="/analytics"> <Link to="/analytics">
<Button type="text"> <Button type="text">
<BarChartOutlined /> Analytics <BarChartOutlined /> Analytics
</Button> </Button>
</Link> </Link>
</AdminLink> </LinkWrapper>
)} )}
{showIngestion && ( {showIngestion && (
<AdminLink> <LinkWrapper>
<Link to="/ingestion"> <Link to="/ingestion">
<Button type="text"> <Button type="text">
<ApiOutlined /> Ingestion <ApiOutlined /> Ingestion
</Button> </Button>
</Link> </Link>
</AdminLink> </LinkWrapper>
)}
{(showGlossary || showDomains) && (
<Dropdown
trigger={['click']}
overlay={
<Menu>
{showGlossary && (
<MenuItem key="0">
<Link to="/glossary">
<BookOutlined style={{ fontSize: '14px', fontWeight: 'bold' }} /> Glossary
</Link>
</MenuItem>
)}
{showDomains && (
<MenuItem key="1">
<Link to="/domains">
<FolderOutlined style={{ fontSize: '14px', fontWeight: 'bold' }} /> Domains
</Link>
</MenuItem>
)}
</Menu>
}
>
<AdminLink>
<Button type="text">
<SolutionOutlined /> Govern <DownOutlined style={{ fontSize: '6px' }} />
</Button>
</AdminLink>
</Dropdown>
)} )}
<Dropdown
trigger={['click']}
overlay={
<Menu>
<MenuItem key="0">
<Link to="/glossary">
<BookOutlined style={{ fontSize: '14px', fontWeight: 'bold' }} /> Glossary
</Link>
</MenuItem>
<MenuItem key="1">
<Link to="/domains">
<FolderOutlined style={{ fontSize: '14px', fontWeight: 'bold' }} /> Domains
</Link>
</MenuItem>
</Menu>
}
>
<LinkWrapper>
<Button type="text">
<SolutionOutlined /> Govern <DownOutlined style={{ fontSize: '6px' }} />
</Button>
</LinkWrapper>
</Dropdown>
{showSettings && ( {showSettings && (
<AdminLink style={{ marginRight: 12 }}> <LinkWrapper style={{ marginRight: 12 }}>
<Link to="/settings"> <Link to="/settings">
<Button type="text"> <Button type="text">
<SettingOutlined /> <SettingOutlined />
</Button> </Button>
</Link> </Link>
</AdminLink> </LinkWrapper>
)} )}
</LinksWrapper> </LinksWrapper>
); );