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';
import { EntityType } from '../../types.generated';
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 { useAppConfig } from '../useAppConfig';
import { DEFAULT_APP_CONFIG } from '../../appConfigContext';
@ -188,7 +188,7 @@ export const HomePageHeader = () => {
)}
</WelcomeText>
<NavGroup>
<AdminHeaderLinks />
<HeaderLinks />
<ManageAccount
urn={user?.urn || ''}
pictureLink={user?.editableProperties?.pictureLink || ''}

View File

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

View File

@ -14,7 +14,7 @@ import { Button, Dropdown, Menu } from 'antd';
import { useAppConfig } from '../../useAppConfig';
import { useGetAuthenticatedUser } from '../../useGetAuthenticatedUser';
const AdminLink = styled.span`
const LinkWrapper = styled.span`
margin-right: 0px;
`;
@ -40,7 +40,7 @@ interface Props {
areLinksHidden?: boolean;
}
export function AdminHeaderLinks(props: Props) {
export function HeaderLinks(props: Props) {
const { areLinksHidden } = props;
const me = useGetAuthenticatedUser();
const { config } = useAppConfig();
@ -52,66 +52,58 @@ export function AdminHeaderLinks(props: Props) {
const showSettings = true;
const showIngestion =
isIngestionEnabled && me && me.platformPrivileges.manageIngestion && me.platformPrivileges.manageSecrets;
const showDomains = me?.platformPrivileges?.manageDomains || false;
const showGlossary = me?.platformPrivileges?.manageGlossaries || false;
return (
<LinksWrapper areLinksHidden={areLinksHidden}>
{showAnalytics && (
<AdminLink>
<LinkWrapper>
<Link to="/analytics">
<Button type="text">
<BarChartOutlined /> Analytics
</Button>
</Link>
</AdminLink>
</LinkWrapper>
)}
{showIngestion && (
<AdminLink>
<LinkWrapper>
<Link to="/ingestion">
<Button type="text">
<ApiOutlined /> Ingestion
</Button>
</Link>
</AdminLink>
)}
{(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>
</LinkWrapper>
)}
<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 && (
<AdminLink style={{ marginRight: 12 }}>
<LinkWrapper style={{ marginRight: 12 }}>
<Link to="/settings">
<Button type="text">
<SettingOutlined />
</Button>
</Link>
</AdminLink>
</LinkWrapper>
)}
</LinksWrapper>
);