-
-
Notifications
You must be signed in to change notification settings - Fork 205
fix(usage): migrate usage breakdown table to universal table DEV-1013 DEV-1247 #6269
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
base: dev-987-asset-usage-limit-offset-pagination
Are you sure you want to change the base?
fix(usage): migrate usage breakdown table to universal table DEV-1013 DEV-1247 #6269
Conversation
|
@duvld you forgot to add task id in PR title :) |
jamesrkiger
left a comment
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.
Left a couple comments, but it's looking good so far.
82c907d to
2de2fa1
Compare
commit 82c907d Merge: 307c0cc 8c71fd2 Author: Anji <[email protected]> Date: Tue Oct 14 10:59:11 2025 -0400 Merge branch 'dev-987-asset-usage-limit-offset-pagination' into anji/dev-1013-mirgrate-to-universal-table commit 307c0cc Merge: d1bbb52 6e62f77 Author: Anji <[email protected]> Date: Tue Oct 14 10:58:28 2025 -0400 Merge branch 'dev-987-asset-usage-limit-offset-pagination' into anji/dev-1013-mirgrate-to-universal-table Conflicts: jsapp/js/account/usage/usageProjectBreakdown.tsx commit d1bbb52 Author: Kalvis Kalniņš <[email protected]> Date: Thu Oct 9 18:45:26 2025 +0300 fixup! WIP, BROKEN: query error typing mismatch commit 1314ccc Author: Kalvis Kalniņš <[email protected]> Date: Thu Oct 9 18:40:33 2025 +0300 refactor(UniversalTable): parameterize error type commit 133d677 Author: Anji <[email protected]> Date: Thu Oct 9 11:33:00 2025 -0400 WIP, BROKEN: query error typing mismatch commit bda0843 Author: Leszek <[email protected]> Date: Tue Sep 30 21:04:47 2025 +0200 remove duplicated column commit f175294 Author: Anji <[email protected]> Date: Tue Sep 30 13:44:05 2025 -0400 Add count commit a13fdf4 Author: Anji <[email protected]> Date: Tue Sep 30 13:26:51 2025 -0400 add proper link to project label commit d58cc9f Author: Anji <[email protected]> Date: Thu Sep 25 15:06:54 2025 -0400 WIP title link commit 94f54d6 Merge: 9d98814 4e7c317 Author: Anji Tong <[email protected]> Date: Thu Sep 25 17:23:27 2025 +0000 Merge branch 'dev-987-asset-usage-limit-offset-pagination' into anji/dev-1013-mirgrate-to-universal-table commit 9d98814 Author: Anji <[email protected]> Date: Thu Sep 18 19:22:31 2025 -0400 biome commit 0772fad Author: Anji <[email protected]> Date: Thu Sep 18 19:21:22 2025 -0400 fix(assetUsage): migrate asset usage table commit 3fc4877 Author: Anji <[email protected]> Date: Thu Sep 18 18:58:35 2025 -0400 WIP: table migrated, TODO: remove old code
2de2fa1 to
09b5623
Compare
…dev-1013-mirgrate-to-universal-table
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.
see the failing CI, code review inline, not tested.
| const usageName: ProjectFieldDefinition = { | ||
| name: 'name', | ||
| label: t('##count## Projects').replace('##count##', projectData.count), | ||
| label: getUsageNameLabel(), |
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.
why bother a separate function for a oneliner that's used once? Also, here's the correct way to check whether response succeeded or errored.
| label: getUsageNameLabel(), | |
| label: queryResult.data.status === 200 ? t('##count## Projects').replace('##count##', queryResult.data.data.count.toString()) : t('Projects') |
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 still needs a check for undefined on queryResult.data, changed it to this:
label: (queryResult.data && queryResult.data.status === 200) ? t('##count## Projects').replace('##count##', queryResult.data.data.count.toString()) : t('Projects'),| // HACK FIX: a bit of a roundabout way to incorporate what the backend expects without diving too deep into changing | ||
| // existing types |
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 comment is not helpful as it answers nothing actually. It logically begs the questions "why don't you dive deep into fixing existing types then" and "which backend expectations" and "which existing types", all of which are not answered.
How about "TODO: align props with backend pagination params to simplify away this helper."?
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.
Yes that sounds a lot better, thanks
| placeholderData: keepPreviousData, | ||
| // We might want to improve this in future, for now let's not retry | ||
| retry: false, | ||
| // The `refetchOnWindowFocus` option is `true` by default, I'm setting it | ||
| // here so we don't forget about it. | ||
| refetchOnWindowFocus: true, | ||
| throwOnError: () => { | ||
| notify(t('There was an error getting the list.'), 'error') // TODO: update message in backend (DEV-1218). | ||
| return false | ||
| }, |
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.
are you sure you need any of these options here? I see they are verbatim copied from the useOrganizationsMembersList. By default use defaults which is no options.
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.
Removed other options except for the error throwing
| const updateOrder = (newOrder: ProjectsTableOrder) => { | ||
| setOrder(newOrder) | ||
| } |
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.
why bother an identity function, just use setOrder directly instead of updateOrder?
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.
I don't know, I didn't write this code. I don't want to change old code if I'm editing an existing file so I usually just leave the logic as is. Perhaps it was originally supposed to hold more logic here, but Ruth never got to it. Do you think we should simplify this?
| /** | ||
| * Note: There is only one use case so far where we don't want this to be resizeable, so we set the default to show | ||
| * the resizer as to not change any other code. See DEV-1255. | ||
| */ | ||
| notResizeable?: boolean |
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.
- positive naming is better than negative naming, please consider names like
fixedWidthinstead. AFAIK all flags are false by default, so lack offixedWidthshould be self-explanatory. - this comment is not answering anything. Which usecase? Why? Won't there be another usecase in future? I looked into it, consider renaming it to something like "For compatibility with react-table set
fixedWidthbecause X otherwise Y".
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.
That's clearer--thank you
jamesrkiger
left a comment
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.
Left one comment that needs a quick fix
jamesrkiger
left a comment
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.
I pushed a small change to the getQueryParams function because I noticed that it was resulting in requests with a query param of ordering=undefined when "default sort" was selected. Can you take a quick look and make sure you like that solution? Other than that, lgtm.

🗒️ Checklist
<type>(<scope>)<!>: <title> DEV-1234Front endand/orBack endorworkflow📣 Summary
Use the new table component to display asset usage data. Fixes old pagination issues
💭 Notes
Modeled after how access logs uses the universal table. Removes
uidfrom theAssetWithUsagetype as it is not actually expected as a response from backend--updated logic accordingly👀 Preview steps