Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

Summary

Fixes #12692

Adds ifNotHaveType product configuration option - the inverse of ifHaveType. This allows products to be hidden when a specific type IS found, enabling products to be shown only on downstream clusters by specifying a local-cluster-only type.

Occurred changes and/or fixed issues

  • Added ifNotHaveType to DSL product function with regex conversion support
  • Added filtering logic in activeProducts getter to hide products when matching type exists
  • Added TypeScript type definition for the new option

Technical notes summary

  • ifNotHaveType uses the same string/regex pattern matching as ifHaveType
  • Evaluated after ifHaveType in the activeProducts filter chain
  • Uses the product's inStore to determine which store to check for the type

Example usage:

product({
  name: 'downstream-only-product',
  ifNotHaveType: 'management.cattle.io.some-local-type',
  // Shows only when the specified type is NOT present
});

Areas or cases that should be tested

  • Product visibility with ifNotHaveType set to existing type (should hide)
  • Product visibility with ifNotHaveType set to non-existing type (should show)
  • Regex patterns in ifNotHaveType
  • Combined ifHaveType and ifNotHaveType usage
  • Browser: Chrome

Areas which could experience regressions

  • Product filtering in navigation
  • Any existing products using type-based visibility conditions

Screenshot/Video

N/A - No UI changes, backend configuration option only

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes
  • The PR has been reviewed in terms of Accessibility
  • The PR has considered, and if applicable tested with, the three Global Roles Admin, Standard User and User Base

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /usr/local/bin/node /usr/local/bin/node index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add a way to hide products in the local cluster</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
Product config can specify that a product should be shown only if the current cluster is the local cluster (usually that means the product is in the local cluster's cluster explorer but not necessarily). We also need to be able to do the opposite and only show products in downstream clusters.

Describe the solution you'd like
Currently products can use ifHaveType mechanism to specify that a product should be hidden if a certain type is not found. We should also support the opposite of this: product configuration should be able to specify that the product should be hidden if a certain type is found.

Describe alternatives you've considered

Additional context
Needed for rancher/virtual-clusters-ui#55</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 28, 2025 10:53
Co-authored-by: aalves08 <97888974+aalves08@users.noreply.github.com>
…rted form

Co-authored-by: aalves08 <97888974+aalves08@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to hide products in local cluster feat: add ifNotHaveType option to hide products when a type exists Nov 28, 2025
Copilot AI requested a review from aalves08 November 28, 2025 11:00
@aalves08 aalves08 marked this pull request as ready for review December 9, 2025 10:42
@aalves08 aalves08 added this to the v2.14.0 milestone Dec 9, 2025
Copy link
Member

@aalves08 aalves08 left a comment

Choose a reason for hiding this comment

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

LGTM!

@mantis-toboggan-md since you were the creator of the issue I need a second pair of eyes here... I think Copilot did a good job here, so LGTM. Just double-check this please 🙏

easy way to test is to add ifNotHaveType: CATALOG.APP, to https://github.com/rancher/dashboard/blob/master/shell/config/product/apps.js#L27-L33

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.

Add a way to hide products in the local cluster

2 participants