forked from MarquezProject/marquez
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: modifications in Events.tsx file * Add PageSizeSelector component and improve responsiveness of Datasets, Jobs, and Events components * refactor function handlerPageSizeChange * Add PageSizeSelector component and improve responsiveness of Datasets, Jobs, and Events components * Correct pagination offsets * Correct pagination offsets events refresh * Correct pagination offsets and improve layout in Events component * Set Compact Nodes as default in ActionBar component
- Loading branch information
Showing
7 changed files
with
266 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Button, Menu, MenuItem } from '@mui/material' | ||
import React, { useState } from 'react' | ||
|
||
type PageSizeSelectorProps = { | ||
onChange: (pageSize: number) => void | ||
initialPageSize?: number | ||
} | ||
|
||
const PAGE_OPTIONS = [20, 50, 100] | ||
|
||
const PageSizeSelector: React.FC<PageSizeSelectorProps> = ({ onChange, initialPageSize = 20 }) => { | ||
const [pageSize, setPageSize] = useState(initialPageSize) | ||
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null) | ||
|
||
const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => { | ||
setAnchorEl(event.currentTarget) | ||
} | ||
|
||
const handleMenuItemClick = (option: number) => { | ||
setPageSize(option) | ||
onChange(option) | ||
setAnchorEl(null) | ||
} | ||
|
||
const handleClose = () => { | ||
setAnchorEl(null) | ||
} | ||
|
||
return ( | ||
<> | ||
<Button variant='outlined' color='primary' onClick={handleButtonClick}> | ||
Items per page: {pageSize} | ||
</Button> | ||
|
||
<Menu anchorEl={anchorEl} open={Boolean(anchorEl)} onClose={handleClose}> | ||
{PAGE_OPTIONS.map((option) => ( | ||
<MenuItem key={option} onClick={() => handleMenuItemClick(option)}> | ||
{option} items per page | ||
</MenuItem> | ||
))} | ||
</Menu> | ||
</> | ||
) | ||
} | ||
|
||
export default PageSizeSelector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.