aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-11-03 13:54:44 +0100
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-11-03 13:54:44 +0100
commit2634bf7e6e4f166f1c1fc3ad613d1cde62282f6d (patch)
treefd2983b2efad21380a83d0414e896508c65d3093
parent9ff24bd9efeb8831b863a98e44e08d21ca6efc35 (diff)
parent2b52fdc96d184e41be8854ca25603501429ec394 (diff)
downloadsonarqube-2634bf7e6e4f166f1c1fc3ad613d1cde62282f6d.tar.gz
sonarqube-2634bf7e6e4f166f1c1fc3ad613d1cde62282f6d.zip
Merge remote-tracking branch 'origin/branch-6.7'
-rw-r--r--server/sonar-web/src/main/js/api/marketplace.ts2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx71
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx15
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsEditionsNotif-test.tsx.snap14
-rw-r--r--server/sonar-web/src/main/js/app/styles/init/misc.css7
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx54
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx52
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap22
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx51
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/EditionBoxBadge.tsx40
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionSet.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionBox-test.tsx61
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionForm-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionSet-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/UninstallEditionForm-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap177
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBoxBadge-test.tsx.snap4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap7
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties19
23 files changed, 277 insertions, 361 deletions
diff --git a/server/sonar-web/src/main/js/api/marketplace.ts b/server/sonar-web/src/main/js/api/marketplace.ts
index 8bb8a462a42..7e3de777006 100644
--- a/server/sonar-web/src/main/js/api/marketplace.ts
+++ b/server/sonar-web/src/main/js/api/marketplace.ts
@@ -25,7 +25,7 @@ export interface Edition {
name: string;
textDescription: string;
homeUrl: string;
- requestUrl: string;
+ licenseRequestUrl: string;
downloadUrl: string;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx
index 2c4cebc6a29..9df1a73d51b 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx
@@ -18,6 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
import NavBarNotif from '../../../../components/nav/NavBarNotif';
import RestartForm from '../../../../components/common/RestartForm';
import { dismissErrorMessage, Edition, EditionStatus } from '../../../../api/marketplace';
@@ -46,6 +47,23 @@ export default class SettingsEditionsNotif extends React.PureComponent<Props, St
() => {}
);
+ renderStatusMsg(edition?: Edition) {
+ const { editionStatus } = this.props;
+ return (
+ <NavBarNotif className="alert alert-info">
+ <i className="spinner spacer-right text-bottom" />
+ <span>
+ {edition
+ ? translateWithParameters(
+ 'marketplace.status_x.' + editionStatus.installationStatus,
+ edition.name
+ )
+ : translate('marketplace.status', editionStatus.installationStatus)}
+ </span>
+ </NavBarNotif>
+ );
+ }
+
renderRestartMsg(edition?: Edition) {
const { editionStatus, preventRestart } = this.props;
return (
@@ -58,6 +76,24 @@ export default class SettingsEditionsNotif extends React.PureComponent<Props, St
)
: translate('marketplace.status', editionStatus.installationStatus)}
</span>
+ {edition &&
+ edition.key === 'datacenter' && (
+ <span className="little-spacer-left">
+ <FormattedMessage
+ defaultMessage={translate('marketplace.see_documentation_to_enable_cluster')}
+ id="marketplace.see_documentation_to_enable_cluster"
+ values={{
+ url: (
+ <a
+ href="https://redirect.sonarsource.com/doc/data-center-edition.html"
+ target="_blank">
+ {edition.name}
+ </a>
+ )
+ }}
+ />
+ </span>
+ )}
{!preventRestart && (
<button className="js-restart spacer-left" onClick={this.handleOpenRestart}>
{translate('marketplace.restart')}
@@ -79,6 +115,16 @@ export default class SettingsEditionsNotif extends React.PureComponent<Props, St
edition.name
)
: translate('marketplace.status', editionStatus.installationStatus)}
+ <a
+ className="spacer-left"
+ href={
+ edition && edition.key === 'datacenter'
+ ? 'https://redirect.sonarsource.com/doc/data-center-edition.html'
+ : 'https://redirect.sonarsource.com/doc/how-to-install-an-edition.html'
+ }
+ target="_blank">
+ {translate('marketplace.how_to_install')}
+ </a>
{edition && (
<a
className="button spacer-left"
@@ -88,33 +134,28 @@ export default class SettingsEditionsNotif extends React.PureComponent<Props, St
{translate('marketplace.download_package')}
</a>
)}
- <a
- className="spacer-left"
- href="https://redirect.sonarsource.com/doc/how-to-install-an-edition.html"
- target="_blank">
- {translate('marketplace.how_to_install')}
- </a>
</NavBarNotif>
);
}
renderStatusAlert() {
- const { editionStatus } = this.props;
- const { installationStatus, nextEditionKey } = editionStatus;
+ const { currentEditionKey, installationStatus, nextEditionKey } = this.props.editionStatus;
const nextEdition =
this.props.editions && this.props.editions.find(edition => edition.key === nextEditionKey);
+ const currentEdition =
+ this.props.editions &&
+ this.props.editions.find(
+ edition =>
+ edition.key === currentEditionKey || (!currentEditionKey && edition.key === 'community')
+ );
switch (installationStatus) {
case 'AUTOMATIC_IN_PROGRESS':
- return (
- <NavBarNotif className="alert alert-info">
- <i className="spinner spacer-right text-bottom" />
- <span>{translate('marketplace.status.AUTOMATIC_IN_PROGRESS')}</span>
- </NavBarNotif>
- );
+ return this.renderStatusMsg(nextEdition);
case 'AUTOMATIC_READY':
- case 'UNINSTALL_IN_PROGRESS':
return this.renderRestartMsg(nextEdition);
+ case 'UNINSTALL_IN_PROGRESS':
+ return this.renderRestartMsg(currentEdition);
case 'MANUAL_IN_PROGRESS':
return this.renderManualMsg(nextEdition);
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx
index 3f12b5bb4a1..0d73fbd8b63 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx
@@ -66,7 +66,7 @@ it('should display a manual installation notification', () => {
textDescription: 'Foo desc',
downloadUrl: 'download_url',
homeUrl: 'more_url',
- requestUrl: 'license_url'
+ licenseRequestUrl: 'license_url'
}
]}
preventRestart={false}
@@ -115,3 +115,16 @@ it('should not display the restart button', () => {
);
expect(wrapper.find('button.js-restart').exists()).toBeFalsy();
});
+
+it('should have a link to cluster documentation for datacenter edition', () => {
+ const editions = [{ key: 'datacenter' }] as any;
+ const wrapper = shallow(
+ <SettingsEditionsNotif
+ editions={editions}
+ editionStatus={{ installationStatus: 'AUTOMATIC_READY', nextEditionKey: 'datacenter' }}
+ preventRestart={false}
+ setEditionStatus={jest.fn()}
+ />
+ );
+ expect(wrapper.find('FormattedMessage').exists()).toBeTruthy();
+});
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsEditionsNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsEditionsNotif-test.tsx.snap
index 51ab67171a5..dcef4f6806f 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsEditionsNotif-test.tsx.snap
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsEditionsNotif-test.tsx.snap
@@ -6,19 +6,19 @@ exports[`should display a manual installation notification 1`] = `
>
marketplace.status_x.MANUAL_IN_PROGRESS.Foo
<a
- className="button spacer-left"
- download="sonarqube-Foo.zip"
- href="download_url"
+ className="spacer-left"
+ href="https://redirect.sonarsource.com/doc/how-to-install-an-edition.html"
target="_blank"
>
- marketplace.download_package
+ marketplace.how_to_install
</a>
<a
- className="spacer-left"
- href="https://redirect.sonarsource.com/doc/how-to-install-an-edition.html"
+ className="button spacer-left"
+ download="sonarqube-Foo.zip"
+ href="download_url"
target="_blank"
>
- marketplace.how_to_install
+ marketplace.download_package
</a>
</NavBarNotif>
`;
diff --git a/server/sonar-web/src/main/js/app/styles/init/misc.css b/server/sonar-web/src/main/js/app/styles/init/misc.css
index a0b1dfabb17..bdb9435384c 100644
--- a/server/sonar-web/src/main/js/app/styles/init/misc.css
+++ b/server/sonar-web/src/main/js/app/styles/init/misc.css
@@ -271,11 +271,16 @@ td.big-spacer-top {
display: inline-block !important;
}
-.diplay-flex-row {
+.display-flex-row {
display: flex !important;
flex-direction: row;
}
+.display-flex-center {
+ display: flex !important;
+ align-items: center;
+}
+
.rounded {
border-radius: 2px;
}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx b/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
index ddba3af1b72..8fab4b9d34b 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
@@ -87,7 +87,7 @@ export default class EditionBoxes extends React.PureComponent<Props, State> {
}
render() {
- const { canInstall, canUninstall, editions, editionStatus, loading } = this.props;
+ const { canInstall, canUninstall, editions, loading } = this.props;
if (loading) {
return <i className="big-spacer-bottom spinner" />;
@@ -114,23 +114,45 @@ export default class EditionBoxes extends React.PureComponent<Props, State> {
}
const sortedEditions = sortEditions(editions);
- const installedIdx =
- editionStatus &&
- sortedEditions.findIndex(edition => edition.key === editionStatus.currentEditionKey);
+ const status = this.props.editionStatus || { installationStatus: 'NONE' };
+ const inProgressStatus = [
+ 'AUTOMATIC_IN_PROGRESS',
+ 'AUTOMATIC_READY',
+ 'UNINSTALL_IN_PROGRESS'
+ ].includes(status.installationStatus);
+ const installedIdx = sortedEditions.findIndex(
+ edition => edition.key === status.currentEditionKey
+ );
+ const nextIdx = sortedEditions.findIndex(edition => edition.key === status.nextEditionKey);
+ const currentIdx = inProgressStatus ? nextIdx : installedIdx;
return (
<div className="spacer-bottom marketplace-editions">
- {sortedEditions.map((edition, idx) => (
- <EditionBox
- canInstall={canInstall}
- canUninstall={canUninstall}
- edition={edition}
- editionStatus={editionStatus}
- isDowngrade={installedIdx !== undefined && idx < installedIdx}
- key={edition.key}
- onInstall={this.handleOpenLicenseForm}
- onUninstall={this.handleOpenUninstallForm}
- />
- ))}
+ <EditionBox
+ actionLabel={translate('marketplace.downgrade')}
+ disableAction={inProgressStatus}
+ displayAction={canUninstall && currentIdx > 0}
+ edition={sortedEditions[0]}
+ editionStatus={status}
+ key={sortedEditions[0].key}
+ onAction={this.handleOpenUninstallForm}
+ />
+ {sortedEditions
+ .slice(1)
+ .map((edition, idx) => (
+ <EditionBox
+ actionLabel={
+ currentIdx > idx + 1
+ ? translate('marketplace.downgrade')
+ : translate('marketplace.upgrade')
+ }
+ disableAction={inProgressStatus}
+ displayAction={canInstall && currentIdx !== idx + 1}
+ edition={edition}
+ editionStatus={status}
+ key={edition.key}
+ onAction={this.handleOpenLicenseForm}
+ />
+ ))}
{this.renderForms(sortedEditions, installedIdx)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx
index f7fe0280173..790c3d0ab92 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx
@@ -35,7 +35,7 @@ const DEFAULT_EDITIONS = [
textDescription: 'foo',
downloadUrl: 'download_url',
homeUrl: 'more_url',
- requestUrl: 'license_url'
+ licenseRequestUrl: 'license_url'
},
{
key: 'comunity',
@@ -43,7 +43,7 @@ const DEFAULT_EDITIONS = [
textDescription: 'bar',
downloadUrl: 'download_url',
homeUrl: 'more_url',
- requestUrl: 'license_url'
+ licenseRequestUrl: 'license_url'
}
];
@@ -59,6 +59,54 @@ it('should display an error message', () => {
expect(wrapper).toMatchSnapshot();
});
+it('should display community without the downgrade button', () => {
+ const communityBox = getWrapper({
+ editions: DEFAULT_EDITIONS,
+ editionStatus: {
+ currentEditionKey: '',
+ installationStatus: 'NONE'
+ },
+ loading: false
+ })
+ .find('EditionBox')
+ .first();
+ expect(communityBox.prop('displayAction')).toBeFalsy();
+});
+
+it('should not display action buttons', () => {
+ const wrapper = getWrapper({
+ editions: DEFAULT_EDITIONS,
+ editionStatus: {
+ currentEditionKey: '',
+ installationStatus: 'NONE'
+ },
+ loading: false,
+ canInstall: false,
+ canUninstall: false
+ });
+ wrapper.find('EditionBox').forEach(box => expect(box.prop('displayAction')).toBeFalsy());
+});
+
+it('should display disabled action buttons', () => {
+ const wrapper = getWrapper({
+ editions: DEFAULT_EDITIONS,
+ editionStatus: { installationStatus: 'AUTOMATIC_IN_PROGRESS', nextEditionKey: 'developer' },
+ loading: false
+ });
+
+ wrapper.find('EditionBox').forEach(box => expect(box.prop('disableAction')).toBeTruthy());
+ expect(wrapper.find('EditionBox').map(box => box.prop('displayAction'))).toEqual([true, false]);
+
+ wrapper.setProps({
+ editionStatus: { currentEditionKey: 'developer', installationStatus: 'UNINSTALL_IN_PROGRESS' }
+ });
+ wrapper.find('EditionBox').forEach(box => expect(box.prop('disableAction')).toBeTruthy());
+ expect(wrapper.find('EditionBox').map(box => box.prop('displayAction'))).toEqual([false, true]);
+
+ wrapper.setProps({ editionStatus: { installationStatus: 'AUTOMATIC_READY' } });
+ wrapper.find('EditionBox').forEach(box => expect(box.prop('disableAction')).toBeTruthy());
+});
+
it('should open the license form', () => {
const wrapper = getWrapper({ editions: DEFAULT_EDITIONS });
(wrapper.instance() as EditionBoxes).handleOpenLicenseForm(DEFAULT_EDITIONS[0]);
diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap
index bd62c3de370..85ba8946957 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap
@@ -36,15 +36,16 @@ exports[`should display the edition boxes correctly 2`] = `
className="spacer-bottom marketplace-editions"
>
<EditionBox
- canInstall={true}
- canUninstall={true}
+ actionLabel="marketplace.downgrade"
+ disableAction={false}
+ displayAction={true}
edition={
Object {
"downloadUrl": "download_url",
"homeUrl": "more_url",
"key": "comunity",
+ "licenseRequestUrl": "license_url",
"name": "Comunity Edition",
- "requestUrl": "license_url",
"textDescription": "bar",
}
}
@@ -55,21 +56,20 @@ exports[`should display the edition boxes correctly 2`] = `
"nextEditionKey": "",
}
}
- isDowngrade={true}
key="comunity"
- onInstall={[Function]}
- onUninstall={[Function]}
+ onAction={[Function]}
/>
<EditionBox
- canInstall={true}
- canUninstall={true}
+ actionLabel="marketplace.upgrade"
+ disableAction={false}
+ displayAction={false}
edition={
Object {
"downloadUrl": "download_url",
"homeUrl": "more_url",
"key": "developer",
+ "licenseRequestUrl": "license_url",
"name": "Developer Edition",
- "requestUrl": "license_url",
"textDescription": "foo",
}
}
@@ -80,10 +80,8 @@ exports[`should display the edition boxes correctly 2`] = `
"nextEditionKey": "",
}
}
- isDowngrade={false}
key="developer"
- onInstall={[Function]}
- onUninstall={[Function]}
+ onAction={[Function]}
/>
</div>
`;
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
index 2d97b212ed0..40d89bc665e 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
@@ -23,52 +23,19 @@ import { Edition, EditionStatus } from '../../../api/marketplace';
import { translate } from '../../../helpers/l10n';
interface Props {
- canInstall: boolean;
- canUninstall: boolean;
+ actionLabel: string;
+ disableAction: boolean;
+ displayAction: boolean;
edition: Edition;
editionStatus?: EditionStatus;
- isDowngrade?: boolean;
- onInstall: (edition: Edition) => void;
- onUninstall: () => void;
+ onAction: (edition: Edition) => void;
}
export default class EditionBox extends React.PureComponent<Props> {
- handleInstall = () => this.props.onInstall(this.props.edition);
-
- renderActions(isInstalled?: boolean, installInProgress?: boolean) {
- const { canInstall, canUninstall, editionStatus } = this.props;
- const uninstallInProgress =
- editionStatus && editionStatus.installationStatus === 'UNINSTALL_IN_PROGRESS';
-
- if (canInstall && !isInstalled) {
- return (
- <button disabled={installInProgress || uninstallInProgress} onClick={this.handleInstall}>
- {this.props.isDowngrade
- ? translate('marketplace.downgrade')
- : translate('marketplace.upgrade')}
- </button>
- );
- }
- if (canUninstall && isInstalled) {
- return (
- <button
- className="button-red"
- disabled={installInProgress || uninstallInProgress}
- onClick={this.props.onUninstall}>
- {translate('marketplace.uninstall')}
- </button>
- );
- }
-
- return null;
- }
+ handleAction = () => this.props.onAction(this.props.edition);
render() {
- const { edition, editionStatus } = this.props;
- const isInstalled = editionStatus && editionStatus.currentEditionKey === edition.key;
- const installInProgress =
- editionStatus &&
- ['AUTOMATIC_IN_PROGRESS', 'AUTOMATIC_READY'].includes(editionStatus.installationStatus);
+ const { disableAction, displayAction, edition, editionStatus } = this.props;
return (
<div className="boxed-group boxed-group-inner marketplace-edition">
{editionStatus && <EditionBoxBadge editionKey={edition.key} status={editionStatus} />}
@@ -80,7 +47,11 @@ export default class EditionBox extends React.PureComponent<Props> {
<a href={edition.homeUrl} target="_blank">
{translate('marketplace.learn_more')}
</a>
- {this.renderActions(isInstalled, installInProgress)}
+ {displayAction && (
+ <button disabled={disableAction} onClick={this.handleAction}>
+ {this.props.actionLabel}
+ </button>
+ )}
</div>
</div>
);
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBoxBadge.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBoxBadge.tsx
index 47b3e767fe2..62c2efabcac 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBoxBadge.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBoxBadge.tsx
@@ -28,25 +28,31 @@ interface Props {
}
export default function EditionBoxBadge({ editionKey, status }: Props) {
- const inProgress = ['AUTOMATIC_IN_PROGRESS', 'AUTOMATIC_READY'].includes(
- status.installationStatus
- );
- const isInstalling = inProgress && status.nextEditionKey === editionKey;
+ const isInstalled =
+ status.currentEditionKey === editionKey ||
+ (!status.currentEditionKey && editionKey === 'community');
+ const isProgressing =
+ status.nextEditionKey === editionKey || (!status.nextEditionKey && editionKey === 'community');
+ const inProgressStatus = [
+ 'AUTOMATIC_READY',
+ 'AUTOMATIC_IN_PROGRESS',
+ 'UNINSTALL_IN_PROGRESS'
+ ].includes(status.installationStatus);
- if (isInstalling) {
- const installReady = status.installationStatus === 'AUTOMATIC_READY';
+ if (inProgressStatus) {
+ if (isProgressing) {
+ return (
+ <span className="marketplace-edition-badge badge badge-normal-size">
+ {status.installationStatus === 'AUTOMATIC_IN_PROGRESS'
+ ? translate('marketplace.installing')
+ : translate('marketplace.pending')}
+ </span>
+ );
+ }
+ } else if (isInstalled) {
return (
- <span className="marketplace-edition-badge badge badge-normal-size">
- {installReady ? translate('marketplace.pending') : translate('marketplace.installing')}
- </span>
- );
- }
-
- const isInstalled = status.currentEditionKey === editionKey;
- if (isInstalled) {
- return (
- <span className="marketplace-edition-badge badge badge-normal-size">
- <CheckIcon size={14} className="little-spacer-right text-bottom" />
+ <span className="marketplace-edition-badge badge badge-normal-size display-flex-center">
+ <CheckIcon size={14} className="little-spacer-right" />
{translate('marketplace.installed')}
</span>
);
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionSet.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionSet.tsx
index ea1320d082a..f33cb6a3911 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionSet.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionSet.tsx
@@ -20,6 +20,7 @@
import { stringify } from 'querystring';
import * as React from 'react';
import * as classNames from 'classnames';
+import { FormattedMessage } from 'react-intl';
import { debounce } from 'lodash';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { omitNil } from '../../../helpers/request';
@@ -95,7 +96,7 @@ export default class LicenseEditionSet extends React.PureComponent<Props, State>
};
getLicenseFormUrl = (edition: Edition) => {
- let url = edition.requestUrl;
+ let url = edition.licenseRequestUrl;
if (this.state.formData) {
const query = stringify(omitNil(this.state.formData));
if (query) {
@@ -146,6 +147,25 @@ export default class LicenseEditionSet extends React.PureComponent<Props, State>
'marketplace.license_preview_status.' + previewStatus,
licenseEdition ? licenseEdition.name : translate('marketplace.commercial_edition')
)}
+ {licenseEdition &&
+ licenseEdition.key === 'datacenter' &&
+ previewStatus !== 'NO_INSTALL' && (
+ <span className="little-spacer-left">
+ <FormattedMessage
+ defaultMessage={translate('marketplace.how_to_setup_cluster_url')}
+ id="marketplace.how_to_setup_cluster_url"
+ values={{
+ url: (
+ <a
+ href="https://redirect.sonarsource.com/doc/data-center-edition.html"
+ target="_blank">
+ {licenseEdition.name}
+ </a>
+ )
+ }}
+ />
+ </span>
+ )}
</p>
);
}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx
index 4c8c1087fb9..4d2edd5a56d 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx
@@ -48,7 +48,7 @@ export default function PluginAvailable({
<PluginDescription plugin={plugin} updateQuery={updateQuery} />
<td className="text-top big-spacer-right">
<ul>
- <li className="diplay-flex-row little-spacer-bottom">
+ <li className="display-flex-row little-spacer-bottom">
<div className="pull-left spacer-right">
<span className="badge badge-success">{plugin.release.version}</span>
</div>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx
index 453ab2741b0..bcfb3560527 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx
@@ -52,7 +52,7 @@ export default class PluginUpdateItem extends React.PureComponent<Props, State>
render() {
const { release, update } = this.props;
return (
- <li key={release.version} className="diplay-flex-row little-spacer-bottom">
+ <li key={release.version} className="display-flex-row little-spacer-bottom">
<div className="pull-left spacer-right">
{update.status === 'COMPATIBLE' ? (
<span className="js-update-version badge badge-success">{release.version}</span>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx
index c2bd0bf7711..483d2fc9f07 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx
@@ -73,7 +73,7 @@ export default class UninstallEditionForm extends React.PureComponent<Props, Sta
const { edition } = this.props;
const { loading } = this.state;
const currentEdition = edition ? edition.name : translate('marketplace.commercial_edition');
- const header = translateWithParameters('marketplace.uninstall_x', currentEdition);
+ const header = translateWithParameters('marketplace.downgrade_to_community_edition');
return (
<Modal contentLabel={header} onRequestClose={this.props.onClose}>
<header className="modal-head">
@@ -86,8 +86,8 @@ export default class UninstallEditionForm extends React.PureComponent<Props, Sta
<footer className="modal-foot">
{loading && <i className="spinner spacer-right" />}
- <button className="button-red" disabled={loading} onClick={this.handleConfirmClick}>
- {translate('marketplace.uninstall')}
+ <button disabled={loading} onClick={this.handleConfirmClick}>
+ {translate('marketplace.downgrade')}
</button>
<a className="js-modal-close" href="#" onClick={this.handleCancelClick}>
{translate('cancel')}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionBox-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionBox-test.tsx
index 1fdf88ee8db..7820b0a98de 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionBox-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionBox-test.tsx
@@ -34,73 +34,30 @@ const DEFAULT_EDITION: Edition = {
textDescription: 'Foo desc',
downloadUrl: 'download_url',
homeUrl: 'more_url',
- requestUrl: 'license_url'
+ licenseRequestUrl: 'license_url'
};
it('should display the edition', () => {
expect(getWrapper()).toMatchSnapshot();
});
-it('should disable upgrade button', () => {
- expect(
- getWrapper({
- editionStatus: {
- currentEditionKey: '',
- nextEditionKey: 'foo',
- installationStatus: 'AUTOMATIC_IN_PROGRESS'
- }
- })
- ).toMatchSnapshot();
- expect(
- getWrapper({
- editionStatus: {
- currentEditionKey: '',
- nextEditionKey: 'foo',
- installationStatus: 'AUTOMATIC_READY'
- }
- })
- ).toMatchSnapshot();
+it('should disable action button', () => {
+ expect(getWrapper({ disableAction: true })).toMatchSnapshot();
});
-it('should disable uninstall button', () => {
- expect(
- getWrapper({
- editionStatus: {
- currentEditionKey: 'foo',
- nextEditionKey: 'foo',
- installationStatus: 'AUTOMATIC_IN_PROGRESS'
- }
- })
- ).toMatchSnapshot();
-});
-
-it('should correctly hide upgrade/uninstall buttons', () => {
- expect(getWrapper({ canInstall: false })).toMatchSnapshot();
- expect(
- getWrapper({
- canUninstall: false,
- editionStatus: {
- currentEditionKey: 'foo',
- nextEditionKey: '',
- installationStatus: 'NONE'
- }
- })
- ).toMatchSnapshot();
-});
-
-it('should display a downgrade button', () => {
- expect(getWrapper({ isDowngrade: true })).toMatchSnapshot();
+it('should correctly hide action buttons', () => {
+ expect(getWrapper({ displayAction: false })).toMatchSnapshot();
});
function getWrapper(props = {}) {
return shallow(
<EditionBox
- canInstall={true}
- canUninstall={true}
+ actionLabel="action"
+ disableAction={false}
+ displayAction={true}
edition={DEFAULT_EDITION}
editionStatus={DEFAULT_STATUS}
- onInstall={jest.fn()}
- onUninstall={jest.fn()}
+ onAction={jest.fn()}
{...props}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionForm-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionForm-test.tsx
index 2105a1405bc..029cb562059 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionForm-test.tsx
@@ -37,7 +37,7 @@ const DEFAULT_EDITION = {
textDescription: 'Foo desc',
downloadUrl: 'download_url',
homeUrl: 'more_url',
- requestUrl: 'license_url'
+ licenseRequestUrl: 'license_url'
};
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionSet-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionSet-test.tsx
index ce2c5e98fdd..5efe571d861 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionSet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionSet-test.tsx
@@ -46,7 +46,7 @@ const DEFAULT_EDITION = {
textDescription: 'Foo desc',
downloadUrl: 'download_url',
homeUrl: 'more_url',
- requestUrl: 'license_url'
+ licenseRequestUrl: 'license_url'
};
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/UninstallEditionForm-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/UninstallEditionForm-test.tsx
index 211be102970..794e437ca89 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/UninstallEditionForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/UninstallEditionForm-test.tsx
@@ -35,7 +35,7 @@ const DEFAULT_EDITION = {
textDescription: 'Foo desc',
downloadUrl: 'download_url',
homeUrl: 'more_url',
- requestUrl: 'license_url'
+ licenseRequestUrl: 'license_url'
};
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap
index c054a76bac9..9fa9b253102 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`should correctly hide upgrade/uninstall buttons 1`] = `
+exports[`should correctly hide action buttons 1`] = `
<div
className="boxed-group boxed-group-inner marketplace-edition"
>
@@ -37,174 +37,7 @@ exports[`should correctly hide upgrade/uninstall buttons 1`] = `
</div>
`;
-exports[`should correctly hide upgrade/uninstall buttons 2`] = `
-<div
- className="boxed-group boxed-group-inner marketplace-edition"
->
- <EditionBoxBadge
- editionKey="foo"
- status={
- Object {
- "currentEditionKey": "foo",
- "installationStatus": "NONE",
- "nextEditionKey": "",
- }
- }
- />
- <div>
- <h3
- className="spacer-bottom"
- >
- Foo
- </h3>
- <p>
- Foo desc
- </p>
- </div>
- <div
- className="marketplace-edition-action spacer-top"
- >
- <a
- href="more_url"
- target="_blank"
- >
- marketplace.learn_more
- </a>
- </div>
-</div>
-`;
-
-exports[`should disable uninstall button 1`] = `
-<div
- className="boxed-group boxed-group-inner marketplace-edition"
->
- <EditionBoxBadge
- editionKey="foo"
- status={
- Object {
- "currentEditionKey": "foo",
- "installationStatus": "AUTOMATIC_IN_PROGRESS",
- "nextEditionKey": "foo",
- }
- }
- />
- <div>
- <h3
- className="spacer-bottom"
- >
- Foo
- </h3>
- <p>
- Foo desc
- </p>
- </div>
- <div
- className="marketplace-edition-action spacer-top"
- >
- <a
- href="more_url"
- target="_blank"
- >
- marketplace.learn_more
- </a>
- <button
- className="button-red"
- disabled={true}
- onClick={[Function]}
- >
- marketplace.uninstall
- </button>
- </div>
-</div>
-`;
-
-exports[`should disable upgrade button 1`] = `
-<div
- className="boxed-group boxed-group-inner marketplace-edition"
->
- <EditionBoxBadge
- editionKey="foo"
- status={
- Object {
- "currentEditionKey": "",
- "installationStatus": "AUTOMATIC_IN_PROGRESS",
- "nextEditionKey": "foo",
- }
- }
- />
- <div>
- <h3
- className="spacer-bottom"
- >
- Foo
- </h3>
- <p>
- Foo desc
- </p>
- </div>
- <div
- className="marketplace-edition-action spacer-top"
- >
- <a
- href="more_url"
- target="_blank"
- >
- marketplace.learn_more
- </a>
- <button
- disabled={true}
- onClick={[Function]}
- >
- marketplace.upgrade
- </button>
- </div>
-</div>
-`;
-
-exports[`should disable upgrade button 2`] = `
-<div
- className="boxed-group boxed-group-inner marketplace-edition"
->
- <EditionBoxBadge
- editionKey="foo"
- status={
- Object {
- "currentEditionKey": "",
- "installationStatus": "AUTOMATIC_READY",
- "nextEditionKey": "foo",
- }
- }
- />
- <div>
- <h3
- className="spacer-bottom"
- >
- Foo
- </h3>
- <p>
- Foo desc
- </p>
- </div>
- <div
- className="marketplace-edition-action spacer-top"
- >
- <a
- href="more_url"
- target="_blank"
- >
- marketplace.learn_more
- </a>
- <button
- disabled={true}
- onClick={[Function]}
- >
- marketplace.upgrade
- </button>
- </div>
-</div>
-`;
-
-exports[`should display a downgrade button 1`] = `
+exports[`should disable action button 1`] = `
<div
className="boxed-group boxed-group-inner marketplace-edition"
>
@@ -238,10 +71,10 @@ exports[`should display a downgrade button 1`] = `
marketplace.learn_more
</a>
<button
- disabled={false}
+ disabled={true}
onClick={[Function]}
>
- marketplace.downgrade
+ action
</button>
</div>
</div>
@@ -284,7 +117,7 @@ exports[`should display the edition 1`] = `
disabled={false}
onClick={[Function]}
>
- marketplace.upgrade
+ action
</button>
</div>
</div>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBoxBadge-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBoxBadge-test.tsx.snap
index 0d5724e6fc1..733b0062157 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBoxBadge-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBoxBadge-test.tsx.snap
@@ -2,10 +2,10 @@
exports[`should display installed badge 1`] = `
<span
- className="marketplace-edition-badge badge badge-normal-size"
+ className="marketplace-edition-badge badge badge-normal-size display-flex-center"
>
<CheckIcon
- className="little-spacer-right text-bottom"
+ className="little-spacer-right"
size={14}
/>
marketplace.installed
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap
index 85de7c934df..6e1defbecd0 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap
@@ -49,8 +49,8 @@ exports[`should display correctly 1`] = `
"downloadUrl": "download_url",
"homeUrl": "more_url",
"key": "foo",
+ "licenseRequestUrl": "license_url",
"name": "Foo",
- "requestUrl": "license_url",
"textDescription": "Foo desc",
}
}
@@ -60,8 +60,8 @@ exports[`should display correctly 1`] = `
"downloadUrl": "download_url",
"homeUrl": "more_url",
"key": "foo",
+ "licenseRequestUrl": "license_url",
"name": "Foo",
- "requestUrl": "license_url",
"textDescription": "Foo desc",
},
]
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap
index 0b3ad80dd5c..0493fdbf245 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap
@@ -2,14 +2,14 @@
exports[`should display correctly 1`] = `
<Modal
- contentLabel="marketplace.uninstall_x.Foo"
+ contentLabel="marketplace.downgrade_to_community_edition."
onRequestClose={[Function]}
>
<header
className="modal-head"
>
<h2>
- marketplace.uninstall_x.Foo
+ marketplace.downgrade_to_community_edition.
</h2>
</header>
<div
@@ -23,11 +23,10 @@ exports[`should display correctly 1`] = `
className="modal-foot"
>
<button
- className="button-red"
disabled={false}
onClick={[Function]}
>
- marketplace.uninstall
+ marketplace.downgrade
</button>
<a
className="js-modal-close"
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 6829011ac94..798f670b52c 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2080,7 +2080,7 @@ marketplace.installed=Installed
marketplace.installing=Installing...
marketplace.upgrade=Upgrade
marketplace.downgrade=Downgrade
-marketplace.uninstall_x=Uninstall {0}
+marketplace.downgrade_to_community_edition=Downgrade to Community Edition
marketplace.uninstall_x_confirmation=Are you sure you want to uninstall {0} and get back to the Community Edition?
marketplace.pending=Pending...
marketplace.checking_license=Checking your license...
@@ -2110,14 +2110,17 @@ marketplace.commercial_edition=Commercial Edition
marketplace.terms_and_conditions=Terms and Conditions
marketplace.editions_unavailable=Explore our Commercial Editions on {url}: advanced feature packs brought to you by SonarSource
marketplace.release_notes=Release Notes
-marketplace.status.AUTOMATIC_IN_PROGRESS=Updating your installation... Please wait...
-marketplace.status.AUTOMATIC_READY=Commercial Edition successfully installed. Please restart the server to activate your new features.
-marketplace.status.UNINSTALL_IN_PROGRESS=Commercial Edition successfully uninstalled. Please restart the server to remove the features.
-marketplace.status.MANUAL_IN_PROGRESS=Commercial Edition can't automatically be installed because of internet access issues. Please manually install the package in your SonarQube's plugins folder.
-marketplace.status_x.AUTOMATIC_READY={0} successfully installed. Please restart the server to activate your new features.
-marketplace.status_X.UNINSTALL_IN_PROGRESS={0} successfully uninstalled. Please restart the server to remove the features.
-marketplace.status_x.MANUAL_IN_PROGRESS={0} can't automatically be installed because of internet access issues. Please manually install the package in your SonarQube's plugins folder.
+marketplace.status.AUTOMATIC_IN_PROGRESS=Installing your new Commercial Edition... Please wait...
+marketplace.status.AUTOMATIC_READY=Commercial Edition successfully installed. Please restart the server to activate your new edition.
+marketplace.status.UNINSTALL_IN_PROGRESS=Commercial Edition successfully downgraded. Please restart the server to remove the features.
+marketplace.status.MANUAL_IN_PROGRESS=Commercial Edition can't automatically be installed because of internet access issues. Please manually install the package.
+marketplace.status_x.AUTOMATIC_IN_PROGRESS=Installing your new {0}... Please wait...
+marketplace.status_x.AUTOMATIC_READY={0} successfully installed. Please restart the server to activate your new edition.
+marketplace.status_x.UNINSTALL_IN_PROGRESS=Successfully downgraded to {0}. Please restart the server to remove the features.
+marketplace.status_x.MANUAL_IN_PROGRESS={0} can't automatically be installed because of internet access issues. Please manually install the package.
marketplace.how_to_install=How to install it?
+marketplace.see_documentation_to_enable_cluster=See {url} documentation to set up a cluster.
+marketplace.how_to_setup_cluster_url=Further setup and configuration are required to get a cluster. See {url} documentation.
marketplace.enter_license_for_x=Enter your license key for {0}
marketplace.wrong_license_type_x=Your license is not compatible with the selected edition. Please provide a valid license for {0}.
marketplace.i_need_a_license=I need a license key