Skip to content

Commit

Permalink
Merge branch 'bugFix/FWF-3816-pagination-issue' into pagination-impor…
Browse files Browse the repository at this point in the history
…t-fix
  • Loading branch information
Bonymol-aot authored Nov 19, 2024
2 parents e4f16df + e0c3371 commit 4a46180
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 27 deletions.
19 changes: 11 additions & 8 deletions forms-flow-admin/src/components/roles/roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { DEFAULT_ROLES } from "../../constants";

import {removingTenantId} from "../../utils/utils.js";
import { TableFooter } from "@formsflow/components";

const Roles = React.memo((props: any) => {
const { t } = useTranslation();
const { tenantId } = useParams();
Expand Down Expand Up @@ -636,6 +637,7 @@ const Roles = React.memo((props: any) => {
setActivePage(1);
};


const columns = [
{
dataField: "name",
Expand Down Expand Up @@ -776,14 +778,15 @@ const Roles = React.memo((props: any) => {

<table className="table">
<tfoot>
<TableFooter
limit={sizePerPage}
activePage={activePage}
totalCount={roles.length}
handlePageChange={handlePageChange}
onLimitChange={handleLimitChange}
pageOptions={getPageList()}
/>

<TableFooter
limit={sizePerPage}
activePage={activePage}
totalCount={roles.length}
handlePageChange={setActivePage}
onLimitChange={handleLimitChange}
pageOptions={getpageList()}
/>
</tfoot>
</table>
</div>
Expand Down
36 changes: 17 additions & 19 deletions forms-flow-admin/src/components/users/users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import "./users.scss";
import { KEYCLOAK_ENABLE_CLIENT_AUTH,MULTITENANCY_ENABLED } from "../../constants";
import Select from "react-select";
import { CreateUser } from "../../services/users";
import { TableFooter } from "@formsflow/components";

const Users = React.memo((props: any) => {
const [selectedRow, setSelectedRow] = React.useState(null);
const [selectedRoles, setSelectedRoles] = React.useState([]);
Expand Down Expand Up @@ -106,7 +108,7 @@ const Users = React.memo((props: any) => {
);
};

const handleSizeChange = (sizePerPage, page) => {
const handleLimitChange = (sizePerPage, page) => {
setActivePage(page);
setSizePerPage(sizePerPage);
};
Expand Down Expand Up @@ -153,23 +155,6 @@ const Users = React.memo((props: any) => {
return list;
};

const pagination = paginationFactory({
showTotal: true,
align: "left",
sizePerPageList: getpageList(),
page: activePage,
pageStartIndex: 1,
totalSize: props.total,
sizePerPage: sizePerPage,
paginationTotalRenderer: customTotal,
onPageChange: (page) => {
setActivePage(page);
props.page.setPageNo(page);
props.setInvalidated(true);
},
onSizePerPageChange: (size, page) => handleSizeChange(size, page),
sizePerPageRenderer: customDropUp,
});

const handleTableChange = () => {};

Expand Down Expand Up @@ -541,6 +526,7 @@ const Users = React.memo((props: any) => {
</div>

{!loading ? (
<div>
<BootstrapTable
remote={{
pagination: true,
Expand All @@ -549,7 +535,6 @@ const Users = React.memo((props: any) => {
data={props?.users}
loading={loading}
columns={columns}
pagination={pagination}
bordered={false}
wrapperClasses="user-table-container px-4"
rowStyle={{
Expand All @@ -560,6 +545,19 @@ const Users = React.memo((props: any) => {
onTableChange={handleTableChange}
data-testid="admin-users-table"
/>
<table className="table">
<tfoot>
<TableFooter
limit={sizePerPage}
activePage={activePage}
totalCount={roles.length}
handlePageChange={setActivePage}
onLimitChange={handleLimitChange}
pageOptions={getpageList()}
/>
</tfoot>
</table>
</div>
) : (
<Loading />
)}
Expand Down
5 changes: 5 additions & 0 deletions forms-flow-admin/src/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ declare module "*.svg" {
declare module "@formsflow/service" {
export const {KeycloakService, RequestService, StorageService,i18nService}: any;
}

declare module "@formsflow/components"{
export const {TableFooter}: any;
}

0 comments on commit 4a46180

Please sign in to comment.