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;
}
return <GlobalFooterSonarCloud />;
}
+ const currentEdition = EDITIONS.find(edition => edition.key === sonarqubeEdition);
+
return (
<div className="page-footer page-container" id="footer">
{productionDatabase === false && (
<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">
interface StateProps {
productionDatabase: boolean;
+ sonarqubeEdition: string;
sonarqubeVersion?: string;
}
}
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);
});
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', () => {
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} />);
}
<ul
className="page-footer-menu"
>
+ <li
+ className="page-footer-menu-item"
+ >
+ Enterprise Edition
+ </li>
<li
className="page-footer-menu-item"
>
<ul
className="page-footer-menu"
>
+ <li
+ className="page-footer-menu-item"
+ >
+ Community Edition
+ </li>
<li
className="page-footer-menu-item"
>
const DEFAULT_EDITION = {
key: 'foo',
+ name: 'Foo',
downloadUrl: 'download_url',
homeUrl: 'more_url'
};
downloadUrl?: string;
homeUrl: string;
key: string;
+ name: string;
}
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'