Skip to content

feat(clusters): let a plugin row action decide which clusters it applies to - #1415

Merged
hibig merged 1 commit into
gpustack:mainfrom
gitlawr:feat/cluster-row-action-show-predicate
Sep 24, 2026
Merged

hibig merged 1 commit into
gpustack:mainfrom
gitlawr:feat/cluster-row-action-show-predicate

Conversation

@gitlawr

@gitlawr gitlawr commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

The cluster row-action filter only knew how to gate on provider, so an action whose applicability depends on a cluster option had no way to exclude itself and showed up on every row. Honour an optional show(row) predicate first, the same seam the my-models card actions already use.

Copilot AI balanced review requested due to automatic review settings September 24, 2026 06:08

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a row-level predicate check (item.show) to filter cluster action items based on the current row's state. The review feedback correctly points out a potential runtime error since item is typed as any, and suggests safely verifying that item.show is a function before calling it.

Comment thread src/pages/cluster-management/hooks/use-cluster-columns.tsx Outdated

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The reviewed change is focused, and no unresolved issues were identified.

Review effort: Balanced
Findings: None

What changed in this PR

Adds row-specific visibility filtering for plugin actions in the cluster management table.

Changes:

  • Evaluates an optional show(row) predicate before existing provider-based filters.
  • Preserves current provider and default visibility behavior.
File Description
src/​pages/​cluster-management/​hooks/​use-cluster-columns.tsx Filters cluster row actions using plugin-defined row predicates.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

…ies to

The cluster row-action filter only knew how to gate on `provider`, so an
action whose applicability depends on a cluster option had no way to
exclude itself and showed up on every row. Honour an optional
`show(row)` predicate first, the same seam the my-models card actions
already use.

Contributed actions are untyped at the plugin boundary, so a `show` that
is not callable falls through to the provider rules instead of throwing
mid-render.
@gitlawr
gitlawr force-pushed the feat/cluster-row-action-show-predicate branch from f198f9c to 8c181ed Compare September 24, 2026 06:20
@gitlawr
gitlawr requested a review from hibig September 24, 2026 06:29
@hibig
hibig merged commit e713304 into gpustack:main Sep 24, 2026
4 checks passed
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.

3 participants