Skip to content
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

[TASK] Render asset usage counter inside inspector action buttons #221

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

soee
Copy link
Contributor

@soee soee commented Nov 5, 2023

What I did

  • i have extended AssetUsageToggleButton component to show also asset udage counter
  • i have modified AssetUsageSection styles so the table rendered inside dialog window looks a bit better

How I did it

  • i have modified AssetUsageToggleButton and AssetUsageSection components
  • i have modified CSS

How to verify it

  • go to Media module
  • select some asset with or without usages
  • for asset with usages set, you should see badge with number on the Show usgaes button inside inspector actions/tasks
  • if you open dialog with usages, you should see re-styled table with usage items

If asset has no usages

image

If asset has usages

image

Table inside modal with asset usages

before

image

after

image

Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

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

Thx, but see my comment regarding usage performance.


const AssetUsagesToggleButton: React.FC = () => {
const { isInUse } = useSelectedAsset();
const asset = useSelectedAsset();
const { assetUsageDetails, loading } = useAssetUsagesQuery(
Copy link
Member

Choose a reason for hiding this comment

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

I intentionally didn't do this due to performance reasons with the default usage strategy implementation. You could do it though if you check for the feature flag queryAssetUsage first before you query the usageDetails.
For that you could put the Badge also into a small component and only load it if the feature flag is active.

@@ -0,0 +1,3 @@
.assetUsageBadge {
color: var(--theme-blue);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the blue on white for the badge fits well with the rest of the module.
I would rather use white on one of our grey colors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants