Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(GlobalFilters): RHINENG-6296 push correct params to url #1185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/SmartComponents/Systems/SystemTable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ const initStore = (state) => {
return mockStore(state);
};

const apply = () => {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since apply is now used inside the SystemsTable (before, it was just passed along to other functions), the tests fail if apply is undefined. thus i'm just passing a plain function into the component

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to make this work even when no apply is provided.


const renderComponent = async (mockedStore) => {
render(<ComponentWithContext renderOptions={{ store: initStore(mockedStore) }}>
<Systems patchSetState={{}}/>
<Systems patchSetState={{}} apply={apply}/>
</ComponentWithContext>);

await waitFor(() => {
Expand Down Expand Up @@ -270,4 +272,8 @@ describe('SystemsTable', () => {
{}
);
});

it('should', async () => {

});
});
16 changes: 15 additions & 1 deletion src/SmartComponents/Systems/SystemsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
arrayFromObj, persistantParams, filterSelectedActiveSystemIDs
} from '../../Utilities/Helpers';
import { useBulkSelectConfig, useGetEntities, useOnExport,
useRemoveFilter, useRemediationDataProvider, useOnSelect, ID_API_ENDPOINTS
useRemoveFilter, useRemediationDataProvider, useOnSelect, ID_API_ENDPOINTS,
usePushUrlParams
} from '../../Utilities/hooks';
import { intl } from '../../Utilities/IntlProvider';
import { systemsListColumns, systemsRowActions } from './SystemsListAssets';
Expand All @@ -37,6 +38,8 @@ const SystemsTable = ({
const store = useStore();
const inventory = useRef(null);

const [firstMount, setFirstMount] = useState(true);

const dispatch = useDispatch();
const [isRemediationLoading, setRemediationLoading] = useState(false);
const systems = useSelector(({ entities }) => entities?.rows || [], shallowEqual);
Expand Down Expand Up @@ -115,6 +118,17 @@ const SystemsTable = ({
}
}, [patchSetState.shouldRefresh]);

const historyPusher = usePushUrlParams(queryParams);

useEffect(() => {
if (firstMount) {
apply(decodedParams);
setFirstMount(false);
} else {
historyPusher();
}
}, [queryParams]);

const onExport = useOnExport(
'systems',
queryParams,
Expand Down