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

User Management Screen improvements #4454

Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
cf2c348
pagination added
kartikaysaxena Feb 20, 2024
ff89499
Merge branch 'master' into usermanagment_improvements
Saranya-jena Feb 23, 2024
b0973f1
manual itemsPerPage limit options
kartikaysaxena Mar 6, 2024
4f4862c
Merge branch 'master' into usermanagment_improvements
SarthakJain26 Mar 7, 2024
ef3b1cb
manual itemsPerPage limit options
kartikaysaxena Mar 6, 2024
f9d1e01
Merge branch 'usermanagment_improvements' of https://github.com/karti…
kartikaysaxena Mar 7, 2024
c16e21e
Merge branch 'master' into usermanagment_improvements
kartikaysaxena Mar 9, 2024
c84ef98
Merge branch 'master' into usermanagment_improvements
Saranya-jena Mar 12, 2024
e728166
Merge branch 'master' into usermanagment_improvements
kartikaysaxena Mar 12, 2024
7c2ffaf
Merge branch 'master' into usermanagment_improvements
hrishavjha Mar 14, 2024
3ff1ee4
Merge branch 'master' into usermanagment_improvements
Saranya-jena Mar 14, 2024
23fcb96
Merge branch 'master' into usermanagment_improvements
Saranya-jena Mar 15, 2024
ead0e01
Merge branch 'master' into usermanagment_improvements
kartikaysaxena Mar 28, 2024
4b839e2
Update chaoscenter/web/src/views/AccountSettingsUserManagement/Accoun…
kartikaysaxena Apr 1, 2024
b0d93e4
Update chaoscenter/web/src/views/AccountSettingsUserManagement/Accoun…
kartikaysaxena Apr 1, 2024
08800f9
Update chaoscenter/web/src/views/AccountSettingsUserManagement/Accoun…
kartikaysaxena Mar 6, 2024
b18c29c
suggestion implemented
kartikaysaxena Apr 6, 2024
372378b
Merge branch 'usermanagment_improvements' of https://github.com/karti…
kartikaysaxena Apr 6, 2024
88c8348
Merge branch 'master' into usermanagment_improvements
kartikaysaxena Apr 7, 2024
6253636
Merge branch 'master' into usermanagment_improvements
Saranya-jena Apr 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Checkbox,
Container,
Layout,
Pagination,
TableV2,
Text,
useToggleOpen
Expand Down Expand Up @@ -190,6 +191,18 @@ export default function AccountSettingsUserManagementView(
const { isOpen: isCreateUserModalOpen, open: openCreateUserModal, close: closeCreateUserModal } = useToggleOpen();
const { getString } = useStrings();

function handleItemsPerPageChange(pageSize: number) {
setItemsPerPage(pageSize);
setCurrentPage(1);
}

const [currentPage, setCurrentPage] = React.useState(1);
const [itemsPerPage, setItemsPerPage] = React.useState(5);

const indexOfLastItem = currentPage * itemsPerPage;
const indexOfFirstItem = indexOfLastItem - itemsPerPage;
const currentItems = usersData?.slice(indexOfFirstItem, indexOfLastItem);

return (
<Layout.Vertical height={'100%'}>
<Layout.Horizontal
Expand Down Expand Up @@ -238,8 +251,18 @@ export default function AccountSettingsUserManagementView(
{getString('totalUsers')}: {usersData?.length ?? 0}
</Text>
<Container style={{ flexGrow: 1 }}>
{usersData && <MemoizedUsersTable users={usersData} getUsersRefetch={getUsersRefetch} />}
{currentItems && <MemoizedUsersTable users={currentItems} getUsersRefetch={getUsersRefetch} />}
</Container>
<Pagination
pageSize={itemsPerPage}
pageCount={Math.ceil(usersData?.length / itemsPerPage)}
itemCount={usersData?.length ?? 0}
pageIndex={currentPage - 1}
gotoPage={pageIndex => setCurrentPage(pageIndex + 1)}
showPagination={true}
pageSizeOptions={[5, 10, 20]}
onPageSizeChange={pageSize => handleItemsPerPageChange(pageSize)}
/>
</Loader>
</Layout.Vertical>
</Layout.Vertical>
Expand Down
Loading