-
-
Notifications
You must be signed in to change notification settings - Fork 248
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 pagination #5605 #5607
Fix pagination #5605 #5607
Conversation
…rt issue and sort users and location data from server #5605
@kinjalravel as far as I understood the 4th point of the issue; We need sorting on multiple fields and every table of admin panel. Currently it's only done for name field of User and Location Table. @HexaField Please let us know if my understanding is correct or not. |
|
no, this is referring to the fact that at least one of the tables is sorting the data it has been given from the server, rather than sending the feathers database query information for the pagination |
@@ -19,6 +19,10 @@ interface Props { | |||
page: number | |||
rowsPerPage: number | |||
count: number | |||
orderby?: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proper camel case would be orderBy
orderby?: string | ||
allowSort?: boolean | ||
setSortField?: (fueld: string) => void | ||
setOrderby?: (order: string) => void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proper camel case would be setOrderBy
@@ -143,7 +161,7 @@ const TableComponent = (props: Props) => { | |||
columns={column} | |||
/> | |||
<TableBody> | |||
{stableSort(rows, getComparator(order, orderBy)) | |||
{(allowSort === false ? rows : stableSort(rows, getComparator(order, orderBy))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allowSort ? stableSort(rows, getComparator(order, orderBy) : rows
LocationService.fetchAdminLocations('increment', search) | ||
// } | ||
//if (user?.id?.value && adminLocationState.updateNeeded.value && !adminScopeReadErrMsg?.value) { | ||
// LocationService.fetchAdminLocations(search, 0, orderby) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code if it isn't required anymore.
} | ||
UserService.fetchUsersAsAdmin('increment', search) | ||
//if (user?.id.value && adminUserState.updateNeeded.value) { | ||
// UserService.fetchUsersAsAdmin(search, 0, orderby) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code if it isn't required anymore.
} | ||
PartyService.fetchAdminParty('increment', search) | ||
//if (user?.id?.value && adminParty.updateNeeded.value) { | ||
//PartyService.fetchAdminParty('increment', null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code if it isn't required anymore.
@@ -36,15 +36,23 @@ const AvatarTable = (props: Props) => { | |||
const [popConfirmOpen, setPopConfirmOpen] = useState(false) | |||
const [avatarId, setAvatarId] = useState('') | |||
const [avatarName, setAvatarName] = useState('') | |||
const [orderby, setOrderby] = useState('asc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix camelcase here as well
@@ -24,18 +24,26 @@ const GroupTable = (props: Props) => { | |||
const [rowsPerPage, setRowsPerPage] = useState(GROUP_PAGE_LIMIT) | |||
const [groupId, setGroupId] = useState('') | |||
const [groupName, setGroupName] = useState('') | |||
const [orderby, setOrderby] = useState('asc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix camelcase here as well
const [popConfirmOpen, setPopConfirmOpen] = useState(false) | ||
const [instanceId, setInstanceId] = useState('') | ||
const [instanceName, setInstanceName] = useState('') | ||
const [orderby, setOrderby] = useState('asc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix camelcase here as well
@@ -42,22 +44,28 @@ const LocationTable = (props: LocationProps) => { | |||
// Call custom hooks | |||
const { t } = useTranslation() | |||
const adminUserState = useUserState() | |||
useFetchLocation(user, adminLocationState, adminScopeReadErrMsg, search, LocationService) | |||
useFetchLocation(user, adminLocationState, adminScopeReadErrMsg, search, LocationService, sortField, orderby) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is failing pipeline due to extra params in functions
@@ -19,6 +19,8 @@ const UserTable = (props: UserProps) => { | |||
const [popConfirmOpen, setPopConfirmOpen] = useState(false) | |||
const [userId, setUserId] = useState('') | |||
const [userName, setUserName] = useState('') | |||
const [orderby, setOrderby] = useState('asc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix camelcase here as well
@@ -20,6 +20,8 @@ const PartyTable = (props: PartyPropsTable) => { | |||
const [popConfirmOpen, setPopConfirmOpen] = useState(false) | |||
const [partyName, setPartyName] = useState('') | |||
const [partyId, setPartyId] = useState('') | |||
const [orderby, setOrderby] = useState('asc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix camelcase here as well
const [popConfirmOpen, setPopConfirmOpen] = useState(false) | ||
const [locationId, setLocationId] = useState('') | ||
const [locationName, setLocationName] = useState('') | ||
const [orderby, setOrderby] = useState('asc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix camelcase here as well
Summary
Change page size, fixed second page empty issue, fixed users table sort issue and sort users and location data from server
Checklist
npm run check
npm run lint
npm run test:packages
npm run build-client
References
closes #5605
QA Steps
git checkout pr_branch_name
npm install
npm run dev-reinit
npm run dev
List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.
Reviewers
Reviewers for this PR