mirror of https://github.com/buster-so/buster.git
Merge pull request #447 from buster-so/big-nate/bus-1232-update-users-list-immediately-after-new-user-request-is-made
Move organization user to a server type
This commit is contained in:
commit
f5bdb9d8da
|
@ -1,2 +1 @@
|
|||
export * from './interfaces';
|
||||
export * from './permissionInterfaces';
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
import type { OrganizationRole } from '@buster/server-shared/organization';
|
||||
|
||||
export interface OrganizationUser {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
avatar_url: string | null;
|
||||
status: 'active' | 'inactive';
|
||||
role: OrganizationRole;
|
||||
datasets: OrganizationUserDataset[];
|
||||
}
|
||||
|
||||
export interface OrganizationUserDataset {
|
||||
can_query: boolean;
|
||||
id: string;
|
||||
name: string;
|
||||
lineage: {
|
||||
name: string;
|
||||
id: string;
|
||||
type: 'user' | 'datasets' | 'permissionGroups';
|
||||
}[][];
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import type { OrganizationUser } from '@/api/asset_interfaces/users';
|
||||
import { serverFetch } from '../../createServerInstance';
|
||||
import { mainApi } from '../instances';
|
||||
import type { Organization } from '@buster/server-shared/organization';
|
||||
import type { Organization, OrganizationUser } from '@buster/server-shared/organization';
|
||||
|
||||
export const getOrganizationUsers = async ({
|
||||
organizationId
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { ShareAssetType } from '@buster/server-shared/share';
|
||||
import type { OrganizationUser } from '@/api/asset_interfaces/users';
|
||||
import type { OrganizationUser } from '@buster/server-shared/organization';
|
||||
import { BASE_URL } from '../config';
|
||||
import { serverFetch } from '../../createServerInstance';
|
||||
import { mainApi } from '../instances';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { queryOptions } from '@tanstack/react-query';
|
||||
import type { OrganizationUser } from '@/api/asset_interfaces/users';
|
||||
import type { OrganizationUser } from '@buster/server-shared/organization';
|
||||
|
||||
const organizationUsers = (organizationId: string) =>
|
||||
queryOptions<OrganizationUser[]>({
|
||||
|
|
|
@ -4,9 +4,9 @@ import type {
|
|||
BusterUserDataset,
|
||||
BusterUserDatasetGroup,
|
||||
BusterUserPermissionGroup,
|
||||
BusterUserTeamListItem,
|
||||
OrganizationUser
|
||||
BusterUserTeamListItem
|
||||
} from '@/api/asset_interfaces/users';
|
||||
import type { OrganizationUser } from '@buster/server-shared/organization';
|
||||
import type {
|
||||
UserFavoriteResponse,
|
||||
UserResponse,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import type { OrganizationUser } from '@/api/asset_interfaces/users';
|
||||
import type { OrganizationUser } from '@buster/server-shared/organization';
|
||||
import { ListUserItem } from '@/components/features/list/ListUserItem';
|
||||
import {
|
||||
type BusterListColumn,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import type { OrganizationUser } from '@/api/asset_interfaces';
|
||||
import type { OrganizationUser } from '@buster/server-shared/organization';
|
||||
import { Avatar } from '@/components/ui/avatar';
|
||||
import { Text, Title } from '@/components/ui/typography';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useMemo } from 'react';
|
||||
import type { OrganizationUserDataset } from '@/api/asset_interfaces';
|
||||
import type { OrganizationUserDataset } from '@buster/server-shared/organization';
|
||||
import { PermissionLineageBreadcrumb } from '@/components/features/PermissionComponents';
|
||||
import {
|
||||
type BusterListColumn,
|
||||
|
@ -102,7 +102,12 @@ export const UserDatasetListContainer = React.memo(
|
|||
rows={rows}
|
||||
showHeader={false}
|
||||
showSelectAll={false}
|
||||
emptyState={useMemo(() => <EmptyStateList text="No datasets found" />, [])}
|
||||
emptyState={useMemo(
|
||||
() => (
|
||||
<EmptyStateList text="No datasets found" />
|
||||
),
|
||||
[]
|
||||
)}
|
||||
/>
|
||||
</InfiniteListContainer>
|
||||
);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import type { OrganizationUser } from '@/api/asset_interfaces';
|
||||
import type { OrganizationUser } from '@buster/server-shared/organization';
|
||||
import { PermissionSearchAndListWrapper } from '@/components/features/PermissionComponents';
|
||||
import { useDebounceSearch } from '@/hooks';
|
||||
import { UserDatasetListContainer } from './UserDatasetListContainer';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { BusterOrganizationRoleLabels, type OrganizationUser } from '@/api/asset_interfaces';
|
||||
import { BusterOrganizationRoleLabels } from '@/api/asset_interfaces';
|
||||
import { useUpdateUser } from '@/api/buster_rest/users';
|
||||
import {
|
||||
Card,
|
||||
|
@ -13,6 +13,7 @@ import { AppTooltip } from '@/components/ui/tooltip';
|
|||
import { Text } from '@/components/ui/typography';
|
||||
import { useMemoizedFn } from '@/hooks';
|
||||
import { User } from '@buster/server-shared/user';
|
||||
import type { OrganizationUser } from '@buster/server-shared/organization';
|
||||
|
||||
export const UserDefaultAccess: React.FC<{
|
||||
user: OrganizationUser;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import type { OrganizationUser } from '@/api/asset_interfaces/users';
|
||||
import type { OrganizationUser } from '@buster/server-shared/organization';
|
||||
import { HeaderExplanation } from '@/components/features/PermissionComponents';
|
||||
|
||||
export const UserLineageHeader = React.memo(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { OrganizationUser } from '@/api/asset_interfaces';
|
||||
import type { OrganizationUser } from '@buster/server-shared/organization';
|
||||
|
||||
export const OrganizationUserStatusText: Record<OrganizationUser['status'], string> = {
|
||||
active: 'Active',
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
export * from './organization.types';
|
||||
export * from './roles.types';
|
||||
export * from './user.types';
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
import { z } from 'zod/v4';
|
||||
import { OrganizationRoleSchema } from './roles.types';
|
||||
|
||||
export const LineageUserItemTypeSchema = z.enum(['user', 'datasets', 'permissionGroups']);
|
||||
|
||||
// Zod schema for lineage item
|
||||
const LineageItemSchema = z.object({
|
||||
name: z.string(),
|
||||
id: z.string(),
|
||||
type: LineageUserItemTypeSchema,
|
||||
});
|
||||
|
||||
// Zod schema for OrganizationUserDataset
|
||||
export const OrganizationUserDatasetSchema = z.object({
|
||||
can_query: z.boolean(),
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
lineage: z.array(z.array(LineageItemSchema)),
|
||||
});
|
||||
|
||||
// Zod schema for OrganizationUser
|
||||
export const OrganizationUserSchema = z.object({
|
||||
id: z.string(),
|
||||
email: z.string(),
|
||||
name: z.string(),
|
||||
avatar_url: z.string().nullable(),
|
||||
status: z.enum(['active', 'inactive']),
|
||||
role: OrganizationRoleSchema,
|
||||
datasets: z.array(OrganizationUserDatasetSchema),
|
||||
});
|
||||
|
||||
// Export inferred types
|
||||
export type OrganizationUser = z.infer<typeof OrganizationUserSchema>;
|
||||
export type OrganizationUserDataset = z.infer<typeof OrganizationUserDatasetSchema>;
|
||||
export type LinageUserItemType = z.infer<typeof LineageUserItemTypeSchema>;
|
||||
export type LinageUserItem = z.infer<typeof LineageItemSchema>;
|
Loading…
Reference in New Issue