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

Show supported versions on download page #849

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/components/SupportedVersionsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import lodash from 'lodash'
import React from 'react'
import React, { FC } from 'react'
import semver from "semver/preload"
import {Stack, Table, TableBody, TableCell, TableHead, TableRow} from "@mui/material"

Expand Down Expand Up @@ -116,7 +116,11 @@ function renderLatestVersionCell(d: SupportedVersionData): JSX.Element {
</TableCell>
}

export default function SupportedVersionsTable(): JSX.Element {
type SupportedVersionsTableProps = {
isHideUnmaintained?: boolean
};

const SupportedVersionsTable: FC<SupportedVersionsTableProps> = (props) => {
let releaseList: SimpleReleaseData[] = releases.map(r => ({
version: semver.coerce(r.tagName),
released: moment(r.publishedAt),
Expand Down Expand Up @@ -147,6 +151,13 @@ export default function SupportedVersionsTable(): JSX.Element {
})
}

if (props.isHideUnmaintained) {
supportedVersionList = supportedVersionList.filter(v =>
v.activeSupport.isAfter(new Date()) ||
v.securitySupport.isAfter(new Date())
);
}

const TableHeaderCell = styled(TableCell)({fontWeight: "bold"})

return <>
Expand All @@ -162,8 +173,8 @@ export default function SupportedVersionsTable(): JSX.Element {
</TableHead>
<TableBody>
{
supportedVersionList.map(r => <>
<TableRow>
supportedVersionList.map((r, i) => <>
<TableRow key={i}>
{renderVersionCell(r.version)}
{renderReleasedCell(r.released)}
{renderSupportCell(r.activeSupport)}
Expand All @@ -176,3 +187,5 @@ export default function SupportedVersionsTable(): JSX.Element {
</Table>
</>
}

export default SupportedVersionsTable;
11 changes: 9 additions & 2 deletions src/pages/download.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ import Page from '@site/src/components/ui/Page/Page';

# Downloads for Apache Pulsar™

## Release notes
## Supported Versions

[Release notes](pathname:///release-notes) for all Pulsar's versions.
````mdx-code-block
import SupportedVersionsTable from "@site/src/components/SupportedVersionsTable";

<SupportedVersionsTable isHideUnmaintained />
````

- [Release notes](pathname:///release-notes)
- [Full Supported Versions Table](pathname:///release-notes)

## Current version <CurrentPulsarVersion/>

Expand Down
Loading