mirror of https://github.com/buster-so/buster.git
highlighted permission group downdown
This commit is contained in:
parent
65174dcf9e
commit
ad394c6cef
|
@ -9,10 +9,11 @@ import {
|
|||
import { queryKeys } from '@/api/query_keys';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
|
||||
export const useListDatasources = () => {
|
||||
export const useListDatasources = (enabled: boolean) => {
|
||||
return useQuery({
|
||||
...queryKeys.datasourceGetList,
|
||||
queryFn: listDatasources
|
||||
queryFn: listDatasources,
|
||||
enabled
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ export const PermissionListDatasetGroupContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionGroups.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionGroups.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -87,7 +87,7 @@ export const PermissionListUserContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryUsers.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryUsers.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -98,7 +98,7 @@ export const PermissionListPermissionGroupContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionGroups.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionGroups.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -108,7 +108,7 @@ export const DatasetGroupDatasetsListContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionUsers.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionUsers.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -108,7 +108,7 @@ export const DatasetGroupDatasetGroupsListContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionDatasetGroups.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionDatasetGroups.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -112,7 +112,7 @@ export const DatasetGroupUsersListContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionUsers.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionUsers.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -103,7 +103,7 @@ export const PermissionGroupDatasetGroupsListContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionDatasetGroups.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionDatasetGroups.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -108,7 +108,7 @@ export const PermissionGroupDatasetsListContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionUsers.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionUsers.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -107,7 +107,7 @@ export const PermissionGroupUsersListContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionUsers.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionUsers.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -109,7 +109,7 @@ export const UserDatasetGroupListContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionUsers.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionUsers.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -104,7 +104,7 @@ export const UserDatasetsListContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionUsers.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionUsers.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -110,7 +110,7 @@ export const UserPermissionGroupsListContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionUsers.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionUsers.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -18,7 +18,7 @@ export const PERMISSION_OPTIONS_ASSIGNED: SelectItem<'true' | 'false'>[] = [
|
|||
value: 'true'
|
||||
},
|
||||
{
|
||||
label: 'Not Assigned',
|
||||
label: 'Not assigned',
|
||||
value: 'false'
|
||||
}
|
||||
];
|
||||
|
|
|
@ -27,7 +27,7 @@ export const NewDatasetModal: React.FC<{
|
|||
const [selectedDatasource, setSelectedDatasource] = React.useState<string | null>(
|
||||
datasourceId || null
|
||||
);
|
||||
const { refetch: refetchDatasourcesList } = useListDatasources();
|
||||
const { refetch: refetchDatasourcesList } = useListDatasources(open);
|
||||
const [datasetName, setDatasetName] = React.useState<string>('');
|
||||
|
||||
const disableSubmit = !selectedDatasource || !datasetName;
|
||||
|
@ -109,7 +109,7 @@ const SelectDataSourceDropdown: React.FC<{
|
|||
selectedDatasource: string | null;
|
||||
}> = React.memo(({ setSelectedDatasource, selectedDatasource }) => {
|
||||
const router = useRouter();
|
||||
const { data: dataSourcesList } = useListDatasources();
|
||||
const { data: dataSourcesList } = useListDatasources(false);
|
||||
|
||||
const selectOptions: SelectItem[] = useMemo(() => {
|
||||
return (dataSourcesList || []).map((dataSource) => ({
|
||||
|
|
|
@ -57,7 +57,8 @@ export const Select = <T extends string>({
|
|||
disabled={disabled}
|
||||
onOpenChange={onOpenChange}
|
||||
open={open}
|
||||
value={value || defaultValue}
|
||||
defaultValue={defaultValue}
|
||||
value={value}
|
||||
onValueChange={onValueChange}>
|
||||
<SelectTrigger className={className}>
|
||||
<SelectValue placeholder={placeholder} defaultValue={value || defaultValue} />
|
||||
|
|
|
@ -17,8 +17,7 @@ export const selectVariants = cva(
|
|||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default:
|
||||
'border-border shadow bg-background data-[placeholder]:text-gray-light hover:border-gray-light',
|
||||
default: 'border-border shadow bg-background data-[placeholder]:text-gray-light ',
|
||||
ghost: 'border-none bg-transparent shadow-none disabled:bg-transparent outline-none'
|
||||
},
|
||||
size: {
|
||||
|
@ -45,7 +44,7 @@ const SelectTrigger = React.forwardRef<
|
|||
{...props}>
|
||||
{children}
|
||||
<SelectPrimitive.Icon asChild>
|
||||
<div className="flex h-4 w-4 items-center justify-center opacity-50">
|
||||
<div className="flex items-center justify-center opacity-50">
|
||||
<ChevronDown />
|
||||
</div>
|
||||
</SelectPrimitive.Icon>
|
||||
|
@ -61,7 +60,7 @@ const SelectScrollUpButton = React.forwardRef<
|
|||
ref={ref}
|
||||
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
||||
{...props}>
|
||||
<div className="flex h-4 w-4 items-center justify-center">
|
||||
<div className="flex items-center justify-center">
|
||||
<ChevronUp />
|
||||
</div>
|
||||
</SelectPrimitive.ScrollUpButton>
|
||||
|
@ -76,7 +75,7 @@ const SelectScrollDownButton = React.forwardRef<
|
|||
ref={ref}
|
||||
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
||||
{...props}>
|
||||
<div className="flex h-4 w-4 items-center justify-center">
|
||||
<div className="flex items-center justify-center">
|
||||
<ChevronDown />
|
||||
</div>
|
||||
</SelectPrimitive.ScrollDownButton>
|
||||
|
@ -134,39 +133,39 @@ const SelectItem = React.forwardRef<
|
|||
index?: number;
|
||||
icon?: React.ReactNode;
|
||||
}
|
||||
>(({ className, children, icon, secondaryChildren, index, ...props }, ref) => (
|
||||
<SelectPrimitive.Item
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'focus:bg-item-hover focus:text-foreground cursor-pointer disabled:cursor-not-allowed disabled:opacity-60',
|
||||
'relative flex w-full cursor-default items-center justify-between rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-60',
|
||||
className
|
||||
)}
|
||||
{...props}>
|
||||
<div className="flex flex-col gap-y-0.5">
|
||||
<div className="flex items-center gap-x-1.5">
|
||||
{icon && <span className="text-icon-color">{icon}</span>}
|
||||
<SelectPrimitive.ItemText className="flex h-full items-center">
|
||||
{children}
|
||||
</SelectPrimitive.ItemText>
|
||||
</div>
|
||||
{secondaryChildren && <span className="text-gray-light text-xs">{secondaryChildren}</span>}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-x-1">
|
||||
<SelectPrimitive.ItemIndicator>
|
||||
<div className="flex h-4 w-4 items-center justify-center">
|
||||
<Check />
|
||||
</div>
|
||||
</SelectPrimitive.ItemIndicator>
|
||||
{index !== undefined && (
|
||||
<span className="text-gray-light flex min-w-2 items-center justify-center text-xs">
|
||||
{index}
|
||||
</span>
|
||||
>(({ className, children, icon, secondaryChildren, index, ...props }, ref) => {
|
||||
return (
|
||||
<SelectPrimitive.Item
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'data-[highlighted]:bg-item-hover focus:text-foreground cursor-pointer disabled:cursor-not-allowed disabled:opacity-60',
|
||||
'data-[state=checked]:bg-item-select! relative flex w-full cursor-pointer items-center justify-between rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-60',
|
||||
className
|
||||
)}
|
||||
</div>
|
||||
</SelectPrimitive.Item>
|
||||
));
|
||||
{...props}>
|
||||
<div className="flex flex-col gap-y-0.5">
|
||||
<div className="flex items-center gap-x-1.5">
|
||||
{icon && <span className="text-icon-color">{icon}</span>}
|
||||
<SelectPrimitive.ItemText className="flex h-full items-center">
|
||||
{children}
|
||||
</SelectPrimitive.ItemText>
|
||||
</div>
|
||||
{secondaryChildren && <span className="text-gray-light text-xs">{secondaryChildren}</span>}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-x-1">
|
||||
<SelectPrimitive.ItemIndicator>
|
||||
<Check />
|
||||
</SelectPrimitive.ItemIndicator>
|
||||
{index !== undefined && (
|
||||
<span className="text-gray-light flex min-w-2 items-center justify-center text-xs">
|
||||
{index}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</SelectPrimitive.Item>
|
||||
);
|
||||
});
|
||||
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
||||
|
||||
const SelectSeparator = React.forwardRef<
|
||||
|
|
|
@ -109,7 +109,7 @@ export const PermissionListUsersContainer: React.FC<{
|
|||
data: {},
|
||||
hidden: cannotQueryPermissionUsers.length === 0,
|
||||
rowSection: {
|
||||
title: 'Not Assigned',
|
||||
title: 'Not assigned',
|
||||
secondaryTitle: cannotQueryPermissionUsers.length.toString()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@ export const PERMISSION_USERS_OPTIONS: SelectItem<'true' | 'false'>[] = [
|
|||
value: 'true'
|
||||
},
|
||||
{
|
||||
label: 'Not Assigned',
|
||||
label: 'Not assigned',
|
||||
value: 'false'
|
||||
}
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue