|
| 1 | +import Link from '@docusaurus/Link'; |
| 2 | +import {getReleaseBranches} from '../RabbitMQServerReleaseInfo'; |
| 3 | +import styles from "./index.module.css" |
| 4 | + |
| 5 | +const dateOptions = { year: 'numeric', month: 'short', day: 'numeric' }; |
| 6 | + |
| 7 | +function getTimelineRows(releaseBranches) { |
| 8 | + const now = Date.now(); |
| 9 | + const rows = []; |
| 10 | + let previousReleaseDate; |
| 11 | + |
| 12 | + for (const branch in releaseBranches) { |
| 13 | + const releaseBranch = releaseBranches[branch]; |
| 14 | + const isReleased = typeof releaseBranch.end_of_support !== 'undefined'; |
| 15 | + const releases = releaseBranch.releases || []; |
| 16 | + if (!isReleased || releases.length === 0) { |
| 17 | + continue; |
| 18 | + } |
| 19 | + |
| 20 | + const patchRelease = releases[0]; |
| 21 | + const releaseDate = new Date(patchRelease.release_date); |
| 22 | + const endOfCommunitySupportDate = previousReleaseDate; |
| 23 | + const endOfCommercialSupportDate = new Date(releaseBranch.end_of_support); |
| 24 | + |
| 25 | + const isCommunitySupported = endOfCommunitySupportDate === undefined || endOfCommunitySupportDate > now; |
| 26 | + const isCommercialSupported = endOfCommercialSupportDate > now; |
| 27 | + |
| 28 | + const endOfCommunitySupport = |
| 29 | + endOfCommunitySupportDate === undefined |
| 30 | + ? 'Next Release' |
| 31 | + : endOfCommunitySupportDate.toLocaleDateString('en-GB', dateOptions); |
| 32 | + const endOfCommercialSupport = endOfCommercialSupportDate.toLocaleDateString("en-GB", dateOptions); |
| 33 | + |
| 34 | + rows.push({ |
| 35 | + release: branch, |
| 36 | + patch: patchRelease.version, |
| 37 | + releaseDate: releaseDate.toLocaleDateString("en-GB", dateOptions), |
| 38 | + endOfCommunitySupport, |
| 39 | + endOfCommercialSupport, |
| 40 | + isCommunitySupported, |
| 41 | + isCommercialSupported |
| 42 | + }); |
| 43 | + |
| 44 | + previousReleaseDate = new Date(releases[releases.length - 1].release_date); |
| 45 | + } |
| 46 | + |
| 47 | + return rows; |
| 48 | +} |
| 49 | + |
| 50 | +export function CommercialSupportTimelines() { |
| 51 | + const releaseBranches = getReleaseBranches(); |
| 52 | + |
| 53 | + const rows = getTimelineRows(releaseBranches); |
| 54 | + console.log(rows) |
| 55 | + |
| 56 | + return ( |
| 57 | + <div className="release-information"> |
| 58 | + <table className={styles.timelines_table}> |
| 59 | + <thead> |
| 60 | + <tr> |
| 61 | + <th>Release</th> |
| 62 | + <th>Patch</th> |
| 63 | + <th>Date of Release</th> |
| 64 | + <th>End of Community Support</th> |
| 65 | + <th>End of Commercial Support*</th> |
| 66 | + </tr> |
| 67 | + </thead> |
| 68 | + <tbody> |
| 69 | + {rows.map((row) => ( |
| 70 | + <tr key={row.release}> |
| 71 | + <td>{row.release}</td> |
| 72 | + <td>{row.patch}</td> |
| 73 | + <td>{row.releaseDate}</td> |
| 74 | + <td className={row.isCommunitySupported ? styles.supported : styles.unsupported}> |
| 75 | + {row.endOfCommunitySupport} |
| 76 | + </td> |
| 77 | + <td className={row.isCommercialSupported ? styles.supported : styles.unsupported}> |
| 78 | + {row.endOfCommercialSupport} |
| 79 | + </td> |
| 80 | + </tr> |
| 81 | + ))} |
| 82 | + </tbody> |
| 83 | + </table> |
| 84 | + <p> |
| 85 | + *End of Commercial Support dates are indicative. Official commercial support lifecycle information can be found on the <Link to="https://support.broadcom.com/web/ecx/productlifecycle">Broadcom support portal</Link>. |
| 86 | + </p> |
| 87 | + <div> |
| 88 | + <strong>Legend:</strong> |
| 89 | + <dl className="release-legend"> |
| 90 | + <dt className="supported-release latest-release"></dt> |
| 91 | + <dd>Latest release, fully supported</dd> |
| 92 | + <dt className="unsupported-release"></dt> |
| 93 | + <dd>Old release, unsupported</dd> |
| 94 | + </dl> |
| 95 | + </div> |
| 96 | + </div> |
| 97 | + ); |
| 98 | +} |
0 commit comments