Skip to content

Commit 2db4488

Browse files
fix(site): fix filters errors display (#8103)
1 parent ea4b7d6 commit 2db4488

File tree

8 files changed

+18
-22
lines changed

8 files changed

+18
-22
lines changed

site/src/components/Filter/filter.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ export const Filter = ({
210210
"& .MuiInputAdornment-root": {
211211
marginLeft: 0,
212212
},
213+
"&.Mui-error": {
214+
zIndex: 3,
215+
},
213216
},
214217
startAdornment: (
215218
<InputAdornment position="start">

site/src/pages/AuditPage/AuditPage.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const AuditPage: FC = () => {
7777
dashboard.experiments.includes("workspace_filter")
7878
? {
7979
filter,
80+
error,
8081
menus: {
8182
user: userMenu,
8283
action: actionMenu,

site/src/pages/AuditPage/AuditPageView.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export const AuditPageView: FC<AuditPageViewProps> = ({
7474
}) => {
7575
const { t } = useTranslation("auditLog")
7676

77-
const isLoading = auditLogs === undefined || count === undefined
78-
const isEmpty = !isLoading && auditLogs.length === 0
77+
const isLoading = (auditLogs === undefined || count === undefined) && !error
78+
const isEmpty = !isLoading && auditLogs?.length === 0
7979

8080
return (
8181
<Margins>
@@ -104,8 +104,8 @@ export const AuditPageView: FC<AuditPageViewProps> = ({
104104

105105
<PaginationStatus
106106
isLoading={Boolean(isLoading)}
107-
showing={auditLogs?.length}
108-
total={count}
107+
showing={auditLogs?.length ?? 0}
108+
total={count ?? 0}
109109
label="audit logs"
110110
/>
111111

site/src/pages/UsersPage/UsersPage.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export const UsersPage: FC<{ children?: ReactNode }> = () => {
159159
dashboard.experiments.includes("workspace_filter")
160160
? {
161161
filter: useFilterResult,
162+
error: getUsersError,
162163
menus: {
163164
status: statusMenu,
164165
},

site/src/pages/UsersPage/UsersPageView.stories.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const meta: Meta<typeof UsersPageView> = {
1717
isNonInitialPage: false,
1818
users: [MockUser, MockUser2],
1919
roles: MockAssignableSiteRoles,
20+
count: 2,
2021
canEditUsers: true,
2122
filterProps: {
2223
onFilter: action("onFilter"),
@@ -41,12 +42,13 @@ export const Member = {
4142
}
4243

4344
export const Empty = {
44-
args: { users: [] },
45+
args: { users: [], count: 0 },
4546
}
4647

4748
export const EmptyPage = {
4849
args: {
4950
users: [],
51+
count: 0,
5052
isNonInitialPage: true,
5153
},
5254
}

site/src/pages/UsersPage/UsersPageView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export const UsersPageView: FC<React.PropsWithChildren<UsersPageViewProps>> = ({
7777

7878
<PaginationStatus
7979
isLoading={Boolean(isLoading)}
80-
showing={users?.length}
81-
total={count}
80+
showing={users?.length ?? 0}
81+
total={count ?? 0}
8282
label="users"
8383
/>
8484

site/src/pages/WorkspacesPage/WorkspacesPageView.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ export const WorkspacesPageView: FC<
146146
</Stack>
147147

148148
<PaginationStatus
149-
isLoading={!workspaces}
150-
showing={workspaces?.length}
151-
total={count}
149+
isLoading={!workspaces && !error}
150+
showing={workspaces?.length ?? 0}
151+
total={count ?? 0}
152152
label="workspaces"
153153
/>
154154

site/src/xServices/users/usersXService.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@ export const usersMachine =
166166
onError: [
167167
{
168168
target: "idle",
169-
actions: [
170-
"clearUsers",
171-
"assignGetUsersError",
172-
"displayGetUsersErrorMessage",
173-
],
169+
actions: ["clearUsers", "assignGetUsersError"],
174170
},
175171
],
176172
},
@@ -487,13 +483,6 @@ export const usersMachine =
487483
clearUpdateUserRolesError: assign({
488484
updateUserRolesError: (_) => undefined,
489485
}),
490-
displayGetUsersErrorMessage: (context) => {
491-
const message = getErrorMessage(
492-
context.getUsersError,
493-
Language.getUsersError,
494-
)
495-
displayError(message)
496-
},
497486
displaySuspendSuccess: () => {
498487
displaySuccess(Language.suspendUserSuccess)
499488
},

0 commit comments

Comments
 (0)