-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Site: Disable Beta buttons in "Get started!" documentation if the release is older than the latest Stable release. #18514
Conversation
Welcome @Sryther! |
Hi @Sryther. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @Sryther thanks for the quick PR ! however in the prview I see it is disabled
https://deploy-preview-18514--kubernetes-sigs-minikube.netlify.app/docs/start/
even though right now minikube does have a new beta release, (it should have NOT been grayed out)
see
https://github.com/kubernetes/minikube/releases/tag/v1.33.0-beta.0
which is newer than 1.32
You're totally right, I just forgot to invert the condition while I was testing... |
Hi @Sryther, thanks for your PR! I took a look at this and think we can simplify this. First off, 99% of the time we don't want to show the diff --git a/site/layouts/shortcodes/quiz_button.html b/site/layouts/shortcodes/quiz_button.html
index 1100d1e92..3cf0b6433 100644
--- a/site/layouts/shortcodes/quiz_button.html
+++ b/site/layouts/shortcodes/quiz_button.html
@@ -1 +1 @@
-<button data-quiz-id="{{ .Parent.Get "base" }}/{{ .Get "option" }}" type="button" class="btn btn-outline-primary option-button">{{ .Get "option" }}</button>
+<button data-quiz-id="{{ .Parent.Get "base" }}/{{ .Get "option" }}" type="button" class="btn btn-outline-primary option-button{{ if eq (.Get "option") "Beta" }} hide{{ end }}">{{ .Get "option" }}</button> Then this will simplify a lot of your code because you can remove your logic that changes the active button to diff --git a/site/content/en/docs/start/_index.md b/site/content/en/docs/start/_index.md
index 71b0a86bc..569f9b0cf 100644
--- a/site/content/en/docs/start/_index.md
+++ b/site/content/en/docs/start/_index.md
@@ -38,21 +38,11 @@ All you need is Docker (or similarly compatible) container or a Virtual Machine
if (releases && releases.length > 0 && releases[0] && releases[0].tag_name) {
const isBetaMostRecent = releases[0].tag_name.includes("-beta");
- if (!isBetaMostRecent) {
+ if (isBetaMostRecent) {
for (architecture of architectures) {
const betaElement = document.querySelector(`button[data-quiz-id="/${architecture}/Beta"]`);
- const stableElement = document.querySelector(`button[data-quiz-id="/${architecture}/Stable"]`);
if (betaElement) {
- betaElement.disabled = true;
-
- if (betaElement.classList.contains("active")) {
- const stableElement = document.querySelector(`button[data-quiz-id="/${architecture}/Stable"]`);
- if (stableElement) {
- stableElement.click();
- stableElement.classList.add("active");
- }
- betaElement.classList.remove("active");
- }
+ betaElement.classList.remove("hide");
}
}
} |
I wasn't aware of the
It should work, right? |
Yeah, that's completely fine, I just used |
"Windows/x86-64" | ||
]; | ||
|
||
fetch('https://api.github.com/repos/kubernetes/minikube/releases') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we console out log how long this takes, so for reference ? I wanna know if it worth it to make our site slower by this call ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a timer to measure the performance. Anyway it's asynchronous, it shouldn't affect page loading 🙂 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: spowelljr, Sryther The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Disabling Beta buttons is not instantaneous. I'm not sure that's the most convenient method to do it.
First it looks for latest release, if it's not a Beta one it'll disable the Beta button and activate the Stable one instead.
fixes #18505