fix(site): fix filters errors display (#8103)

This commit is contained in:
Bruno Quaresma
2023-06-20 12:08:05 -03:00
committed by GitHub
parent ea4b7d60d7
commit 2db4488337
8 changed files with 18 additions and 22 deletions
+3
View File
@@ -210,6 +210,9 @@ export const Filter = ({
"& .MuiInputAdornment-root": {
marginLeft: 0,
},
"&.Mui-error": {
zIndex: 3,
},
},
startAdornment: (
<InputAdornment position="start">
+1
View File
@@ -77,6 +77,7 @@ const AuditPage: FC = () => {
dashboard.experiments.includes("workspace_filter")
? {
filter,
error,
menus: {
user: userMenu,
action: actionMenu,
+4 -4
View File
@@ -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"
/>
+1
View File
@@ -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,
},
}
+2 -2
View File
@@ -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"
/>
+1 -12
View File
@@ -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)
},