mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
fix(site): fix filters errors display (#8103)
This commit is contained in:
@@ -210,6 +210,9 @@ export const Filter = ({
|
||||
"& .MuiInputAdornment-root": {
|
||||
marginLeft: 0,
|
||||
},
|
||||
"&.Mui-error": {
|
||||
zIndex: 3,
|
||||
},
|
||||
},
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
|
||||
@@ -77,6 +77,7 @@ const AuditPage: FC = () => {
|
||||
dashboard.experiments.includes("workspace_filter")
|
||||
? {
|
||||
filter,
|
||||
error,
|
||||
menus: {
|
||||
user: userMenu,
|
||||
action: actionMenu,
|
||||
|
||||
@@ -74,8 +74,8 @@ export const AuditPageView: FC<AuditPageViewProps> = ({
|
||||
}) => {
|
||||
const { t } = useTranslation("auditLog")
|
||||
|
||||
const isLoading = auditLogs === undefined || count === undefined
|
||||
const isEmpty = !isLoading && auditLogs.length === 0
|
||||
const isLoading = (auditLogs === undefined || count === undefined) && !error
|
||||
const isEmpty = !isLoading && auditLogs?.length === 0
|
||||
|
||||
return (
|
||||
<Margins>
|
||||
@@ -104,8 +104,8 @@ export const AuditPageView: FC<AuditPageViewProps> = ({
|
||||
|
||||
<PaginationStatus
|
||||
isLoading={Boolean(isLoading)}
|
||||
showing={auditLogs?.length}
|
||||
total={count}
|
||||
showing={auditLogs?.length ?? 0}
|
||||
total={count ?? 0}
|
||||
label="audit logs"
|
||||
/>
|
||||
|
||||
|
||||
@@ -159,6 +159,7 @@ export const UsersPage: FC<{ children?: ReactNode }> = () => {
|
||||
dashboard.experiments.includes("workspace_filter")
|
||||
? {
|
||||
filter: useFilterResult,
|
||||
error: getUsersError,
|
||||
menus: {
|
||||
status: statusMenu,
|
||||
},
|
||||
|
||||
@@ -17,6 +17,7 @@ const meta: Meta<typeof UsersPageView> = {
|
||||
isNonInitialPage: false,
|
||||
users: [MockUser, MockUser2],
|
||||
roles: MockAssignableSiteRoles,
|
||||
count: 2,
|
||||
canEditUsers: true,
|
||||
filterProps: {
|
||||
onFilter: action("onFilter"),
|
||||
@@ -41,12 +42,13 @@ export const Member = {
|
||||
}
|
||||
|
||||
export const Empty = {
|
||||
args: { users: [] },
|
||||
args: { users: [], count: 0 },
|
||||
}
|
||||
|
||||
export const EmptyPage = {
|
||||
args: {
|
||||
users: [],
|
||||
count: 0,
|
||||
isNonInitialPage: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ export const UsersPageView: FC<React.PropsWithChildren<UsersPageViewProps>> = ({
|
||||
|
||||
<PaginationStatus
|
||||
isLoading={Boolean(isLoading)}
|
||||
showing={users?.length}
|
||||
total={count}
|
||||
showing={users?.length ?? 0}
|
||||
total={count ?? 0}
|
||||
label="users"
|
||||
/>
|
||||
|
||||
|
||||
@@ -146,9 +146,9 @@ export const WorkspacesPageView: FC<
|
||||
</Stack>
|
||||
|
||||
<PaginationStatus
|
||||
isLoading={!workspaces}
|
||||
showing={workspaces?.length}
|
||||
total={count}
|
||||
isLoading={!workspaces && !error}
|
||||
showing={workspaces?.length ?? 0}
|
||||
total={count ?? 0}
|
||||
label="workspaces"
|
||||
/>
|
||||
|
||||
|
||||
@@ -166,11 +166,7 @@ export const usersMachine =
|
||||
onError: [
|
||||
{
|
||||
target: "idle",
|
||||
actions: [
|
||||
"clearUsers",
|
||||
"assignGetUsersError",
|
||||
"displayGetUsersErrorMessage",
|
||||
],
|
||||
actions: ["clearUsers", "assignGetUsersError"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -487,13 +483,6 @@ export const usersMachine =
|
||||
clearUpdateUserRolesError: assign({
|
||||
updateUserRolesError: (_) => undefined,
|
||||
}),
|
||||
displayGetUsersErrorMessage: (context) => {
|
||||
const message = getErrorMessage(
|
||||
context.getUsersError,
|
||||
Language.getUsersError,
|
||||
)
|
||||
displayError(message)
|
||||
},
|
||||
displaySuspendSuccess: () => {
|
||||
displaySuccess(Language.suspendUserSuccess)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user