aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2021-10-18 16:39:42 +0200
committersonartech <sonartech@sonarsource.com>2021-10-21 20:04:02 +0000
commit7a39654d96281f32c9f6653275ff1804f4f7faab (patch)
tree7e3d907da2395f6187e35009ab85b9afbcdf8ebf /server/sonar-web/src/main/js
parent4f1b67914042edb28f5b9db4e0dc59f5ac31b659 (diff)
downloadsonarqube-7a39654d96281f32c9f6653275ff1804f4f7faab.tar.gz
sonarqube-7a39654d96281f32c9f6653275ff1804f4f7faab.zip
SONAR-15509 Fix prompt LTS version when no new version is released
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeNotif.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/SystemUpgradeButton.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeButton-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap2
5 files changed, 20 insertions, 10 deletions
diff --git a/server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx b/server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx
index 390137539cc..f7b188dcc85 100644
--- a/server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx
+++ b/server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx
@@ -54,6 +54,7 @@ interface Props {
interface State {
dismissKey: string;
useCase: UpdateUseCase;
+ latestLTS: string;
systemUpgrades: SystemUpgrade[];
canSeeNotification: boolean;
}
@@ -67,6 +68,7 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
this.state = {
dismissKey: '',
systemUpgrades: [],
+ latestLTS: '',
canSeeNotification: false,
useCase: UpdateUseCase.NewMinorVersion
};
@@ -200,6 +202,7 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
+ latestLTS,
useCase,
dismissKey,
systemUpgrades: upgrades,
@@ -215,7 +218,7 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
}
render() {
- const { systemUpgrades, canSeeNotification, useCase, dismissKey } = this.state;
+ const { latestLTS, systemUpgrades, canSeeNotification, useCase, dismissKey } = this.state;
if (!canSeeNotification) {
return null;
}
@@ -225,7 +228,11 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
variant={MAP_VARIANT[useCase]}
className={`promote-update-notification it__upgrade-prompt-${useCase}`}>
{translate('admin_notification.update', useCase)}
- <SystemUpgradeButton systemUpgrades={systemUpgrades} updateUseCase={useCase} />
+ <SystemUpgradeButton
+ systemUpgrades={systemUpgrades}
+ updateUseCase={useCase}
+ latestLTS={latestLTS}
+ />
</DismissableAlert>
);
}
diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeNotif.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeNotif.tsx
index e6f7c4c0903..f39ddc3bdc0 100644
--- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeNotif.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeNotif.tsx
@@ -25,12 +25,13 @@ import { translate } from '../../../../helpers/l10n';
import { SystemUpgrade } from '../../../../types/system';
interface State {
+ latestLTS: string;
systemUpgrades: SystemUpgrade[];
}
export default class SystemUpgradeNotif extends React.PureComponent<{}, State> {
mounted = false;
- state: State = { systemUpgrades: [] };
+ state: State = { systemUpgrades: [], latestLTS: '' };
componentDidMount() {
this.mounted = true;
@@ -43,16 +44,16 @@ export default class SystemUpgradeNotif extends React.PureComponent<{}, State> {
fetchSystemUpgrade = () =>
getSystemUpgrades().then(
- ({ upgrades }) => {
+ ({ upgrades, latestLTS }) => {
if (this.mounted) {
- this.setState({ systemUpgrades: upgrades });
+ this.setState({ latestLTS, systemUpgrades: upgrades });
}
},
() => {}
);
render() {
- const { systemUpgrades } = this.state;
+ const { systemUpgrades, latestLTS } = this.state;
if (systemUpgrades.length <= 0) {
return null;
@@ -62,7 +63,7 @@ export default class SystemUpgradeNotif extends React.PureComponent<{}, State> {
<div className="page-notifs">
<Alert variant="info">
{translate('system.new_version_available')}
- <SystemUpgradeButton systemUpgrades={systemUpgrades} />
+ <SystemUpgradeButton systemUpgrades={systemUpgrades} latestLTS={latestLTS} />
</Alert>
</div>
);
diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeButton.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeButton.tsx
index c993f597a7a..87689ae4662 100644
--- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeButton.tsx
+++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeButton.tsx
@@ -25,6 +25,7 @@ import SystemUpgradeForm from './SystemUpgradeForm';
import { groupUpgrades, sortUpgrades, UpdateUseCase } from './utils';
interface Props {
+ latestLTS: string;
systemUpgrades: SystemUpgrade[];
updateUseCase?: UpdateUseCase;
}
@@ -45,7 +46,7 @@ export default class SystemUpgradeButton extends React.PureComponent<Props, Stat
};
render() {
- const { systemUpgrades, updateUseCase } = this.props;
+ const { latestLTS, systemUpgrades, updateUseCase } = this.props;
const { openSystemUpgradeForm } = this.state;
return (
<>
@@ -56,6 +57,7 @@ export default class SystemUpgradeButton extends React.PureComponent<Props, Stat
<SystemUpgradeForm
onClose={this.handleCloseSystemUpgradeForm}
systemUpgrades={groupUpgrades(sortUpgrades(systemUpgrades))}
+ latestLTS={latestLTS}
updateUseCase={updateUseCase}
/>
)}
diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeButton-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeButton-test.tsx
index df853f7207c..01a9e6b0857 100644
--- a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeButton-test.tsx
+++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeButton-test.tsx
@@ -33,6 +33,6 @@ it('should open modal correctly', () => {
function shallowRender(props: Partial<SystemUpgradeButton['props']> = {}) {
return shallow<SystemUpgradeButton['props']>(
- <SystemUpgradeButton systemUpgrades={[]} {...props} />
+ <SystemUpgradeButton systemUpgrades={[]} latestLTS="9.2" {...props} />
);
}
diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap
index ca65521832b..697c8eb3375 100644
--- a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap
@@ -303,7 +303,7 @@ exports[`should display correctly 3`] = `
exports[`should display correctly 4`] = `
<div
- className="system-upgrade-version"
+ className="system-upgrade-version it__upgrade-list-item"
>
<h3
className="h1 spacer-bottom"