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

fix(docs): ensure version dropdown sorts correctly regardless of browser language #20289 #20322

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

jaehanbyun
Copy link
Contributor

Closes #20289

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

What I have done:

I resolved an issue where 'version' was hardcoded, preventing proper sorting in browsers set to languages other than English.
The screenshot below shows that it now operates correctly in a browser set to German.
image

@jaehanbyun jaehanbyun requested review from a team as code owners October 10, 2024 07:37
Copy link

bunnyshell bot commented Oct 10, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

const link = dd.querySelector('a');
if (link) {
// Check if the link's href matches version pattern
return /\/en\/(release-(?:v?\d+[\.\d+]*)|\d+\.\d+\.\d+|latest|stable)\//.test(link.getAttribute('href'));
Copy link
Member

Choose a reason for hiding this comment

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

const currentVersion = window.location.href.match(/\/en\/(release-(?:v\d+|[\d\.]+|\w+)|latest|stable)\//);

image

The version regex expression Line 23 excludes versions without the release- prefix, except for 'latest' or 'stable'. However,Here currently including them. Why is this necessary? 🤔

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have now corrected it. I appreciate your help!

Copy link
Member

@nitishfy nitishfy left a comment

Choose a reason for hiding this comment

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

Overall LGTM. I'd like to present another small request related to this -

Right now, if I select any version on the docs, the topbar doesn't reflect which version I'm currently at completely. As you can see in the below image, it shows as Release..... You can either put those changes in the same PR or raise a new PR for it.
image

@jaehanbyun
Copy link
Contributor Author

jaehanbyun commented Oct 10, 2024

Hello, @nitishfy.

I have reviewed what you mentioned. I will address the issue and submit a new PR shortly. Thank you!

Comment on lines 88 to 92
if (link) {
// Check if the link's href matches version pattern
return /\/en\/(release-(?:v\d+|[\d\.]+|\w+)|latest|stable)\//.test(link.getAttribute('href'));
}
return false;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (link) {
// Check if the link's href matches version pattern
return /\/en\/(release-(?:v\d+|[\d\.]+|\w+)|latest|stable)\//.test(link.getAttribute('href'));
}
return false;
return /\/en\/(release-(?:v\d+|[\d\.]+|\w+)|latest|stable)\//.test(link?.getAttribute?.('href'));

This could be simplified.

If the version regex expression is the same as above, maybe we should store it in a constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used a constant for the regex as you suggested. Thanks!

…ser language

Signed-off-by: jaehanbyun <awbrg789@naver.com>
Copy link
Member

@linghaoSu linghaoSu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@todaywasawesome todaywasawesome left a comment

Choose a reason for hiding this comment

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

LGTM

@agaudreault agaudreault merged commit d1ef0f8 into argoproj:master Oct 17, 2024
23 checks passed
adriananeci pushed a commit to adriananeci/argo-cd that referenced this pull request Dec 4, 2024
…ser language argoproj#20289 (argoproj#20322)

Signed-off-by: jaehanbyun <awbrg789@naver.com>
Signed-off-by: Adrian Aneci <aneci@adobe.com>
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.

Release Versions are not sorted in the documentation.
6 participants