aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-11-01 15:38:47 +0100
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-11-03 11:54:04 +0100
commit8bf1ad56841f7bdff94762b50937ffece1e2375b (patch)
treef0be608e26cbaa3e05e440ea174674ddff00ef4b
parent76b61972e9a2438a01d39f89db8aac878a2c8074 (diff)
downloadsonarqube-8bf1ad56841f7bdff94762b50937ffece1e2375b.tar.gz
sonarqube-8bf1ad56841f7bdff94762b50937ffece1e2375b.zip
SONAR-9937 New workflow for uninstallation of edition in marketplace
-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.tsx37
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx56
-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.tsx53
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/EditionBoxBadge.tsx42
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionSet.tsx2
-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__/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--server/sonar-web/src/main/less/init/misc.less7
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties13
21 files changed, 208 insertions, 345 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 527b8479ada..4e39bd19030 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
@@ -46,6 +46,25 @@ 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 (
@@ -104,21 +123,23 @@ export default class SettingsEditionsNotif extends React.PureComponent<Props, St
renderStatusAlert() {
const { editionStatus } = this.props;
- const { installationStatus, nextEditionKey } = editionStatus;
+ const { currentEditionKey, installationStatus, nextEditionKey } = 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 3614b9b06fe..9c16173bead 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
@@ -65,7 +65,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}
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..1dbbefc1153 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,47 @@ 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 0201372b086..fc8babe79d2 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 952e8dc78c1..644471ccdca 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,20 +56,19 @@ exports[`should display the edition boxes correctly 2`] = `
"nextEditionKey": "",
}
}
- isDowngrade={true}
- 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",
}
}
@@ -79,9 +79,7 @@ exports[`should display the edition boxes correctly 2`] = `
"nextEditionKey": "",
}
}
- isDowngrade={false}
- 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 6f90fda970e..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,54 +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} />}
@@ -82,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..e58c8edf24a 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,33 @@ 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 74e2874c1a0..7ef5650c19f 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
@@ -95,7 +95,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) {
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 aabb86e0f6d..cbae64fd069 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 37b76edc83e..2802634d264 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
isOpen={true}
@@ -91,8 +91,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 133ac464913..745c8308a9b 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
@@ -36,7 +36,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 0992ebb36bd..ce68f4c2d3e 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
@@ -44,7 +44,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 be7f50ce171..f104038722f 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
@@ -34,7 +34,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__/LicenseEditionForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap
index 9e07155c292..d178e5134f4 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
@@ -58,8 +58,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",
}
}
@@ -69,8 +69,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 507f7e4fe73..a8d55e70b19 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
@@ -6,7 +6,7 @@ exports[`should display correctly 1`] = `
bodyOpenClassName="ReactModal__Body--open"
className="modal"
closeTimeoutMS={0}
- contentLabel="marketplace.uninstall_x.Foo"
+ contentLabel="marketplace.downgrade_to_community_edition."
isOpen={true}
onRequestClose={[Function]}
overlayClassName="modal-overlay"
@@ -18,7 +18,7 @@ exports[`should display correctly 1`] = `
className="modal-head"
>
<h2>
- marketplace.uninstall_x.Foo
+ marketplace.downgrade_to_community_edition.
</h2>
</header>
<div
@@ -32,11 +32,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/server/sonar-web/src/main/less/init/misc.less b/server/sonar-web/src/main/less/init/misc.less
index f7a4583cb98..5a29f12b6ce 100644
--- a/server/sonar-web/src/main/less/init/misc.less
+++ b/server/sonar-web/src/main/less/init/misc.less
@@ -237,11 +237,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/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index e734fbfc5e5..ecf24dbf1ea 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2077,7 +2077,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...
@@ -2107,12 +2107,13 @@ 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.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 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.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 in your SonarQube's plugins folder.
marketplace.how_to_install=How to install it?
marketplace.enter_license_for_x=Enter your license key for {0}