import { SystemUpgrade } from '../../../../types/system';
import SystemUpgradeIntermediate from './SystemUpgradeIntermediate';
-interface Props {
+export interface SystemUpgradeItemProps {
edition: EditionKey | undefined;
- type: string;
+ isLatestVersion: boolean;
systemUpgrades: SystemUpgrade[];
}
-export default function SystemUpgradeItem(props: Props) {
- const { edition, type, systemUpgrades } = props;
+export default function SystemUpgradeItem(props: SystemUpgradeItemProps) {
+ const { edition, isLatestVersion, systemUpgrades } = props;
const lastUpgrade = systemUpgrades[0];
const downloadUrl = getEditionDownloadUrl(
getEdition(edition || EditionKey.community),
return (
<div className="system-upgrade-version">
<h3 className="h1 spacer-bottom">
- <strong>{type}</strong>
+ <strong>
+ {isLatestVersion ? translate('system.latest_version') : translate('system.lts_version')}
+ </strong>
+ {isLatestVersion && (
+ <a
+ className="spacer-left medium"
+ href="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
+ rel="noopener noreferrer"
+ target="_blank">
+ {translate('system.see_whats_new')}
+ </a>
+ )}
</h3>
<p>
<FormattedMessage
import { shallow } from 'enzyme';
import * as React from 'react';
import { EditionKey } from '../../../../../types/editions';
-import SystemUpgradeItem from '../SystemUpgradeItem';
+import SystemUpgradeItem, { SystemUpgradeItemProps } from '../SystemUpgradeItem';
it('should display correctly', () => {
expect(shallowRender()).toMatchSnapshot();
+ expect(shallowRender({ isLatestVersion: false })).toMatchSnapshot();
expect(shallowRender({ edition: EditionKey.developer })).toMatchSnapshot();
expect(shallowRender({ edition: EditionKey.enterprise })).toMatchSnapshot();
expect(shallowRender({ edition: EditionKey.datacenter })).toMatchSnapshot();
// Fallback to Community.
expect(
shallowRender({
- edition: EditionKey.datacenter,
systemUpgrades: [
{
version: '5.6.7',
).toMatchSnapshot();
});
-function shallowRender(props = {}) {
- return shallow(
+function shallowRender(props: Partial<SystemUpgradeItemProps> = {}) {
+ return shallow<SystemUpgradeItemProps>(
<SystemUpgradeItem
edition={EditionKey.community}
systemUpgrades={[
downloadDeveloperUrl: 'http://download.url/developer'
}
]}
- type="Latest Version"
+ isLatestVersion={true}
{...props}
/>
);
className="h1 spacer-bottom"
>
<strong>
- Latest Version
+ system.latest_version
</strong>
+ <a
+ className="spacer-left medium"
+ href="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ system.see_whats_new
+ </a>
</h3>
<p>
<FormattedMessage
className="h1 spacer-bottom"
>
<strong>
- Latest Version
+ system.lts_version
+ </strong>
+ </h3>
+ <p>
+ <FormattedMessage
+ defaultMessage="system.version_is_availble"
+ id="system.version_is_availble"
+ values={
+ Object {
+ "version": <b>
+ SonarQube
+ 5.6.7
+ </b>,
+ }
+ }
+ />
+ </p>
+ <p
+ className="spacer-top"
+ >
+ Version 5.6.7 description
+ </p>
+ <div
+ className="big-spacer-top"
+ >
+ <DateFormatter
+ date="2017-03-01"
+ long={true}
+ >
+ <Component />
+ </DateFormatter>
+ <a
+ className="spacer-left"
+ href="http://changelog.url/"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ system.release_notes
+ </a>
+ </div>
+ <SystemUpgradeIntermediate
+ className="spacer-top"
+ upgrades={
+ Array [
+ Object {
+ "changeLogUrl": "http://changelog.url/",
+ "description": "Version 5.6.6 description",
+ "downloadDeveloperUrl": "http://download.url/developer",
+ "downloadUrl": "http://download.url/community",
+ "releaseDate": "2017-04-02",
+ "version": "5.6.6",
+ },
+ Object {
+ "changeLogUrl": "http://changelog.url/",
+ "description": "Version 5.6.5 description",
+ "downloadDeveloperUrl": "http://download.url/developer",
+ "downloadUrl": "http://download.url/community",
+ "releaseDate": "2017-03-01",
+ "version": "5.6.5",
+ },
+ ]
+ }
+ />
+ <div
+ className="big-spacer-top"
+ >
+ <a
+ className="button"
+ download="http://download.url/community"
+ href="http://download.url/community"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ system.download_x.5.6.7
+ </a>
+ <a
+ className="spacer-left"
+ href="https://redirect.sonarsource.com/doc/upgrading.html"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ system.how_to_upgrade
+ </a>
+ </div>
+</div>
+`;
+
+exports[`should display correctly 3`] = `
+<div
+ className="system-upgrade-version"
+>
+ <h3
+ className="h1 spacer-bottom"
+ >
+ <strong>
+ system.latest_version
</strong>
+ <a
+ className="spacer-left medium"
+ href="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ system.see_whats_new
+ </a>
</h3>
<p>
<FormattedMessage
</div>
`;
-exports[`should display correctly 3`] = `
+exports[`should display correctly 4`] = `
<div
className="system-upgrade-version"
>
className="h1 spacer-bottom"
>
<strong>
- Latest Version
+ system.latest_version
</strong>
+ <a
+ className="spacer-left medium"
+ href="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ system.see_whats_new
+ </a>
</h3>
<p>
<FormattedMessage
</div>
`;
-exports[`should display correctly 4`] = `
+exports[`should display correctly 5`] = `
<div
className="system-upgrade-version"
>
className="h1 spacer-bottom"
>
<strong>
- Latest Version
+ system.latest_version
</strong>
+ <a
+ className="spacer-left medium"
+ href="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ system.see_whats_new
+ </a>
</h3>
<p>
<FormattedMessage
</div>
`;
-exports[`should display correctly 5`] = `
+exports[`should display correctly 6`] = `
<div
className="system-upgrade-version"
>
className="h1 spacer-bottom"
>
<strong>
- Latest Version
+ system.latest_version
</strong>
+ <a
+ className="spacer-left medium"
+ href="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ system.see_whats_new
+ </a>
</h3>
<p>
<FormattedMessage