Skip to content

Conversation

duvld
Copy link
Member

@duvld duvld commented Sep 18, 2025

🗒️ Checklist

  1. run linter locally
  2. update developer docs (API, README, inline, etc.), if any
  3. for user-facing doc changes create a Zulip thread at #Kobo support docs, if any
  4. draft PR with a title <type>(<scope>)<!>: <title> DEV-1234
  5. assign yourself, tag PR: at least Front end and/or Back end or workflow
  6. fill in the template below and delete template comments
  7. review thyself: read the diff and repro the preview as written
  8. open PR & confirm that CI passes & request reviewers, if needed
  9. delete this section before merging

📣 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 uid from the AssetWithUsage type as it is not actually expected as a response from backend--updated logic accordingly

👀 Preview steps

  1. ℹ️ have an account and many projects
  2. submit some data
  3. navigate to account/usage > per project total tab
  4. 🔴 [on main] notice that pagination doesn't work
  5. 🟢 [on PR] notice that pagination does work
  6. 🟢 [on PR] notice that table displays the correct data with no regressions
  7. ℹ️ have a MMO with different member's permissions
  8. 🟢 notice that the table has no regressions related to MMOs

@magicznyleszek
Copy link
Member

@duvld you forgot to add task id in PR title :)

@duvld duvld changed the title fix(assetUsage): migrate asset usage table fix(assetUsage): migrate asset usage table DEV-1013 Sep 30, 2025
@duvld duvld marked this pull request as draft September 30, 2025 15:00
@duvld duvld marked this pull request as ready for review September 30, 2025 17:28
@jamesrkiger
Copy link
Contributor

jamesrkiger commented Oct 1, 2025

Let's give the table a set height so the sort dropdowns don't get cut off if you only have one asset like here:
image

This would also make it so the table doesn't jump sizes when you switch from a page of 10 results to a page of 1 result, for example.

Also, there is currently some horizontal overflow, seemingly no matter how wide my screen is. It's fine if there is horizontal overflow on small screens, but can you fix the column sizes so there is no overflow on normal screens?

errorMessageDisplay: t('There was an error fetching asset usage data.'),
})
return {
status: 200 as const,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the story here? Pre-defining the response status seems strange.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my other comment

Copy link
Contributor

@jamesrkiger jamesrkiger left a 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.

Comment on lines +32 to +36
const queryResult = useQuery({
queryKey: [QueryKeys.assetUsage, pagination.limit, pagination.offset, orgQuery.data, orgQuery.data?.id, order],
queryFn: () => getOrgAssetUsage(pagination.limit, pagination.offset, orgQuery.data ? orgQuery.data.id : '', order),
placeholderData: keepPreviousData,
})
Copy link
Contributor

@Akuukis Akuukis Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to migrate to custom react-queries 👌 But let's migrate straight Orval's react-query!
See useOrganizationsServiceUsageRetrieve, or useOrganizationsServiceUsageSummary that just got merged into main. Afterwards the whole of assetUsage.api.ts could be deleted.

P.S. #6307 also uses Orval's react-query response in UniversalTable

errorMessageDisplay: t('There was an error fetching asset usage data.'),
})
return {
status: 200 as const,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my other comment

@magicznyleszek magicznyleszek removed their request for review October 3, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants