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

Add support for modifying doc links and add support for different links for Rancher Prime #13020

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

nwmac
Copy link
Member

@nwmac nwmac commented Jan 9, 2025

Summary

Fixes #12384

Occurred changes and/or fixed issues

  • This PR adds the necessary support to allow an extension to modify documentation links.
  • It also adds a Prime extension that uses this new mechanism to modify documentation links from the community documentation to the Prime documentation site.

Technical notes summary

In order to allow a Prime extension to modify the documentation links, it needs to know:

  1. Is the system Rancher Prime
  2. The version of Rancher

Currently this metadata is not available to extensions. In order to make that available and for it to be available to built-in extensions, this requires a change to the way built-in extensions are loaded - they are no longer loaded immediately, but instead are recorded where they used to be initialised and now they get initialised in the same place as external extensions. This is much more consistent. At this point we have version information, so we extend the extension interface to add environment information.

For built-in extensions, we also allow them to indicate that they should not load, in this case they are hidden - this allows the Prime extension to be hidden when not applicable.

The actual mechanism to change the documentation links is done via the clean-html directive - it ensures for A links that the new linkInterceptors can modify URLs. We also wire this into the CommunityLinks component, which renders links but does not use the clean-html directive.

Areas or cases that should be tested

This PR adds two e2e tests which check the two different ways in which the documentation links can be intercepted and verifies that these are correct for Prime.

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

@rancher-ui-project-bot rancher-ui-project-bot bot added this to the v2.11.0 milestone Jan 9, 2025
@nwmac nwmac requested review from richard-cox and aalves08 and removed request for richard-cox January 9, 2025 12:15
aalves08
aalves08 previously approved these changes Jan 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.

Took me a while to review it and test it, but no comments. Everything LGTM!

Interesting idea to have an extension that control all customisations to Prime 👍

@aalves08
Copy link
Member

aalves08 commented Jan 9, 2025

It's failing on the check-plugins step with https://github.com/rancher/dashboard/actions/runs/12693532930/job/35381326812?pr=13020... probably because you typed get environment() which is dependent on getVersionData

aalves08
aalves08 previously approved these changes Jan 10, 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.

all gates seem good, so LGTM

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.

There'll need to be some extension site docs at some point. Could do as part of this PR or another?

pkg/rancher-prime/docs.ts Outdated Show resolved Hide resolved
pkg/rancher-prime/docs.ts Show resolved Hide resolved
@nwmac
Copy link
Member Author

nwmac commented Jan 24, 2025

@richard-cox Will do docs later - if there are no issues with this approach, we can document for others to use.

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.

Show different content (like docs) if Prime or Community in use
3 participants