Skip to content

FE: generalize ClassSetConfig and DistributionConfigDialog for categorical values - #1736

Open
ikondrat wants to merge 1 commit into
kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p10from
kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p11
Open

FE: generalize ClassSetConfig and DistributionConfigDialog for categorical values#1736
ikondrat wants to merge 1 commit into
kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p10from
kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p11

Conversation

@ikondrat

Copy link
Copy Markdown
Contributor

Summary

Stacked on p10.

Makes the existing config components reusable for categorical metadata values (not just annotation classes):

  • ClassSetConfigDialog / ManualClassSelector: accept an itemNounPlural prop ("classes" by default, "values" for categorical use) — labels like "Search classes…" and "No class found." become context-sensitive
  • DistributionConfigDialog: accepts itemNounPlural and showCountMode props so the count-mode selector is hidden for categorical distributions (which have no object/frame distinction)
  • selectVisibleCounts helper: standalone pure function that slices a CategoryCount[] array to the configured top-N limit — extracted here so the panel can use it independently
  • BarChart/types.ts: adds orientation to BarChartConfig for persistence
  • DatasetDistributionPanel/types.ts: adds CategoricalDistributionConfig and extends DistributionSourceGroup

Test plan

  • make static-checks (frontend) passes
  • npm run test:unit passes (updated tests in ClassSetConfigDialog, ManualClassSelector, DistributionConfigDialog, selectVisibleCounts)

Part of LIG-9585.

@ikondrat
ikondrat requested a review from a team as a code owner July 22, 2026 16:11
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 83c7969f-8062-4956-bd03-a168358fce12

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p11

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lightly-fast-track-bot

lightly-fast-track-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

❌ Fast Track: checks did not pass

Failed guardrails: frontend/complexity (Guardrail threw: Cannot find module 'eslint'
Require stack:

  • /home/runner/work/lightly-studio/lightly-studio/lightly_studio_view/package.json), frontend/coverage ( [FAIL] lightly_studio_view/src/lib/components/BarChart/types.ts: no test file found
    [FAIL] lightly_studio_view/src/lib/components/DatasetDistributionPanel/types.ts: no test file found
    [FAIL] lightly_studio_view/src/lib/components/ClassSetConfig/ClassSetConfigDialog.svelte: coverage data not found
    [FAIL] lightly_studio_view/src/lib/components/ClassSetConfig/ManualClassSelector.svelte: coverage data not found
    [FAIL] lightly_studio_view/src/lib/components/DatasetDistributionPanel/DistributionConfigDialog/DistributionConfigDialog.svelte: coverage data not found
    [FAIL] lightly_studio_view/src/lib/components/DatasetDistributionPanel/selectVisibleCounts.ts: coverage data not found)
Guardrail Result Message
dummy Always passes.
frontend/complexity Guardrail threw: Cannot find module 'eslint' Require stack: - /home/runner/work/lightly-studio/lightly-studio/lightly_studio_view/package.json
backend/complexity 0 file(s) checked.
backend/coverage 0 file(s) checked.
diff-size PR adds 165 line(s) (limit: 215).
frontend/coverage [FAIL] lightly_studio_view/src/lib/components/BarChart/types.ts: no test file found [FAIL] lightly_studio_view/src/lib/components/DatasetDistributionPanel/types.ts: no test file found [FAIL] lightly_studio_view/src/lib/components/ClassSetConfig/ClassSetConfigDialog.svelte: coverage data not found [FAIL] lightly_studio_view/src/lib/components/ClassSetConfig/ManualClassSelector.svelte: coverage data not found [FAIL] lightly_studio_view/src/lib/components/DatasetDistributionPanel/DistributionConfigDialog/DistributionConfigDialog.svelte: coverage data not found [FAIL] lightly_studio_view/src/lib/components/DatasetDistributionPanel/selectVisibleCounts.ts: coverage data not found

Reflects 0d8fd50.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ea245b987

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}: Props = $props();

const maxN = $derived(allClasses.length);
const maxN = $derived(items?.length ?? allClasses.length);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep top-N bounded by the full category list

When items is supplied only to give the manual selector stable values/labels, this changes the top-N cap from the full allClasses list to items.length. If those lists differ, such as a manual list that omits a non-selectable semantic bucket while the chart still has it in allClasses, the input max and the “All” action cap the chart too low so users cannot show every category. Keep the top-N bound tied to the full chart data, or make items a documented complete replacement for allClasses.

Useful? React with 👍 / 👎.

{allClasses}
{items}
{itemNounPlural}
itemNoun={itemNounPlural === 'classes' ? 'class' : 'value'}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pass the singular noun explicitly

This hard-codes every non-classes use of the generalized dialog to the singular value. If the new itemNounPlural prop is reused for another categorical source, for example tags, the manual tab will render copy like No value found. while the rest of the dialog says tags. Add a matching singular prop instead of deriving it from one special case.

AGENTS.md reference: AGENTS.md:L39-L41

Useful? React with 👍 / 👎.

…rical values

Adds itemNounPlural/showCountMode props so both components work for
annotation classes and categorical metadata values. Adds the
selectVisibleCounts helper and extends BarChart/types with orientation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ikondrat
ikondrat force-pushed the kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p10 branch from 52599bb to 09a545f Compare July 22, 2026 17:06
@ikondrat
ikondrat force-pushed the kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p11 branch from 4ea245b to 0d8fd50 Compare July 22, 2026 17:06
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.

1 participant