aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-05-28 15:43:24 +0200
committerSonarTech <sonartech@sonarsource.com>2018-06-12 20:20:59 +0200
commitaaa7d9450fdcbd5cbed48e64bfb2c3e1befb0ffa (patch)
treecdec20d764da3b2d401d67b4cd2203a2016974a0
parentd5576133cbd1b2572a95bd6872b1be5df2ba4853 (diff)
downloadsonarqube-aaa7d9450fdcbd5cbed48e64bfb2c3e1befb0ffa.tar.gz
sonarqube-aaa7d9450fdcbd5cbed48e64bfb2c3e1befb0ffa.zip
SONAR-10703 Add the current edition in the footer
-rw-r--r--server/sonar-web/src/main/js/app/components/GlobalFooter.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap10
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionBox-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/utils.ts5
6 files changed, 30 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx b/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
index 63e5ee4eab5..363102ff653 100644
--- a/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
+++ b/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
@@ -22,12 +22,14 @@ import { Link } from 'react-router';
import GlobalFooterSonarCloud from './GlobalFooterSonarCloud';
import GlobalFooterBranding from './GlobalFooterBranding';
import InstanceMessage from '../../components/common/InstanceMessage';
+import { EDITIONS } from '../../apps/marketplace/utils';
import { translate, translateWithParameters } from '../../helpers/l10n';
import { isSonarCloud } from '../../helpers/system';
interface Props {
hideLoggedInInfo?: boolean;
productionDatabase: boolean;
+ sonarqubeEdition: string;
sonarqubeVersion?: string;
}
@@ -40,6 +42,8 @@ export default function GlobalFooter({
return <GlobalFooterSonarCloud />;
}
+ const currentEdition = EDITIONS.find(edition => edition.key === sonarqubeEdition);
+
return (
<div className="page-footer page-container" id="footer">
{productionDatabase === false && (
@@ -57,6 +61,8 @@ export default function GlobalFooter({
<ul className="page-footer-menu">
{!hideLoggedInInfo &&
+ currentEdition && <li className="page-footer-menu-item">{currentEdition.name}</li>}
+ {!hideLoggedInInfo &&
sonarqubeVersion && (
<li className="page-footer-menu-item">
{translateWithParameters('footer.version_x', sonarqubeVersion)}
diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx b/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx
index b0a9a2c29a3..915fb155f2f 100644
--- a/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx
@@ -23,6 +23,7 @@ import { getAppState } from '../../store/rootReducer';
interface StateProps {
productionDatabase: boolean;
+ sonarqubeEdition: string;
sonarqubeVersion?: string;
}
@@ -31,8 +32,9 @@ interface OwnProps {
}
const mapStateToProps = (state: any): StateProps => ({
- sonarqubeVersion: getAppState(state).version,
- productionDatabase: getAppState(state).productionDatabase
+ productionDatabase: getAppState(state).productionDatabase,
+ sonarqubeEdition: getAppState(state).edition,
+ sonarqubeVersion: getAppState(state).version
});
export default connect<StateProps, {}, OwnProps>(mapStateToProps)(GlobalFooter);
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx
index 6eb9e440d3a..47d63dd2ffc 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx
@@ -39,7 +39,9 @@ it('should show the db warning message', () => {
});
it('should display the sq version', () => {
- expect(getWrapper({ sonarqubeVersion: '6.4-SNAPSHOT' })).toMatchSnapshot();
+ expect(
+ getWrapper({ sonarqubeEdition: 'enterprise', sonarqubeVersion: '6.4-SNAPSHOT' })
+ ).toMatchSnapshot();
});
it('should render SonarCloud footer', () => {
@@ -48,5 +50,5 @@ it('should render SonarCloud footer', () => {
function getWrapper(props = {}, onSonarCloud = false) {
(isSonarCloud as jest.Mock).mockImplementation(() => onSonarCloud);
- return shallow(<GlobalFooter productionDatabase={true} {...props} />);
+ return shallow(<GlobalFooter productionDatabase={true} sonarqubeEdition="community" {...props} />);
}
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap b/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap
index 7b42faddf53..edff04e27c5 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap
+++ b/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap
@@ -12,6 +12,11 @@ exports[`should display the sq version 1`] = `
<li
className="page-footer-menu-item"
>
+ Enterprise Edition
+ </li>
+ <li
+ className="page-footer-menu-item"
+ >
footer.version_x.6.4-SNAPSHOT
</li>
<li
@@ -157,6 +162,11 @@ exports[`should render the only logged in information 1`] = `
<li
className="page-footer-menu-item"
>
+ Community Edition
+ </li>
+ <li
+ className="page-footer-menu-item"
+ >
<a
href="http://www.gnu.org/licenses/lgpl-3.0.txt"
>
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 ec0303053a4..4142b022e58 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
@@ -23,6 +23,7 @@ import EditionBox from '../EditionBox';
const DEFAULT_EDITION = {
key: 'foo',
+ name: 'Foo',
downloadUrl: 'download_url',
homeUrl: 'more_url'
};
diff --git a/server/sonar-web/src/main/js/apps/marketplace/utils.ts b/server/sonar-web/src/main/js/apps/marketplace/utils.ts
index 9aebc85c3ad..0c93eb22f17 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/utils.ts
+++ b/server/sonar-web/src/main/js/apps/marketplace/utils.ts
@@ -27,6 +27,7 @@ export interface Edition {
downloadUrl?: string;
homeUrl: string;
key: string;
+ name: string;
}
export interface Query {
@@ -37,22 +38,26 @@ export interface Query {
export const EDITIONS: Edition[] = [
{
key: 'community',
+ name: 'Community Edition',
homeUrl: 'https://redirect.sonarsource.com/editions/community.html'
},
{
key: 'developer',
+ name: 'Developer Edition',
homeUrl: 'https://redirect.sonarsource.com/editions/developer.html',
downloadUrl:
'https://sonarsource.bintray.com/CommercialDistribution/editions/developer-edition-7.0.0.717.zip'
},
{
key: 'enterprise',
+ name: 'Enterprise Edition',
homeUrl: 'https://redirect.sonarsource.com/editions/enterprise.html',
downloadUrl:
'https://sonarsource.bintray.com/CommercialDistribution/editions/enterprise-edition-7.0.0.717.zip'
},
{
key: 'datacenter',
+ name: 'Data Center Edition',
homeUrl: 'https://redirect.sonarsource.com/editions/datacenter.html',
downloadUrl:
'https://sonarsource.bintray.com/CommercialDistribution/editions/datacenter-edition-7.0.0.717.zip'