Skip to content

Commit e97c7f9

Browse files
authored
Merge pull request #18514 from Sryther/master
Site: Disable Beta buttons in "Get started!" documentation if the release is older than the latest Stable release.
2 parents 179be77 + 6c7e620 commit e97c7f9

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

Diff for: site/content/en/docs/start/_index.md

+41-8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,39 @@ All you need is Docker (or similarly compatible) container or a Virtual Machine
2020

2121
<h2 class="step"><span class="fa-stack fa-1x"><i class="fa fa-circle fa-stack-2x"></i><strong class="fa-stack-1x text-primary">1</strong></span>Installation</h2>
2222

23+
<script language="javascript">
24+
const architectures = [
25+
"Linux/x86-64",
26+
"Linux/ARM64",
27+
"Linux/ppc64",
28+
"Linux/S390x",
29+
"Linux/ARMv7",
30+
"macOS/x86-64",
31+
"macOS/ARM64",
32+
"Windows/x86-64"
33+
];
34+
35+
console.time("timerReleaseFetch");
36+
fetch('https://api.github.com/repos/kubernetes/minikube/releases')
37+
.then((response) => response.json())
38+
.then((releases) => {
39+
console.timeEnd("timerReleaseFetch");
40+
if (releases && releases.length > 0 && releases[0] && releases[0].tag_name) {
41+
const isBetaMostRecent = releases[0].tag_name.includes("-beta");
42+
43+
if (isBetaMostRecent) {
44+
for (architecture of architectures) {
45+
const betaElement = document.querySelector(`button[data-quiz-id="/${architecture}/Beta"]`);
46+
if (betaElement) {
47+
betaElement.classList.remove("hide");
48+
}
49+
}
50+
}
51+
}
52+
})
53+
.catch(console.error);
54+
</script>
55+
2356
{{% card %}}
2457

2558
Click on the buttons that describe your target platform. For other architectures, see [the release page](https://github.com/kubernetes/minikube/releases/latest) for a complete list of minikube binaries.
@@ -33,7 +66,7 @@ Click on the buttons that describe your target platform. For other architectures
3366
{{% /quiz_row %}}
3467

3568
{{% quiz_row base="/Linux/x86-64" name="Release type" %}}
36-
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" %}}
69+
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" hide="true" %}}
3770
{{% /quiz_row %}}
3871

3972
{{% quiz_row base="/Linux/x86-64/Stable" name="Installer type" %}}
@@ -45,7 +78,7 @@ Click on the buttons that describe your target platform. For other architectures
4578
{{% /quiz_row %}}
4679

4780
{{% quiz_row base="/Linux/ARM64" name="Release type" %}}
48-
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" %}}
81+
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" hide="true" %}}
4982
{{% /quiz_row %}}
5083

5184
{{% quiz_row base="/Linux/ARM64/Stable" name="Installer type" %}}
@@ -57,7 +90,7 @@ Click on the buttons that describe your target platform. For other architectures
5790
{{% /quiz_row %}}
5891

5992
{{% quiz_row base="/Linux/ppc64" name="Release type" %}}
60-
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" %}}
93+
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" hide="true" %}}
6194
{{% /quiz_row %}}
6295

6396
{{% quiz_row base="/Linux/ppc64/Stable" name="Installer type" %}}
@@ -69,7 +102,7 @@ Click on the buttons that describe your target platform. For other architectures
69102
{{% /quiz_row %}}
70103

71104
{{% quiz_row base="/Linux/S390x" name="Release type" %}}
72-
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" %}}
105+
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" hide="true" %}}
73106
{{% /quiz_row %}}
74107

75108
{{% quiz_row base="/Linux/S390x/Stable" name="Installer type" %}}
@@ -81,7 +114,7 @@ Click on the buttons that describe your target platform. For other architectures
81114
{{% /quiz_row %}}
82115

83116
{{% quiz_row base="/Linux/ARMv7" name="Release type" %}}
84-
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" %}}
117+
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" hide="true" %}}
85118
{{% /quiz_row %}}
86119

87120
{{% quiz_row base="/Linux/ARMv7/Stable" name="Installer type" %}}
@@ -97,7 +130,7 @@ Click on the buttons that describe your target platform. For other architectures
97130
{{% /quiz_row %}}
98131

99132
{{% quiz_row base="/macOS/x86-64" name="Release type" %}}
100-
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" %}}
133+
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" hide="true" %}}
101134
{{% /quiz_row %}}
102135

103136
{{% quiz_row base="/macOS/x86-64/Stable" name="Installer type" %}}
@@ -109,7 +142,7 @@ Click on the buttons that describe your target platform. For other architectures
109142
{{% /quiz_row %}}
110143

111144
{{% quiz_row base="/macOS/ARM64" name="Release type" %}}
112-
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" %}}
145+
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" hide="true" %}}
113146
{{% /quiz_row %}}
114147

115148
{{% quiz_row base="/macOS/ARM64/Stable" name="Installer type" %}}
@@ -125,7 +158,7 @@ Click on the buttons that describe your target platform. For other architectures
125158
{{% /quiz_row %}}
126159

127160
{{% quiz_row base="/Windows/x86-64" name="Release type" %}}
128-
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" %}}
161+
{{% quiz_button option="Stable" %}} {{% quiz_button option="Beta" hide="true" %}}
129162
{{% /quiz_row %}}
130163

131164
{{% quiz_row base="/Windows/x86-64/Stable" name="Installer type" %}}

Diff for: site/layouts/shortcodes/quiz_button.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<button data-quiz-id="{{ .Parent.Get "base" }}/{{ .Get "option" }}" type="button" class="btn btn-outline-primary option-button">{{ .Get "option" }}</button>
1+
<button data-quiz-id="{{ .Parent.Get "base" }}/{{ .Get "option" }}" type="button" class="btn btn-outline-primary option-button{{ if eq (.Get "hide") "true" }} hide{{ end }}">{{ .Get "option" }}</button>

0 commit comments

Comments
 (0)