1
0
mirror of https://github.com/prometheus/docs.git synced 2026-02-05 15:45:27 +01:00

feat(downloads): mark first stable release as Latest (even if LTS) (#2712)

- Ensure the very first non-prerelease version is always tagged as Latest
- Allow coexistence of Latest + LTS badges on the same release

I recommend using "Hide whitespace changes" option for a clearer diff.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
This commit is contained in:
Julien
2025-09-02 17:20:34 +02:00
committed by GitHub
parent 432c621b67
commit 9846b5a7c7

View File

@@ -65,115 +65,135 @@ export default function DownloadsSelector() {
/>
</Group>
{downloadsMetadata.repos.map((repo) => (
// "overflow: unset" is needed, since otherwise "overflow: hidden"
// on the Card breaks the scroll-margin-top of the Title / h2, and
// the title ends up under the sticky header.
<Card key={repo.name} withBorder style={{ overflow: "unset" }}>
<Title order={2} mt={0} mb="xs" id={repo.name}>
{repo.name}
</Title>
<Group justify="space-between" mb="xs" align="flex-end">
{repo.description}
<Anchor
c="var(--secondary-link-color)"
href={repo.url}
target="_blank"
>
<Group gap={5} align="center">
<IconBrandGithub size="1em" /> {repo.fullName}
</Group>
</Anchor>
</Group>
<Box style={{ overflowX: "auto" }}>
<Table withColumnBorders withRowBorders withTableBorder fz="sm">
{repo.releases.map((release) => (
<React.Fragment key={release.id}>
<TableThead>
<TableTr>
<TableTd colSpan={5}>
<Group justify="space-between" align="center">
<Group gap="xs">
<strong>{release.name}</strong>
{release.prerelease ? (
<Badge size="sm" color="yellow">
Pre-release
</Badge>
) : release.ltsRelease ? (
<Badge size="sm" color="blue">
LTS
</Badge>
) : (
<Badge size="sm" color="green">
Latest
</Badge>
)}
</Group>
<Anchor
c="var(--secondary-link-color)"
size="sm"
href={release.url}
target="_blank"
>
Release notes
</Anchor>
</Group>
</TableTd>
</TableTr>
<TableTr>
<TableTh>File name</TableTh>
<TableTh>OS</TableTh>
<TableTh>Arch</TableTh>
<TableTh>Size</TableTh>
<TableTh>SHA256 Checksum</TableTh>
</TableTr>
</TableThead>
<TableTbody>
{release.binaries
.filter((b) => {
if (
osList.includes(b.os) &&
arch === "popular" &&
(b.arch === "amd64" ||
(b.os === "darwin" && b.arch === "arm64"))
) {
return true;
} else if (
osList.includes(b.os) &&
(arch === "all" || b.arch === arch)
) {
return true;
} else {
return false;
}
})
.map((binary) => (
<TableTr key={binary.name}>
<TableTd>
<Anchor
c="var(--secondary-link-color)"
inherit
className="download"
href={binary.url}
>
{binary.name}
</Anchor>
{downloadsMetadata.repos.map((repo) => {
let latestAssigned = false;
return (
// "overflow: unset" is needed, since otherwise "overflow: hidden"
// on the Card breaks the scroll-margin-top of the Title / h2, and
// the title ends up under the sticky header.
<Card key={repo.name} withBorder style={{ overflow: "unset" }}>
<Title order={2} mt={0} mb="xs" id={repo.name}>
{repo.name}
</Title>
<Group justify="space-between" mb="xs" align="flex-end">
{repo.description}
<Anchor
c="var(--secondary-link-color)"
href={repo.url}
target="_blank"
>
<Group gap={5} align="center">
<IconBrandGithub size="1em" /> {repo.fullName}
</Group>
</Anchor>
</Group>
<Box style={{ overflowX: "auto" }}>
<Table withColumnBorders withRowBorders withTableBorder fz="sm">
{repo.releases.map((release) => {
const badges: React.ReactNode[] = [];
if (release.prerelease) {
badges.push(
<Badge key={`${release.id}-pre`} size="sm" color="yellow">
Pre-release
</Badge>
);
} else {
if (!latestAssigned) {
badges.push(
<Badge key={`${release.id}-latest`} size="sm" color="green">
Latest
</Badge>
);
latestAssigned = true;
}
if (release.ltsRelease) {
badges.push(
<Badge key={`${release.id}-lts`} size="sm" color="blue">
LTS
</Badge>
);
}
}
return (
<React.Fragment key={release.id}>
<TableThead>
<TableTr>
<TableTd colSpan={5}>
<Group justify="space-between" align="center">
<Group gap="xs">
<strong>{release.name}</strong>
{badges}
</Group>
<Anchor
c="var(--secondary-link-color)"
size="sm"
href={release.url}
target="_blank"
>
Release notes
</Anchor>
</Group>
</TableTd>
<TableTd>{binary.os}</TableTd>
<TableTd>{binary.arch}</TableTd>
<TableTd>
{(binary.sizeBytes / 1024 / 1024).toFixed(2)} MiB
</TableTd>
<TableTd fz="xs">{binary.checksum}</TableTd>
</TableTr>
))}
</TableTbody>
</React.Fragment>
))}
</Table>
</Box>
</Card>
))}
<TableTr>
<TableTh>File name</TableTh>
<TableTh>OS</TableTh>
<TableTh>Arch</TableTh>
<TableTh>Size</TableTh>
<TableTh>SHA256 Checksum</TableTh>
</TableTr>
</TableThead>
<TableTbody>
{release.binaries
.filter((b) => {
if (
osList.includes(b.os) &&
arch === "popular" &&
(b.arch === "amd64" ||
(b.os === "darwin" && b.arch === "arm64"))
) {
return true;
} else if (
osList.includes(b.os) &&
(arch === "all" || b.arch === arch)
) {
return true;
} else {
return false;
}
})
.map((binary) => (
<TableTr key={binary.name}>
<TableTd>
<Anchor
c="var(--secondary-link-color)"
inherit
className="download"
href={binary.url}
>
{binary.name}
</Anchor>
</TableTd>
<TableTd>{binary.os}</TableTd>
<TableTd>{binary.arch}</TableTd>
<TableTd>
{(binary.sizeBytes / 1024 / 1024).toFixed(2)} MiB
</TableTd>
<TableTd fz="xs">{binary.checksum}</TableTd>
</TableTr>
))}
</TableTbody>
</React.Fragment>
);
})}
</Table>
</Box>
</Card>
);
})}
</Stack>
);
}