From: Grégoire Aubert Date: Fri, 27 Oct 2017 07:13:05 +0000 (+0200) Subject: SONAR-9937 Display error message when license don't match selected edition in marketplace X-Git-Tag: 6.7-RC1~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=38ef4f02e5feccc2d1e740ee12220b5088a2b8ba;p=sonarqube.git SONAR-9937 Display error message when license don't match selected edition in marketplace --- 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 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 this.setState({ formData }); } }, - () => { } + () => {} ); }; @@ -122,8 +123,18 @@ export default class LicenseEditionSet extends React.PureComponent renderAlert() { const { licenseEdition, previewStatus } = this.state; if (!previewStatus) { + const { edition } = this.props; + if (edition && licenseEdition && edition.key !== licenseEdition.key) { + return ( +

+ {translateWithParameters('marketplace.wrong_license_type_x', edition.name)} +

+ ); + } + return undefined; } + return (