]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10703 Add the current edition in the footer
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 28 May 2018 13:43:24 +0000 (15:43 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 12 Jun 2018 18:20:59 +0000 (20:20 +0200)
server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx
server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx
server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap
server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionBox-test.tsx
server/sonar-web/src/main/js/apps/marketplace/utils.ts

index 63e5ee4eab523d45457eed628bde346bfab4a3e9..363102ff65329872b1f7ea63486af0923bb2304b 100644 (file)
@@ -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 && (
@@ -56,6 +60,8 @@ export default function GlobalFooter({
       <GlobalFooterBranding />
 
       <ul className="page-footer-menu">
+        {!hideLoggedInInfo &&
+          currentEdition && <li className="page-footer-menu-item">{currentEdition.name}</li>}
         {!hideLoggedInInfo &&
           sonarqubeVersion && (
             <li className="page-footer-menu-item">
index b0a9a2c29a392f0f2355c7a13f6805e10d332a14..915fb155f2f0878451cc133c0bf6f054e3dd1447 100644 (file)
@@ -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);
index 6eb9e440d3a7a8d70e943a5f16a1a259792f5c2a..47d63dd2ffc73be84afccb10397217be379e0f72 100644 (file)
@@ -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} />);
 }
index 7b42faddf53727e70e4cc65179779380e86de760..edff04e27c5a76bbcca53bd3ba2373cabadcf8dd 100644 (file)
@@ -9,6 +9,11 @@ exports[`should display the sq version 1`] = `
   <ul
     className="page-footer-menu"
   >
+    <li
+      className="page-footer-menu-item"
+    >
+      Enterprise Edition
+    </li>
     <li
       className="page-footer-menu-item"
     >
@@ -154,6 +159,11 @@ exports[`should render the only logged in information 1`] = `
   <ul
     className="page-footer-menu"
   >
+    <li
+      className="page-footer-menu-item"
+    >
+      Community Edition
+    </li>
     <li
       className="page-footer-menu-item"
     >
index ec0303053a47933ed901432801cd6fa71f4bd5da..4142b022e589b07f5b35eb45847f64d0ed49e24b 100644 (file)
@@ -23,6 +23,7 @@ import EditionBox from '../EditionBox';
 
 const DEFAULT_EDITION = {
   key: 'foo',
+  name: 'Foo',
   downloadUrl: 'download_url',
   homeUrl: 'more_url'
 };
index 9aebc85c3ad889037d18bde4e83d9a7772b66911..0c93eb22f17a1623bd541691b094ec3f72b921bc 100644 (file)
@@ -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'