]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9937 New workflow for uninstallation of edition in marketplace
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 1 Nov 2017 14:38:47 +0000 (15:38 +0100)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 3 Nov 2017 10:54:04 +0000 (11:54 +0100)
21 files changed:
server/sonar-web/src/main/js/api/marketplace.ts
server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx
server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx
server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx
server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap
server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
server/sonar-web/src/main/js/apps/marketplace/components/EditionBoxBadge.tsx
server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionSet.tsx
server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx
server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx
server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx
server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionBox-test.tsx
server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionForm-test.tsx
server/sonar-web/src/main/js/apps/marketplace/components/__tests__/LicenseEditionSet-test.tsx
server/sonar-web/src/main/js/apps/marketplace/components/__tests__/UninstallEditionForm-test.tsx
server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap
server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap
server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap
server/sonar-web/src/main/less/init/misc.less
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 8bb8a462a42845ec29a3c69f73898f962326f7d1..7e3de777006c87d2367ffeac01cfa94faa71f887 100644 (file)
@@ -25,7 +25,7 @@ export interface Edition {
   name: string;
   textDescription: string;
   homeUrl: string;
-  requestUrl: string;
+  licenseRequestUrl: string;
   downloadUrl: string;
 }
 
index 527b8479adab67dd260b5e287f5ff6fece9b7856..4e39bd190309246235b490a16a0d346a83d3ca39 100644 (file)
@@ -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);
     }
index 3614b9b06fe407e69c99e7a7ad40fdbafa0710ba..9c16173bead3e517c3c2111c9cdd8f96979e62bd 100644 (file)
@@ -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}
index ddba3af1b7240509b60b32f885fa70d7a14cea60..1dbbefc1153f3b4f4bf0c07396512dd3234002b3 100644 (file)
@@ -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>
index 0201372b08642b53c7bad194acda88589ce16717..fc8babe79d22a37c6a3260816248f69c1a1db9f6 100644 (file)
@@ -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]);
index 952e8dc78c165d1e4f1f407cb967af06932e1502..644471ccdcad0cbdd3cf9e70b1b47f530c38c034 100644 (file)
@@ -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>
 `;
index 6f90fda970e528436485f21e36a030c956c3a6d4..40d89bc665e3c49be11021c44c75380e3b7428d6 100644 (file)
@@ -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>
     );
index 47b3e767fe2fba5e5765c0c5690b8f692c03d108..e58c8edf24a859cf4844f73d3e10d0d84d367ac8 100644 (file)
@@ -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>
     );
index 74e2874c1a0d35b45e61f0b8e388f0e4c71549db..7ef5650c19f9b8739e3f7817906191950754469a 100644 (file)
@@ -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) {
index aabb86e0f6d43272fb1305d8682c9146703a3f5c..cbae64fd06925e43b4c440656cf4b6042530e4f5 100644 (file)
@@ -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>
index 453ab2741b08475aec34ce5a54c43f5b80b7e5c9..bcfb3560527891633321f7c303c47fae517a003c 100644 (file)
@@ -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>
index 37b76edc83e4a0758a0cfe634bdd172dbb8983b6..2802634d264919c7480742dc98f4aa49d88ebb00 100644 (file)
@@ -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')}
index 1fdf88ee8db11976f3ee7a1d0a5df094e5579145..7820b0a98de5e6898484a6bf9f575c6e630b9d1f 100644 (file)
@@ -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}
     />
   );
index 133ac46491342be575676acae5f7195f4bb38a63..745c8308a9b7dd0ff486297d10385078d102e2c7 100644 (file)
@@ -36,7 +36,7 @@ const DEFAULT_EDITION = {
   textDescription: 'Foo desc',
   downloadUrl: 'download_url',
   homeUrl: 'more_url',
-  requestUrl: 'license_url'
+  licenseRequestUrl: 'license_url'
 };
 
 beforeEach(() => {
index 0992ebb36bd2c111d0ac1b07dc0ab17e78f1a379..ce68f4c2d3ea8fb9b03111ecf9b60ae0f222d935 100644 (file)
@@ -44,7 +44,7 @@ const DEFAULT_EDITION = {
   textDescription: 'Foo desc',
   downloadUrl: 'download_url',
   homeUrl: 'more_url',
-  requestUrl: 'license_url'
+  licenseRequestUrl: 'license_url'
 };
 
 beforeEach(() => {
index be7f50ce171714f606ef92bc59ee060dbf3fdab1..f104038722f2d3a8efd431365fd4f0d9b728d3c2 100644 (file)
@@ -34,7 +34,7 @@ const DEFAULT_EDITION = {
   textDescription: 'Foo desc',
   downloadUrl: 'download_url',
   homeUrl: 'more_url',
-  requestUrl: 'license_url'
+  licenseRequestUrl: 'license_url'
 };
 
 beforeEach(() => {
index c054a76bac9bf8d72bfdefaea5a764f296737073..9fa9b25310293a9083c881403981cfaeae6752ed 100644 (file)
@@ -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>
index 9e07155c2924b563661a27bdbfe560a5601b9c3f..d178e5134f41258454ee2087e23cc3164773f4d7 100644 (file)
@@ -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",
         },
       ]
index 507f7e4fe73a0ef3711f88174c187f9bea0150b4..a8d55e70b19cc08de9013c6fa4179349cd1aeb2b 100644 (file)
@@ -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"
index f7a4583cb98219bb9aa8b6b156bedb693c372c8d..5a29f12b6ce9d21187e64c35b537b3a7cc4673f1 100644 (file)
@@ -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;
 }
index e734fbfc5e5a5aad482fb3f8efd29c52d3e98c2b..ecf24dbf1ea50077be7774dab7079f101c521df5 100644 (file)
@@ -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}