Add UI for Card Management#1731
Conversation
e6c91f6 to
6099b92
Compare
…e, fix Messaging bug
6099b92 to
a5003d9
Compare
| , (error, result) => { | ||
| if (error) { | ||
| logger.error('getAllCards got an error querying mongodb'); | ||
| return resolve(null); |
There was a problem hiding this comment.
maybe we should resolve an empty array, so this function returns some sort of array no matter what
| let getCards = await getAllCards(); | ||
| if (!getCards) { | ||
| logger.info('Error retrieving cards'); | ||
| return res.sendStatus(SERVER_ERROR); | ||
| } | ||
|
|
||
| logger.info('Retrieved all cards successfully!'); | ||
| res.json(getCards).status(OK); |
There was a problem hiding this comment.
this is a silly nitpick, the less we add not in our if statements the easier debugging becomes later
also we already log errors, so we can skip logging it again, plus logging nothing on success is ok
| let getCards = await getAllCards(); | |
| if (!getCards) { | |
| logger.info('Error retrieving cards'); | |
| return res.sendStatus(SERVER_ERROR); | |
| } | |
| logger.info('Retrieved all cards successfully!'); | |
| res.json(getCards).status(OK); | |
| const getCards = await getAllCards(); | |
| if (getCards) { | |
| return res.json(getCards).status(OK); | |
| } | |
| return res.sendStatus(SERVER_ERROR); |
| const url = new URL('/api/OfficeAccessCard/delete', BASE_API_URL); | ||
| url.searchParams.append('cardBytes', cardBytes); | ||
| const res = await fetch(url.href, { |
There was a problem hiding this comment.
we didnt do this earlier but can we change the delete endpoint to be a post request? then we can send the bytes as a json body
| > | ||
| Card Registry | ||
| </button> | ||
| <div> | </div> |
There was a problem hiding this comment.
add a comment above this line on what this is rendering
evanugarte
left a comment
There was a problem hiding this comment.
also can we get screenshots of the new ui, with how both tabs look
| body: JSON.stringify({ cardBytes, }), | ||
| }); | ||
| if (res.ok) { | ||
| const result = await res.json(); |
There was a problem hiding this comment.
is there a json response from the delete endpoint?
There was a problem hiding this comment.
i believe its a boolean of success/failure
There was a problem hiding this comment.
double check if this res.json() returns an error
| headerText: `Delete card: ${cardToDelete.cardBytes}?`, | ||
| bodyText: `Are you sure you want to delete | ||
| card: ${cardToDelete.cardBytes}? It'll be gone forever if you do.`, | ||
| confirmText: `Yes, delete card: ${cardToDelete.cardBytes}`, |
There was a problem hiding this comment.
| confirmText: `Yes, delete card: ${cardToDelete.cardBytes}`, | |
| confirmText: `Yes, delete ${cardToDelete.cardBytes}`, |
There was a problem hiding this comment.
i think the original is still there
There was a problem hiding this comment.
I haven't committed yet, still working on the useMemo thing below
edb258c to
eb05d9a
Compare
eb05d9a to
91a097c
Compare
… verifiedCount to 1
6f83717 to
0935119
Compare
a636313 to
7e0e19c
Compare
| endpoint: '/delete', | ||
| message: 'cardBytes missing from request' | ||
| message: 'cardBytes missing from request', | ||
| requestType: 'HTTP POST', |
There was a problem hiding this comment.
is there a way to get the method from the request object?
| eventSource.onerror = (error) => { | ||
| setLogs( | ||
| (currLogs) => [ | ||
| '...crickets...', |
There was a problem hiding this comment.
instead can we show the error in the console
There was a problem hiding this comment.
I can log the error in the browser console but it'll not pass lint and also won't actually say what happened, it's a very vague Event object
|
|
||
| useEffect(() => { | ||
| if (connected) { | ||
| setConnectionStatusText('Listening for card reader activity...'); |
There was a problem hiding this comment.
| setConnectionStatusText('Listening for card reader activity...'); | |
| setConnectionStatusText('Listening for card reader activity...'); | |
| return; |
then you can remove the else block
c455f42 to
a03cd58
Compare
4cbaeb8 to
8d74c78
Compare
…darsh/06252025_card_management_ui
eb5e9e5 to
a7a5b61
Compare
Co-authored-by: Evan Ugarte <36345325+evanugarte@users.noreply.github.com>
* Add UI to manage cards, move CardReader API functions to separate file, fix Messaging bug * Addressed previous comments * Addressed comments * addressed more comments * added light mode compatibility, adjusted log format, set default card verifiedCount to 1 * Add pagination to card registry * Removed search and sort logic for now * Add pagination to card registry * Removed search and sort logic for now * fix crickets msg * Apply suggestions from code review Co-authored-by: Evan Ugarte <36345325+evanugarte@users.noreply.github.com> --------- Co-authored-by: Evan Ugarte <36345325+evanugarte@users.noreply.github.com>


Add UI to manage/delete cards, move CardReader API functions to separate file, fix Messaging bug