From db7d98ec9ab7e7952a40bf67416bede2ea7fdb86 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 17 Jan 2025 12:10:23 -0700 Subject: [PATCH] add additional bulk popup menus Co-Authored-By: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- .../PermissionDatasetGroupSelectedPopup.tsx | 2 +- .../PermissionListDatasetGroupContainer.tsx | 40 +++++---- ...PermissionListPermissionGroupContainer.tsx | 33 +++----- .../PermissionListUsersContainer.tsx | 80 ++++++++---------- .../_PermissionUsers/PermissionUsers.tsx | 6 +- .../PermissionUsersSelectedPopup.tsx | 81 +++++++++++++++++++ .../permissions/_PermissionUsers/config.ts | 10 +++ .../_components/PermissionListContainer.tsx | 30 +++++++ .../permissions/_components/index.ts | 1 + web/src/app/test/list/test2/page.tsx | 3 - .../list/BusterList/BusterListReactWindow.tsx | 16 +++- .../BusterList/BusterListRowComponent.tsx | 5 +- 12 files changed, 204 insertions(+), 103 deletions(-) create mode 100644 web/src/app/app/datasets/[datasetId]/permissions/_PermissionUsers/PermissionUsersSelectedPopup.tsx create mode 100644 web/src/app/app/datasets/[datasetId]/permissions/_PermissionUsers/config.ts create mode 100644 web/src/app/app/datasets/[datasetId]/permissions/_components/PermissionListContainer.tsx create mode 100644 web/src/app/app/datasets/[datasetId]/permissions/_components/index.ts diff --git a/web/src/app/app/datasets/[datasetId]/permissions/_PermissionDatasetGroups/PermissionDatasetGroupSelectedPopup.tsx b/web/src/app/app/datasets/[datasetId]/permissions/_PermissionDatasetGroups/PermissionDatasetGroupSelectedPopup.tsx index e5b1af3d3..9e6cf5833 100644 --- a/web/src/app/app/datasets/[datasetId]/permissions/_PermissionDatasetGroups/PermissionDatasetGroupSelectedPopup.tsx +++ b/web/src/app/app/datasets/[datasetId]/permissions/_PermissionDatasetGroups/PermissionDatasetGroupSelectedPopup.tsx @@ -19,7 +19,7 @@ export const PermissionDatasetGroupSelectedPopup: React.FC<{ onSelectChange={onSelectChange} buttons={[ = ({ filteredPermissionGroups, datasetId }) => { - const { styles, cx } = useStyles(); const { mutateAsync: updateDatasetGroups } = useDatasetUpdateDatasetGroups(datasetId); const [selectedRowKeys, setSelectedRowKeys] = useState([]); const numberOfPermissionGroups = filteredPermissionGroups.length; @@ -107,36 +107,28 @@ export const PermissionListDatasetGroupContainer: React.FC<{ ); return ( - <> -
- No dataset groups found
} + datasetId={datasetId} /> - - - + No dataset groups found} /> - + ); }; -const useStyles = createStyles(({ css, token }) => ({ - container: css` - border: 0.5px solid ${token.colorBorder}; - border-radius: ${token.borderRadius}px; - overflow: hidden; - ` -})); - const DatasetGroupInfoCell: React.FC<{ name: string }> = ({ name }) => { return
{name}
; }; @@ -165,6 +157,10 @@ const DatasetGroupAssignedCell: React.FC<{ onSelect={(value) => { onSelect({ id, assigned: value }); }} + onClick={(e) => { + e.preventDefault(); + e.stopPropagation(); + }} /> ); }); diff --git a/web/src/app/app/datasets/[datasetId]/permissions/_PermissionPermissionGroup/PermissionListPermissionGroupContainer.tsx b/web/src/app/app/datasets/[datasetId]/permissions/_PermissionPermissionGroup/PermissionListPermissionGroupContainer.tsx index b6329118c..69453e91f 100644 --- a/web/src/app/app/datasets/[datasetId]/permissions/_PermissionPermissionGroup/PermissionListPermissionGroupContainer.tsx +++ b/web/src/app/app/datasets/[datasetId]/permissions/_PermissionPermissionGroup/PermissionListPermissionGroupContainer.tsx @@ -5,18 +5,17 @@ import { import { BusterListColumn, BusterListRowItem } from '@/components/list'; import { useMemoizedFn } from 'ahooks'; import { Select } from 'antd'; -import { createStyles } from 'antd-style'; import React, { useMemo, useState } from 'react'; import { Text } from '@/components/text'; import { PermissionGroupSelectedPopup } from './PermissionGroupSelectedPopup'; import { BusterInfiniteList } from '@/components/list/BusterInfiniteList'; import { PERMISSION_GROUP_ASSIGNED_OPTIONS } from './config'; +import { PermissionListContainer } from '../_components/PermissionListContainer'; export const PermissionListPermissionGroupContainer: React.FC<{ filteredPermissionGroups: ListPermissionGroupsResponse[]; datasetId: string; }> = React.memo(({ filteredPermissionGroups, datasetId }) => { - const { styles, cx } = useStyles(); const { mutateAsync: updatePermissionGroups } = useDatasetUpdatePermissionGroups(datasetId); const [selectedRowKeys, setSelectedRowKeys] = useState([]); @@ -113,7 +112,14 @@ export const PermissionListPermissionGroupContainer: React.FC<{ ); return ( -
+ + }> } useRowClickSelectChange={true} /> - -
-
- -
-
-
+ ); }); PermissionListPermissionGroupContainer.displayName = 'PermissionListTeamContainer'; -const useStyles = createStyles(({ css, token }) => ({ - container: css` - border: 0.5px solid ${token.colorBorder}; - border-radius: ${token.borderRadius}px; - ` -})); - const PermissionGroupInfoCell = React.memo(({ name }: { name: string }) => { return
{name}
; }); @@ -165,7 +154,7 @@ export const PermissionGroupAssignedCell = React.memo( return ( { - onSelect({ id, assigned: value }); - }} - /> - ); - }, - () => true -); - -PermissionGroupAssignedCell.displayName = 'PermissionGroupAssignedCell'; +const PermissionGroupAssignedCell: React.FC<{ + id: string; + assigned: boolean; + onSelect: (value: { id: string; assigned: boolean }) => void; +}> = ({ id, assigned, onSelect }) => { + return ( +