diff --git a/src/Components/SmartComponents/Reports/ReportsPage.js b/src/Components/SmartComponents/Reports/ReportsPage.js index 71cc3d756..0c473702c 100644 --- a/src/Components/SmartComponents/Reports/ReportsPage.js +++ b/src/Components/SmartComponents/Reports/ReportsPage.js @@ -36,7 +36,8 @@ const ReportsPage = () => { const [inheritGlobalTags, setInheritGlobalTags] = useState(true); const [cvesWithoutErrata, setCvesWithoutErrata] = useState(false); - const globalFilterTags = useSelector(({ ReportsPageStore }) => ReportsPageStore.parameters.tags) ?? []; + const globalFilterTags = useSelector(({ ReportsPageStore }) => + ReportsPageStore.parameters.tags?.length && ReportsPageStore.parameters.tags.split(',')) || []; const dispatch = useDispatch(); diff --git a/src/Components/SmartComponents/Reports/ReportsPage.test.js b/src/Components/SmartComponents/Reports/ReportsPage.test.js index e20c56b45..ff5854fe9 100644 --- a/src/Components/SmartComponents/Reports/ReportsPage.test.js +++ b/src/Components/SmartComponents/Reports/ReportsPage.test.js @@ -33,7 +33,7 @@ jest.mock("../../../Helpers/APIHelper.js", () => ({ getCveListByAccount: () => new Promise(() => {}, () => {}) })); -const state = { +let state = { parameters: {} } @@ -205,4 +205,22 @@ describe('Reports page component', () => { expect(screen.getByText(/systems: 1 or more conventional \(rpm\-dnf\), 1 or more immutable \(ostree\)/i)).toBeVisible(); }); + + it('Should apply global tags.', async () => { + state.parameters = { tags: "AAaNIKhDBt/LorNtSjoRt=WRTmPByfQ,BMCRfrl/kgWDqQYPT=KVdLiE" }; + render( + + + + ); + + await waitFor(() => { + fireEvent.click(screen.getByText(/create report/i)); + }); + + screen.logTestingPlaygroundURL(); + + expect(screen.getByText(/tags: aaanikhdbt: lorntsjort = wrtmpbyfq, bmcrfrl: kgwdqqypt = kvdlie/i)).toBeVisible(); + expect(screen.queryByText(/tags: all/i)).toBeFalsy(); + }); });