+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import * as React from 'react';
-import { getSystemUpgrades, SystemUpgrade } from '../../../api/system';
-import { translate } from '../../../helpers/l10n';
-
-interface State {
- systemUpgrades?: SystemUpgrade[];
-}
-
-export default class SystemUpgradeNotif extends React.PureComponent<{}, State> {
- mounted: boolean;
- state: State = {};
-
- componentDidMount() {
- this.mounted = true;
- this.fetchSystemUpgrades();
- }
-
- componentWillUnmount() {
- this.mounted = false;
- }
-
- fetchSystemUpgrades = () =>
- getSystemUpgrades().then(
- ({ upgrades }) => {
- if (this.mounted) {
- this.setState({ systemUpgrades: upgrades });
- }
- },
- () => {}
- );
-
- handleLearnMore = () => {};
-
- render() {
- const { systemUpgrades } = this.state;
-
- if (!systemUpgrades || systemUpgrades.length <= 0) {
- return null;
- }
-
- return (
- <div className="page-notifs">
- <div className="alert alert-info">
- {translate('system.new_version_available')}
- <button className="spacer-left" onClick={this.handleLearnMore}>
- {translate('learn_more')}
- </button>
- </div>
- </div>
- );
- }
-}
export default class SystemUpgradeForm extends React.PureComponent<Props, State> {
state: State = { upgrading: false };
- getBadge = (idx: number) => {
- if (this.props.systemUpgrades.length <= 1) {
- return undefined;
- }
- if (idx === 0) {
- return translate('system.latest_version');
- }
- return translate('system.latest_lts_version');
- };
-
handleCancelClick = (event: React.SyntheticEvent<HTMLElement>) => {
event.preventDefault();
event.stopPropagation();
{systemUpgrades.map((upgrades, idx) => (
<SystemUpgradeItem
key={upgrades[upgrades.length - 1].version}
- badge={this.getBadge(idx)}
+ type={
+ idx === 0 ? translate('system.latest_version') : translate('system.lts_version')
+ }
systemUpgrades={upgrades}
/>
))}
<p>
<b className="little-spacer-right">SonarQube {upgrade.version}</b>
{formattedDate}
+ {upgrade.changeLogUrl && (
+ <a className="spacer-left" href={upgrade.changeLogUrl} target="_blank">
+ {translate('system.release_notes')}
+ </a>
+ )}
</p>
)}
</DateFormatter>
import { translate, translateWithParameters } from '../../../../helpers/l10n';
interface Props {
- badge?: string;
+ type?: string;
systemUpgrades: SystemUpgrade[];
}
-export default function SystemUpgradeItem({ badge, systemUpgrades }: Props) {
+export default function SystemUpgradeItem({ type, systemUpgrades }: Props) {
const lastUpgrade = systemUpgrades[0];
return (
<div className="system-upgrade-version">
- {badge && <span className="spacer-bottom badge badge-secondary">{badge}</span>}
+ {type && (
+ <h1 className="spacer-bottom">
+ <strong>{type}</strong>
+ </h1>
+ )}
<p>
<FormattedMessage
defaultMessage={translate('system.version_is_availble')}
<span>{translateWithParameters('system.released_x', formattedDate)}</span>
)}
</DateFormatter>
- <a className="spacer-left" href={lastUpgrade.changeLogUrl} target="_blank">
- {translate('system.release_notes')}
- </a>
+ {lastUpgrade.changeLogUrl && (
+ <a className="spacer-left" href={lastUpgrade.changeLogUrl} target="_blank">
+ {translate('system.release_notes')}
+ </a>
+ )}
</div>
<SystemUpgradeIntermediate className="spacer-top" upgrades={systemUpgrades.slice(1)} />
<div className="big-spacer-top">
});
it('should display a badge', () => {
- const wrapper = shallow(<SystemUpgradeItem badge="test badge" systemUpgrades={UPGRADES} />);
- expect(wrapper.find('.badge').exists()).toBeTruthy();
+ const wrapper = shallow(<SystemUpgradeItem type="LTS Version" systemUpgrades={UPGRADES} />);
+ expect(wrapper.find('h1').exists()).toBeTruthy();
});
className="modal-body"
>
<SystemUpgradeItem
- badge="system.latest_version"
systemUpgrades={
Array [
Object {
},
]
}
+ type="system.latest_version"
/>
<SystemUpgradeItem
- badge="system.latest_lts_version"
systemUpgrades={
Array [
Object {
},
]
}
+ type="system.lts_version"
/>
</div>
<div
system.how_to_upgrade=How to upgrade?
system.is_restarting=Server is restarting. This page will be automatically refreshed.
system.latest_version=Latest Version
-system.latest_lts_version=Latest LTS Version
+system.lts_version=LTS Version
system.log_level.warning=This level has performance impacts, please make sure to get back to INFO level once your investigation is done. Please note that when the server is restarted, logging will revert to the level configured in sonar.properties.
system.log_level.warning.short=Current logs level has performance impacts, get back to INFO level.
system.log_level.info=Changes don't apply to Search.