Skip to content

Commit

Permalink
fix(Systems page): Correctly parse all URL params (#1172)
Browse files Browse the repository at this point in the history
  • Loading branch information
leSamo authored Sep 2, 2021
1 parent ad74aba commit 1ad1b08
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/Components/SmartComponents/SystemsPage/SystemsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const SystemsPage = () => {

const apply = (params) => dispatch(changeSystemsParams(params));

useEffect(() => apply(urlParameters), []);
useEffect(() => apply(urlParameters), []);

useDeepCompareEffect(() => setUrlParams({ ...parameters }), [parameters]);

Expand All @@ -81,15 +81,25 @@ const SystemsPage = () => {
<Header title={intl.formatMessage(messages.systemsHeader)} showBreadcrumb={false} />
<Main>
<Fragment>
{ hasError
{hasError
? <ErrorHandler code={errorCode} />
: (
<InventoryTable
disableDefaultColumns
onLoad={({ mergeWithEntities }) => {
ReducerRegistry.register({
...mergeWithEntities(
inventoryEntitiesReducer(SYSTEMS_HEADER)
inventoryEntitiesReducer(SYSTEMS_HEADER),
{
page: Number(parameters.page || 1),
perPage: Number(parameters.page_size || 20),
...(parameters.sort && {
sortBy: {
key: parameters.sort.replace(/^-/, ''),
direction: parameters.sort.match(/^-/) ? 'desc' : 'asc'
}
})
}
)
});
}}
Expand Down Expand Up @@ -117,12 +127,12 @@ const SystemsPage = () => {
noSystemsTable={<EmptyStateNoSystems />}
>
<SystemsTableToolbar
parameters = {parameters}
systems = {{ data: systems, meta: { total_items: totalItems } }}
selectedRows = {selectedRows}
parameters={parameters}
systems={{ data: systems, meta: { total_items: totalItems } }}
selectedRows={selectedRows}
selectedRowsCount={selectedRowsCount}
selectedRowsRawData={selectedRowsRawData}
methods = {{
methods={{
doOptOut,
apply,
handleSelect
Expand Down

0 comments on commit 1ad1b08

Please sign in to comment.