-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(UI): AccessManagement UI to access the role metadata for a dataset #8541
Conversation
6d93f20
to
be51228
Compare
@jjoyce0510 |
be51228
to
f4aeda1
Compare
}; | ||
|
||
export default function AccessManagerDescription({ description }: Props) { | ||
const DescriptionContainer = styled.div` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please place these styled components at the top of the file (similar to other components)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
@@ -0,0 +1,27 @@ | |||
export default function handleExternalRoles(externalRoles, loggedInUser) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's name this file utils.ts since it's just a utility function
we can also remove the "Default" in front of function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to utils.ts
externalRoles?.dataset?.access.roles.length > 0 | ||
) { | ||
externalRoles?.dataset?.access?.roles?.forEach((userRoles) => { | ||
const arr = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does "arr" mean here?
can we name this "role"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
const arr = { | ||
name: userRoles?.role?.properties?.name || ' ', | ||
description: userRoles?.role?.properties?.description || ' ', | ||
accesstype: userRoles?.role?.properties?.type || ' ', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCase please!
accessType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
name: userRoles?.role?.properties?.name || ' ', | ||
description: userRoles?.role?.properties?.description || ' ', | ||
accesstype: userRoles?.role?.properties?.type || ' ', | ||
access: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's name this:
hasAccess
to imply that it is boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
setIsExpanded(!expanded); | ||
}; | ||
|
||
if (description.length > 150) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we combine these 2 blocks into 1?
const shouldTruncateDescription = description.length > 150;
const [expanded, setIsExpanded] = useState(!shouldTruncateDescription);
const finalDescription = expanded ? description : description.slice(0, 150);
return (
<DescriptionContainer>
{finalDescription}
<Typography.Link
onClick={() => {
toggleExpanded();
}}
>
{shouldTruncate && (expanded ? ' Read Less' : '...Read More') || undefined}
</Typography.Link>
</DescriptionContainer>
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
]; | ||
|
||
return ( | ||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove this additional div?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
render: (text, record) => { | ||
if (text) { | ||
return ( | ||
<div |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pleae use styled component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
<button | ||
type="button" | ||
style={{ | ||
backgroundColor: '#1890ff', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use styled component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
|
||
const columns = [ | ||
{ | ||
title: 'RoleName', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Role Name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
import AccessManagerDescription from './AccessManagerDescription'; | ||
|
||
export default function AccessManagement() { | ||
const StyledTable = styled(Table)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please place this at the top of the file, similar to toher components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
@@ -68,6 +70,8 @@ export class DatasetEntity implements Entity<Dataset> { | |||
|
|||
isSearchEnabled = () => true; | |||
|
|||
isAccessManagementEnabled = useIsShowAccessManagementEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's get rid of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recieving below error
"React Hook "useIsShowAccessManagementEnabled" is called in function "visible" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter react-hooks/rules-of-hooks"
to resolve that we used isAccessManagementEnabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(please remove this line)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking w my colleague @chriscollins3456
name: 'Access Management', | ||
component: AccessManagement, | ||
display: { | ||
visible: (_, _1) => this.isAccessManagementEnabled(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use the hook here:
visible: (_, _1) => useIsShowAccessManagementEnabled(),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recieving below error
"React Hook "useIsShowAccessManagementEnabled" is called in function "visible" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter react-hooks/rules-of-hooks"
to resolve that we used isAccessManagementEnabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. here's what we want to do then... pass a new optional parameter into the function called "appConfig" in line 249 on EntityProfile.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use a context object actually, then the method can just use that instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @jjoyce0510 we used a context object still had hooks issue. as a solution we called "appConfig" in datasetEntity.tsx
datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/featureflags/FeatureFlags.java
Show resolved
Hide resolved
fontSize?: number; | ||
} | ||
|
||
export default function AccessTermstyle({ data, fontSize, highlightText }: Props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the file name and let's revisit the name of this component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we name it AccessRoleLabel.tsx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the changes as we cannot make changes in the default preview card
if (maxShow && renderedTags > maxShow) return null; | ||
return ( | ||
<div> | ||
{console.log(role?.role)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the changes as we cannot make changes in the default preview card
entityType={EntityType.Role} | ||
useEntityQuery={useGetExternalRoleQuery} | ||
getOverrideProperties={this.getOverridePropertiesFromEntity} | ||
tabs={[]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want Documentation tab?
Since you have the About section, which displays the same information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added RoleEntityProfile in renderpreview similar to tagProfile.tsx
@@ -252,6 +264,7 @@ export class DatasetEntity implements Entity<Dataset> { | |||
platformLogo={data.platform.properties?.logoUrl} | |||
platformInstanceId={data.dataPlatformInstance?.instanceId} | |||
owners={data.ownership?.owners} | |||
access={this.isAccessManagementEnabled() ? data?.access : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not change this preview DatasetEntity.tsx - what are you hoping to achieve with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
@@ -290,6 +303,7 @@ export class DatasetEntity implements Entity<Dataset> { | |||
glossaryTerms={data.glossaryTerms} | |||
subtype={data.subTypes?.typeNames?.[0]} | |||
container={data.container} | |||
access={this.isAccessManagementEnabled() ? data?.access : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not change this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
@@ -101,6 +104,7 @@ export const Preview = ({ | |||
tags={globalTags || undefined} | |||
owners={owners} | |||
domain={domain} | |||
access={access} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not change this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
key: 'hasAccess', | ||
render: (text, record) => { | ||
if (text) { | ||
return <Accessprovision>Provisioned</Accessprovision>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using a Divider component to wrap this text? Let's use a or something similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated with StyledSection
@@ -355,6 +359,8 @@ export default function DefaultPreviewCard({ | |||
{hasGlossaryTerms && <TagTermGroup uneditableGlossaryTerms={glossaryTerms} maxShow={3} />} | |||
{((hasGlossaryTerms && hasTags) || ((dataProduct || domain) && hasTags)) && <TagSeparator />} | |||
{hasTags && <TagTermGroup uneditableTags={tags} maxShow={3} />} | |||
{hasAccess && <TagSeparator />} | |||
{hasAccess && <TagTermGroup uneditableAccess={access} maxShow={3} />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this please. We do not want to accept changes to one of the most important components we have - the default preview card.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done update
@@ -12,3 +12,8 @@ export function useIsShowAcrylInfoEnabled() { | |||
const appConfig = useAppConfig(); | |||
return appConfig.config.featureFlags.showAcrylInfo; | |||
} | |||
|
|||
export function useIsShowAccessManagementEnabled(): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we pass the appConfig into the visible function, we should no longer need this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed useIsShowAccessManagementEnabled()
1b032a2
to
295743d
Compare
@@ -1451,7 +1455,7 @@ type Role implements Entity { | |||
""" | |||
Role properties to include Request Access Url | |||
""" | |||
properties: RoleProperties! | |||
properties: RoleProperties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this no longer an optional field? What happens if someone wishes to create a role without properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @anshbansal we are facing issues in search and autocomplete in web-react search.graphql if we are making it as optional field. i.e why we update the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice stuff here gang! this PR is very very close. I only have one real request and that's around an error I saw in the UI when no actors were associated with a role and so we weren't setting it on the role graphql object but we defined it as required on the graphql side (simple fix is simply make actors
not required to return on graphql)
Otherwise I have a few small suggestions and wanted to call out how the profile page is pretty bare bones right now but maybe that's alright.
<Paragraph style={{ fontSize: '12px', lineHeight: '15px', padding: '5px 0px' }}> | ||
{data?.role?.properties?.description} | ||
</Paragraph> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so you don't want to allow users to edit role entity descriptions through the UI? you could get the same functionality as other entities if you used EntityProfile
and passed in a list of tabs and sidebar sections instead of defining your own entity profile page for this one entity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @chriscollins3456 for Roles the description is not editable. We have description for the accessRole coming from an external source we are updating in datahub if we provide option to edit the dscription we would not be able to update the same at source.
@@ -1451,7 +1455,7 @@ type Role implements Entity { | |||
""" | |||
Role properties to include Request Access Url | |||
""" | |||
properties: RoleProperties! | |||
properties: RoleProperties | |||
|
|||
""" | |||
A standard Entity Type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm getting an error when trying locally if I don't set any role actors on a role saying that this is a required field that was not set.
I'd make this field not required for graphql since we aren't always setting actors on the result as you can see in RoleMapper.java
final EnvelopedAspect envelopedUsers = aspects.get(Constants.ROLE_ACTORS_ASPECT_NAME);
if (envelopedUsers != null) {
result.setActors(mapActor(new Actors(envelopedUsers.getValue().data())));
}
Or alternatively we could always set an empty list of actors and always return it saying we don't have any actors. either way we need to prevent this error from popping up:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the actor as optional.
render: (text, record) => { | ||
if (text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text
is a bit confusing here. can it be called hasAccess
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
(user) => user.user.urn === loggedInUser?.me?.corpUser.urn, | ||
)) || | ||
false, | ||
url: userRoles?.role?.properties?.requestUrl || window.location.href, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: so if there's no requestUrl on the role we just send them to this page? I feel like the button should either not exist to request access or it should be disabled with a tooltip saying this role has no request access URL associated with it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @chriscollins3456 updated we have removed request button if there is no request url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice thanks for addressing those comments! this is looking good to me thanks for all of your work here 👍
@Ramendra761 Could you please describe shortly how to use this feature? just deployed 0.12 but didn't see any Access management tab in the UI. |
@Ramendra761 nice work! I enabled access management via the |
The aim of this feature is to add a new tab for Access Management to enable users to view the required roles (Roles/Policies defined in Access Management System of an organisation) for accessing a dataset in that organisation for a dataset. Also allow user to raise the request for a required role if user dont have access.
People can navigate to a dataset and view list of roles necessary to access that dataset. We can click on a dataset role and request access from that page.
Attaching the RFC for further details
rfc-DatahubUI.pdf
Uploading RFC.-.Addition.of.External.Access.Managemt.pdf…
reference PR - 8499
Checklist