-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into docs/add-markdown-link-check
- Loading branch information
Showing
25 changed files
with
787 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { TagOutlined, TagFilled } from '@ant-design/icons'; | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
import { Role, EntityType, SearchResult } from '../../../types.generated'; | ||
import DefaultPreviewCard from '../../preview/DefaultPreviewCard'; | ||
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity'; | ||
import { getDataForEntityType } from '../shared/containers/profile/utils'; | ||
import { urlEncodeUrn } from '../shared/utils'; | ||
import RoleEntityProfile from './RoleEntityProfile'; | ||
|
||
const PreviewTagIcon = styled(TagOutlined)` | ||
font-size: 20px; | ||
`; | ||
// /** | ||
// * Definition of the DataHub Access Role entity. | ||
// */ | ||
export class RoleEntity implements Entity<Role> { | ||
type: EntityType = EntityType.Role; | ||
|
||
icon = (fontSize: number, styleType: IconStyleType, color?: string) => { | ||
if (styleType === IconStyleType.TAB_VIEW) { | ||
return <TagFilled style={{ fontSize, color }} />; | ||
} | ||
|
||
if (styleType === IconStyleType.HIGHLIGHT) { | ||
return <TagFilled style={{ fontSize, color: color || '#B37FEB' }} />; | ||
} | ||
|
||
return ( | ||
<TagOutlined | ||
style={{ | ||
fontSize, | ||
color: color || '#BFBFBF', | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
isSearchEnabled = () => true; | ||
|
||
isBrowseEnabled = () => false; | ||
|
||
isLineageEnabled = () => false; | ||
|
||
getAutoCompleteFieldName = () => 'name'; | ||
|
||
getPathName: () => string = () => 'role'; | ||
|
||
getCollectionName: () => string = () => 'Roles'; | ||
|
||
getEntityName: () => string = () => 'Role'; | ||
|
||
renderProfile: (urn: string) => JSX.Element = (_) => <RoleEntityProfile />; | ||
|
||
renderPreview = (_: PreviewType, data: Role) => ( | ||
<DefaultPreviewCard | ||
description={data?.properties?.description || ''} | ||
name={this.displayName(data)} | ||
urn={data.urn} | ||
url={`/${this.getPathName()}/${urlEncodeUrn(data.urn)}`} | ||
logoComponent={<PreviewTagIcon />} | ||
type="Role" | ||
typeIcon={this.icon(14, IconStyleType.ACCENT)} | ||
/> | ||
); | ||
|
||
renderSearch = (result: SearchResult) => { | ||
return this.renderPreview(PreviewType.SEARCH, result.entity as Role); | ||
}; | ||
|
||
displayName = (data: Role) => { | ||
return data.properties?.name || data.urn; | ||
}; | ||
|
||
getOverridePropertiesFromEntity = (data: Role) => { | ||
return { | ||
name: data.properties?.name, | ||
}; | ||
}; | ||
|
||
getGenericEntityProperties = (role: Role) => { | ||
return getDataForEntityType({ data: role, entityType: this.type, getOverrideProperties: (data) => data }); | ||
}; | ||
|
||
supportedCapabilities = () => { | ||
return new Set([EntityCapabilityType.OWNERS]); | ||
}; | ||
} |
75 changes: 75 additions & 0 deletions
75
datahub-web-react/src/app/entity/Access/RoleEntityProfile.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React from 'react'; | ||
|
||
import { useParams } from 'react-router'; | ||
import { Divider, Typography } from 'antd'; | ||
import { grey } from '@ant-design/colors'; | ||
import styled from 'styled-components'; | ||
|
||
import { Message } from '../../shared/Message'; | ||
import { decodeUrn } from '../shared/utils'; | ||
import { useGetExternalRoleQuery } from '../../../graphql/accessrole.generated'; | ||
|
||
const PageContainer = styled.div` | ||
padding: 32px 100px; | ||
`; | ||
|
||
const LoadingMessage = styled(Message)` | ||
margin-top: 10%; | ||
`; | ||
|
||
type RolePageParams = { | ||
urn: string; | ||
}; | ||
|
||
const TitleLabel = styled(Typography.Text)` | ||
&&& { | ||
color: ${grey[2]}; | ||
font-size: 12px; | ||
display: block; | ||
line-height: 20px; | ||
font-weight: 700; | ||
} | ||
`; | ||
|
||
const DescriptionLabel = styled(Typography.Text)` | ||
&&& { | ||
text-align: left; | ||
font-weight: bold; | ||
font-size: 14px; | ||
line-height: 28px; | ||
color: rgb(38, 38, 38); | ||
} | ||
`; | ||
|
||
const TitleText = styled(Typography.Text)` | ||
&&& { | ||
color: ${grey[10]}; | ||
font-weight: 700; | ||
font-size: 20px; | ||
line-height: 28px; | ||
display: inline-block; | ||
margin: 0px 7px; | ||
} | ||
`; | ||
|
||
const { Paragraph } = Typography; | ||
|
||
export default function RoleEntityProfile() { | ||
const { urn: encodedUrn } = useParams<RolePageParams>(); | ||
const urn = decodeUrn(encodedUrn); | ||
const { data, loading } = useGetExternalRoleQuery({ variables: { urn } }); | ||
|
||
return ( | ||
<PageContainer> | ||
{loading && <LoadingMessage type="loading" content="Loading..." />} | ||
<TitleLabel>Role</TitleLabel> | ||
<TitleText>{data?.role?.properties?.name}</TitleText> | ||
<Divider /> | ||
{/* Role Description */} | ||
<DescriptionLabel>About</DescriptionLabel> | ||
<Paragraph style={{ fontSize: '12px', lineHeight: '15px', padding: '5px 0px' }}> | ||
{data?.role?.properties?.description} | ||
</Paragraph> | ||
</PageContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.