mirror of https://github.com/buster-so/buster.git
add a popup for permissions
This commit is contained in:
parent
33bcd9f34e
commit
7e9daac477
|
@ -0,0 +1,31 @@
|
||||||
|
import { BusterListSelectedOptionPopupContainer } from '@/components/list';
|
||||||
|
import { Button } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export const PermissionGroupSelectedPopup: React.FC<{
|
||||||
|
selectedRowKeys: string[];
|
||||||
|
onSelectChange: (selectedRowKeys: string[]) => void;
|
||||||
|
}> = React.memo(({ selectedRowKeys, onSelectChange }) => {
|
||||||
|
return (
|
||||||
|
<BusterListSelectedOptionPopupContainer
|
||||||
|
selectedRowKeys={selectedRowKeys}
|
||||||
|
onSelectChange={onSelectChange}
|
||||||
|
buttons={[
|
||||||
|
<PermissionGroupAssignButton
|
||||||
|
key="assign"
|
||||||
|
selectedRowKeys={selectedRowKeys}
|
||||||
|
onSelectChange={onSelectChange}
|
||||||
|
/>
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
PermissionGroupSelectedPopup.displayName = 'PermissionGroupSelectedPopup';
|
||||||
|
|
||||||
|
const PermissionGroupAssignButton: React.FC<{
|
||||||
|
selectedRowKeys: string[];
|
||||||
|
onSelectChange: (selectedRowKeys: string[]) => void;
|
||||||
|
}> = ({ selectedRowKeys, onSelectChange }) => {
|
||||||
|
return <Button>Assign</Button>;
|
||||||
|
};
|
|
@ -3,12 +3,13 @@ import {
|
||||||
useDatasetUpdatePermissionGroups
|
useDatasetUpdatePermissionGroups
|
||||||
} from '@/api/busterv2/datasets';
|
} from '@/api/busterv2/datasets';
|
||||||
import { BusterListColumn, BusterListRowItem } from '@/components/list';
|
import { BusterListColumn, BusterListRowItem } from '@/components/list';
|
||||||
import { BusterInfiniteList } from '@/components/list/BusterInfiniteList';
|
|
||||||
import { useMemoizedFn } from 'ahooks';
|
import { useMemoizedFn } from 'ahooks';
|
||||||
import { Select } from 'antd';
|
import { Select } from 'antd';
|
||||||
import { createStyles } from 'antd-style';
|
import { createStyles } from 'antd-style';
|
||||||
import React, { useMemo, useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { Text } from '@/components/text';
|
import { Text } from '@/components/text';
|
||||||
|
import { PermissionGroupSelectedPopup } from './PermissionGroupSelectedPopup';
|
||||||
|
import { BusterInfiniteList } from '@/components/list/BusterInfiniteList';
|
||||||
|
|
||||||
export const PermissionListPermissionGroupContainer: React.FC<{
|
export const PermissionListPermissionGroupContainer: React.FC<{
|
||||||
filteredPermissionGroups: ListPermissionGroupsResponse[];
|
filteredPermissionGroups: ListPermissionGroupsResponse[];
|
||||||
|
@ -111,7 +112,7 @@ export const PermissionListPermissionGroupContainer: React.FC<{
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cx('', styles.container)}>
|
<div className={cx('min-h-fit overflow-hidden', styles.container)}>
|
||||||
<BusterInfiniteList
|
<BusterInfiniteList
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rows={rows}
|
rows={rows}
|
||||||
|
@ -121,6 +122,15 @@ export const PermissionListPermissionGroupContainer: React.FC<{
|
||||||
onSelectChange={setSelectedRowKeys}
|
onSelectChange={setSelectedRowKeys}
|
||||||
emptyState={<EmptyState />}
|
emptyState={<EmptyState />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div className="fixed bottom-1 left-0 right-0 w-full">
|
||||||
|
<div className="relative ml-[220px] mr-[55px]">
|
||||||
|
<PermissionGroupSelectedPopup
|
||||||
|
selectedRowKeys={selectedRowKeys}
|
||||||
|
onSelectChange={setSelectedRowKeys}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -131,7 +141,6 @@ const useStyles = createStyles(({ css, token }) => ({
|
||||||
container: css`
|
container: css`
|
||||||
border: 0.5px solid ${token.colorBorder};
|
border: 0.5px solid ${token.colorBorder};
|
||||||
border-radius: ${token.borderRadius}px;
|
border-radius: ${token.borderRadius}px;
|
||||||
overflow: hidden;
|
|
||||||
`
|
`
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,13 @@ export const PermissionPermissionGroup: React.FC<{
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="flex h-full w-full flex-col">
|
||||||
<HeaderExplanation
|
<HeaderExplanation
|
||||||
className="mb-5"
|
className="mb-5"
|
||||||
title="Dataset permissions"
|
title="Dataset permissions"
|
||||||
description="Manage who can build dashboards & metrics using this dataset"
|
description="Manage who can build dashboards & metrics using this dataset"
|
||||||
/>
|
/>
|
||||||
<div className="flex h-full flex-col space-y-3">
|
<div className="mb-12 flex h-fit flex-col space-y-3">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<PermissionSearch
|
<PermissionSearch
|
||||||
searchText={searchText}
|
searchText={searchText}
|
||||||
|
@ -64,7 +64,7 @@ export const PermissionPermissionGroup: React.FC<{
|
||||||
onClose={onCloseNewPermissionGroupModal}
|
onClose={onCloseNewPermissionGroupModal}
|
||||||
datasetId={datasetId}
|
datasetId={datasetId}
|
||||||
/>
|
/>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ export default async function Page({ params }: { params: { datasetId: string } }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||||
<div className="m-auto flex h-full max-w-[1400px] flex-col space-y-5 overflow-y-auto px-14 pb-12 pt-12">
|
<div className="m-auto flex h-full max-w-[1400px] flex-col space-y-5 overflow-y-auto px-14 pt-12">
|
||||||
<PermissionTitleCard />
|
<PermissionTitleCard />
|
||||||
<PermissionsAppContainer datasetId={datasetId} />
|
<PermissionsAppContainer datasetId={datasetId} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -104,7 +104,7 @@ export const BusterInfiniteList: React.FC<BusterInfiniteListProps> = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="infinite-list-container relative flex h-full w-full flex-col overflow-auto"
|
className="infinite-list-container relative flex h-full w-full flex-col"
|
||||||
ref={containerRef}>
|
ref={containerRef}>
|
||||||
{showHeader && !showEmptyState && (
|
{showHeader && !showEmptyState && (
|
||||||
<BusterListHeader
|
<BusterListHeader
|
||||||
|
@ -117,11 +117,11 @@ export const BusterInfiniteList: React.FC<BusterInfiniteListProps> = ({
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!showEmptyState && (
|
{!showEmptyState && (
|
||||||
<div className="relative h-full w-full">
|
<>
|
||||||
{rows.map((row) => (
|
{rows.map((row) => (
|
||||||
<BusterListRowComponentSelector key={row.id} row={row} id={row.id} {...itemData} />
|
<BusterListRowComponentSelector key={row.id} row={row} id={row.id} {...itemData} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showEmptyState && (
|
{showEmptyState && (
|
||||||
|
|
|
@ -8,11 +8,13 @@ import { AnimatePresence, motion } from 'framer-motion';
|
||||||
export const BusterListSelectedOptionPopupContainer: React.FC<{
|
export const BusterListSelectedOptionPopupContainer: React.FC<{
|
||||||
selectedRowKeys: string[];
|
selectedRowKeys: string[];
|
||||||
onSelectChange: (selectedRowKeys: string[]) => void;
|
onSelectChange: (selectedRowKeys: string[]) => void;
|
||||||
buttons: React.ReactNode[];
|
buttons?: React.ReactNode[];
|
||||||
show: boolean;
|
show?: boolean;
|
||||||
}> = ({ selectedRowKeys, onSelectChange, buttons = [], show }) => {
|
}> = ({ selectedRowKeys, onSelectChange, buttons = [], show: showProp }) => {
|
||||||
const token = useAntToken();
|
const token = useAntToken();
|
||||||
|
|
||||||
|
const show = showProp ?? selectedRowKeys.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatePresence mode="wait">
|
<AnimatePresence mode="wait">
|
||||||
{show && (
|
{show && (
|
||||||
|
|
Loading…
Reference in New Issue