diff --git a/gatsby-node.js b/gatsby-node.js index 597c98e46..2a2b669a7 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -66,6 +66,25 @@ exports.sourceNodes = async ({ actions, createNodeId }) => { } } createNode(node) + + // Create a node for the most_recent_feature_version + const latestFeatureVersion = data.most_recent_feature_version + const nodeContentFeatureVersion = JSON.stringify(latestFeatureVersion) + const MostRecentFeatureVersion = { + id: createNodeId('adoptium-feature-version-most-recent'), // Unique identifier for each node + version: latestFeatureVersion, + parent: null, + children: [], + internal: { + type: 'MostRecentFeatureVersion', + content: nodeContentFeatureVersion, + contentDigest: crypto + .createHash('md5') + .update(nodeContentFeatureVersion) + .digest('hex') + } + } + createNode(MostRecentFeatureVersion) } exports.onCreatePage = ({ page, actions }) => { diff --git a/src/components/DownloadDropdowns/index.tsx b/src/components/DownloadDropdowns/index.tsx index ed754fd33..a1a1621f7 100644 --- a/src/components/DownloadDropdowns/index.tsx +++ b/src/components/DownloadDropdowns/index.tsx @@ -14,20 +14,23 @@ let defaultArch = 'any' const DownloadDropdowns = ({updaterAction, marketplace, Table}) => { const data = useStaticQuery(graphql` - query VersionsQuery { + query VersionsQuery { allVersions(sort: {version: DESC}) { - edges { + edges { node { - version - label - lts - } + version + label + lts } + } } mostRecentLts { - version + version } + mostRecentFeatureVersion { + version } + } `) const defaultVersion = data.mostRecentLts.version; diff --git a/src/components/VersionSelector/__tests__/__snapshots__/VersionSelector.test.tsx.snap b/src/components/VersionSelector/__tests__/__snapshots__/VersionSelector.test.tsx.snap index 95d9f51c5..66c5f1e73 100644 --- a/src/components/VersionSelector/__tests__/__snapshots__/VersionSelector.test.tsx.snap +++ b/src/components/VersionSelector/__tests__/__snapshots__/VersionSelector.test.tsx.snap @@ -19,6 +19,11 @@ exports[`VersionSelector > updates the number of builds and build date when the [33mid[39m=[32m\\"version-filter\\"[39m [33mstyle[39m=[32m\\"max-width: 10em;\\"[39m [36m>[39m + [36m[39m + [0m2 - EA[0m + [36m[39m [36m[39m diff --git a/src/components/VersionSelector/index.tsx b/src/components/VersionSelector/index.tsx index 697e4644b..3113d81f6 100644 --- a/src/components/VersionSelector/index.tsx +++ b/src/components/VersionSelector/index.tsx @@ -24,10 +24,14 @@ const VersionSelector = ({updater, releaseType, Table}) => { mostRecentLts { version } + mostRecentFeatureVersion { + version + } } `) const defaultVersion = data.mostRecentLts.version; + const mostRecentFeatureVersion = data.mostRecentFeatureVersion.version; const versions = data.allVersions.edges; const { language } = useI18next(); @@ -81,11 +85,15 @@ const VersionSelector = ({updater, releaseType, Table}) => { Version setVersion(e.target.value)} value={version} className="form-select form-select-sm" style={{ maxWidth: '10em' }}> + {/* if releaseType is ea add another option */} + {releaseType === "ea" && ( + {`${mostRecentFeatureVersion} - EA`} + )} {/* loop through versions array from graphql */} {versions.map( - (version, i): number | JSX.Element => version && ( - {version.node.label} - ) + (version, i): number | JSX.Element => version && ( + {version.node.label} + ) )} diff --git a/src/pages/temurin/__tests__/__snapshots__/nightly.test.tsx.snap b/src/pages/temurin/__tests__/__snapshots__/nightly.test.tsx.snap index 6910c938a..b730bccde 100644 --- a/src/pages/temurin/__tests__/__snapshots__/nightly.test.tsx.snap +++ b/src/pages/temurin/__tests__/__snapshots__/nightly.test.tsx.snap @@ -116,6 +116,11 @@ exports[`Temurin Nightly page > renders correctly 1`] = ` id="version-filter" style="max-width: 10em;" > + + 2 - EA + diff --git a/vitest-setup.ts b/vitest-setup.ts index 55ff765da..523c007b1 100644 --- a/vitest-setup.ts +++ b/vitest-setup.ts @@ -27,6 +27,9 @@ vi.mock('gatsby', async () => { mostRecentLts: { version: 1, }, + mostRecentFeatureVersion: { + version: 2, + }, allVersions: { edges: [ {