Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add row number to staff list

Krzysztof Bialoglowiczce3fe30baffd
diff --git a/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx b/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx
index f044ffd901..280c8e3bbe 100644
--- a/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx
@@ -72,9 +72,11 @@ interface StaffListProps extends ListProps, WithStyles<typeof styles> {
const StaffList = withStyles(styles, { name: "StaffList" })(
({
classes,
+ listSettings,
disabled,
onNextPage,
onPreviousPage,
+ onUpdateListSettings,
onRowClick,
pageInfo,
staffMembers
@@ -95,10 +97,12 @@ const StaffList = withStyles(styles, { name: "StaffList" })(
<TableRow>
<TablePagination
colSpan={3}
+ listSettings={listSettings}
hasNextPage={
pageInfo && !disabled ? pageInfo.hasNextPage : undefined
}
onNextPage={onNextPage}
+ onUpdateListSettings={onUpdateListSettings}
hasPreviousPage={
pageInfo && !disabled ? pageInfo.hasPreviousPage : undefined
}
diff --git a/saleor/static/dashboard-next/staff/views/StaffList.tsx b/saleor/static/dashboard-next/staff/views/StaffList.tsx
index eb3d94f50f..16c99affd4 100644
--- a/saleor/static/dashboard-next/staff/views/StaffList.tsx
+++ b/saleor/static/dashboard-next/staff/views/StaffList.tsx
@@ -1,14 +1,16 @@
import React from "react";
+import useListSettings from "@saleor/hooks/useListSettings";
import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier";
import usePaginator, {
createPaginationState
} from "@saleor/hooks/usePaginator";
-import { PAGINATE_BY } from "../../config";
-import { configurationMenuUrl } from "../../configuration";
-import i18n from "../../i18n";
-import { getMutationState, maybe } from "../../misc";
+
+import { configurationMenuUrl } from "@saleor/configuration";
+import i18n from "@saleor/i18n";
+import { getMutationState, maybe } from "@saleor/misc";
+import { Lists } from "@saleor/types";
import StaffAddMemberDialog, {
FormData as AddStaffMemberForm
} from "../components/StaffAddMemberDialog";
@@ -32,6 +34,9 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
+ const { updateListSettings, listSettings } = useListSettings(
+ Lists.STAFF_MEMBERS_LIST
+ );
const closeModal = () =>
navigate(
@@ -43,7 +48,10 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({
true
);
- const paginationState = createPaginationState(PAGINATE_BY, params);
+ const paginationState = createPaginationState(
+ listSettings.STAFF_MEMBERS_LIST.rowNumber,
+ params
+ );
return (
<TypedStaffListQuery displayLoader variables={paginationState}>
{({ data, loading }) => {
@@ -91,6 +99,7 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({
<>
<StaffListPage
disabled={loading || addStaffMemberData.loading}
+ listSettings={listSettings.STAFF_MEMBERS_LIST}
pageInfo={pageInfo}
staffMembers={maybe(() =>
data.staffUsers.edges.map(edge => edge.node)
@@ -105,6 +114,7 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({
onBack={() => navigate(configurationMenuUrl)}
onNextPage={loadNextPage}
onPreviousPage={loadPreviousPage}
+ onUpdateListSettings={updateListSettings}
onRowClick={id => () => navigate(staffMemberDetailsUrl(id))}
/>
<StaffAddMemberDialog