You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SystemUpgradeItem.tsx 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import { DownloadButton, Link, SubHeading } from 'design-system';
  21. import * as React from 'react';
  22. import { FormattedMessage } from 'react-intl';
  23. import {
  24. getEdition,
  25. getEditionDownloadFilename,
  26. getEditionDownloadUrl,
  27. } from '../../helpers/editions';
  28. import { translate, translateWithParameters } from '../../helpers/l10n';
  29. import { EditionKey } from '../../types/editions';
  30. import { SystemUpgrade } from '../../types/system';
  31. import DocumentationLink from '../common/DocumentationLink';
  32. import DateFormatter from '../intl/DateFormatter';
  33. import SystemUpgradeIntermediate from './SystemUpgradeIntermediate';
  34. export interface SystemUpgradeItemProps {
  35. edition: EditionKey | undefined;
  36. isLTAVersion: boolean;
  37. isPatch: boolean;
  38. systemUpgrades: SystemUpgrade[];
  39. }
  40. export default function SystemUpgradeItem(props: SystemUpgradeItemProps) {
  41. const { edition, isPatch, isLTAVersion, systemUpgrades } = props;
  42. const lastUpgrade = systemUpgrades[0];
  43. const downloadUrl = getEditionDownloadUrl(
  44. getEdition(edition || EditionKey.community),
  45. lastUpgrade,
  46. );
  47. let header = translate('system.latest_version');
  48. if (isLTAVersion) {
  49. header = translate('system.lta_version');
  50. } else if (isPatch) {
  51. header = translate('system.latest_patch');
  52. }
  53. return (
  54. <div className="system-upgrade-version it__upgrade-list-item">
  55. <SubHeading as="h3">
  56. <strong>{header}</strong>
  57. {!isPatch && (
  58. <Link
  59. className="sw-ml-2"
  60. to="https://www.sonarsource.com/products/sonarqube/whats-new/?referrer=sonarqube"
  61. >
  62. {translate('system.see_whats_new')}
  63. </Link>
  64. )}
  65. </SubHeading>
  66. <p>
  67. <FormattedMessage
  68. defaultMessage={translate('system.version_is_availble')}
  69. id="system.version_is_availble"
  70. values={{ version: <b>SonarQube {lastUpgrade.version}</b> }}
  71. />
  72. </p>
  73. <p className="sw-mt-2">{lastUpgrade.description}</p>
  74. <div className="sw-mt-4">
  75. {lastUpgrade.releaseDate && (
  76. <DateFormatter date={lastUpgrade.releaseDate} long>
  77. {(formattedDate) => (
  78. <span>{translateWithParameters('system.released_x', formattedDate)}</span>
  79. )}
  80. </DateFormatter>
  81. )}
  82. {lastUpgrade.changeLogUrl && (
  83. <Link className="sw-ml-2" to={lastUpgrade.changeLogUrl}>
  84. {translate('system.release_notes')}
  85. </Link>
  86. )}
  87. </div>
  88. <SystemUpgradeIntermediate className="sw-mt-2" upgrades={systemUpgrades.slice(1)} />
  89. <div className="sw-mt-4">
  90. <DownloadButton download={getEditionDownloadFilename(downloadUrl)} href={downloadUrl}>
  91. {translateWithParameters('system.download_x', lastUpgrade.version)}
  92. </DownloadButton>
  93. <DocumentationLink
  94. className="sw-ml-2"
  95. to="/setup-and-upgrade/upgrade-the-server/upgrade-guide/"
  96. >
  97. {translate('system.how_to_upgrade')}
  98. </DocumentationLink>
  99. </div>
  100. </div>
  101. );
  102. }