aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-27 09:13:05 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-27 16:03:44 +0200
commit38ef4f02e5feccc2d1e740ee12220b5088a2b8ba (patch)
tree10a564abf8a6a6689d7bf37258be1c2cffe903ba
parentd4799b6bd87a9c61e2d97594795450f9e60f1f73 (diff)
downloadsonarqube-38ef4f02e5feccc2d1e740ee12220b5088a2b8ba.tar.gz
sonarqube-38ef4f02e5feccc2d1e740ee12220b5088a2b8ba.zip
SONAR-9937 Display error message when license don't match selected edition in marketplace
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionSet.tsx15
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
2 files changed, 14 insertions, 2 deletions
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 3ec3bb3485b..74e2874c1a0 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
@@ -67,10 +67,11 @@ export default class LicenseEditionSet extends React.PureComponent<Props, State>
getLicensePreview({ license }).then(
({ previewStatus, nextEditionKey }) => {
if (this.mounted) {
+ const { edition } = this.props;
this.updateLicense(
license,
this.props.editions.find(edition => edition.key === nextEditionKey),
- previewStatus
+ edition && edition.key !== nextEditionKey ? undefined : previewStatus
);
}
},
@@ -89,7 +90,7 @@ export default class LicenseEditionSet extends React.PureComponent<Props, State>
this.setState({ formData });
}
},
- () => { }
+ () => {}
);
};
@@ -122,8 +123,18 @@ export default class LicenseEditionSet extends React.PureComponent<Props, State>
renderAlert() {
const { licenseEdition, previewStatus } = this.state;
if (!previewStatus) {
+ const { edition } = this.props;
+ if (edition && licenseEdition && edition.key !== licenseEdition.key) {
+ return (
+ <p className="alert alert-danger spacer-top">
+ {translateWithParameters('marketplace.wrong_license_type_x', edition.name)}
+ </p>
+ );
+ }
+
return undefined;
}
+
return (
<p
className={classNames('alert spacer-top', {
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 11440377ec6..5fbb5c85f05 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2110,6 +2110,7 @@ marketplace.status_X.UNINSTALL_IN_PROGRESS={0} successfully uninstalled. Please
marketplace.status_x.MANUAL_IN_PROGRESS=Can't install {0} because of internet access issue. 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}
+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
marketplace.download_package=Download package