-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update homepage with log records from DB + pagination #77
Update homepage with log records from DB + pagination #77
Conversation
8c089a2
to
39233c8
Compare
ccb0e70
to
39233c8
Compare
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.
awesome stuff 💯 you guys popped off with this and got it done quickly, but there are a few front-end issues that should be fixed so #try-again #skill-issue #be-happy
return ( | ||
<Tr key={record.logId} style={{ verticalAlign: "middle" }}> | ||
<Td width="5%"> | ||
{`${dateObj.getMonth()} ${dateObj.getDate()} ${dateObj.getFullYear()}`} |
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.
Would it be possible to show an abbreviated form for the month instead of the number? For example, instead of "9 2 2023", we would see Sept 9th, 2023.
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.
Resolved ; used the following const array for the months. Let me know if you want any of these to be changed:
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
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.
Following up on this ; the year is not included in the designs ; this was accidentally included by us. On that note though, is the year something we want to include?
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.
yeah, might be confusing if you have two logs that are both jan 18th (but one is 2023, the other 2024)
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.
will do
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.
frontend/src/index.css
Outdated
@@ -22,7 +22,7 @@ code { | |||
text-align: center; | |||
color: #2d3748; | |||
width: 75%; | |||
padding-top: 10%; | |||
padding-top: 2%; |
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 probably needs to get updated in #76 when that's merged
<Box padding="12px 0px 33px"> | ||
<Flex justifyContent="space-between" alignItems="center"> | ||
<Box> | ||
<Text color="#6D8788">{getNumRecordsStr()}</Text> |
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.
some manual styling will need to be updated when #76 is merged
TODOs:
|
@connor-bechthold @kevin-pierce can you folks also test the performance of the pagination? I noticed there was a slight delay when navigating to another page, but I don't have any issues with this unless the delay is notably longer with more log records. Please test to see what the delay is with like 10k log records and lmk 🐱 |
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.
Not too many added comments since I think Safwaan covered most of them, but overall good work! I think the main changes and/or things to think about are the ones that Safwaan commented on (and the bug!)
@@ -28,7 +28,7 @@ def add_record(self, log_record): | |||
pass | |||
|
|||
@abstractmethod | |||
def get_log_records(self, page_number, filters=None): | |||
def get_log_records(self, page_number, results_per_page, filters=None): |
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.
If we have the default value for the results_per_page =1 in the implementations, maybe we should consider doing it the same for here
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.
Good catch, will add 🙏
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.
just some issues with the input for the page number, let's sync with the designers to iron them out
> | ||
<Text>Page</Text> | ||
<NumberInput | ||
maxW="60px" |
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.
an issue with this is if there are 1000s of pages, the input box only shows 2 digits. This may be confusing to the user. I don't know what the width should be, but my (naïve) solution would be just to use a width that accommodates the largest possible integer.
Syncing with the designers on this would be a good first step.
width="210px" | ||
> | ||
<Text>Page</Text> | ||
<NumberInput |
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.
noticing if you keep typing numbers it'll go to infinity then back to 0 lol
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.
maybe lets cap the input to the max number of pages (meaning if there are 400 pages and I'm at 300, I add another digit, it'll just go to 400 and won't let me add new numbers)
newUserPageNum >= 1 && | ||
newUserPageNum <= numPages | ||
) { | ||
getLogRecords(newUserPageNum); |
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.
one issue I have with getting the new logs whenever the input changes is that the pagination gets really slow (I'm testing with 100000 logs) and its hard to tell when you're on the right page. I think it makes more sense to get the log records once the input is actually submitted.
For example, if I start on page 1, and want to go to page 300, it'll fetch the logs for page 3, then page 30, then finally page 300. It should only retrieve the page 300 log records at the end, either by hitting enter on the input or clicking out of it.
A lot of this headache is coming from the designs 😖 maybe we can approach the UI for this differently
frontend/src/index.css
Outdated
@@ -14,6 +14,15 @@ code { | |||
monospace; | |||
} | |||
|
|||
.records-hero { |
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.
#76 is merged, so merge main and move these changes to the theme dir
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.
lgtm! there's a few thing we need to improve (dealing with large page numbers, when to call the API, etc) but I'm happy with merging it in :D
Awesome work guys 🚀 now write 300 jest tests on pagination.
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.
LGTM! There's a few small things with the linter and whatnot but it looks good to me!
GH ticket link
Pagination Component on Homepage
Related ticket
Update Homepage table to render data from DB
Implementation description
get_log_records
service + associated endpoint to take inresults_per_page
as parameter, allowing for chunked request sizesPagination
component as per functional description + Figma designscommon/LogRecordsTable.tsx
componentSearchAndFilters
intopages/LogRecords
Functional Testing
What should reviewers focus on?
pages/LogRecords
; the design choice of liftingSearchAndFilters
was done due to weird rendering issues, but we'd still like to get a second pair of 👀 on thatPage 1
upon changing the results per page parameter?Checklist