mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-10 15:59:57 +00:00
changing admin accessibility on dataset page (#182)
* changing admin accessibility on dataset page * minor change
This commit is contained in:
parent
e006191ca7
commit
a3ff766947
@ -4,9 +4,10 @@ import PopOver from '../popover/PopOver';
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
title: string;
|
title?: string;
|
||||||
position?: 'top' | 'right' | 'bottom' | 'left';
|
position?: 'top' | 'right' | 'bottom' | 'left';
|
||||||
isOwner?: boolean;
|
isOwner?: boolean;
|
||||||
|
html?: React.ReactElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
const NonAdminAction = ({
|
const NonAdminAction = ({
|
||||||
@ -14,6 +15,7 @@ const NonAdminAction = ({
|
|||||||
position = 'top',
|
position = 'top',
|
||||||
title,
|
title,
|
||||||
isOwner = false,
|
isOwner = false,
|
||||||
|
html,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { isAuthDisabled, isAdminUser } = useAuth();
|
const { isAuthDisabled, isAdminUser } = useAuth();
|
||||||
|
|
||||||
@ -29,7 +31,11 @@ const NonAdminAction = ({
|
|||||||
{isAdminUser || isOwner || isAuthDisabled ? (
|
{isAdminUser || isOwner || isAuthDisabled ? (
|
||||||
<span>{children}</span>
|
<span>{children}</span>
|
||||||
) : (
|
) : (
|
||||||
<PopOver position={position} title={title} trigger="mouseenter">
|
<PopOver
|
||||||
|
html={html}
|
||||||
|
position={position}
|
||||||
|
title={title}
|
||||||
|
trigger="mouseenter">
|
||||||
<span className="disable-cta">
|
<span className="disable-cta">
|
||||||
<span
|
<span
|
||||||
onClickCapture={handleCapturedEvent}
|
onClickCapture={handleCapturedEvent}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ const RichTextEditorPreviewer = ({ markdown }: { markdown: string }) => {
|
|||||||
ul: ({ node, children, ...props }) => {
|
ul: ({ node, children, ...props }) => {
|
||||||
const { ordered: _ordered, ...rest } = props;
|
const { ordered: _ordered, ...rest } = props;
|
||||||
return (
|
return (
|
||||||
<ul style={{ marginLeft: '14px' }} {...rest}>
|
<ul style={{ marginLeft: '16px' }} {...rest}>
|
||||||
{children}
|
{children}
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import { getUserTeams } from '../../utils/CommonUtils';
|
|||||||
import SVGIcons from '../../utils/SvgUtils';
|
import SVGIcons from '../../utils/SvgUtils';
|
||||||
import { Button } from '../buttons/Button/Button';
|
import { Button } from '../buttons/Button/Button';
|
||||||
import CardListItem from '../card-list/CardListItem/CardWithListItems';
|
import CardListItem from '../card-list/CardListItem/CardWithListItems';
|
||||||
|
import NonAdminAction from '../common/non-admin-action/NonAdminAction';
|
||||||
import DropDownList from '../dropdown/DropDownList';
|
import DropDownList from '../dropdown/DropDownList';
|
||||||
import Loader from '../Loader/Loader';
|
import Loader from '../Loader/Loader';
|
||||||
|
|
||||||
@ -34,12 +35,14 @@ type Props = {
|
|||||||
owner: TableDetail['owner'],
|
owner: TableDetail['owner'],
|
||||||
tier: TableDetail['tier']
|
tier: TableDetail['tier']
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
|
hasEditAccess: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ManageTab: FunctionComponent<Props> = ({
|
const ManageTab: FunctionComponent<Props> = ({
|
||||||
currentTier = '',
|
currentTier = '',
|
||||||
currentUser = '',
|
currentUser = '',
|
||||||
onSave,
|
onSave,
|
||||||
|
hasEditAccess,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { data } = cardData;
|
const { data } = cardData;
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
@ -162,12 +165,22 @@ const ManageTab: FunctionComponent<Props> = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="tw-flex tw-flex-col">
|
<div className="tw-flex tw-flex-col">
|
||||||
{data.map((card, i) => (
|
{data.map((card, i) => (
|
||||||
<CardListItem
|
<NonAdminAction
|
||||||
card={card}
|
html={
|
||||||
isActive={activeTier === card.id}
|
<>
|
||||||
|
<p>You need ownership to perform this action</p>
|
||||||
|
<p>Claim ownership from above </p>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
isOwner={hasEditAccess || Boolean(owner)}
|
||||||
key={i}
|
key={i}
|
||||||
onSelect={handleCardSelection}
|
position="left">
|
||||||
/>
|
<CardListItem
|
||||||
|
card={card}
|
||||||
|
isActive={activeTier === card.id}
|
||||||
|
onSelect={handleCardSelection}
|
||||||
|
/>
|
||||||
|
</NonAdminAction>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="tw-mt-6 tw-text-right">
|
<div className="tw-mt-6 tw-text-right">
|
||||||
|
|||||||
@ -449,8 +449,8 @@ const MyDataDetailsPage = () => {
|
|||||||
{'Schema '}
|
{'Schema '}
|
||||||
</button>
|
</button>
|
||||||
<NonAdminAction
|
<NonAdminAction
|
||||||
isOwner={hasEditAccess()}
|
isOwner={!owner || hasEditAccess()}
|
||||||
title="Only Owner and Admin is allowed for the action">
|
title="You need ownership to perform this action">
|
||||||
<button
|
<button
|
||||||
className={getTabClasses(6, activeTab)}
|
className={getTabClasses(6, activeTab)}
|
||||||
data-testid="tab"
|
data-testid="tab"
|
||||||
@ -472,8 +472,15 @@ const MyDataDetailsPage = () => {
|
|||||||
</span>
|
</span>
|
||||||
<div className="tw-flex-initial">
|
<div className="tw-flex-initial">
|
||||||
<NonAdminAction
|
<NonAdminAction
|
||||||
isOwner={hasEditAccess()}
|
html={
|
||||||
title="Only Owner and Admin is allowed for the action">
|
<>
|
||||||
|
<p>You need ownership to perform this action</p>
|
||||||
|
{!owner ? (
|
||||||
|
<p>Claim ownership in Manage </p>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
isOwner={hasEditAccess()}>
|
||||||
<button
|
<button
|
||||||
className="focus:tw-outline-none"
|
className="focus:tw-outline-none"
|
||||||
onClick={onDescriptionEdit}>
|
onClick={onDescriptionEdit}>
|
||||||
@ -535,6 +542,7 @@ const MyDataDetailsPage = () => {
|
|||||||
<ManageTab
|
<ManageTab
|
||||||
currentTier={tier}
|
currentTier={tier}
|
||||||
currentUser={owner?.id}
|
currentUser={owner?.id}
|
||||||
|
hasEditAccess={hasEditAccess()}
|
||||||
onSave={onSettingsUpdate}
|
onSave={onSettingsUpdate}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user