Skip to content

Commit

Permalink
fix: [M3-7811] - Fix Users & Grants query filtering on user_type (#10230
Browse files Browse the repository at this point in the history
)

* Use an API supported simple filter on one user_type

* Filter on child accounts for proxy user too

* Add changeset

* Use correct number of columns for Business Partner table
  • Loading branch information
mjac0bs authored Feb 27, 2024
1 parent d9b5b92 commit fd9617d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Fix Users & Grants filtering error based on `user_type` ([#10230](https://github.com/linode/manager/pull/10230))
15 changes: 6 additions & 9 deletions packages/manager/src/features/Users/UsersLanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ export const UsersLanding = () => {
const pagination = usePagination(1, 'account-users');
const order = useOrder();

const showProxyUserTable =
flags.parentChildAccountAccess &&
(profile?.user_type === 'child' || profile?.user_type === 'proxy');

const usersFilter: Filter = {
['+order']: order.order,
['+order_by']: order.orderBy,
['user_type']: showProxyUserTable ? 'child' : undefined,
};

if (flags.parentChildAccountAccess) {
usersFilter['user_type'] = { '+neq': 'proxy' };
}

const { data: users, error, isLoading, refetch } = useAccountUsers({
filters: usersFilter,
params: {
Expand All @@ -61,10 +62,6 @@ export const UsersLanding = () => {

const isRestrictedUser = profile?.restricted;

const showProxyUserTable =
flags.parentChildAccountAccess &&
(profile?.user_type === 'child' || profile?.user_type === 'proxy');

const showChildAccountAccessCol = Boolean(
flags.parentChildAccountAccess && profile?.user_type === 'parent'
);
Expand Down Expand Up @@ -100,7 +97,7 @@ export const UsersLanding = () => {
<UsersLandingTableBody
error={proxyUserError}
isLoading={isLoadingProxyUser}
numCols={numCols}
numCols={4}
onDelete={handleDelete}
users={proxyUser?.data}
/>
Expand Down

0 comments on commit fd9617d

Please sign in to comment.