From 8da4a207dd8c5b2d562f16a7ddf14a0e9713bd41 Mon Sep 17 00:00:00 2001 From: Patrick Jungermann Date: Wed, 20 Apr 2022 01:34:48 +0200 Subject: [PATCH] fix: fix ref to filtered catalog table view when using aggregated relations Instead of using the query parameters `&filters[owners][0]=foo&filters[owners][1]=bar`, etc. the query parameters `&filters[owners]=foo&filters[owners]=bar` need to be used. Closes: #10911 Signed-off-by: Patrick Jungermann --- .changeset/tough-forks-carry.md | 5 +++++ .../components/Cards/OwnershipCard/OwnershipCard.test.tsx | 4 ++-- .../src/components/Cards/OwnershipCard/useGetEntities.ts | 6 +----- 3 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 .changeset/tough-forks-carry.md diff --git a/.changeset/tough-forks-carry.md b/.changeset/tough-forks-carry.md new file mode 100644 index 0000000000..88fd82b55d --- /dev/null +++ b/.changeset/tough-forks-carry.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-org': patch +--- + +Fix ref to filtered catalog table view when using aggregated relations. diff --git a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx index 298c921069..b6e3982d51 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx +++ b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx @@ -246,7 +246,7 @@ describe('OwnershipCard', () => { expect(getByText('OPENAPI').closest('a')).toHaveAttribute( 'href', - '/create/?filters%5Bkind%5D=API&filters%5Btype%5D=openapi&filters%5Bowners%5D%5B0%5D=my-team&filters%5Buser%5D=all', + '/create/?filters%5Bkind%5D=API&filters%5Btype%5D=openapi&filters%5Bowners%5D=my-team&filters%5Buser%5D=all', ); }); @@ -288,7 +288,7 @@ describe('OwnershipCard', () => { expect(getByText('OPENAPI').closest('a')).toHaveAttribute( 'href', - '/create/?filters%5Bkind%5D=API&filters%5Btype%5D=openapi&filters%5Bowners%5D%5B0%5D=the-user&filters%5Bowners%5D%5B1%5D=my-team&filters%5Buser%5D=all', + '/create/?filters%5Bkind%5D=API&filters%5Btype%5D=openapi&filters%5Bowners%5D=the-user&filters%5Bowners%5D=my-team&filters%5Buser%5D=all', ); }); diff --git a/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts b/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts index 48760002fa..6a4aaa1399 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts +++ b/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts @@ -50,11 +50,7 @@ const getQueryParams = ( owners, user: 'all', }; - const queryParams = qs.stringify({ - filters, - }); - - return queryParams; + return qs.stringify({ filters }, { arrayFormat: 'repeat' }); }; const getOwnersEntityRef = (owner: Entity): string[] => {