From cf92756abf4e33c4d92a5efc307b55d4a18e656b Mon Sep 17 00:00:00 2001 From: mjac0bs Date: Mon, 26 Feb 2024 12:31:17 -0800 Subject: [PATCH 1/4] Use an API supported simple filter on one user_type --- packages/manager/src/features/Users/UsersLanding.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/manager/src/features/Users/UsersLanding.tsx b/packages/manager/src/features/Users/UsersLanding.tsx index e7d86191574..d93afcb91d3 100644 --- a/packages/manager/src/features/Users/UsersLanding.tsx +++ b/packages/manager/src/features/Users/UsersLanding.tsx @@ -33,15 +33,17 @@ export const UsersLanding = () => { const pagination = usePagination(1, 'account-users'); const order = useOrder(); + const isRestrictedUser = profile?.restricted; + const isChildUser = Boolean( + flags.parentChildAccountAccess && profile?.user_type === 'child' + ); + const usersFilter: Filter = { ['+order']: order.order, ['+order_by']: order.orderBy, + ['user_type']: isChildUser ? 'child' : undefined, }; - if (flags.parentChildAccountAccess) { - usersFilter['user_type'] = { '+neq': 'proxy' }; - } - const { data: users, error, isLoading, refetch } = useAccountUsers({ filters: usersFilter, params: { @@ -59,8 +61,6 @@ export const UsersLanding = () => { filters: { user_type: 'proxy' }, }); - const isRestrictedUser = profile?.restricted; - const showProxyUserTable = flags.parentChildAccountAccess && (profile?.user_type === 'child' || profile?.user_type === 'proxy'); From c70ed23fb996859f964d7cc69bac2766e2058040 Mon Sep 17 00:00:00 2001 From: mjac0bs Date: Mon, 26 Feb 2024 13:18:52 -0800 Subject: [PATCH 2/4] Filter on child accounts for proxy user too --- .../manager/src/features/Users/UsersLanding.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/manager/src/features/Users/UsersLanding.tsx b/packages/manager/src/features/Users/UsersLanding.tsx index d93afcb91d3..2cdd422a483 100644 --- a/packages/manager/src/features/Users/UsersLanding.tsx +++ b/packages/manager/src/features/Users/UsersLanding.tsx @@ -33,15 +33,14 @@ export const UsersLanding = () => { const pagination = usePagination(1, 'account-users'); const order = useOrder(); - const isRestrictedUser = profile?.restricted; - const isChildUser = Boolean( - flags.parentChildAccountAccess && profile?.user_type === 'child' - ); + const showProxyUserTable = + flags.parentChildAccountAccess && + (profile?.user_type === 'child' || profile?.user_type === 'proxy'); const usersFilter: Filter = { ['+order']: order.order, ['+order_by']: order.orderBy, - ['user_type']: isChildUser ? 'child' : undefined, + ['user_type']: showProxyUserTable ? 'child' : undefined, }; const { data: users, error, isLoading, refetch } = useAccountUsers({ @@ -61,9 +60,7 @@ export const UsersLanding = () => { filters: { user_type: 'proxy' }, }); - const showProxyUserTable = - flags.parentChildAccountAccess && - (profile?.user_type === 'child' || profile?.user_type === 'proxy'); + const isRestrictedUser = profile?.restricted; const showChildAccountAccessCol = Boolean( flags.parentChildAccountAccess && profile?.user_type === 'parent' From 38d790255880e5d38ad025a7e4c9e5e40964fa02 Mon Sep 17 00:00:00 2001 From: mjac0bs Date: Mon, 26 Feb 2024 13:23:20 -0800 Subject: [PATCH 3/4] Add changeset --- .../.changeset/pr-10230-upcoming-features-1708982538087.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 packages/manager/.changeset/pr-10230-upcoming-features-1708982538087.md diff --git a/packages/manager/.changeset/pr-10230-upcoming-features-1708982538087.md b/packages/manager/.changeset/pr-10230-upcoming-features-1708982538087.md new file mode 100644 index 00000000000..9d3ae547592 --- /dev/null +++ b/packages/manager/.changeset/pr-10230-upcoming-features-1708982538087.md @@ -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)) From 8147a97831638cc6de734f4a330952cf37254f4b Mon Sep 17 00:00:00 2001 From: mjac0bs Date: Mon, 26 Feb 2024 13:36:54 -0800 Subject: [PATCH 4/4] Use correct number of columns for Business Partner table --- packages/manager/src/features/Users/UsersLanding.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/manager/src/features/Users/UsersLanding.tsx b/packages/manager/src/features/Users/UsersLanding.tsx index 2cdd422a483..c218a8fde6f 100644 --- a/packages/manager/src/features/Users/UsersLanding.tsx +++ b/packages/manager/src/features/Users/UsersLanding.tsx @@ -97,7 +97,7 @@ export const UsersLanding = () => {