Skip to content

Conversation

@codyrancher
Copy link
Member

@codyrancher codyrancher commented Dec 17, 2025

Summary

Fixes #16179
Fixes #16189

Occurred changes and/or fixed issues

Made is so we can now differentiate between detail pages and show configuration when adding tabs via extensions.

Technical notes summary

This is done by using provide/inject to indicate to all ancestors that they're inside a resourcedetailpage. It's not the most elegant but it seems preferable over prop drilling especially when we don't control all detail pages that are rendered.

Areas or cases that should be tested

Extension tabs on the resource detail page, show configuration page, create and edit pages.

Areas which could experience regressions

See above

Screenshot/Video

tabular.mp4

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

data() {
const extensionTabs = this.showExtensionTabs ? getApplicableExtensionEnhancements(this, ExtensionPoint.TAB, TabLocation.RESOURCE_DETAIL, this.$route, this, this.extensionParams) || [] : [];
const location = this.isResourceDetailDrawer ? TabLocation.RESOURCE_SHOW_CONFIGURATION : TabLocation.RESOURCE_DETAIL;
Copy link
Member

Choose a reason for hiding this comment

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

@aalves08 @codyrancher just want to confirm my comment in #16189 (comment).

The issue needs updating to reflect that we need it primarily on the edit page and then the show config tab, so two tab locations.

We probably need to be more explicit as well (if a --> y, if b --> x) instead of falling back on a location (if then else). Tabs can be used in a number of different places

Copy link
Member

Choose a reason for hiding this comment

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

@richard-cox we are safe with the create and edit scenarios because of the url param create (i just need to double-check if it works of if I need a PR, but in node we can't do Create's) and the edit has the mode query param, which is working fine.

Copy link
Member

Choose a reason for hiding this comment

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

It may be technically possible to overload the resource detail location + also supply some additional restrictions, but from the perspective of a ui extension developer having distinct tab locations is much easier to understand and use. This also follows the general messages of the three primary resource pages

  • List page
  • Detail page
  • Create/Edit page

/**
* Hide the product if the type is present (opposite of ifHaveType)
*/
ifNotHaveType?: string | RegExp;
Copy link
Member

Choose a reason for hiding this comment

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

careful about this... probably is because it's missing a rebase or something. This was added quite recently. Should not be deleted

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Really not sure what caused it.

@aalves08
Copy link
Member

@codyrancher overall path looks great. I've tried the PR and it works just fine. Thank you very much! If you want I can take care of the documentation part in a separate PR 🙇

@aalves08
Copy link
Member

aalves08 commented Dec 17, 2025

FYI, you can target:

EDIT

plugin.addTab(
    TabLocation.RESOURCE_DETAIL,
    { resource: ['pod'], mode: ['edit'] },
    {
      name:       'some-name',
      label:      'some-label',
      weight:     -5,
      showHeader: true,
      tooltip:    'this is a tooltip message',
      component:  () => import('./MyTabComponent.vue')
    }
  );

CREATE

  plugin.addTab(
    TabLocation.RESOURCE_DETAIL,
    {
      resource: ['pod'], mode: [], path: { urlPath: '/create', endsWith: true }
    },
    {
      name:       'some-name',
      label:      'some-label222',
      weight:     -5,
      showHeader: true,
      tooltip:    'this is a tooltip message',
      component:  () => import('./MyTabComponent.vue')
    }
  );

@codyrancher codyrancher force-pushed the tabular-yo branch 3 times, most recently from 0422aff to a9765bf Compare December 18, 2025 05:50
@codyrancher
Copy link
Member Author

codyrancher commented Dec 18, 2025

@codyrancher overall path looks great. I've tried the PR and it works just fine. Thank you very much! If you want I can take care of the documentation part in a separate PR 🙇

@aalves08 I cleaned it up and added some docs. If we do want to make separate location I'm happy to do that as well but it's up to you.

Edit: do we want to add each of the scenarios to https://github.com/rancher/ui-plugin-examples to make it easier for QA to test?

@codyrancher codyrancher marked this pull request as ready for review December 18, 2025 06:04
@codyrancher codyrancher requested a review from aalves08 December 18, 2025 06:26
Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

Re-iterating #16203 (comment).

The developer experience is not good, we should have tab locations for each of the three places.

aalves08
aalves08 previously approved these changes Dec 18, 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.

@aalves08
Copy link
Member

Re-iterating #16203 (comment).

The developer experience is not good, we should have tab locations for each of the three places.

Created new isssue #16218 to be tackled separately @richard-cox

@aalves08
Copy link
Member

@codyrancher I can take care of the ui-plugins-examples, as per #16219. I've got more stuff to add there

@aalves08 aalves08 dismissed their stale review December 18, 2025 11:14

found an issue on docs

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.

minor changes, but let's try to get this in today 🙏 Thanks @codyrancher !

| Key | Type | Description |
|---|---|---|
|`TabLocation.RESOURCE_DETAIL`| String | Location for a Tab on a Resource Detail page |
|`TabLocation.RESOURCE_SHOW_CONFIGURATION`| String | Location for a Tab on a Resource Show Configuration |
Copy link
Member

Choose a reason for hiding this comment

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

Ah, the docs content is correct but where you've edited them is wrong... It should be docusaurus/docs/extensions/api/tabs.md not the versioned_docs part as that's old stuff...

Also, minor change but important, can you add a reference that this available from 2.14 and onwards? 🙏

*(From Rancher version v2.14.0)*

@aalves08 aalves08 dismissed richard-cox’s stale review December 18, 2025 11:18

Dismissing review because created issue to tackle it separately

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

@codyrancher codyrancher merged commit 4e34af4 into rancher:master Dec 18, 2025
61 of 64 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

3 participants