From febc464778196523cd9c3fb6538671548ccb8d3d Mon Sep 17 00:00:00 2001
From: Grégoire Aubert
Date: Mon, 23 Oct 2017 14:54:22 +0200
Subject: SONAR-9953 Apply feedbacks on system upgrades
---
.../apps/system/components/SystemUpgradeNotif.tsx | 71 ----------------------
.../system-upgrade/SystemUpgradeForm.tsx | 14 +----
.../system-upgrade/SystemUpgradeIntermediate.tsx | 5 ++
.../system-upgrade/SystemUpgradeItem.tsx | 18 ++++--
.../__tests__/SystemUpgradeItem-test.tsx | 4 +-
.../__snapshots__/SystemUpgradeForm-test.tsx.snap | 4 +-
6 files changed, 24 insertions(+), 92 deletions(-)
delete mode 100644 server/sonar-web/src/main/js/apps/system/components/SystemUpgradeNotif.tsx
(limited to 'server')
diff --git a/server/sonar-web/src/main/js/apps/system/components/SystemUpgradeNotif.tsx b/server/sonar-web/src/main/js/apps/system/components/SystemUpgradeNotif.tsx
deleted file mode 100644
index cdb15d71939..00000000000
--- a/server/sonar-web/src/main/js/apps/system/components/SystemUpgradeNotif.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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 (
-
-
- {translate('system.new_version_available')}
-
-
-
- );
- }
-}
diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx
index 9370ea4493b..0c508a86706 100644
--- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx
@@ -35,16 +35,6 @@ interface State {
export default class SystemUpgradeForm extends React.PureComponent {
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) => {
event.preventDefault();
event.stopPropagation();
@@ -69,7 +59,9 @@ export default class SystemUpgradeForm extends React.PureComponent
{systemUpgrades.map((upgrades, idx) => (
))}
diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeIntermediate.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeIntermediate.tsx
index d428dc2310b..ccafec8a1aa 100644
--- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeIntermediate.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeIntermediate.tsx
@@ -74,6 +74,11 @@ export default class SystemUpgradeIntermediate extends React.PureComponent
SonarQube {upgrade.version}
{formattedDate}
+ {upgrade.changeLogUrl && (
+
+ {translate('system.release_notes')}
+
+ )}
)}
diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeItem.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeItem.tsx
index 980cae8d2e1..83d45e9ea63 100644
--- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeItem.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeItem.tsx
@@ -25,15 +25,19 @@ import { SystemUpgrade } from '../../../../api/system';
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 (
diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/SystemUpgradeItem-test.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/SystemUpgradeItem-test.tsx
index f23842f8689..b7bd0280a44 100644
--- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/SystemUpgradeItem-test.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/SystemUpgradeItem-test.tsx
@@ -54,6 +54,6 @@ it('should display correctly', () => {
});
it('should display a badge', () => {
- const wrapper = shallow();
- expect(wrapper.find('.badge').exists()).toBeTruthy();
+ const wrapper = shallow();
+ expect(wrapper.find('h1').exists()).toBeTruthy();
});
diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap
index 3bfbebace5a..0f84689c104 100644
--- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap
@@ -25,7 +25,6 @@ exports[`should display correctly 1`] = `
className="modal-body"
>