diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-08-29 11:38:53 +0200 |
---|---|---|
committer | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-09-13 13:53:58 +0200 |
commit | 793e86fce66f356099792b7231c9a1d949ff875e (patch) | |
tree | 8bd08099539c3cb1ff159823ee1d1f74a5f2c979 /server/sonar-web/src/main | |
parent | 736e89cc1629e1e52db00f67e4650f1b88695de9 (diff) | |
download | sonarqube-793e86fce66f356099792b7231c9a1d949ff875e.tar.gz sonarqube-793e86fce66f356099792b7231c9a1d949ff875e.zip |
update prettier
Diffstat (limited to 'server/sonar-web/src/main')
496 files changed, 4099 insertions, 4510 deletions
diff --git a/server/sonar-web/src/main/js/api/auth.ts b/server/sonar-web/src/main/js/api/auth.ts index 0c95f699127..ebe74afa014 100644 --- a/server/sonar-web/src/main/js/api/auth.ts +++ b/server/sonar-web/src/main/js/api/auth.ts @@ -28,7 +28,10 @@ export function login(login: string, password: string): Promise<Response> { } export function logout(): Promise<Response> { - return request('/api/authentication/logout').setMethod('POST').submit().then(basicCheckStatus); + return request('/api/authentication/logout') + .setMethod('POST') + .submit() + .then(basicCheckStatus); } function basicCheckStatus(response: Response): Promise<Response> { diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx index 8aea4c958d8..99bd095c9e8 100644 --- a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx @@ -136,14 +136,15 @@ export default class ComponentContainer extends React.PureComponent<Props, State return ( <div> - {!isFile && + {!isFile && ( <ComponentNav branches={branches} currentBranch={branch} component={component} conf={configuration} location={this.props.location} - />} + /> + )} {React.cloneElement(this.props.children, { branch, branches, diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainerNotFound.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainerNotFound.tsx index b404c5d1af8..e87bea11cce 100644 --- a/server/sonar-web/src/main/js/app/components/ComponentContainerNotFound.tsx +++ b/server/sonar-web/src/main/js/app/components/ComponentContainerNotFound.tsx @@ -40,12 +40,8 @@ export default class ComponentContainerNotFound extends React.PureComponent { return ( <div id="bd" className="page-wrapper-simple"> <div id="nonav" className="page-simple"> - <h2 className="big-spacer-bottom"> - {translate('dashboard.project_not_found')} - </h2> - <p className="spacer-bottom"> - {translate('dashboard.project_not_found.2')} - </p> + <h2 className="big-spacer-bottom">{translate('dashboard.project_not_found')}</h2> + <p className="spacer-bottom">{translate('dashboard.project_not_found.2')}</p> <p> <Link to="/">Go back to the homepage</Link> </p> diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooter.js b/server/sonar-web/src/main/js/app/components/GlobalFooter.js index d24ae3ab27b..2f104f6958f 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalFooter.js +++ b/server/sonar-web/src/main/js/app/components/GlobalFooter.js @@ -42,15 +42,14 @@ export default function GlobalFooter( return ( <div id="footer" className="page-footer page-container"> - {productionDatabase === false && + {productionDatabase === false && ( <div className="alert alert-danger"> <p className="big" id="evaluation_warning"> {translate('footer.production_database_warning')} </p> - <p> - {translate('footer.production_database_explanation')} - </p> - </div>} + <p>{translate('footer.production_database_explanation')}</p> + </div> + )} <GlobalFooterBranding /> @@ -59,13 +58,9 @@ export default function GlobalFooter( sonarqubeVersion && translateWithParameters('footer.version_x', sonarqubeVersion)} {!hideLoggedInInfo && sonarqubeVersion && ' - '} - <a href="http://www.gnu.org/licenses/lgpl-3.0.txt"> - {translate('footer.licence')} - </a> + <a href="http://www.gnu.org/licenses/lgpl-3.0.txt">{translate('footer.licence')}</a> {' - '} - <a href="http://www.sonarqube.org"> - {translate('footer.community')} - </a> + <a href="http://www.sonarqube.org">{translate('footer.community')}</a> {' - '} <a href="https://redirect.sonarsource.com/doc/home.html"> {translate('footer.documentation')} @@ -79,15 +74,9 @@ export default function GlobalFooter( {translate('footer.plugins')} </a> {!hideLoggedInInfo && ' - '} - {!hideLoggedInInfo && - <Link to="/web_api"> - {translate('footer.web_api')} - </Link>} + {!hideLoggedInInfo && <Link to="/web_api">{translate('footer.web_api')}</Link>} {!hideLoggedInInfo && ' - '} - {!hideLoggedInInfo && - <Link to="/about"> - {translate('footer.about')} - </Link>} + {!hideLoggedInInfo && <Link to="/about">{translate('footer.about')}</Link>} </div> </div> ); diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooterForSonarQubeDotCom.js b/server/sonar-web/src/main/js/app/components/GlobalFooterForSonarQubeDotCom.js index f2763723da2..f05bb330fda 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalFooterForSonarQubeDotCom.js +++ b/server/sonar-web/src/main/js/app/components/GlobalFooterForSonarQubeDotCom.js @@ -34,29 +34,17 @@ export default function GlobalFooterForSonarQubeDotCom() { </div> <div> - <a href="https://about.sonarcloud.io/news/"> - {translate('footer.news')} - </a> + <a href="https://about.sonarcloud.io/news/">{translate('footer.news')}</a> {' - '} - <a href="https://about.sonarcloud.io/terms.pdf"> - {translate('footer.terms')} - </a> + <a href="https://about.sonarcloud.io/terms.pdf">{translate('footer.terms')}</a> {' - '} - <a href="https://twitter.com/sonarqube"> - {translate('footer.twitter')} - </a> + <a href="https://twitter.com/sonarqube">{translate('footer.twitter')}</a> {' - '} - <a href="https://about.sonarcloud.io/get-started/"> - {translate('footer.get_started')} - </a> + <a href="https://about.sonarcloud.io/get-started/">{translate('footer.get_started')}</a> {' - '} - <a href="https://about.sonarcloud.io/contact/"> - {translate('footer.help')} - </a> + <a href="https://about.sonarcloud.io/contact/">{translate('footer.help')}</a> {' - '} - <Link to="/about"> - {translate('footer.about')} - </Link> + <Link to="/about">{translate('footer.about')}</Link> </div> </div> ); diff --git a/server/sonar-web/src/main/js/app/components/MarkdownHelp.js b/server/sonar-web/src/main/js/app/components/MarkdownHelp.js index a5ac92da031..452936b1e91 100644 --- a/server/sonar-web/src/main/js/app/components/MarkdownHelp.js +++ b/server/sonar-web/src/main/js/app/components/MarkdownHelp.js @@ -39,13 +39,9 @@ export default function MarkdownHelp() { </td> </tr> <tr> - <td> - {'http://sonarqube.org'} - </td> + <td>{'http://sonarqube.org'}</td> <td className="markdown"> - <a href="http://sonarqube.org"> - {'http://sonarqube.org'} - </a> + <a href="http://sonarqube.org">{'http://sonarqube.org'}</a> </td> </tr> <tr> diff --git a/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.js b/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.js index ab2931ac382..e5d38f46800 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.js +++ b/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.js @@ -54,13 +54,15 @@ class OrganizationPageExtension extends React.PureComponent { } const extension = pages.find(p => p.key === `${pluginKey}/${extensionKey}`); - return extension - ? <Extension - extension={extension} - location={this.props.location} - options={{ organization, refreshOrganization: this.refreshOrganization }} - /> - : <ExtensionNotFound />; + return extension ? ( + <Extension + extension={extension} + location={this.props.location} + options={{ organization, refreshOrganization: this.refreshOrganization }} + /> + ) : ( + <ExtensionNotFound /> + ); } } diff --git a/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.js b/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.js index a72607ce2d0..3881206d667 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.js +++ b/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.js @@ -45,9 +45,11 @@ function ProjectAdminPageExtension(props /*: Props */) { const extension = component.configuration && component.configuration.extensions.find(p => p.key === `${pluginKey}/${extensionKey}`); - return extension - ? <Extension extension={extension} options={{ component }} /> - : <ExtensionNotFound />; + return extension ? ( + <Extension extension={extension} options={{ component }} /> + ) : ( + <ExtensionNotFound /> + ); } const mapDispatchToProps = { onFail: addGlobalErrorMessage }; diff --git a/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx index c06716a279c..dc23ec8df22 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx +++ b/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx @@ -37,7 +37,9 @@ export default function ProjectPageExtension(props: Props) { const extension = component.extensions && component.extensions.find(p => p.key === `${pluginKey}/${extensionKey}`); - return extension - ? <Extension extension={extension} options={{ component }} /> - : <ExtensionNotFound />; + return extension ? ( + <Extension extension={extension} options={{ component }} /> + ) : ( + <ExtensionNotFound /> + ); } diff --git a/server/sonar-web/src/main/js/app/components/help/GlobalHelp.js b/server/sonar-web/src/main/js/app/components/help/GlobalHelp.js index 7e4b14609b5..9df12c7801c 100644 --- a/server/sonar-web/src/main/js/app/components/help/GlobalHelp.js +++ b/server/sonar-web/src/main/js/app/components/help/GlobalHelp.js @@ -62,9 +62,11 @@ export default class GlobalHelp extends React.PureComponent { case 'shortcuts': return <ShortcutsHelp />; case 'links': - return this.props.sonarCloud - ? <LinksHelpSonarCloud onClose={this.props.onClose} /> - : <LinksHelp onClose={this.props.onClose} />; + return this.props.sonarCloud ? ( + <LinksHelpSonarCloud onClose={this.props.onClose} /> + ) : ( + <LinksHelp onClose={this.props.onClose} /> + ); case 'tutorials': return <TutorialsHelp onTutorialSelect={this.props.onTutorialSelect} />; default: @@ -72,7 +74,7 @@ export default class GlobalHelp extends React.PureComponent { } }; - renderMenuItem = (section /*: string */) => + renderMenuItem = (section /*: string */) => ( <li key={section}> <a className={classNames({ active: section === this.state.section })} @@ -81,14 +83,16 @@ export default class GlobalHelp extends React.PureComponent { onClick={this.handleSectionClick}> {translate('help.section', section)} </a> - </li>; + </li> + ); - renderMenu = () => + renderMenu = () => ( <ul className="side-tabs-menu"> {(this.props.currentUser.isLoggedIn ? ['shortcuts', 'tutorials', 'links'] : ['shortcuts', 'links']).map(this.renderMenuItem)} - </ul>; + </ul> + ); render() { return ( @@ -99,18 +103,12 @@ export default class GlobalHelp extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.props.onClose}> <div className="modal-head"> - <h2> - {translate('help')} - </h2> + <h2>{translate('help')}</h2> </div> <div className="side-tabs-layout"> - <div className="side-tabs-side"> - {this.renderMenu()} - </div> - <div className="side-tabs-main"> - {this.renderSection()} - </div> + <div className="side-tabs-side">{this.renderMenu()}</div> + <div className="side-tabs-main">{this.renderSection()}</div> </div> <div className="modal-foot"> diff --git a/server/sonar-web/src/main/js/app/components/help/LinksHelp.js b/server/sonar-web/src/main/js/app/components/help/LinksHelp.js index 627f7d49dcd..8cb885b02a6 100644 --- a/server/sonar-web/src/main/js/app/components/help/LinksHelp.js +++ b/server/sonar-web/src/main/js/app/components/help/LinksHelp.js @@ -29,14 +29,10 @@ type Props = { onClose: () => void }; export default function LinksHelp({ onClose } /*: Props */) { return ( <div> - <h2 className="spacer-top spacer-bottom"> - {translate('help.section.links')} - </h2> + <h2 className="spacer-top spacer-bottom">{translate('help.section.links')}</h2> <p className="spacer-bottom"> - <a href="http://www.sonarqube.org"> - {translate('footer.community')} - </a> + <a href="http://www.sonarqube.org">{translate('footer.community')}</a> </p> <p className="spacer-bottom"> diff --git a/server/sonar-web/src/main/js/app/components/help/LinksHelpSonarCloud.js b/server/sonar-web/src/main/js/app/components/help/LinksHelpSonarCloud.js index 3275528cf3c..802d1b9620c 100644 --- a/server/sonar-web/src/main/js/app/components/help/LinksHelpSonarCloud.js +++ b/server/sonar-web/src/main/js/app/components/help/LinksHelpSonarCloud.js @@ -29,38 +29,26 @@ type Props = { onClose: () => void }; export default function LinksHelpSonarCloud({ onClose } /*: Props */) { return ( <div> - <h2 className="spacer-top spacer-bottom"> - {translate('help.section.links')} - </h2> + <h2 className="spacer-top spacer-bottom">{translate('help.section.links')}</h2> <p className="spacer-bottom"> - <a href="https://about.sonarcloud.io/news/"> - {translate('footer.news')} - </a> + <a href="https://about.sonarcloud.io/news/">{translate('footer.news')}</a> </p> <p className="spacer-bottom"> - <a href="https://about.sonarcloud.io/terms.pdf"> - {translate('footer.terms')} - </a> + <a href="https://about.sonarcloud.io/terms.pdf">{translate('footer.terms')}</a> </p> <p className="spacer-bottom"> - <a href="https://twitter.com/sonarqube"> - {translate('footer.twitter')} - </a> + <a href="https://twitter.com/sonarqube">{translate('footer.twitter')}</a> </p> <p className="spacer-bottom"> - <a href="https://about.sonarcloud.io/get-started/"> - {translate('footer.get_started')} - </a> + <a href="https://about.sonarcloud.io/get-started/">{translate('footer.get_started')}</a> </p> <p className="spacer-bottom"> - <a href="https://about.sonarcloud.io/contact/"> - {translate('footer.help')} - </a> + <a href="https://about.sonarcloud.io/contact/">{translate('footer.help')}</a> </p> <p className="spacer-bottom"> diff --git a/server/sonar-web/src/main/js/app/components/help/ShortcutsHelp.js b/server/sonar-web/src/main/js/app/components/help/ShortcutsHelp.js index feb27478d89..1787524f5dc 100644 --- a/server/sonar-web/src/main/js/app/components/help/ShortcutsHelp.js +++ b/server/sonar-web/src/main/js/app/components/help/ShortcutsHelp.js @@ -24,16 +24,12 @@ import { translate } from '../../../helpers/l10n'; export default function ShortcutsHelp() { return ( <div> - <h2 className="spacer-top spacer-bottom"> - {translate('help.section.shortcuts')} - </h2> + <h2 className="spacer-top spacer-bottom">{translate('help.section.shortcuts')}</h2> <div className="columns"> <div className="column-half"> <div className="spacer-bottom"> - <h3 className="shortcuts-section-title"> - {translate('shortcuts.section.global')} - </h3> + <h3 className="shortcuts-section-title">{translate('shortcuts.section.global')}</h3> <ul className="shortcuts-list"> <li> <span className="shortcut-button spacer-right">s</span> @@ -46,9 +42,7 @@ export default function ShortcutsHelp() { </ul> </div> - <h3 className="shortcuts-section-title"> - {translate('shortcuts.section.rules')} - </h3> + <h3 className="shortcuts-section-title">{translate('shortcuts.section.rules')}</h3> <ul className="shortcuts-list"> <li> <span className="shortcut-button little-spacer-right">↑</span> @@ -75,9 +69,7 @@ export default function ShortcutsHelp() { </div> <div className="column-half"> - <h3 className="shortcuts-section-title"> - {translate('shortcuts.section.issues')} - </h3> + <h3 className="shortcuts-section-title">{translate('shortcuts.section.issues')}</h3> <ul className="shortcuts-list"> <li> <span className="shortcut-button little-spacer-right">↑</span> diff --git a/server/sonar-web/src/main/js/app/components/help/TutorialsHelp.js b/server/sonar-web/src/main/js/app/components/help/TutorialsHelp.js index ee97ec26116..2196a8179e5 100644 --- a/server/sonar-web/src/main/js/app/components/help/TutorialsHelp.js +++ b/server/sonar-web/src/main/js/app/components/help/TutorialsHelp.js @@ -33,9 +33,7 @@ export default function TutorialsHelp({ onTutorialSelect } /*: Props */) { return ( <div> - <h2 className="spacer-top spacer-bottom"> - {translate('help.section.tutorials')} - </h2> + <h2 className="spacer-top spacer-bottom">{translate('help.section.tutorials')}</h2> <a href="#" onClick={handleClick}> {translate('tutorials.onboarding')} </a> diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx index 06a5f7889a8..1c7a748ecef 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx @@ -99,14 +99,15 @@ export default class ComponentNav extends React.PureComponent<Props, State> { breadcrumbs={this.props.component.breadcrumbs} /> - {this.props.currentBranch && + {this.props.currentBranch && ( <ComponentNavBranch branches={this.props.branches} currentBranch={this.props.currentBranch} // to close dropdown on any location change location={this.props.location} project={this.props.component} - />} + /> + )} <ComponentNavMeta branch={this.props.currentBranch} diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx index c59cebdd6f8..dd5ecaa3020 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx @@ -117,14 +117,14 @@ export default class ComponentNavBranch extends React.PureComponent<Props, State }; renderDropdown = () => { - return this.state.dropdownOpen - ? <ComponentNavBranchesMenu - branches={this.props.branches} - currentBranch={this.props.currentBranch} - onClose={this.closeDropdown} - project={this.props.project} - /> - : null; + return this.state.dropdownOpen ? ( + <ComponentNavBranchesMenu + branches={this.props.branches} + currentBranch={this.props.currentBranch} + onClose={this.closeDropdown} + project={this.props.project} + /> + ) : null; }; renderMergeBranch = () => { @@ -132,19 +132,21 @@ export default class ComponentNavBranch extends React.PureComponent<Props, State if (!isShortLivingBranch(currentBranch)) { return null; } - return currentBranch.isOrphan - ? <span className="note big-spacer-left text-lowercase"> - {translate('branches.orphan_branch')} - <Tooltip overlay={translate('branches.orphan_branches.tooltip')}> - <i className="icon-help spacer-left" /> - </Tooltip> - </span> - : <span className="note big-spacer-left text-lowercase"> - {translate('from')} <strong>{currentBranch.mergeBranch}</strong> - </span>; + return currentBranch.isOrphan ? ( + <span className="note big-spacer-left text-lowercase"> + {translate('branches.orphan_branch')} + <Tooltip overlay={translate('branches.orphan_branches.tooltip')}> + <i className="icon-help spacer-left" /> + </Tooltip> + </span> + ) : ( + <span className="note big-spacer-left text-lowercase"> + {translate('from')} <strong>{currentBranch.mergeBranch}</strong> + </span> + ); }; - renderSingleBranchPopup = () => + renderSingleBranchPopup = () => ( <div className="display-inline-block spacer-left"> <a className="link-no-underline" href="#" onClick={this.handleSingleBranchClick}> <HelpIcon fill="#4b9fd5" /> @@ -155,9 +157,10 @@ export default class ComponentNavBranch extends React.PureComponent<Props, State popup={<SingleBranchHelperPopup />} togglePopup={this.toggleSingleBranchPopup} /> - </div>; + </div> + ); - renderNoBranchSupportPopup = () => + renderNoBranchSupportPopup = () => ( <div className="display-inline-block spacer-left"> <a className="link-no-underline" href="#" onClick={this.handleNoBranchSupportClick}> <HelpIcon fill="#cdcdcd" /> @@ -168,7 +171,8 @@ export default class ComponentNavBranch extends React.PureComponent<Props, State popup={<NoBranchSupportPopup />} togglePopup={this.toggleNoBranchSupportPopup} /> - </div>; + </div> + ); render() { const { branches, currentBranch } = this.props; @@ -181,9 +185,7 @@ export default class ComponentNavBranch extends React.PureComponent<Props, State return ( <div className="navbar-context-branches"> <BranchIcon branch={currentBranch} className="little-spacer-right" color="#cdcdcd" /> - <span className="note"> - {currentBranch.name} - </span> + <span className="note">{currentBranch.name}</span> {this.renderNoBranchSupportPopup()} </div> ); @@ -193,9 +195,7 @@ export default class ComponentNavBranch extends React.PureComponent<Props, State return ( <div className="navbar-context-branches"> <BranchIcon branch={currentBranch} className="little-spacer-right" /> - <span className="note"> - {currentBranch.name} - </span> + <span className="note">{currentBranch.name}</span> {this.renderSingleBranchPopup()} </div> ); diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx index 3085c1212f9..9f41411bbad 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx @@ -133,7 +133,7 @@ export default class ComponentNavBranchesMenu extends React.PureComponent<Props, isSelected = (branch: Branch) => branch.name === this.getSelected(); - renderSearch = () => + renderSearch = () => ( <div className="search-box menu-search"> <button className="search-box-submit button-clean"> <i className="icon-search-new" /> @@ -147,18 +147,15 @@ export default class ComponentNavBranchesMenu extends React.PureComponent<Props, type="search" value={this.state.query} /> - </div>; + </div> + ); renderBranchesList = () => { const branches = this.getFilteredBranches(); const selected = this.getSelected(); if (branches.length === 0) { - return ( - <div className="menu-message note"> - {translate('no_results')} - </div> - ); + return <div className="menu-message note">{translate('no_results')}</div>; } const menu: JSX.Element[] = []; @@ -190,11 +187,7 @@ export default class ComponentNavBranchesMenu extends React.PureComponent<Props, ); }); - return ( - <ul className="menu menu-vertically-limited"> - {menu} - </ul> - ); + return <ul className="menu menu-vertically-limited">{menu}</ul>; }; render() { @@ -206,14 +199,15 @@ export default class ComponentNavBranchesMenu extends React.PureComponent<Props, <div className="dropdown-menu dropdown-menu-shadow" ref={node => (this.node = node)}> {this.renderSearch()} {this.renderBranchesList()} - {showManageLink && + {showManageLink && ( <div className="dropdown-bottom-hint text-right"> <Link className="text-muted" to={{ pathname: '/project/branches', query: { id: project.key } }}> {translate('branches.manage')} </Link> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx index 40fa2ec46fb..fa49b53d2d8 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx @@ -54,10 +54,9 @@ export default function ComponentNavBranchesMenuItem({ branch, ...props }: Props })} /> {branch.name} - {branch.isMain && - <div className="outline-badge spacer-left"> - {translate('branches.main_branch')} - </div>} + {branch.isMain && ( + <div className="outline-badge spacer-left">{translate('branches.main_branch')}</div> + )} </div> <div className="big-spacer-left note"> <BranchStatus branch={branch} concise={true} /> diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js index f584506a493..27637b0f3ed 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js @@ -53,21 +53,20 @@ class ComponentNavBreadcrumbs extends React.PureComponent { return ( <span key={item.key}> {!displayOrganization && - index === 0 && + index === 0 && ( <span className="navbar-context-title-qualifier little-spacer-right"> <QualifierIcon qualifier={lastItem.qualifier} /> - </span>} + </span> + )} <Link title={item.name} to={{ pathname: '/dashboard', query: { id: item.key } }} className="link-base-color link-no-underline"> - {index === breadcrumbs.length - 1 - ? <strong> - {itemName} - </strong> - : <span> - {itemName} - </span>} + {index === breadcrumbs.length - 1 ? ( + <strong>{itemName}</strong> + ) : ( + <span>{itemName}</span> + )} </Link> {index < breadcrumbs.length - 1 && <span className="slash-separator" />} </span> @@ -80,7 +79,7 @@ class ComponentNavBreadcrumbs extends React.PureComponent { title={component.name} organization={displayOrganization ? organization : null} /> - {displayOrganization && + {displayOrganization && ( <span> <span className="navbar-context-title-qualifier little-spacer-right"> <QualifierIcon qualifier={lastItem.qualifier} /> @@ -91,7 +90,8 @@ class ComponentNavBreadcrumbs extends React.PureComponent { {organization.name} </OrganizationLink> <span className="slash-separator" /> - </span>} + </span> + )} {items} {component.visibility === 'private' && <PrivateBadge className="spacer-left" />} </h1> diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx index 69f0fd45640..e3c49a90b9a 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx @@ -113,9 +113,11 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { } }} activeClassName="active"> - {this.isView() || this.isApplication() - ? translate('view_projects.page') - : translate('code.page')} + {this.isView() || this.isApplication() ? ( + translate('view_projects.page') + ) : ( + translate('code.page') + )} </Link> </li> ); @@ -228,9 +230,7 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { {translate('layout.settings')} <i className="icon-dropdown" /> </a> - <ul className="dropdown-menu"> - {adminLinks} - </ul> + <ul className="dropdown-menu">{adminLinks}</ul> </li> ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx index 9f8c46a43e8..4c1e485000c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx @@ -85,9 +85,7 @@ export default function ComponentNavMeta(props: Props) { overlay={<div dangerouslySetInnerHTML={{ __html: tooltip }} />} mouseLeaveDelay={2}> <li> - <span className="badge badge-danger"> - {translate('background_task.status.FAILED')} - </span> + <span className="badge badge-danger">{translate('background_task.status.FAILED')}</span> </li> </Tooltip> ); @@ -102,11 +100,7 @@ export default function ComponentNavMeta(props: Props) { } if (props.component.version && !shortBranch) { - metaList.push( - <li key="version"> - Version {props.component.version} - </li> - ); + metaList.push(<li key="version">Version {props.component.version}</li>); } if (props.incremental) { @@ -119,13 +113,12 @@ export default function ComponentNavMeta(props: Props) { return ( <div className="navbar-context-meta"> - <ul className="list-inline"> - {metaList} - </ul> - {shortBranch && + <ul className="list-inline">{metaList}</ul> + {shortBranch && ( <div className="navbar-context-meta-branch"> <BranchStatus branch={props.branch!} /> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/IncrementalBadge.tsx b/server/sonar-web/src/main/js/app/components/nav/component/IncrementalBadge.tsx index 0ac87aaa448..25f9121e592 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/IncrementalBadge.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/IncrementalBadge.tsx @@ -24,9 +24,7 @@ import { translate } from '../../../../helpers/l10n'; export default function IncrementalBadge() { return ( <Tooltip overlay={translate('incremental.project_tooltip')}> - <div className="outline-badge"> - {translate('incremental')} - </div> + <div className="outline-badge">{translate('incremental')}</div> </Tooltip> ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/NoBranchSupportPopup.tsx b/server/sonar-web/src/main/js/app/components/nav/component/NoBranchSupportPopup.tsx index fe2f3235dbc..db44804e214 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/NoBranchSupportPopup.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/NoBranchSupportPopup.tsx @@ -29,12 +29,8 @@ export default function NoBranchSupportPopup(props: Props) { return ( <BubblePopup position={props.popupPosition} customClass="bubble-popup-bottom"> <div className="abs-width-400"> - <h6 className="spacer-bottom"> - {translate('branches.no_support.header')} - </h6> - <p className="big-spacer-bottom markdown"> - {translate('branches.no_support.header.text')} - </p> + <h6 className="spacer-bottom">{translate('branches.no_support.header')}</h6> + <p className="big-spacer-bottom markdown">{translate('branches.no_support.header.text')}</p> <p> <a href="https://redirect.sonarsource.com/doc/branches.html" target="_blank"> {translate('learn_more')} diff --git a/server/sonar-web/src/main/js/app/components/nav/component/SingleBranchHelperPopup.tsx b/server/sonar-web/src/main/js/app/components/nav/component/SingleBranchHelperPopup.tsx index abb4adc8c3d..d41c48b32ac 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/SingleBranchHelperPopup.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/SingleBranchHelperPopup.tsx @@ -29,9 +29,7 @@ export default function SingleBranchHelperPopup(props: Props) { return ( <BubblePopup position={props.popupPosition} customClass="bubble-popup-bottom"> <div className="abs-width-400"> - <h6 className="spacer-bottom"> - {translate('branches.learn_how_to_analyze')} - </h6> + <h6 className="spacer-bottom">{translate('branches.learn_how_to_analyze')}</h6> <p className="big-spacer-bottom markdown"> {translate('branches.learn_how_to_analyze.text')} </p> diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js index 0650d20d714..fe155adbbe6 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js @@ -111,29 +111,33 @@ class GlobalNav extends React.PureComponent { <Search appState={this.props.appState} currentUser={this.props.currentUser} /> <li> <a className="navbar-help" onClick={this.handleHelpClick} href="#"> - {this.state.onboardingTutorialTooltip - ? <Tooltip - defaultVisible={true} - overlay={translate('tutorials.follow_later')} - trigger="manual"> - <HelpIcon /> - </Tooltip> - : <HelpIcon />} + {this.state.onboardingTutorialTooltip ? ( + <Tooltip + defaultVisible={true} + overlay={translate('tutorials.follow_later')} + trigger="manual"> + <HelpIcon /> + </Tooltip> + ) : ( + <HelpIcon /> + )} </a> </li> <GlobalNavUserContainer {...this.props} /> </ul> - {this.state.helpOpen && + {this.state.helpOpen && ( <GlobalHelp currentUser={this.props.currentUser} onClose={this.closeHelp} onTutorialSelect={this.openOnboardingTutorial} sonarCloud={this.props.sonarCloud} - />} + /> + )} - {this.state.onboardingTutorialOpen && - <OnboardingModal onFinish={this.closeOnboardingTutorial} />} + {this.state.onboardingTutorialOpen && ( + <OnboardingModal onFinish={this.closeOnboardingTutorial} /> + )} </NavBar> ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.js b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.js index 89053dedf89..2bbec0defdc 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.js +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.js @@ -123,9 +123,7 @@ export default class GlobalNavMenu extends React.PureComponent { renderGlobalPageLink = ({ key, name }) => { return ( <li key={key}> - <Link to={`/extension/${key}`}> - {name} - </Link> + <Link to={`/extension/${key}`}>{name}</Link> </li> ); }; @@ -142,9 +140,7 @@ export default class GlobalNavMenu extends React.PureComponent { {translate('more')} <span className="icon-dropdown" /> </a> - <ul className="dropdown-menu"> - {withoutPortfolios.map(this.renderGlobalPageLink)} - </ul> + <ul className="dropdown-menu">{withoutPortfolios.map(this.renderGlobalPageLink)}</ul> </li> ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.js b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.js index eee3fca4b6e..37bc3af8caa 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.js +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.js @@ -124,20 +124,19 @@ export default class GlobalNavUser extends React.PureComponent { <a className="dropdown-toggle navbar-avatar" href="#" onClick={this.toggleDropdown}> <Avatar email={currentUser.email} name={currentUser.name} size={24} /> </a> - {this.state.open && + {this.state.open && ( <ul className="dropdown-menu dropdown-menu-right"> <li className="dropdown-item"> <div className="text-ellipsis text-muted" title={currentUser.name}> - <strong> - {currentUser.name} - </strong> + <strong>{currentUser.name}</strong> </div> - {currentUser.email != null && + {currentUser.email != null && ( <div className="little-spacer-top text-ellipsis text-muted" title={currentUser.email}> {currentUser.email} - </div>} + </div> + )} </li> <li className="divider" /> <li> @@ -146,27 +145,25 @@ export default class GlobalNavUser extends React.PureComponent { </Link> </li> {hasOrganizations && <li role="separator" className="divider" />} + {hasOrganizations && ( + <li className="dropdown-header spacer-left">{translate('my_organizations')}</li> + )} {hasOrganizations && - <li className="dropdown-header spacer-left"> - {translate('my_organizations')} - </li>} - {hasOrganizations && - sortBy(organizations, org => org.name.toLowerCase()).map(organization => + sortBy(organizations, org => org.name.toLowerCase()).map(organization => ( <li key={organization.key}> <OrganizationLink organization={organization} onClick={this.closeDropdown}> - <span className="spacer-left"> - {organization.name} - </span> + <span className="spacer-left">{organization.name}</span> </OrganizationLink> </li> - )} + ))} {hasOrganizations && <li role="separator" className="divider" />} <li> <a onClick={this.handleLogout} href="#"> {translate('layout.logout')} </a> </li> - </ul>} + </ul> + )} </li> ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js index 903de6c74ea..fe610c1edc1 100644 --- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js +++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js @@ -76,9 +76,7 @@ class SettingsNav extends React.PureComponent { return ( <ContextNavBar id="context-navigation" height={65}> <h1 className="navbar-context-header"> - <strong> - {translate('layout.settings')} - </strong> + <strong>{translate('layout.settings')}</strong> </h1> <NavBarTabs> @@ -130,24 +128,27 @@ class SettingsNav extends React.PureComponent { {translate('users.page')} </IndexLink> </li> - {!this.props.customOrganizations && + {!this.props.customOrganizations && ( <li> <IndexLink to="/groups" activeClassName="active"> {translate('user_groups.page')} </IndexLink> - </li>} - {!this.props.customOrganizations && + </li> + )} + {!this.props.customOrganizations && ( <li> <IndexLink to="/roles/global" activeClassName="active"> {translate('global_permissions.page')} </IndexLink> - </li>} - {!this.props.customOrganizations && + </li> + )} + {!this.props.customOrganizations && ( <li> <IndexLink to="/permission_templates" activeClassName="active"> {translate('permission_templates')} </IndexLink> - </li>} + </li> + )} </ul> </li> @@ -156,12 +157,13 @@ class SettingsNav extends React.PureComponent { {translate('sidebar.projects')} <i className="icon-dropdown" /> </a> <ul className="dropdown-menu"> - {!this.props.customOrganizations && + {!this.props.customOrganizations && ( <li> <IndexLink to="/admin/projects_management" activeClassName="active"> Management </IndexLink> - </li>} + </li> + )} <li> <IndexLink to="/background_tasks" activeClassName="active"> {translate('background_tasks.page')} diff --git a/server/sonar-web/src/main/js/app/components/search/Search.js b/server/sonar-web/src/main/js/app/components/search/Search.js index e28606b0d7d..015e56622c9 100644 --- a/server/sonar-web/src/main/js/app/components/search/Search.js +++ b/server/sonar-web/src/main/js/app/components/search/Search.js @@ -301,7 +301,7 @@ export default class Search extends React.PureComponent { this.nodes[component] = node; }; - renderResult = (component /*: Component */) => + renderResult = (component /*: Component */) => ( <SearchResult appState={this.props.appState} component={component} @@ -312,12 +312,14 @@ export default class Search extends React.PureComponent { organizations={this.state.organizations} projects={this.state.projects} selected={this.state.selected === component.key} - />; + /> + ); - renderNoResults = () => + renderNoResults = () => ( <div className="navbar-search-no-results"> {translateWithParameters('no_results_for_x', this.state.query)} - </div>; + </div> + ); render() { const dropdownClassName = classNames('dropdown', 'navbar-search', { open: this.state.open }); @@ -343,16 +345,17 @@ export default class Search extends React.PureComponent { value={this.state.query} /> - {this.state.shortQuery && + {this.state.shortQuery && ( <span className={classNames('navbar-search-input-hint', { 'is-shifted': this.state.query.length > 5 })}> {translateWithParameters('select2.tooShort', 2)} - </span>} + </span> + )} {this.state.open && - Object.keys(this.state.results).length > 0 && + Object.keys(this.state.results).length > 0 && ( <div className="dropdown-menu dropdown-menu-shadow dropdown-menu-right global-navbar-search-dropdown" ref={node => (this.node = node)}> @@ -381,7 +384,8 @@ export default class Search extends React.PureComponent { }} /> </div> - </div>} + </div> + )} </li> ); } diff --git a/server/sonar-web/src/main/js/app/components/search/SearchResult.js b/server/sonar-web/src/main/js/app/components/search/SearchResult.js index f6381a3645d..7b91a192bc9 100644 --- a/server/sonar-web/src/main/js/app/components/search/SearchResult.js +++ b/server/sonar-web/src/main/js/app/components/search/SearchResult.js @@ -99,11 +99,9 @@ export default class SearchResult extends React.PureComponent { } const organization = this.props.organizations[component.organization]; - return organization - ? <div className="navbar-search-item-right text-muted-2"> - {organization.name} - </div> - : null; + return organization ? ( + <div className="navbar-search-item-right text-muted-2">{organization.name}</div> + ) : null; }; renderProject = (component /*: Component */) => { @@ -112,11 +110,9 @@ export default class SearchResult extends React.PureComponent { } const project = this.props.projects[component.project]; - return project - ? <div className="navbar-search-item-right text-muted-2"> - {project.name} - </div> - : null; + return project ? ( + <div className="navbar-search-item-right text-muted-2">{project.name}</div> + ) : null; }; render() { @@ -144,14 +140,14 @@ export default class SearchResult extends React.PureComponent { <QualifierIcon className="little-spacer-right" qualifier={component.qualifier} /> </span> - {component.match - ? <span - className="navbar-search-item-match" - dangerouslySetInnerHTML={{ __html: component.match }} - /> - : <span className="navbar-search-item-match"> - {component.name} - </span>} + {component.match ? ( + <span + className="navbar-search-item-match" + dangerouslySetInnerHTML={{ __html: component.match }} + /> + ) : ( + <span className="navbar-search-item-match">{component.name}</span> + )} {this.renderOrganization(component)} {this.renderProject(component)} diff --git a/server/sonar-web/src/main/js/app/components/search/SearchResults.js b/server/sonar-web/src/main/js/app/components/search/SearchResults.js index dfc5870e519..28cd8001970 100644 --- a/server/sonar-web/src/main/js/app/components/search/SearchResults.js +++ b/server/sonar-web/src/main/js/app/components/search/SearchResults.js @@ -78,10 +78,10 @@ export default class SearchResults extends React.PureComponent { } }); - return renderedComponents.length > 0 - ? <ul className="menu"> - {renderedComponents} - </ul> - : this.props.renderNoResults(); + return renderedComponents.length > 0 ? ( + <ul className="menu">{renderedComponents}</ul> + ) : ( + this.props.renderNoResults() + ); } } diff --git a/server/sonar-web/src/main/js/app/components/search/SearchShowMore.js b/server/sonar-web/src/main/js/app/components/search/SearchShowMore.js index b736a7b2bdc..4da41158cca 100644 --- a/server/sonar-web/src/main/js/app/components/search/SearchShowMore.js +++ b/server/sonar-web/src/main/js/app/components/search/SearchShowMore.js @@ -71,9 +71,7 @@ export default class SearchShowMore extends React.PureComponent { ) }} /> - <span> - {translate('show_more')} - </span> + <span>{translate('show_more')}</span> </a> </DeferredSpinner> </li> diff --git a/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResults-test.js b/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResults-test.js index 51bcac37395..4da24534c2b 100644 --- a/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResults-test.js +++ b/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResults-test.js @@ -32,10 +32,7 @@ it('renders different components and dividers between them', () => { onMoreClick={jest.fn()} onSelect={jest.fn()} renderNoResults={() => <div />} - renderResult={component => - <span key={component.key}> - {component.name} - </span>} + renderResult={component => <span key={component.key}>{component.name}</span>} results={{ TRK: [component('foo'), component('bar')], BRC: [component('qwe', 'BRC'), component('qux', 'BRC')], @@ -57,10 +54,7 @@ it('renders "Show More" link', () => { onMoreClick={jest.fn()} onSelect={jest.fn()} renderNoResults={() => <div />} - renderResult={component => - <span key={component.key}> - {component.name} - </span>} + renderResult={component => <span key={component.key}>{component.name}</span>} results={{ TRK: [component('foo'), component('bar')], BRC: [component('qwe', 'BRC'), component('qux', 'BRC')] diff --git a/server/sonar-web/src/main/js/app/styles/boxed-group.css b/server/sonar-web/src/main/js/app/styles/boxed-group.css index 0fc395a3280..56c69e066ec 100644 --- a/server/sonar-web/src/main/js/app/styles/boxed-group.css +++ b/server/sonar-web/src/main/js/app/styles/boxed-group.css @@ -28,7 +28,7 @@ line-height: 24px; } -.boxed-group-header [class^="icon-"] { +.boxed-group-header [class^='icon-'] { display: inline-block; vertical-align: middle; } diff --git a/server/sonar-web/src/main/js/app/utils/startAjaxMonitoring.js b/server/sonar-web/src/main/js/app/utils/startAjaxMonitoring.js index 013236e4049..46a70d515f5 100644 --- a/server/sonar-web/src/main/js/app/utils/startAjaxMonitoring.js +++ b/server/sonar-web/src/main/js/app/utils/startAjaxMonitoring.js @@ -101,7 +101,9 @@ const ProcessesView = Marionette.ItemView.extend({ }); el.appendTo(this.$el); } else if (timeout != null) { - el = $('<li></li>').html(timeout.get('message')).addClass('process-spinner shown'); + el = $('<li></li>') + .html(timeout.get('message')) + .addClass('process-spinner shown'); el.appendTo(this.$el); } return this; diff --git a/server/sonar-web/src/main/js/app/utils/startReactApp.js b/server/sonar-web/src/main/js/app/utils/startReactApp.js index 53e2290fbaa..648a6068834 100644 --- a/server/sonar-web/src/main/js/app/utils/startReactApp.js +++ b/server/sonar-web/src/main/js/app/utils/startReactApp.js @@ -137,12 +137,8 @@ const startReactApp = () => { <Route component={DefaultHelmetContainer}> <Route component={LocalizationContainer}> <Route component={SimpleContainer}> - <Route path="maintenance"> - {maintenanceRoutes} - </Route> - <Route path="setup"> - {setupRoutes} - </Route> + <Route path="maintenance">{maintenanceRoutes}</Route> + <Route path="setup">{setupRoutes}</Route> </Route> <Route component={MigrationContainer}> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js index 36ced3119e7..d736f754310 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js @@ -138,13 +138,12 @@ class AboutApp extends React.PureComponent { <div id="about-page" className="page page-limited about-page"> <div className="about-page-entry"> <div className="about-page-intro"> - <h1 className="big-spacer-bottom"> - {translate('layout.sonar.slogan')} - </h1> - {!this.props.currentUser.isLoggedIn && + <h1 className="big-spacer-bottom">{translate('layout.sonar.slogan')}</h1> + {!this.props.currentUser.isLoggedIn && ( <Link to="/sessions/new" className="button button-active big-spacer-right"> {translate('layout.login')} - </Link>} + </Link> + )} <a className="button" href="https://redirect.sonarsource.com/doc/home.html" @@ -165,11 +164,12 @@ class AboutApp extends React.PureComponent { </div> {customText != null && - customText.value && + customText.value && ( <div className="about-page-section" dangerouslySetInnerHTML={{ __html: customText.value }} - />} + /> + )} <AboutLanguages /> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutAppForSonarQubeDotCom.js b/server/sonar-web/src/main/js/apps/about/components/AboutAppForSonarQubeDotCom.js index 67f3b803d99..b3e048a1d1e 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutAppForSonarQubeDotCom.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutAppForSonarQubeDotCom.js @@ -77,11 +77,12 @@ export default function AboutAppForSonarQubeDotCom(props /*: Props */) { <div className="page-limited"> {customText != null && - customText.value && + customText.value && ( <div className="about-page-section" dangerouslySetInnerHTML={{ __html: customText.value }} - />} + /> + )} <AboutQualityModelForSonarQubeDotCom /> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.js b/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.js index 92e08353bbc..1ed36c5127b 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.js @@ -26,13 +26,9 @@ const link = 'https://redirect.sonarsource.com/doc/issues.html'; export default function AboutCleanCode() { return ( <div className="boxed-group"> - <h2> - {translate('about_page.clean_code')} - </h2> + <h2>{translate('about_page.clean_code')}</h2> <div className="boxed-group-inner"> - <p className="about-page-text"> - {translate('about_page.clean_code.text')} - </p> + <p className="about-page-text">{translate('about_page.clean_code.text')}</p> <ReadMore link={link} /> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.js b/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.js index 2a87ba96a96..5bc1b2c2bd5 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.js @@ -48,26 +48,19 @@ const half = (languages.length + 1) / 2; export default function AboutLanguages() { return ( <div className="boxed-group"> - <h2> - {translate('about_page.languages')} - </h2> + <h2>{translate('about_page.languages')}</h2> <div className="boxed-group-inner"> - <p className="about-page-text"> - {translate('about_page.languages.text')} - </p> + <p className="about-page-text">{translate('about_page.languages.text')}</p> <ul className="about-page-languages"> - {languages.slice(0, half).map((language, index) => + {languages.slice(0, half).map((language, index) => ( <li key={index}> - <a href={languages[index].url}> - {languages[index].name} - </a> + <a href={languages[index].url}>{languages[index].name}</a> <br /> - {index + half < languages.length && - <a href={languages[index + half].url}> - {languages[index + half].name} - </a>} + {index + half < languages.length && ( + <a href={languages[index + half].url}>{languages[index + half].name}</a> + )} </li> - )} + ))} </ul> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.js b/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.js index 1e65f5f646a..f959dd97cbb 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.js @@ -26,13 +26,9 @@ const link = 'https://redirect.sonarsource.com/doc/fix-the-leak.html'; export default function AboutLeakPeriod() { return ( <div className="boxed-group"> - <h2> - {translate('about_page.fix_the_leak')} - </h2> + <h2>{translate('about_page.fix_the_leak')}</h2> <div className="boxed-group-inner"> - <p className="about-page-text"> - {translate('about_page.fix_the_leak.text')} - </p> + <p className="about-page-text">{translate('about_page.fix_the_leak.text')}</p> <ReadMore link={link} /> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js b/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js index c160383e9d4..fb421a16655 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js @@ -34,17 +34,16 @@ export default function AboutProjects({ count, loading } /*: Props */) { return ( <div className="about-page-projects"> {loading && <i className="spinner" />} - {!loading && + {!loading && ( <div> <div> <Link to="/projects" className="about-page-projects-link"> {formatMeasure(count, 'INT')} </Link> </div> - <div> - {translate('about_page.projects_analyzed')} - </div> - </div>} + <div>{translate('about_page.projects_analyzed')}</div> + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.js b/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.js index 8499b680883..e83d8d77b95 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.js @@ -26,13 +26,9 @@ const link = 'https://redirect.sonarsource.com/doc/quality-gates.html'; export default function AboutQualityGates() { return ( <div className="boxed-group"> - <h2> - {translate('about_page.quality_gates')} - </h2> + <h2>{translate('about_page.quality_gates')}</h2> <div className="boxed-group-inner"> - <p className="about-page-text"> - {translate('about_page.quality_gates.text')} - </p> + <p className="about-page-text">{translate('about_page.quality_gates.text')}</p> <ReadMore link={link} /> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.js b/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.js index 20c483535d5..234a78f2a90 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.js @@ -26,9 +26,7 @@ import CodeSmellIcon from '../../../components/icons-components/CodeSmellIcon'; export default function AboutQualityModel() { return ( <div className="boxed-group about-quality-model"> - <h2> - {translate('about_page.quality_model')} - </h2> + <h2>{translate('about_page.quality_model')}</h2> <div className="boxed-group-inner clearfix"> <div className="flex-columns"> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutQualityModelForSonarQubeDotCom.js b/server/sonar-web/src/main/js/apps/about/components/AboutQualityModelForSonarQubeDotCom.js index 26b60c32f88..277c1ea2036 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutQualityModelForSonarQubeDotCom.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutQualityModelForSonarQubeDotCom.js @@ -26,9 +26,7 @@ import CodeSmellIconForSonarQubeDotCom from './CodeSmellIconForSonarQubeDotCom'; export default function AboutQualityModelForSonarQubeDotCom() { return ( <div className="boxed-group about-quality-model sqcom-about-quality-model"> - <h2> - {translate('about_page.quality_model')} - </h2> + <h2>{translate('about_page.quality_model')}</h2> <div className="boxed-group-inner clearfix"> <div className="flex-columns"> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js b/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js index 2e8ffe89e0e..8396fa6289b 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js @@ -50,15 +50,11 @@ const scanners = [ export default function AboutScanners() { return ( <div className="boxed-group"> - <h2> - {translate('about_page.scanners')} - </h2> + <h2>{translate('about_page.scanners')}</h2> <div className="boxed-group-inner"> - <p className="about-page-text"> - {translate('about_page.scanners.text')} - </p> + <p className="about-page-text">{translate('about_page.scanners.text')}</p> <div className="about-page-analyzers"> - {scanners.map(scanner => + {scanners.map(scanner => ( <a key={scanner.key} className="about-page-analyzer-box" href={scanner.link}> <img src={`${window.baseUrl}/images/scanner-logos/${scanner.key}.svg`} @@ -66,7 +62,7 @@ export default function AboutScanners() { alt={translate('about_page.scanners', scanner.key)} /> </a> - )} + ))} </div> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutStandards.js b/server/sonar-web/src/main/js/apps/about/components/AboutStandards.js index 893aed8e51f..5e50b423199 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutStandards.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutStandards.js @@ -45,13 +45,9 @@ export default function AboutStandards(props /*: Props */) { return ( <div className="boxed-group"> - <h2> - {translate('about_page.standards')} - </h2> + <h2>{translate('about_page.standards')}</h2> <div className="boxed-group-inner"> - <p className="about-page-text"> - {translate('about_page.standards.text')} - </p> + <p className="about-page-text">{translate('about_page.standards.text')}</p> <div className="spacer-top"> <ul className="list-inline"> diff --git a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js index caa1d57279e..9188ee11e0a 100644 --- a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js +++ b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js @@ -42,7 +42,7 @@ export default function EntryIssueTypes( return ( <div className="about-page-projects"> {loading && <i className="spinner" />} - {!loading && + {!loading && ( <table className="about-page-issue-types"> <tbody> <tr> @@ -95,7 +95,8 @@ export default function EntryIssueTypes( </td> </tr> </tbody> - </table>} + </table> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypesForSonarQubeDotCom.js b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypesForSonarQubeDotCom.js index 1bdfba96a4e..582bf582d38 100644 --- a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypesForSonarQubeDotCom.js +++ b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypesForSonarQubeDotCom.js @@ -42,7 +42,7 @@ export default function EntryIssueTypesForSonarQubeDotCom( return ( <div className="about-page-projects"> {loading && <i className="spinner" />} - {!loading && + {!loading && ( <table className="about-page-issue-types"> <tbody> <tr> @@ -95,7 +95,8 @@ export default function EntryIssueTypesForSonarQubeDotCom( </td> </tr> </tbody> - </table>} + </table> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/about/components/ReadMore.js b/server/sonar-web/src/main/js/apps/about/components/ReadMore.js index 87df2de5625..a669ea81f56 100644 --- a/server/sonar-web/src/main/js/apps/about/components/ReadMore.js +++ b/server/sonar-web/src/main/js/apps/about/components/ReadMore.js @@ -30,9 +30,7 @@ export default class ReadMore extends React.PureComponent { return ( <div className="big-spacer-top"> <a className="about-page-link-more" href={this.props.link} target="_blank"> - <span> - {translate('about_page.read_more')} - </span> + <span>{translate('about_page.read_more')}</span> </a> </div> ); diff --git a/server/sonar-web/src/main/js/apps/account/account.css b/server/sonar-web/src/main/js/apps/account/account.css index 6050ad05929..0d9fd7ce41d 100644 --- a/server/sonar-web/src/main/js/apps/account/account.css +++ b/server/sonar-web/src/main/js/apps/account/account.css @@ -151,7 +151,7 @@ height: 100px; background-color: #e6e6e6; transform: rotate(30deg); - content: ""; + content: ''; } .my-activity-issues > a { diff --git a/server/sonar-web/src/main/js/apps/account/components/Nav.js b/server/sonar-web/src/main/js/apps/account/components/Nav.js index 14bd9fbdaa1..09281e5ac7e 100644 --- a/server/sonar-web/src/main/js/apps/account/components/Nav.js +++ b/server/sonar-web/src/main/js/apps/account/components/Nav.js @@ -48,18 +48,20 @@ export default function Nav({ customOrganizations } /*: Props */) { {translate('my_account.notifications')} </Link> </li> - {!customOrganizations && + {!customOrganizations && ( <li> <Link to="/account/projects/" activeClassName="active"> {translate('my_account.projects')} </Link> - </li>} - {customOrganizations && + </li> + )} + {customOrganizations && ( <li> <Link to="/account/organizations" activeClassName="active"> {translate('my_account.organizations')} </Link> - </li>} + </li> + )} </NavBarTabs> </nav> ); diff --git a/server/sonar-web/src/main/js/apps/account/components/Password.js b/server/sonar-web/src/main/js/apps/account/components/Password.js index ae30647b7e0..f90aedc34cd 100644 --- a/server/sonar-web/src/main/js/apps/account/components/Password.js +++ b/server/sonar-web/src/main/js/apps/account/components/Password.js @@ -71,22 +71,19 @@ export default class Password extends Component { return ( <section> - <h2 className="spacer-bottom"> - {translate('my_profile.password.title')} - </h2> + <h2 className="spacer-bottom">{translate('my_profile.password.title')}</h2> <form onSubmit={this.handleChangePassword.bind(this)}> - {success && - <div className="alert alert-success"> - {translate('my_profile.password.changed')} - </div>} + {success && ( + <div className="alert alert-success">{translate('my_profile.password.changed')}</div> + )} {errors && - errors.map((e, i) => + errors.map((e, i) => ( <div key={i} className="alert alert-danger"> {e} </div> - )} + ))} <div className="modal-field"> <label htmlFor="old_password"> diff --git a/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.js b/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.js index d4209080839..d7ba3d35197 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.js +++ b/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.js @@ -47,21 +47,17 @@ type Props = { function GlobalNotifications(props /*: Props */) { return ( <section> - <h2 className="spacer-bottom"> - {translate('my_profile.overall_notifications.title')} - </h2> + <h2 className="spacer-bottom">{translate('my_profile.overall_notifications.title')}</h2> <table className="form"> <thead> <tr> <th /> - {props.channels.map(channel => + {props.channels.map(channel => ( <th key={channel} className="text-center"> - <h4> - {translate('notification.channel', channel)} - </h4> + <h4>{translate('notification.channel', channel)}</h4> </th> - )} + ))} </tr> </thead> diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Notifications.js b/server/sonar-web/src/main/js/apps/account/notifications/Notifications.js index 3a150bf551a..aa2c8d1179e 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/Notifications.js +++ b/server/sonar-web/src/main/js/apps/account/notifications/Notifications.js @@ -41,9 +41,7 @@ class Notifications extends React.PureComponent { <div className="account-body account-container"> <Helmet title={translate('my_account.notifications')} /> - <p className="big-spacer-bottom"> - {translate('notification.dispatcher.information')} - </p> + <p className="big-spacer-bottom">{translate('notification.dispatcher.information')}</p> <GlobalNotifications /> diff --git a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.js b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.js index ae82df2cd4c..2c90aee9251 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.js +++ b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.js @@ -57,12 +57,10 @@ export default class NotificationsList extends React.PureComponent { return ( <tbody> - {types.map(type => + {types.map(type => ( <tr key={type}> - <td> - {translate('notification.dispatcher', type)} - </td> - {channels.map(channel => + <td>{translate('notification.dispatcher', type)}</td> + {channels.map(channel => ( <td key={channel} className="text-center"> <Checkbox checked={this.isEnabled(type, channel)} @@ -70,9 +68,9 @@ export default class NotificationsList extends React.PureComponent { onCheck={checked => this.handleCheck(type, channel, checked)} /> </td> - )} + ))} </tr> - )} + ))} </tbody> ); } diff --git a/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.js b/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.js index eb59f445ca3..750440be1f1 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.js +++ b/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.js @@ -82,18 +82,14 @@ class ProjectNotifications extends React.PureComponent { <Organization organizationKey={project.organization} /> </span> <h4 className="display-inline-block"> - <Link to={getProjectUrl(project.key)}> - {project.name} - </Link> + <Link to={getProjectUrl(project.key)}>{project.name}</Link> </h4> </th> - {channels.map(channel => + {channels.map(channel => ( <th key={channel} className="text-center"> - <h4> - {translate('notification.channel', channel)} - </h4> + <h4>{translate('notification.channel', channel)}</h4> </th> - )} + ))} </tr> </thead> <NotificationsList diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Projects.js b/server/sonar-web/src/main/js/apps/account/notifications/Projects.js index b4fbe9adf1f..9c20ab517e3 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/Projects.js +++ b/server/sonar-web/src/main/js/apps/account/notifications/Projects.js @@ -104,9 +104,7 @@ class Projects extends React.PureComponent { return ( <span> <Organization organizationKey={option.organization} link={false} /> - <strong> - {option.label} - </strong> + <strong>{option.label}</strong> </span> ); }; @@ -116,14 +114,11 @@ class Projects extends React.PureComponent { return ( <section> - <h2 className="spacer-bottom"> - {translate('my_profile.per_project_notifications.title')} - </h2> - - {allProjects.length === 0 && - <div className="note"> - {translate('my_account.no_project_notifications')} - </div>} + <h2 className="spacer-bottom">{translate('my_profile.per_project_notifications.title')}</h2> + + {allProjects.length === 0 && ( + <div className="note">{translate('my_account.no_project_notifications')}</div> + )} {allProjects.map(project => <ProjectNotifications key={project.key} project={project} />)} diff --git a/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.js b/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.js index 3d15de3d760..129fec6034e 100644 --- a/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.js +++ b/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.js @@ -126,9 +126,7 @@ class CreateOrganizationForm extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.closeForm}> <header className="modal-head"> - <h2> - {translate('my_account.create_organization')} - </h2> + <h2>{translate('my_account.create_organization')}</h2> </header> <form onSubmit={this.handleSubmit}> @@ -155,9 +153,7 @@ class CreateOrganizationForm extends React.PureComponent { </div> </div> <div className="modal-field"> - <label htmlFor="organization-key"> - {translate('organization.key')} - </label> + <label htmlFor="organization-key">{translate('organization.key')}</label> <input id="organization-key" name="key" @@ -173,9 +169,7 @@ class CreateOrganizationForm extends React.PureComponent { </div> </div> <div className="modal-field"> - <label htmlFor="organization-avatar"> - {translate('organization.avatar')} - </label> + <label htmlFor="organization-avatar">{translate('organization.avatar')}</label> <input id="organization-avatar" name="avatar" @@ -188,19 +182,18 @@ class CreateOrganizationForm extends React.PureComponent { <div className="modal-field-description"> {translate('organization.avatar.description')} </div> - {!!this.state.avatarImage && + {!!this.state.avatarImage && ( <div className="spacer-top spacer-bottom"> <div className="little-spacer-bottom"> {translate('organization.avatar.preview')} {':'} </div> <img src={this.state.avatarImage} alt="" height={30} /> - </div>} + </div> + )} </div> <div className="modal-field"> - <label htmlFor="organization-description"> - {translate('description')} - </label> + <label htmlFor="organization-description">{translate('description')}</label> <textarea id="organization-description" name="description" @@ -215,9 +208,7 @@ class CreateOrganizationForm extends React.PureComponent { </div> </div> <div className="modal-field"> - <label htmlFor="organization-url"> - {translate('organization.url')} - </label> + <label htmlFor="organization-url">{translate('organization.url')}</label> <input id="organization-url" name="url" diff --git a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.js b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.js index 5dc72aef546..392b0286d68 100644 --- a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.js +++ b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.js @@ -34,32 +34,29 @@ export default function OrganizationCard(props /*: Props */) { return ( <div className="account-project-card clearfix"> <aside className="account-project-side"> - {!!organization.avatar && + {!!organization.avatar && ( <div className="spacer-bottom"> <img src={organization.avatar} height={30} alt={organization.name} /> - </div>} - {!!organization.url && + </div> + )} + {!!organization.url && ( <div className="text-limited text-top spacer-bottom"> <a className="small" href={organization.url} title={organization.url} rel="nofollow"> {organization.url} </a> - </div>} + </div> + )} </aside> <h3 className="account-project-name"> - <OrganizationLink organization={organization}> - {organization.name} - </OrganizationLink> + <OrganizationLink organization={organization}>{organization.name}</OrganizationLink> </h3> - <div className="account-project-key"> - {organization.key} - </div> + <div className="account-project-key">{organization.key}</div> - {!!organization.description && - <div className="account-project-description"> - {organization.description} - </div>} + {!!organization.description && ( + <div className="account-project-description">{organization.description}</div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.js b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.js index 67469b32a0f..621f1b59117 100644 --- a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.js +++ b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.js @@ -34,11 +34,11 @@ export default function OrganizationsList(props /*: Props */) { <ul className="account-projects-list"> {sortBy(props.organizations, organization => organization.name.toLocaleLowerCase() - ).map(organization => + ).map(organization => ( <li key={organization.key}> <OrganizationCard organization={organization} /> </li> - )} + ))} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js index 2f602ad826e..95794c931c5 100644 --- a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js +++ b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js @@ -72,27 +72,30 @@ class UserOrganizations extends React.PureComponent { <Helmet title={translate('my_account.organizations')} /> <header className="page-header"> - <h2 className="page-title"> - {translate('my_account.organizations')} - </h2> - {canCreateOrganizations && + <h2 className="page-title">{translate('my_account.organizations')}</h2> + {canCreateOrganizations && ( <div className="page-actions"> <Link to="/account/organizations/create" className="button"> {translate('create')} </Link> - </div>} - {this.props.organizations.length > 0 - ? <div className="page-description"> - {translate('my_account.organizations.description')} - </div> - : <div className="page-description"> - {translate('my_account.organizations.no_results')} - </div>} + </div> + )} + {this.props.organizations.length > 0 ? ( + <div className="page-description"> + {translate('my_account.organizations.description')} + </div> + ) : ( + <div className="page-description"> + {translate('my_account.organizations.no_results')} + </div> + )} </header> - {this.state.loading - ? <i className="spinner" /> - : <OrganizationsList organizations={this.props.organizations} />} + {this.state.loading ? ( + <i className="spinner" /> + ) : ( + <OrganizationsList organizations={this.props.organizations} /> + )} {this.props.children} </div> diff --git a/server/sonar-web/src/main/js/apps/account/profile/Profile.js b/server/sonar-web/src/main/js/apps/account/profile/Profile.js index 368377bb35c..343e4206aba 100644 --- a/server/sonar-web/src/main/js/apps/account/profile/Profile.js +++ b/server/sonar-web/src/main/js/apps/account/profile/Profile.js @@ -49,15 +49,17 @@ function Profile(props /*: Props */) { </div> {!user.local && - user.externalProvider !== 'sonarqube' && + user.externalProvider !== 'sonarqube' && ( <div id="identity-provider" className="spacer-bottom"> <UserExternalIdentity user={user} /> - </div>} + </div> + )} - {!!user.email && + {!!user.email && ( <div className="spacer-bottom"> Email: <strong id="email">{user.email}</strong> - </div>} + </div> + )} {!customOrganizations && <hr className="account-separator" />} {!customOrganizations && <UserGroups groups={user.groups} />} diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserGroups.js b/server/sonar-web/src/main/js/apps/account/profile/UserGroups.js index 75c9f0a2d96..8f897d76699 100644 --- a/server/sonar-web/src/main/js/apps/account/profile/UserGroups.js +++ b/server/sonar-web/src/main/js/apps/account/profile/UserGroups.js @@ -31,15 +31,13 @@ export default class UserGroups extends React.PureComponent { return ( <div> - <h2 className="spacer-bottom"> - {translate('my_profile.groups')} - </h2> + <h2 className="spacer-bottom">{translate('my_profile.groups')}</h2> <ul id="groups"> - {groups.map(group => + {groups.map(group => ( <li key={group} className="little-spacer-bottom" title={group}> {group} </li> - )} + ))} </ul> </div> ); diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.js b/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.js index b4fc4ecd6e0..03333827452 100644 --- a/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.js +++ b/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.js @@ -32,24 +32,23 @@ export default class UserScmAccounts extends React.PureComponent { return ( <div> - <h2 className="spacer-bottom"> - {translate('my_profile.scm_accounts')} - </h2> + <h2 className="spacer-bottom">{translate('my_profile.scm_accounts')}</h2> <ul id="scm-accounts"> <li className="little-spacer-bottom text-ellipsis" title={user.login}> {user.login} </li> - {user.email && + {user.email && ( <li className="little-spacer-bottom text-ellipsis" title={user.email}> {user.email} - </li>} + </li> + )} - {scmAccounts.map(scmAccount => + {scmAccounts.map(scmAccount => ( <li key={scmAccount} className="little-spacer-bottom" title={scmAccount}> {scmAccount} </li> - )} + ))} </ul> </div> ); diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx index 5ce7e174de7..7b4b8491595 100644 --- a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx +++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx @@ -38,39 +38,39 @@ export default function ProjectCard({ project }: Props) { return ( <div className="account-project-card clearfix"> <aside className="account-project-side"> - {isAnalyzed - ? <Tooltip - overlay={<DateTimeFormatter date={project.lastAnalysisDate} />} - placement="right"> - <div className="account-project-analysis"> - <DateFromNow date={project.lastAnalysisDate}> - {(fromNow: string) => - <span> - {translateWithParameters('my_account.projects.analyzed_x', fromNow)} - </span>} - </DateFromNow> - </div> - </Tooltip> - : <div className="account-project-analysis"> - {translate('my_account.projects.never_analyzed')} - </div>} + {isAnalyzed ? ( + <Tooltip + overlay={<DateTimeFormatter date={project.lastAnalysisDate} />} + placement="right"> + <div className="account-project-analysis"> + <DateFromNow date={project.lastAnalysisDate}> + {(fromNow: string) => ( + <span>{translateWithParameters('my_account.projects.analyzed_x', fromNow)}</span> + )} + </DateFromNow> + </div> + </Tooltip> + ) : ( + <div className="account-project-analysis"> + {translate('my_account.projects.never_analyzed')} + </div> + )} - {project.qualityGate != null && + {project.qualityGate != null && ( <div className="account-project-quality-gate"> <Level level={project.qualityGate} /> - </div>} + </div> + )} </aside> <h3 className="account-project-name"> - <Link to={{ pathname: '/dashboard', query: { id: project.key } }}> - {project.name} - </Link> + <Link to={{ pathname: '/dashboard', query: { id: project.key } }}>{project.name}</Link> </h3> - {links.length > 0 && + {links.length > 0 && ( <div className="account-project-links"> <ul className="list-inline"> - {links.map(link => + {links.map(link => ( <li key={link.type}> <a className="link-with-icon" @@ -81,18 +81,16 @@ export default function ProjectCard({ project }: Props) { <i className={`icon-color-link icon-${link.type}`} /> </a> </li> - )} + ))} </ul> - </div>} + </div> + )} - <div className="account-project-key"> - {project.key} - </div> + <div className="account-project-key">{project.key}</div> - {!!project.description && - <div className="account-project-description"> - {project.description} - </div>} + {!!project.description && ( + <div className="account-project-description">{project.description}</div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx b/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx index 1b574e3d09d..ffc015b45ad 100644 --- a/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx +++ b/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx @@ -36,30 +36,30 @@ export default function Projects(props: Props) { return ( <div id="account-projects"> - {projects.length === 0 - ? <div className="js-no-results"> - {translate('my_account.projects.no_results')} - </div> - : <p> - {translate('my_account.projects.description')} - </p>} + {projects.length === 0 ? ( + <div className="js-no-results">{translate('my_account.projects.no_results')}</div> + ) : ( + <p>{translate('my_account.projects.description')}</p> + )} - {projects.length > 0 && + {projects.length > 0 && ( <ul className="account-projects-list"> - {projects.map(project => + {projects.map(project => ( <li key={project.key}> <ProjectCard project={project} /> </li> - )} - </ul>} + ))} + </ul> + )} - {projects.length > 0 && + {projects.length > 0 && ( <ListFooter count={projects.length} total={props.total || 0} ready={!props.loading} loadMore={props.loadMore} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/account/projects/__tests__/ProjectCard-test.js b/server/sonar-web/src/main/js/apps/account/projects/__tests__/ProjectCard-test.js index d7a80d12599..f85b27ea47e 100644 --- a/server/sonar-web/src/main/js/apps/account/projects/__tests__/ProjectCard-test.js +++ b/server/sonar-web/src/main/js/apps/account/projects/__tests__/ProjectCard-test.js @@ -29,7 +29,12 @@ it('should render key and name', () => { const project = { ...BASE }; const output = shallow(<ProjectCard project={project} />); expect(output.find('.account-project-key').text()).toBe('key'); - expect(output.find('.account-project-name').find(Link).prop('children')).toBe('name'); + expect( + output + .find('.account-project-name') + .find(Link) + .prop('children') + ).toBe('name'); }); it('should render description', () => { @@ -63,7 +68,12 @@ it('should not render analysis date', () => { it('should render quality gate status', () => { const project = { ...BASE, qualityGate: 'ERROR' }; const output = shallow(<ProjectCard project={project} />); - expect(output.find('.account-project-quality-gate').find(Level).prop('level')).toBe('ERROR'); + expect( + output + .find('.account-project-quality-gate') + .find(Level) + .prop('level') + ).toBe('ERROR'); }); it('should render links', () => { diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/CurrentsFilter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/CurrentsFilter.tsx index 5b4ccbb090b..174b432de21 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/CurrentsFilter.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/CurrentsFilter.tsx @@ -38,9 +38,7 @@ export default class CurrentsFilter extends React.PureComponent<Props> { return ( <div className="bt-search-form-field"> <Checkbox checked={checked} onCheck={this.handleChange}> - <span className="little-spacer-left"> - {translate('yes')} - </span> + <span className="little-spacer-left">{translate('yes')}</span> </Checkbox> </div> ); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Header.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Header.js index 986924b6754..6aa13b27a92 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Header.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Header.js @@ -31,16 +31,13 @@ type Props = { export default function Header(props /*: Props */) { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('background_tasks.page')} - </h1> - {!props.component && + <h1 className="page-title">{translate('background_tasks.page')}</h1> + {!props.component && ( <div className="page-actions"> <Workers /> - </div>} - <p className="page-description"> - {translate('background_tasks.page.description')} - </p> + </div> + )} + <p className="page-description">{translate('background_tasks.page.description')}</p> </header> ); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx index c15d38eda16..c5fa551f142 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx @@ -81,11 +81,11 @@ export default class ScannerContext extends React.PureComponent<Props, State> { </div> <div className="modal-body modal-container"> - {scannerContext != null - ? <pre className="js-task-scanner-context"> - {scannerContext} - </pre> - : <i className="spinner" />} + {scannerContext != null ? ( + <pre className="js-task-scanner-context">{scannerContext}</pre> + ) : ( + <i className="spinner" /> + )} </div> <div className="modal-foot"> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Search.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Search.js index 39c75d43210..9036a5613b0 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Search.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Search.js @@ -112,7 +112,7 @@ export default class Search extends React.PureComponent { <h6 className="bt-search-form-label">Status</h6> <StatusFilter value={status} onChange={this.handleStatusChange.bind(this)} /> </li> - {types.length > 1 && + {types.length > 1 && ( <li> <h6 className="bt-search-form-label">Type</h6> <TypesFilter @@ -120,12 +120,14 @@ export default class Search extends React.PureComponent { types={types} onChange={this.handleTypeChange.bind(this)} /> - </li>} - {!component && + </li> + )} + {!component && ( <li> <h6 className="bt-search-form-label">Only Latest Analysis</h6> <CurrentsFilter value={currents} onChange={this.handleCurrentsChange.bind(this)} /> - </li>} + </li> + )} <li> <h6 className="bt-search-form-label">Date</h6> <DateFilter diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx index 1397e58ac6a..7156099b54c 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx @@ -82,25 +82,19 @@ export default class Stacktrace extends React.PureComponent<Props, State> { </div> <div className="modal-body modal-container"> - {loading - ? <i className="spinner" /> - : stacktrace - ? <div> - <h4 className="spacer-bottom"> - {translate('background_tasks.error_stacktrace')} - </h4> - <pre className="js-task-stacktrace"> - {stacktrace} - </pre> - </div> - : <div> - <h4 className="spacer-bottom"> - {translate('background_tasks.error_message')} - </h4> - <pre className="js-task-error-message"> - {task.errorMessage} - </pre> - </div>} + {loading ? ( + <i className="spinner" /> + ) : stacktrace ? ( + <div> + <h4 className="spacer-bottom">{translate('background_tasks.error_stacktrace')}</h4> + <pre className="js-task-stacktrace">{stacktrace}</pre> + </div> + ) : ( + <div> + <h4 className="spacer-bottom">{translate('background_tasks.error_message')}</h4> + <pre className="js-task-error-message">{task.errorMessage}</pre> + </div> + )} </div> <div className="modal-foot"> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js index 0983059a320..3021b5af21b 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js @@ -123,12 +123,8 @@ export default class Stats extends React.PureComponent { render() { return ( <section className="big-spacer-top big-spacer-bottom"> - <span> - {this.renderPending()} - </span> - <span className="huge-spacer-left"> - {this.renderFailures()} - </span> + <span>{this.renderPending()}</span> + <span className="huge-spacer-left">{this.renderFailures()}</span> </section> ); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx index e75801aa4f8..748acacd729 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx @@ -86,7 +86,7 @@ export default class TaskActions extends React.PureComponent<Props, State> { </button> <ul className="dropdown-menu dropdown-menu-right"> {canFilter && - task.componentName && + task.componentName && ( <li> <a className="js-task-filter" href="#" onClick={this.handleFilterClick}> <i className="spacer-right icon-filter icon-gray" /> @@ -95,15 +95,17 @@ export default class TaskActions extends React.PureComponent<Props, State> { task.componentName )} </a> - </li>} - {canCancel && + </li> + )} + {canCancel && ( <li> <a className="js-task-cancel" href="#" onClick={this.handleCancelClick}> <i className="spacer-right icon-delete" /> {translate('background_tasks.cancel_task')} </a> - </li>} - {task.hasScannerContext && + </li> + )} + {task.hasScannerContext && ( <li> <a className="js-task-show-scanner-context" @@ -112,8 +114,9 @@ export default class TaskActions extends React.PureComponent<Props, State> { <i className="spacer-right icon-list icon-gray" /> {translate('background_tasks.show_scanner_context')} </a> - </li>} - {canShowStacktrace && + </li> + )} + {canShowStacktrace && ( <li> <a className="js-task-show-stacktrace" @@ -122,12 +125,14 @@ export default class TaskActions extends React.PureComponent<Props, State> { <i className="spacer-right icon-list icon-red" /> {translate('background_tasks.show_stacktrace')} </a> - </li>} + </li> + )} </ul> </div> - {this.state.scannerContextOpen && - <ScannerContext onClose={this.closeScannerContext} task={task} />} + {this.state.scannerContextOpen && ( + <ScannerContext onClose={this.closeScannerContext} task={task} /> + )} {this.state.stacktraceOpen && <Stacktrace onClose={this.closeStacktrace} task={task} />} </td> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx index c6839478f78..72a38a1bf50 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx @@ -33,9 +33,7 @@ export default function TaskComponent({ task }: Props) { if (!task.componentKey) { return ( <td> - <span className="note"> - {task.id} - </span> + <span className="note">{task.id}</span> <TaskType incremental={task.incremental} type={task.type} /> </td> ); @@ -43,23 +41,26 @@ export default function TaskComponent({ task }: Props) { return ( <td> - {task.componentQualifier && + {task.componentQualifier && ( <span className="little-spacer-right"> <QualifierIcon qualifier={task.componentQualifier} /> - </span>} + </span> + )} {task.organization && <Organization organizationKey={task.organization} />} - {task.componentName && + {task.componentName && ( <Link className="spacer-right" to={getProjectUrl(task.componentKey, task.branch)}> {task.componentName} - {task.branch && + {task.branch && ( <span className="text-limited text-text-top" title={task.branch}> <span style={{ marginLeft: 5, marginRight: 5 }}>/</span> {task.branch} - </span>} - </Link>} + </span> + )} + </Link> + )} <TaskType incremental={task.incremental} type={task.type} /> </td> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.tsx index 55baca3f360..78dfad7fce2 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.tsx @@ -25,9 +25,5 @@ interface Props { } export default function TaskExecutionTime({ ms }: Props) { - return ( - <td className="thin nowrap text-right"> - {ms && formatDuration(ms)} - </td> - ); + return <td className="thin nowrap text-right">{ms && formatDuration(ms)}</td>; } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.tsx index cd2215d40e6..9013985e8c5 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.tsx @@ -26,9 +26,7 @@ interface Props { export default function TaskId({ id }: Props) { return ( <td className="thin nowrap"> - <div className="note"> - {id} - </div> + <div className="note">{id}</div> </td> ); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.tsx index 87b2a7d7338..a657a873fbe 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.tsx @@ -38,32 +38,22 @@ export default function TaskStatus({ status }: Props) { break; case STATUSES.SUCCESS: inner = ( - <span className="badge badge-success"> - {translate('background_task.status.SUCCESS')} - </span> + <span className="badge badge-success">{translate('background_task.status.SUCCESS')}</span> ); break; case STATUSES.FAILED: inner = ( - <span className="badge badge-danger"> - {translate('background_task.status.FAILED')} - </span> + <span className="badge badge-danger">{translate('background_task.status.FAILED')}</span> ); break; case STATUSES.CANCELED: inner = ( - <span className="badge badge-muted"> - {translate('background_task.status.CANCELED')} - </span> + <span className="badge badge-muted">{translate('background_task.status.CANCELED')}</span> ); break; default: inner = ''; } - return ( - <td className="thin spacer-right"> - {inner} - </td> - ); + return <td className="thin spacer-right">{inner}</td>; } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js index ebbfb3f253e..0f0f843a1f5 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js @@ -52,33 +52,19 @@ export default class Tasks extends React.PureComponent { <table className={className}> <thead> <tr> - <th> - {translate('background_tasks.table.status')} - </th> - <th> - {translate('background_tasks.table.task')} - </th> - <th> - {translate('background_tasks.table.id')} - </th> + <th>{translate('background_tasks.table.status')}</th> + <th>{translate('background_tasks.table.task')}</th> + <th>{translate('background_tasks.table.id')}</th> <th> </th> - <th className="text-right"> - {translate('background_tasks.table.submitted')} - </th> - <th className="text-right"> - {translate('background_tasks.table.started')} - </th> - <th className="text-right"> - {translate('background_tasks.table.finished')} - </th> - <th className="text-right"> - {translate('background_tasks.table.duration')} - </th> + <th className="text-right">{translate('background_tasks.table.submitted')}</th> + <th className="text-right">{translate('background_tasks.table.started')}</th> + <th className="text-right">{translate('background_tasks.table.finished')}</th> + <th className="text-right">{translate('background_tasks.table.duration')}</th> <th> </th> </tr> </thead> <tbody> - {tasks.map((task, index, tasks) => + {tasks.map((task, index, tasks) => ( <Task key={task.id} task={task} @@ -88,7 +74,7 @@ export default class Tasks extends React.PureComponent { onFilterTask={onFilterTask} previousTask={index > 0 ? tasks[index - 1] : undefined} /> - )} + ))} </tbody> </table> ); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.js index cbcfb1d39f1..9f3935e8d90 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.js @@ -80,30 +80,33 @@ export default class Workers extends React.PureComponent { return ( <div> {!loading && - workerCount > 1 && + workerCount > 1 && ( <Tooltip overlay={translate('background_tasks.number_of_workers.warning')}> <i className="icon-alert-warn little-spacer-right bt-workers-warning-icon" /> - </Tooltip>} + </Tooltip> + )} {translate('background_tasks.number_of_workers')} - {loading - ? <i className="spinner little-spacer-left" /> - : <strong className="little-spacer-left"> - {workerCount} - </strong>} + {loading ? ( + <i className="spinner little-spacer-left" /> + ) : ( + <strong className="little-spacer-left">{workerCount}</strong> + )} {!loading && - (canSetWorkerCount - ? <Tooltip overlay={translate('background_tasks.change_number_of_workers')}> - <a className="icon-edit spacer-left" href="#" onClick={this.handleChangeClick} /> - </Tooltip> - : <a - className="button button-promote spacer-left" - href="https://redirect.sonarsource.com/plugins/governance.html" - target="_blank"> - {translate('background_tasks.add_more_with_governance')} - </a>)} + (canSetWorkerCount ? ( + <Tooltip overlay={translate('background_tasks.change_number_of_workers')}> + <a className="icon-edit spacer-left" href="#" onClick={this.handleChangeClick} /> + </Tooltip> + ) : ( + <a + className="button button-promote spacer-left" + href="https://redirect.sonarsource.com/plugins/governance.html" + target="_blank"> + {translate('background_tasks.add_more_with_governance')} + </a> + ))} {formOpen && <WorkersForm onClose={this.closeForm} workerCount={this.state.workerCount} />} </div> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.js b/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.js index 83464c862b3..ded18f7c6c8 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.js @@ -96,9 +96,7 @@ export default class WorkersForm extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.handleClose}> <header className="modal-head"> - <h2> - {translate('background_tasks.change_number_of_workers')} - </h2> + <h2>{translate('background_tasks.change_number_of_workers')}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body"> diff --git a/server/sonar-web/src/main/js/apps/code/code.css b/server/sonar-web/src/main/js/apps/code/code.css index 937d646a064..2a345793f1d 100644 --- a/server/sonar-web/src/main/js/apps/code/code.css +++ b/server/sonar-web/src/main/js/apps/code/code.css @@ -17,7 +17,7 @@ padding-left: 10px; color: #777; font-size: 11px; - content: ">"; + content: '>'; } .code-breadcrumbs > li:last-child::after { diff --git a/server/sonar-web/src/main/js/apps/code/components/App.tsx b/server/sonar-web/src/main/js/apps/code/components/App.tsx index 7063fe085c8..aa773ae2177 100644 --- a/server/sonar-web/src/main/js/apps/code/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/App.tsx @@ -208,10 +208,7 @@ export default class App extends React.PureComponent<Props, State> { <div className="page page-limited"> <Helmet title={translate('code.page')} /> - {error && - <div className="alert alert-danger"> - {error} - </div>} + {error && <div className="alert alert-danger">{error}</div>} <Search branch={branchName} @@ -221,11 +218,12 @@ export default class App extends React.PureComponent<Props, State> { /> <div className="code-components"> - {shouldShowBreadcrumbs && - <Breadcrumbs branch={branchName} breadcrumbs={breadcrumbs} rootComponent={component} />} + {shouldShowBreadcrumbs && ( + <Breadcrumbs branch={branchName} breadcrumbs={breadcrumbs} rootComponent={component} /> + )} {sourceViewer == undefined && - components != undefined && + components != undefined && ( <div className={componentsClassName}> <Components baseComponent={baseComponent} @@ -233,16 +231,19 @@ export default class App extends React.PureComponent<Props, State> { components={components} rootComponent={component} /> - </div>} + </div> + )} {sourceViewer == undefined && - components != undefined && - <ListFooter count={components.length} total={total} loadMore={this.handleLoadMore} />} + components != undefined && ( + <ListFooter count={components.length} total={total} loadMore={this.handleLoadMore} /> + )} - {sourceViewer != undefined && + {sourceViewer != undefined && ( <div className="spacer-top"> <SourceViewer branch={branchName} component={sourceViewer.key} /> - </div>} + </div> + )} </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx b/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx index 3c8feee7b2b..581e9726c4b 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx @@ -30,7 +30,7 @@ interface Props { export default function Breadcrumbs({ branch, breadcrumbs, rootComponent }: Props) { return ( <ul className="code-breadcrumbs"> - {breadcrumbs.map((component, index) => + {breadcrumbs.map((component, index) => ( <li key={component.key}> <ComponentName branch={branch} @@ -39,7 +39,7 @@ export default function Breadcrumbs({ branch, breadcrumbs, rootComponent }: Prop rootComponent={rootComponent} /> </li> - )} + ))} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/code/components/Component.tsx b/server/sonar-web/src/main/js/apps/code/components/Component.tsx index 5294779fd66..8547e6eec19 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Component.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Component.tsx @@ -115,9 +115,7 @@ export default class Component extends React.PureComponent<Props> { return ( <tr className={classNames({ selected })} ref={node => (this.node = node as HTMLElement)}> <td className="thin nowrap"> - <span className="spacer-right"> - {componentAction} - </span> + <span className="spacer-right">{componentAction}</span> </td> <td className="code-name-cell"> <ComponentName @@ -129,7 +127,7 @@ export default class Component extends React.PureComponent<Props> { /> </td> - {columns.map(column => + {columns.map(column => ( <td key={column.metric} className="thin nowrap text-right"> <div className="code-components-cell"> <ComponentMeasure @@ -139,7 +137,7 @@ export default class Component extends React.PureComponent<Props> { /> </div> </td> - )} + ))} </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx index f6f2474ff42..c0947e98ec0 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx @@ -62,16 +62,14 @@ export default function ComponentName(props: Props) { areBothDirs && previous != undefined ? mostCommitPrefix([component.name + '/', previous.name + '/']) : ''; - const name = prefix - ? <span> - <span style={{ color: '#777' }}> - {prefix} - </span> - <span> - {component.name.substr(prefix.length)} - </span> - </span> - : component.name; + const name = prefix ? ( + <span> + <span style={{ color: '#777' }}>{prefix}</span> + <span>{component.name.substr(prefix.length)}</span> + </span> + ) : ( + component.name + ); let inner = null; @@ -101,9 +99,5 @@ export default function ComponentName(props: Props) { ); } - return ( - <Truncated title={getTooltip(component)}> - {inner} - </Truncated> - ); + return <Truncated title={getTooltip(component)}>{inner}</Truncated>; } diff --git a/server/sonar-web/src/main/js/apps/code/components/Components.tsx b/server/sonar-web/src/main/js/apps/code/components/Components.tsx index 89decb3012c..b8aab7421da 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Components.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Components.tsx @@ -36,7 +36,7 @@ export default function Components(props: Props) { return ( <table className="data zebra"> <ComponentsHeader baseComponent={baseComponent} rootComponent={rootComponent} /> - {baseComponent && + {baseComponent && ( <tbody> <Component branch={branch} @@ -47,21 +47,24 @@ export default function Components(props: Props) { <tr className="blank"> <td colSpan={8}> </td> </tr> - </tbody>} + </tbody> + )} <tbody> - {components.length - ? components.map((component, index, list) => - <Component - branch={branch} - canBrowse={true} - component={component} - key={component.key} - previous={index > 0 ? list[index - 1] : undefined} - rootComponent={rootComponent} - selected={component === selected} - /> - ) - : <ComponentsEmpty />} + {components.length ? ( + components.map((component, index, list) => ( + <Component + branch={branch} + canBrowse={true} + component={component} + key={component.key} + previous={index > 0 ? list[index - 1] : undefined} + rootComponent={rootComponent} + selected={component === selected} + /> + )) + ) : ( + <ComponentsEmpty /> + )} </tbody> </table> ); diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentsEmpty.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentsEmpty.tsx index 8ea0b1a11b6..2d136bd1856 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentsEmpty.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentsEmpty.tsx @@ -23,9 +23,7 @@ import { translate } from '../../../helpers/l10n'; export default function ComponentsEmpty() { return ( <tr> - <td colSpan={2}> - {translate('no_results')} - </td> + <td colSpan={2}>{translate('no_results')}</td> <td colSpan={6} /> </tr> ); diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx index 4717af5957f..a2138a020b4 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx @@ -53,11 +53,11 @@ export default function ComponentsHeader({ baseComponent, rootComponent }: Props <tr className="code-components-header"> <th className="thin nowrap"> </th> <th> </th> - {columns.map(column => + {columns.map(column => ( <th key={column} className="thin nowrap text-right code-components-cell"> {baseComponent && column} </th> - )} + ))} </tr> </thead> ); diff --git a/server/sonar-web/src/main/js/apps/code/components/Search.tsx b/server/sonar-web/src/main/js/apps/code/components/Search.tsx index a66320d85d9..fe470159f57 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Search.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Search.tsx @@ -216,18 +216,17 @@ export default class Search extends React.PureComponent<Props, State> { {loading && <i className="spinner spacer-left" />} - <span className="note spacer-left"> - {translateWithParameters('select2.tooShort', 3)} - </span> + <span className="note spacer-left">{translateWithParameters('select2.tooShort', 3)}</span> </form> - {results != null && + {results != null && ( <Components branch={this.props.branch} components={results} rootComponent={component} selected={selected} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/code/utils.ts b/server/sonar-web/src/main/js/apps/code/utils.ts index 4904ed4c50f..cd60dff2dd9 100644 --- a/server/sonar-web/src/main/js/apps/code/utils.ts +++ b/server/sonar-web/src/main/js/apps/code/utils.ts @@ -179,10 +179,12 @@ function retrieveComponentBreadcrumbs( return Promise.resolve(existing); } - return getBreadcrumbs(componentKey, branch).then(skipRootDir).then(breadcrumbs => { - addComponentBreadcrumbs(componentKey, breadcrumbs); - return breadcrumbs; - }); + return getBreadcrumbs(componentKey, branch) + .then(skipRootDir) + .then(breadcrumbs => { + addComponentBreadcrumbs(componentKey, breadcrumbs); + return breadcrumbs; + }); } export function retrieveComponent( diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js index 9142102574e..3efdac89cfb 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js @@ -86,7 +86,9 @@ export default BaseFacet.extend({ setActivation(e) { e.stopPropagation(); const compareProfile = this.options.app.state.get('query').compareToProfile; - const profile = $(e.currentTarget).parents('.js-facet').data('value'); + const profile = $(e.currentTarget) + .parents('.js-facet') + .data('value'); if (compareProfile == null || compareProfile !== profile) { this.options.app.state.updateFilter({ activation: 'true', compareToProfile: null }); } @@ -95,7 +97,9 @@ export default BaseFacet.extend({ unsetActivation(e) { e.stopPropagation(); const compareProfile = this.options.app.state.get('query').compareToProfile; - const profile = $(e.currentTarget).parents('.js-facet').data('value'); + const profile = $(e.currentTarget) + .parents('.js-facet') + .data('value'); if (compareProfile == null || compareProfile !== profile) { this.options.app.state.updateFilter({ activation: 'false', diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js index 810dfe29eee..1259ac016a2 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js @@ -28,7 +28,9 @@ export default BaseFacet.extend({ BaseFacet.prototype.onRender.apply(this, arguments); const value = this.options.app.state.get('query').is_template; if (value != null) { - this.$('.js-facet').filter(`[data-value="${value}"]`).addClass('active'); + this.$('.js-facet') + .filter(`[data-value="${value}"]`) + .addClass('active'); } }, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js index b2be0820a3a..f55361b621f 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js @@ -70,7 +70,10 @@ export default ModalForm.extend({ formatSelection: format }); setTimeout(() => { - that.$('a').first().focus(); + that + .$('a') + .first() + .focus(); }, 0); }, diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/App.js b/server/sonar-web/src/main/js/apps/component-measures/components/App.js index 255d5b5732d..a9fc88958ad 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/App.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/App.js @@ -162,7 +162,7 @@ export default class App extends React.PureComponent { </div> </div> - {metric != null && + {metric != null && ( <MeasureContentContainer branch={branch && getBranchName(branch)} className="layout-page-main" @@ -176,9 +176,10 @@ export default class App extends React.PureComponent { selected={query.selected} updateQuery={this.updateQuery} view={query.view} - />} + /> + )} {metric == null && - hasBubbleChart(query.metric) && + hasBubbleChart(query.metric) && ( <MeasureOverviewContainer branch={branch && getBranchName(branch)} className="layout-page-main" @@ -190,7 +191,8 @@ export default class App extends React.PureComponent { router={this.props.router} selected={query.selected} updateQuery={this.updateQuery} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumb.js b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumb.js index 4e8adbf33ee..58877c072af 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumb.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumb.js @@ -45,21 +45,23 @@ export default class Breadcrumb extends React.PureComponent { const componentName = isPath ? collapsePath(component.name, 15) : limitComponentName(component.name); - const breadcrumbItem = canBrowse - ? <a href="#" onClick={this.handleClick}> - {componentName} - </a> - : <span> - {componentName} - </span>; + const breadcrumbItem = canBrowse ? ( + <a href="#" onClick={this.handleClick}> + {componentName} + </a> + ) : ( + <span>{componentName}</span> + ); return ( <span> - {component.name !== componentName - ? <Tooltip overlay={component.name} placement="bottom"> - {breadcrumbItem} - </Tooltip> - : breadcrumbItem} + {component.name !== componentName ? ( + <Tooltip overlay={component.name} placement="bottom"> + {breadcrumbItem} + </Tooltip> + ) : ( + breadcrumbItem + )} {!isLast && <span className="slash-separator" />} </span> ); diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.js b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.js index 6fa80158a26..2ac6ba82a12 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.js @@ -99,7 +99,7 @@ export default class Breadcrumbs extends React.PureComponent { const lastItem = breadcrumbs[breadcrumbs.length - 1]; return ( <div className={this.props.className}> - {breadcrumbs.map(component => + {breadcrumbs.map(component => ( <Breadcrumb key={component.key} canBrowse={component.key !== lastItem.key} @@ -107,7 +107,7 @@ export default class Breadcrumbs extends React.PureComponent { isLast={component.key === lastItem.key} handleSelect={this.props.handleSelect} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/FilesCounter.js b/server/sonar-web/src/main/js/apps/component-measures/components/FilesCounter.js index fb35bc21e13..cb02bff5b44 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/FilesCounter.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/FilesCounter.js @@ -32,11 +32,12 @@ export default function FilesCounter({ className, current, total } /*: Props */) return ( <span className={className}> <strong> - {current != null && + {current != null && ( <span> {formatMeasure(current, 'INT')} {' / '} - </span>} + </span> + )} {formatMeasure(total, 'INT')} </strong>{' '} {translate('component_measures.files')} diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/LeakPeriodLegend.js b/server/sonar-web/src/main/js/apps/component-measures/components/LeakPeriodLegend.js index 8ca27ea3eb9..16eeef529dc 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/LeakPeriodLegend.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/LeakPeriodLegend.js @@ -36,11 +36,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; export default function LeakPeriodLegend({ className, component, period } /*: Props */) { const leakClass = classNames('domain-measures-leak-header', className); if (component.qualifier === 'APP') { - return ( - <div className={leakClass}> - {translate('issues.leak_period')} - </div> - ); + return <div className={leakClass}>{translate('issues.leak_period')}</div>; } const label = ( diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js index 6824148b0ee..47675037a7b 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js @@ -303,18 +303,20 @@ export default class MeasureContent extends React.PureComponent { rootComponent={rootComponent} /> {component.key !== rootComponent.key && - isLoggedIn && + isLoggedIn && ( <MeasureFavoriteContainer component={component.key} className="measure-favorite spacer-right" - />} - {!isFile && + /> + )} + {!isFile && ( <MeasureViewSelect className="measure-view-select" metric={metric} handleViewChange={this.props.updateView} view={view} - />} + /> + )} <PageActions current={selectedIdx != null && view !== 'treemap' ? selectedIdx + 1 : null} loading={this.props.loading} @@ -325,10 +327,11 @@ export default class MeasureContent extends React.PureComponent { </div> </div> </div> - {metric == null && - <MetricNotFound className="layout-page-main-inner measure-details-content" />} + {metric == null && ( + <MetricNotFound className="layout-page-main-inner measure-details-content" /> + )} {metric != null && - measure != null && + measure != null && ( <div className="layout-page-main-inner measure-details-content"> <MeasureHeader branch={branch} @@ -341,7 +344,8 @@ export default class MeasureContent extends React.PureComponent { selectedIdx={selectedIdx} /> {isFileType(component) ? this.renderCode() : this.renderMeasure()} - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.js b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.js index fe905f163e0..b2763cbcdc5 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.js @@ -77,14 +77,15 @@ export default class MeasureHeader extends React.PureComponent { const hasNext = selectedIdx < components.length - 1; return ( <div className="display-inline-block"> - {components.length > 0 && + {components.length > 0 && ( <span className="note spacer-right"> {translateWithParameters( 'component_measures.x_of_y', selectedIdx + 1, components.length )} - </span>} + </span> + )} <div className="button-group"> {hasPrevious && <button onClick={this.handleSelectPrevious}><</button>} {hasNext && <button onClick={this.handleSelectNext}>></button>} @@ -107,12 +108,14 @@ export default class MeasureHeader extends React.PureComponent { {getLocalizedMetricName(metric)} <span className="measure-details-value spacer-left"> <strong> - {isDiff - ? <Measure className="domain-measures-leak" measure={measure} metric={metric} /> - : <Measure measure={measure} metric={metric} />} + {isDiff ? ( + <Measure className="domain-measures-leak" measure={measure} metric={metric} /> + ) : ( + <Measure measure={measure} metric={metric} /> + )} </strong> </span> - {hasHistory && + {hasHistory && ( <Tooltip placement="right" overlay={translate('component_measures.show_metric_history')}> @@ -121,33 +124,34 @@ export default class MeasureHeader extends React.PureComponent { to={getComponentMeasureHistory(component.key, metric.key, branch)}> <HistoryIcon /> </Link> - </Tooltip>} + </Tooltip> + )} </div> <div className="measure-details-primary-actions"> {hasComponents && isFileType(component) && this.renderFileNav()} - {leakPeriod != null && - <LeakPeriodLegend - className="spacer-left" - component={component} - period={leakPeriod} - />} + {leakPeriod != null && ( + <LeakPeriodLegend className="spacer-left" component={component} period={leakPeriod} /> + )} </div> </div> {secondaryMeasure && - secondaryMeasure.metric.key === 'ncloc_language_distribution' && + secondaryMeasure.metric.key === 'ncloc_language_distribution' && ( <div className="measure-details-secondary"> <LanguageDistribution alignTicks={true} distribution={secondaryMeasure.value} /> - </div>} + </div> + )} {secondaryMeasure && - secondaryMeasure.metric.key === 'function_complexity_distribution' && + secondaryMeasure.metric.key === 'function_complexity_distribution' && ( <div className="measure-details-secondary"> <ComplexityDistribution distribution={secondaryMeasure.value} of="function" /> - </div>} + </div> + )} {secondaryMeasure && - secondaryMeasure.metric.key === 'file_complexity_distribution' && + secondaryMeasure.metric.key === 'file_complexity_distribution' && ( <div className="measure-details-secondary"> <ComplexityDistribution distribution={secondaryMeasure.value} of="file" /> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.js b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.js index 213fdf050fa..91d5cf8d669 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.js @@ -152,11 +152,12 @@ export default class MeasureOverview extends React.PureComponent { rootComponent={rootComponent} /> {component.key !== rootComponent.key && - isLoggedIn && + isLoggedIn && ( <MeasureFavoriteContainer component={component.key} className="measure-favorite spacer-right" - />} + /> + )} <PageActions current={this.state.components.length} loading={this.props.loading} @@ -168,8 +169,9 @@ export default class MeasureOverview extends React.PureComponent { </div> <div className="layout-page-main-inner measure-details-content"> <div className="clearfix big-spacer-bottom"> - {leakPeriod != null && - <LeakPeriodLegend className="pull-right" component={component} period={leakPeriod} />} + {leakPeriod != null && ( + <LeakPeriodLegend className="pull-right" component={component} period={leakPeriod} /> + )} </div> {!this.props.loading && this.renderContent()} </div> diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MetricNotFound.js b/server/sonar-web/src/main/js/apps/component-measures/components/MetricNotFound.js index 9b2cb8ee27c..a2494f192fd 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MetricNotFound.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MetricNotFound.js @@ -24,9 +24,7 @@ import { translate } from '../../../helpers/l10n'; export default function MetricNotFound({ className } /*: { className?: string } */) { return ( <div className={className}> - <div className="alert alert-danger"> - {translate('component_measures.not_found')} - </div> + <div className="alert alert-danger">{translate('component_measures.not_found')}</div> </div> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/PageActions.js b/server/sonar-web/src/main/js/apps/component-measures/components/PageActions.js index 1d5d4abcef3..eb76a1bd635 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/PageActions.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/PageActions.js @@ -43,8 +43,9 @@ export default function PageActions(props /*: Props */) { <DeferredSpinner loading={props.loading}> <i className="spinner-placeholder" /> </DeferredSpinner> - {paging != null && - <FilesCounter className="spacer-left" current={props.current} total={paging.total} />} + {paging != null && ( + <FilesCounter className="spacer-left" current={props.current} total={paging.total} /> + )} </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.js index a57d110e5ea..fab193a3452 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.js @@ -149,12 +149,10 @@ export default class BubbleChart extends React.PureComponent { ); return ( <div className="measure-overview-bubble-chart-header"> - <span className="measure-overview-bubble-chart-title"> - {title} - </span> + <span className="measure-overview-bubble-chart-title">{title}</span> <span className="measure-overview-bubble-chart-legend"> <span className="note"> - {colorsMetric && + {colorsMetric && ( <span className="spacer-right"> {translateWithParameters( 'component_measures.legend.color_x', @@ -165,7 +163,8 @@ export default class BubbleChart extends React.PureComponent { ) : getLocalizedMetricName(colorsMetric[0]) )} - </span>} + </span> + )} {translateWithParameters( 'component_measures.legend.size_x', getLocalizedMetricName(sizeMetric) @@ -183,11 +182,7 @@ export default class BubbleChart extends React.PureComponent { if (description === translatedDescription) { return null; } - return ( - <div className="measure-overview-bubble-chart-footer"> - {translatedDescription} - </div> - ); + return <div className="measure-overview-bubble-chart-footer">{translatedDescription}</div>; } render() { diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js index 1f4dc6dc78b..855c605c585 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js @@ -57,10 +57,7 @@ export default class ComponentCell extends React.PureComponent { <span title={component.refKey || component.key}> <QualifierIcon qualifier={component.qualifier} /> - {head.length > 0 && - <span className="note"> - {head}/ - </span>} + {head.length > 0 && <span className="note">{head}/</span>} <span>{tail}</span> </span> ); @@ -71,23 +68,25 @@ export default class ComponentCell extends React.PureComponent { return ( <td className="measure-details-component-cell"> <div className="text-ellipsis"> - {component.refKey == null - ? <a - id={'component-measures-component-link-' + component.key} - className="link-no-underline" - href={getComponentUrl(component.key, branch)} - onClick={this.handleClick}> - {this.renderInner()} - </a> - : <a - id={'component-measures-component-link-' + component.key} - className="link-no-underline" - href={getComponentUrl(component.refKey, branch)}> - <span className="big-spacer-right"> - <i className="icon-detach" /> - </span> - {this.renderInner()} - </a>} + {component.refKey == null ? ( + <a + id={'component-measures-component-link-' + component.key} + className="link-no-underline" + href={getComponentUrl(component.key, branch)} + onClick={this.handleClick}> + {this.renderInner()} + </a> + ) : ( + <a + id={'component-measures-component-link-' + component.key} + className="link-no-underline" + href={getComponentUrl(component.refKey, branch)}> + <span className="big-spacer-right"> + <i className="icon-detach" /> + </span> + {this.renderInner()} + </a> + )} </div> </td> ); diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.js index 18d307848e4..d8bbfb4db55 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.js @@ -45,27 +45,24 @@ export default function ComponentsList( const otherMetrics = (complementary[metric.key] || []).map(key => metrics[key]); return ( <table className="data zebra zebra-hover"> - {otherMetrics.length > 0 && + {otherMetrics.length > 0 && ( <thead> <tr> <th> </th> <th className="text-right"> - <span className="small"> - {getLocalizedMetricName(metric)} - </span> + <span className="small">{getLocalizedMetricName(metric)}</span> </th> - {otherMetrics.map(metric => + {otherMetrics.map(metric => ( <th key={metric.key} className="text-right"> - <span className="small"> - {getLocalizedMetricName(metric)} - </span> + <span className="small">{getLocalizedMetricName(metric)}</span> </th> - )} + ))} </tr> - </thead>} + </thead> + )} <tbody> - {components.map(component => + {components.map(component => ( <ComponentsListRow key={component.id} branch={branch} @@ -75,7 +72,7 @@ export default function ComponentsList( metric={metric} onClick={onClick} /> - )} + ))} </tbody> </table> ); diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.js index 841ff84a60c..7d43537bcc3 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.js @@ -49,7 +49,7 @@ export default function ComponentsListRow(props /*: Props */) { <MeasureCell component={component} metric={props.metric} /> - {otherMeasures.map(measure => + {otherMeasures.map(measure => ( <MeasureCell key={measure.metric.key} component={{ @@ -59,7 +59,7 @@ export default function ComponentsListRow(props /*: Props */) { }} metric={measure.metric} /> - )} + ))} </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/EmptyResult.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/EmptyResult.js index 3b237ad7dd8..426e30fd08e 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/EmptyResult.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/EmptyResult.js @@ -22,9 +22,5 @@ import React from 'react'; import { translate } from '../../../helpers/l10n'; export default function EmptyResult() { - return ( - <div className="note"> - {translate('no_results')} - </div> - ); + return <div className="note">{translate('no_results')}</div>; } diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.js index f7f26fe9e26..e13ec374232 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.js @@ -126,12 +126,13 @@ export default class ListView extends React.PureComponent { selectedComponent={this.props.selectedKey} /> {this.props.paging && - this.props.components.length > 0 && + this.props.components.length > 0 && ( <ListFooter count={this.props.components.length} total={this.props.paging.total} loadMore={this.props.fetchMore} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js index f055ef7e68b..4411d4743ec 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js @@ -101,7 +101,9 @@ export default class TreeMapView extends React.PureComponent { }; getLevelColorScale = () => - scaleOrdinal().domain(['ERROR', 'WARN', 'OK', 'NONE']).range(LEVEL_COLORS); + scaleOrdinal() + .domain(['ERROR', 'WARN', 'OK', 'NONE']) + .range(LEVEL_COLORS); getPercentColorScale = (metric /*: Metric */) => { const color = scaleLinear().domain([0, 25, 50, 75, 100]); @@ -109,7 +111,10 @@ export default class TreeMapView extends React.PureComponent { return color; }; - getRatingColorScale = () => scaleLinear().domain([1, 2, 3, 4, 5]).range(COLORS); + getRatingColorScale = () => + scaleLinear() + .domain([1, 2, 3, 4, 5]) + .range(COLORS); getColorScale = (metric /*: Metric */) => { if (metric.type === 'LEVEL') { @@ -194,18 +199,17 @@ export default class TreeMapView extends React.PureComponent { ) )} </li> - <li className="pull-right"> - {this.renderLegend()} - </li> + <li className="pull-right">{this.renderLegend()}</li> </ul> <AutoSizer> - {({ width }) => + {({ width }) => ( <TreeMap items={treemapItems} onRectangleClick={this.props.handleSelect} height={HEIGHT} width={width} - />} + /> + )} </AutoSizer> </div> ); diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js b/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js index 85d77e4bb34..b3c62520459 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js @@ -70,27 +70,31 @@ export default class DomainFacet extends React.PureComponent { const sortedItems = sortMeasures(domain.name, items); return sortedItems.map( item => - typeof item === 'string' - ? <span key={item} className="facet search-navigator-facet facet-category"> - <span className="facet-name"> - {translate('component_measures.facet_category', item)} - </span> + typeof item === 'string' ? ( + <span key={item} className="facet search-navigator-facet facet-category"> + <span className="facet-name"> + {translate('component_measures.facet_category', item)} </span> - : <FacetItem - active={item.metric.key === selected} - disabled={false} - key={item.metric.key} - name={ - <span className="big-spacer-left" id={`measure-${item.metric.key}-name`}> - {hasCategories - ? getLocalizedCategoryMetricName(item.metric) - : getLocalizedMetricName(item.metric)} - </span> - } - onClick={this.props.onChange} - stat={hasFacetStat(item.metric.key) ? <FacetMeasureValue measure={item} /> : null} - value={item.metric.key} - /> + </span> + ) : ( + <FacetItem + active={item.metric.key === selected} + disabled={false} + key={item.metric.key} + name={ + <span className="big-spacer-left" id={`measure-${item.metric.key}-name`}> + {hasCategories ? ( + getLocalizedCategoryMetricName(item.metric) + ) : ( + getLocalizedMetricName(item.metric) + )} + </span> + } + onClick={this.props.onChange} + stat={hasFacetStat(item.metric.key) ? <FacetMeasureValue measure={item} /> : null} + value={item.metric.key} + /> + ) ); }; @@ -130,11 +134,12 @@ export default class DomainFacet extends React.PureComponent { values={this.hasFacetSelected(domain, domain.measures, selected) ? 1 : 0} /> - {this.props.open && + {this.props.open && ( <FacetItemsList> {this.renderOverviewFacet()} {this.renderItemsFacet()} - </FacetItemsList>} + </FacetItemsList> + )} </FacetBox> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/ProjectOverviewFacet.js b/server/sonar-web/src/main/js/apps/component-measures/sidebar/ProjectOverviewFacet.js index ded7b731082..1dff2ba20f7 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/ProjectOverviewFacet.js +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/ProjectOverviewFacet.js @@ -42,9 +42,7 @@ export default function ProjectOverviewFacet({ value, selected, onChange } /*: P key={value} name={ <Tooltip overlay={facetName} mouseEnterDelay={0.5}> - <strong id={`measure-overview-${value}-name`}> - {facetName} - </strong> + <strong id={`measure-overview-${value}-name`}>{facetName}</strong> </Tooltip> } onClick={onChange} diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.js b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.js index 1cf5fad085f..1bbab3c5cc5 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.js +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.js @@ -83,7 +83,7 @@ export default class Sidebar extends React.PureComponent { selected={this.props.selectedMetric} value={PROJECT_OVERVEW} /> - {groupByDomains(this.props.measures).map(domain => + {groupByDomains(this.props.measures).map(domain => ( <DomainFacet key={domain.name} domain={domain} @@ -92,7 +92,7 @@ export default class Sidebar extends React.PureComponent { open={this.state.openFacets[domain.name] === true} selected={this.props.selectedMetric} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/components/App.js b/server/sonar-web/src/main/js/apps/issues/components/App.js index a67b66722cf..91257b03102 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/App.js +++ b/server/sonar-web/src/main/js/apps/issues/components/App.js @@ -361,7 +361,10 @@ export default class App extends React.PureComponent { const { myIssues, openFacets, query } = this.state; const facets = requestFacets - ? Object.keys(openFacets).filter(facet => openFacets[facet]).map(mapFacet).join(',') + ? Object.keys(openFacets) + .filter(facet => openFacets[facet]) + .map(mapFacet) + .join(',') : undefined; const parameters = { @@ -689,29 +692,31 @@ export default class App extends React.PureComponent { return ( <div className="pull-left"> - {checked.length > 0 - ? <div className="dropdown"> - <button id="issues-bulk-change" data-toggle="dropdown"> - {translate('bulk_change')} - <i className="icon-dropdown little-spacer-left" /> - </button> - <ul className="dropdown-menu"> - <li> - <a href="#" onClick={this.handleBulkChangeClick}> - {translateWithParameters('issues.bulk_change', paging ? paging.total : 0)} - </a> - </li> - <li> - <a href="#" onClick={this.handleBulkChangeSelectedClick}> - {translateWithParameters('issues.bulk_change_selected', checked.length)} - </a> - </li> - </ul> - </div> - : <button id="issues-bulk-change" onClick={this.handleBulkChangeClick}> + {checked.length > 0 ? ( + <div className="dropdown"> + <button id="issues-bulk-change" data-toggle="dropdown"> {translate('bulk_change')} - </button>} - {bulkChange != null && + <i className="icon-dropdown little-spacer-left" /> + </button> + <ul className="dropdown-menu"> + <li> + <a href="#" onClick={this.handleBulkChangeClick}> + {translateWithParameters('issues.bulk_change', paging ? paging.total : 0)} + </a> + </li> + <li> + <a href="#" onClick={this.handleBulkChangeSelectedClick}> + {translateWithParameters('issues.bulk_change_selected', checked.length)} + </a> + </li> + </ul> + </div> + ) : ( + <button id="issues-bulk-change" onClick={this.handleBulkChangeClick}> + {translate('bulk_change')} + </button> + )} + {bulkChange != null && ( <BulkChangeModal component={component} currentUser={currentUser} @@ -719,7 +724,8 @@ export default class App extends React.PureComponent { onClose={this.closeBulkChange} onDone={this.handleBulkChangeDone} organization={this.props.organization} - />} + /> + )} </div> ); } @@ -730,11 +736,12 @@ export default class App extends React.PureComponent { return ( <div className="layout-page-filters"> - {currentUser.isLoggedIn && + {currentUser.isLoggedIn && ( <MyIssuesFilter myIssues={this.state.myIssues} onMyIssuesChange={this.handleMyIssuesChange} - />} + /> + )} <FiltersHeader displayReset={this.isFiltered()} onReset={this.handleReset} /> <Sidebar component={component} @@ -776,8 +783,9 @@ export default class App extends React.PureComponent { selectedLocationIndex={this.state.selectedLocationIndex} /> {paging != null && - paging.total > 0 && - <ListFooter total={paging.total} count={issues.length} loadMore={this.fetchMoreIssues} />} + paging.total > 0 && ( + <ListFooter total={paging.total} count={issues.length} loadMore={this.fetchMoreIssues} /> + )} </div> ); } @@ -808,7 +816,7 @@ export default class App extends React.PureComponent { return ( <div> - {paging.total > 0 && + {paging.total > 0 && ( <IssuesList branch={this.props.branch && getBranchName(branch)} checked={this.state.checked} @@ -822,10 +830,12 @@ export default class App extends React.PureComponent { openPopup={this.state.openPopup} organization={organization} selectedIssue={selectedIssue} - />} + /> + )} - {paging.total > 0 && - <ListFooter total={paging.total} count={issues.length} loadMore={this.fetchMoreIssues} />} + {paging.total > 0 && ( + <ListFooter total={paging.total} count={issues.length} loadMore={this.fetchMoreIssues} /> + )} {paging.total === 0 && <EmptySearch />} </div> @@ -841,16 +851,15 @@ export default class App extends React.PureComponent { return ( <div className="pull-right note"> <span className="shortcut-button little-spacer-right">alt</span> - <span className="little-spacer-right"> - {'+'} - </span> + <span className="little-spacer-right">{'+'}</span> <span className="shortcut-button little-spacer-right">↑</span> <span className="shortcut-button little-spacer-right">↓</span> - {hasSeveralFlows && + {hasSeveralFlows && ( <span> <span className="shortcut-button little-spacer-right">←</span> <span className="shortcut-button little-spacer-right">→</span> - </span>} + </span> + )} {translate('issues.to_navigate_issue_locations')} </div> ); @@ -870,21 +879,23 @@ export default class App extends React.PureComponent { <div className="layout-page-header-panel-inner layout-page-main-header-inner"> <div className="layout-page-main-inner"> {this.renderBulkChange(openIssue)} - {openIssue != null - ? <div className="pull-left width-60"> - <ComponentBreadcrumbs - branch={this.props.branch && getBranchName(this.props.branch)} - component={component} - issue={openIssue} - organization={this.props.organization} - /> - </div> - : <PageActions - loading={this.state.loading} - onReload={this.handleReload} - paging={paging} - selectedIndex={selectedIndex} - />} + {openIssue != null ? ( + <div className="pull-left width-60"> + <ComponentBreadcrumbs + branch={this.props.branch && getBranchName(this.props.branch)} + component={component} + issue={openIssue} + organization={this.props.organization} + /> + </div> + ) : ( + <PageActions + loading={this.state.loading} + onReload={this.handleReload} + paging={paging} + selectedIndex={selectedIndex} + /> + )} {this.renderShortcutsForLocations()} </div> </div> @@ -892,21 +903,23 @@ export default class App extends React.PureComponent { <div className="layout-page-main-inner"> <div> - {openIssue - ? <IssuesSourceViewer - branch={this.props.branch && getBranchName(this.props.branch)} - component={component} - openIssue={openIssue} - loadIssues={this.fetchIssuesForComponent} - onIssueChange={this.handleIssueChange} - onIssueSelect={this.openIssue} - onLocationSelect={this.selectLocation} - selectedFlowIndex={this.state.selectedFlowIndex} - selectedLocationIndex={ - this.state.locationsNavigator ? this.state.selectedLocationIndex : null - } - /> - : this.renderList()} + {openIssue ? ( + <IssuesSourceViewer + branch={this.props.branch && getBranchName(this.props.branch)} + component={component} + openIssue={openIssue} + loadIssues={this.fetchIssuesForComponent} + onIssueChange={this.handleIssueChange} + onIssueSelect={this.openIssue} + onLocationSelect={this.selectLocation} + selectedFlowIndex={this.state.selectedFlowIndex} + selectedLocationIndex={ + this.state.locationsNavigator ? this.state.selectedLocationIndex : null + } + /> + ) : ( + this.renderList() + )} </div> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js index a0ce352c35b..c1202812707 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js +++ b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js @@ -226,63 +226,64 @@ export default class BulkChangeModal extends React.PureComponent { })); } - renderCancelButton = () => + renderCancelButton = () => ( <a id="bulk-change-cancel" href="#" onClick={this.handleCloseClick}> {translate('cancel')} - </a>; + </a> + ); - renderLoading = () => + renderLoading = () => ( <div> <div className="modal-head"> - <h2> - {translate('bulk_change')} - </h2> + <h2>{translate('bulk_change')}</h2> </div> <div className="modal-body"> <div className="text-center"> <i className="spinner spinner-margin" /> </div> </div> - <div className="modal-foot"> - {this.renderCancelButton()} - </div> - </div>; + <div className="modal-foot">{this.renderCancelButton()}</div> + </div> + ); - renderCheckbox = (field /*: string */) => - <Checkbox checked={this.state[field] != null} onCheck={this.handleFieldCheck(field)} />; + renderCheckbox = (field /*: string */) => ( + <Checkbox checked={this.state[field] != null} onCheck={this.handleFieldCheck(field)} /> + ); - renderAffected = (affected /*: number */) => + renderAffected = (affected /*: number */) => ( <div className="pull-right note"> ({translateWithParameters('issue_bulk_change.x_issues', affected)}) - </div>; + </div> + ); renderField = ( field /*: string */, label /*: string */, affected /*: ?number */, input /*: Object */ - ) => + ) => ( <div className="modal-field" id={`issues-bulk-change-${field}`}> - <label htmlFor={field}> - {translate(label)} - </label> + <label htmlFor={field}>{translate(label)}</label> {this.renderCheckbox(field)} {input} {affected != null && this.renderAffected(affected)} - </div>; + </div> + ); - renderAssigneeOption = (option /*: { avatar?: string, email?: string, label: string } */) => + renderAssigneeOption = (option /*: { avatar?: string, email?: string, label: string } */) => ( <span> - {(option.avatar != null || option.email != null) && + {(option.avatar != null || option.email != null) && ( <Avatar className="little-spacer-right" email={option.email} hash={option.avatar} name={option.label} size={16} - />} + /> + )} {option.label} - </span>; + </span> + ); renderAssigneeField = () => { const affected /*: number */ = this.state.issues.filter(hasAction('assign')).length; @@ -315,11 +316,12 @@ export default class BulkChangeModal extends React.PureComponent { const types = ['BUG', 'VULNERABILITY', 'CODE_SMELL']; const options = types.map(type => ({ label: translate('issue.type', type), value: type })); - const optionRenderer = (option /*: { label: string, value: string } */) => + const optionRenderer = (option /*: { label: string, value: string } */) => ( <span> <IssueTypeIcon className="little-spacer-right" query={option.value} /> {option.label} - </span>; + </span> + ); const input = ( <Select @@ -423,10 +425,8 @@ export default class BulkChangeModal extends React.PureComponent { return ( <div className="modal-field"> - <label> - {translate('issue.transition')} - </label> - {transitions.map(transition => + <label>{translate('issue.transition')}</label> + {transitions.map(transition => ( <span key={transition.transition}> <input checked={this.state.transition === transition.transition} @@ -444,7 +444,7 @@ export default class BulkChangeModal extends React.PureComponent { {this.renderAffected(transition.count)} <br /> </span> - )} + ))} </div> ); }; @@ -480,13 +480,12 @@ export default class BulkChangeModal extends React.PureComponent { ); }; - renderNotificationsField = () => + renderNotificationsField = () => ( <div className="modal-field"> - <label htmlFor="send-notifications"> - {translate('issue.send_notifications')} - </label> + <label htmlFor="send-notifications">{translate('issue.send_notifications')}</label> {this.renderCheckbox('notifications')} - </div>; + </div> + ); renderForm = () => { const { issues, paging, submitting } = this.state; @@ -497,16 +496,15 @@ export default class BulkChangeModal extends React.PureComponent { return ( <form id="bulk-change-form" onSubmit={this.handleSubmit}> <div className="modal-head"> - <h2> - {translateWithParameters('issue_bulk_change.form.title', issues.length)} - </h2> + <h2>{translateWithParameters('issue_bulk_change.form.title', issues.length)}</h2> </div> <div className="modal-body"> - {limitReached && + {limitReached && ( <div className="alert alert-warning"> {translateWithParameters('issue_bulk_change.max_issues_reached', issues.length)} - </div>} + </div> + )} {this.renderAssigneeField()} {this.renderTypeField()} diff --git a/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx b/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx index e02644dbda0..6e4b9a13805 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx @@ -47,31 +47,32 @@ export default function ComponentBreadcrumbs({ branch, component, issue, organiz return ( <div className="component-name text-ellipsis"> - {displayOrganization && - <Organization linkClassName="link-no-underline" organizationKey={issue.organization} />} + {displayOrganization && ( + <Organization linkClassName="link-no-underline" organizationKey={issue.organization} /> + )} - {displayProject && + {displayProject && ( <span title={issue.projectName}> <Link to={getProjectUrl(issue.project, branch)} className="link-no-underline"> {limitComponentName(issue.projectName)} </Link> <span className="slash-separator" /> - </span>} + </span> + )} {displaySubProject && - issue.subProject != undefined && - issue.subProjectName != undefined && + issue.subProject != undefined && + issue.subProjectName != undefined && ( <span title={issue.subProjectName}> <Link to={getProjectUrl(issue.subProject, branch)} className="link-no-underline"> {limitComponentName(issue.subProjectName)} </Link> <span className="slash-separator" /> - </span>} + </span> + )} <Link to={getProjectUrl(issue.component, branch)} className="link-no-underline"> - <span title={issue.componentLongName}> - {collapsePath(issue.componentLongName)} - </span> + <span title={issue.componentLongName}>{collapsePath(issue.componentLongName)}</span> </Link> </div> ); diff --git a/server/sonar-web/src/main/js/apps/issues/components/FiltersHeader.js b/server/sonar-web/src/main/js/apps/issues/components/FiltersHeader.js index 3e6448ed6d4..ee8dcadc644 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/FiltersHeader.js +++ b/server/sonar-web/src/main/js/apps/issues/components/FiltersHeader.js @@ -40,16 +40,15 @@ export default class FiltersHeader extends React.PureComponent { render() { return ( <div className="issues-filters-header"> - {this.props.displayReset && + {this.props.displayReset && ( <div className="pull-right"> <button className="button-red" onClick={this.handleResetClick}> {translate('clear_all_filters')} </button> - </div>} + </div> + )} - <h3> - {translate('filters')} - </h3> + <h3>{translate('filters')}</h3> </div> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesCounter.js b/server/sonar-web/src/main/js/apps/issues/components/IssuesCounter.js index b44ed55d61a..310c0c4bcbe 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssuesCounter.js +++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesCounter.js @@ -30,17 +30,19 @@ type Props = { }; */ -const IssuesCounter = (props /*: Props */) => +const IssuesCounter = (props /*: Props */) => ( <span className={props.className}> <strong> - {props.current != null && + {props.current != null && ( <span> {formatMeasure(props.current + 1, 'INT')} {' / '} - </span>} + </span> + )} {formatMeasure(props.total, 'INT')} </strong>{' '} {translate('issues.issues')} - </span>; + </span> +); export default IssuesCounter; diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesList.js b/server/sonar-web/src/main/js/apps/issues/components/IssuesList.js index e2228919ba9..149430e732a 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssuesList.js +++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesList.js @@ -48,7 +48,7 @@ export default class IssuesList extends React.PureComponent { return ( <div> - {issues.map((issue, index) => + {issues.map((issue, index) => ( <ListItem branch={branch} checked={checked.includes(issue.key)} @@ -65,7 +65,7 @@ export default class IssuesList extends React.PureComponent { previousIssue={index > 0 ? issues[index - 1] : null} selected={selectedIssue != null && selectedIssue.key === issue.key} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/components/ListItem.js b/server/sonar-web/src/main/js/apps/issues/components/ListItem.js index c053d0fd2c7..6dc60a3776f 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/ListItem.js +++ b/server/sonar-web/src/main/js/apps/issues/components/ListItem.js @@ -95,7 +95,7 @@ export default class ListItem extends React.PureComponent { return ( <div className="issues-workspace-list-item"> - {displayComponent && + {displayComponent && ( <div className="issues-workspace-list-component"> <ComponentBreadcrumbs branch={branch} @@ -103,7 +103,8 @@ export default class ListItem extends React.PureComponent { issue={this.props.issue} organization={this.props.organization} /> - </div>} + </div> + )} <Issue checked={this.props.checked} issue={issue} diff --git a/server/sonar-web/src/main/js/apps/issues/components/PageActions.js b/server/sonar-web/src/main/js/apps/issues/components/PageActions.js index 199a627d929..e939e60869f 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/PageActions.js +++ b/server/sonar-web/src/main/js/apps/issues/components/PageActions.js @@ -66,8 +66,9 @@ export default class PageActions extends React.PureComponent { <DeferredSpinner className="issues-main-header-spinner" loading={this.props.loading}> <ReloadButton onClick={this.props.onReload} /> </DeferredSpinner> - {paging != null && - <IssuesCounter className="spacer-left" current={selectedIndex} total={paging.total} />} + {paging != null && ( + <IssuesCounter className="spacer-left" current={selectedIndex} total={paging.total} /> + )} </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.js b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.js index 3d741603f62..483e83b1464 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.js +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.js @@ -104,14 +104,15 @@ export default class ConciseIssueBox extends React.PureComponent { selectedFlowIndex={this.props.selectedFlowIndex} /> </div> - {selected && + {selected && ( <ConciseIssueLocationsNavigator issue={issue} onLocationSelect={this.props.onLocationSelect} scroll={this.props.scroll} selectedFlowIndex={this.props.selectedFlowIndex} selectedLocationIndex={this.props.selectedLocationIndex} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueComponent.js b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueComponent.js index 35d46db0fff..fc1d64f9580 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueComponent.js +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueComponent.js @@ -27,9 +27,8 @@ type Props = { }; */ -const ConciseIssueComponent = (props /*: Props */) => - <div className="concise-issue-component note text-ellipsis"> - {collapsePath(props.path, 20)} - </div>; +const ConciseIssueComponent = (props /*: Props */) => ( + <div className="concise-issue-component note text-ellipsis">{collapsePath(props.path, 20)}</div> +); export default ConciseIssueComponent; diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.js b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.js index d9ca0594f50..28a92099f07 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.js +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.js @@ -81,13 +81,13 @@ export default class ConciseIssueLocations extends React.PureComponent { ); }); - return this.state.collapsed - ? <div className="concise-issue-locations pull-right"> - {badges.slice(0, LIMIT)} - {badges.length > LIMIT && this.renderExpandButton()} - </div> - : <div className="concise-issue-locations spacer-top"> - {badges} - </div>; + return this.state.collapsed ? ( + <div className="concise-issue-locations pull-right"> + {badges.slice(0, LIMIT)} + {badges.length > LIMIT && this.renderExpandButton()} + </div> + ) : ( + <div className="concise-issue-locations spacer-top">{badges}</div> + ); } } diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigator.js b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigator.js index fdc31fe2533..ce9285318c8 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigator.js +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigator.js @@ -55,7 +55,7 @@ export default class ConciseIssueLocationsNavigator extends React.PureComponent return ( <div className="spacer-top"> - {locations.map((location, index) => + {locations.map((location, index) => ( <ConciseIssueLocationsNavigatorLocation key={index} index={index} @@ -64,7 +64,7 @@ export default class ConciseIssueLocationsNavigator extends React.PureComponent scroll={this.props.scroll} selected={index === selectedLocationIndex} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigatorLocation.js b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigatorLocation.js index e4af455b43b..fe2a9d91be6 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigatorLocation.js +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigatorLocation.js @@ -60,12 +60,8 @@ export default class ConciseIssueLocationsNavigatorLocation extends React.PureCo className="consice-issue-locations-navigator-location" href="#" onClick={this.handleClick}> - <LocationIndex selected={this.props.selected}> - {this.props.index + 1} - </LocationIndex> - <LocationMessage selected={this.props.selected}> - {this.props.message} - </LocationMessage> + <LocationIndex selected={this.props.selected}>{this.props.index + 1}</LocationIndex> + <LocationMessage selected={this.props.selected}>{this.props.message}</LocationMessage> </a> </div> ); diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesList.js b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesList.js index f8700d6035d..e9def821c70 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesList.js +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesList.js @@ -48,7 +48,7 @@ export default class ConciseIssuesList extends React.PureComponent { render() { return ( <div> - {this.props.issues.map((issue, index) => + {this.props.issues.map((issue, index) => ( <ConciseIssue key={issue.key} issue={issue} @@ -61,7 +61,7 @@ export default class ConciseIssuesList extends React.PureComponent { selectedFlowIndex={this.props.selectedFlowIndex} selectedLocationIndex={this.props.selectedLocationIndex} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesListHeader.js b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesListHeader.js index a38dd89363a..13e22d32d43 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesListHeader.js +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesListHeader.js @@ -41,9 +41,11 @@ export default function ConciseIssuesListHeader(props /*: Props */) { <header className="layout-page-header-panel concise-issues-list-header"> <div className="layout-page-header-panel-inner concise-issues-list-header-inner"> <BackButton className="pull-left" onClick={props.onBackClick} /> - {props.loading - ? <i className="spinner pull-right" /> - : <ReloadButton className="pull-right" onClick={props.onReload} />} + {props.loading ? ( + <i className="spinner pull-right" /> + ) : ( + <ReloadButton className="pull-right" onClick={props.onReload} /> + )} {paging != null && <IssuesCounter current={selectedIndex} total={paging.total} />} </div> </header> diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/AssigneeFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/AssigneeFacet.js index 6ed62ddc478..d7e0b4b0e21 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/AssigneeFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/AssigneeFacet.js @@ -124,13 +124,14 @@ export default class AssigneeFacet extends React.PureComponent { renderOption = (option /*: { avatar: string, label: string } */) => { return ( <span> - {option.avatar != null && + {option.avatar != null && ( <Avatar className="little-spacer-right" hash={option.avatar} name={option.label} size={16} - />} + /> + )} {option.label} </span> ); @@ -153,7 +154,7 @@ export default class AssigneeFacet extends React.PureComponent { return ( <FacetItemsList> - {assignees.map(assignee => + {assignees.map(assignee => ( <FacetItem active={this.isAssigneeActive(assignee)} key={assignee} @@ -162,7 +163,7 @@ export default class AssigneeFacet extends React.PureComponent { stat={formatFacetStat(this.getStat(assignee), this.props.facetMode)} value={assignee} /> - )} + ))} </FacetItemsList> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.js index 6aa249a574b..ee9fce637fd 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.js @@ -79,7 +79,7 @@ export default class AuthorFacet extends React.PureComponent { return ( <FacetItemsList> - {authors.map(author => + {authors.map(author => ( <FacetItem active={this.props.authors.includes(author)} key={author} @@ -88,7 +88,7 @@ export default class AuthorFacet extends React.PureComponent { stat={formatFacetStat(this.getStat(author), this.props.facetMode)} value={author} /> - )} + ))} </FacetItemsList> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.js index 95174567951..721c9c75e88 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.js @@ -227,47 +227,53 @@ export default class CreationDateFacet extends React.PureComponent { onClick={this.handlePeriodClick} value="" /> - {component == null && + {component == null && ( <FacetItem active={createdInLast === '1w'} name={translate('issues.facet.createdAt.last_week')} onClick={this.handlePeriodClick} value="1w" - />} - {component == null && + /> + )} + {component == null && ( <FacetItem active={createdInLast === '1m'} name={translate('issues.facet.createdAt.last_month')} onClick={this.handlePeriodClick} value="1m" - />} - {component == null && + /> + )} + {component == null && ( <FacetItem active={createdInLast === '1y'} name={translate('issues.facet.createdAt.last_year')} onClick={this.handlePeriodClick} value="1y" - />} - {component != null && + /> + )} + {component != null && ( <FacetItem active={sinceLeakPeriod} name={translate('issues.leak_period')} onClick={this.handleLeakPeriodClick} value="" - />} + /> + )} </div> ); } renderInner() { const { createdAt } = this.props; - return createdAt - ? this.renderExactDate() - : <div> - {this.renderBarChart()} - {this.renderPeriodSelectors()} - {this.renderPredefinedPeriods()} - </div>; + return createdAt ? ( + this.renderExactDate() + ) : ( + <div> + {this.renderBarChart()} + {this.renderPeriodSelectors()} + {this.renderPredefinedPeriods()} + </div> + ); } render() { diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/DirectoryFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/DirectoryFacet.js index 030a8b3bb35..c860c1a0d4b 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/DirectoryFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/DirectoryFacet.js @@ -100,7 +100,7 @@ export default class DirectoryFacet extends React.PureComponent { return ( <FacetItemsList> - {directories.map(directory => + {directories.map(directory => ( <FacetItem active={this.props.directories.includes(directory)} key={directory} @@ -109,7 +109,7 @@ export default class DirectoryFacet extends React.PureComponent { stat={formatFacetStat(this.getStat(directory), this.props.facetMode)} value={directory} /> - )} + ))} </FacetItemsList> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/FacetMode.js b/server/sonar-web/src/main/js/apps/issues/sidebar/FacetMode.js index 59c963a1178..9603b7cae75 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/FacetMode.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/FacetMode.js @@ -50,7 +50,7 @@ export default class FacetMode extends React.PureComponent { <FacetHeader name={translate('issues.facet.mode')} /> <FacetItemsList> - {modes.map(mode => + {modes.map(mode => ( <FacetItem active={facetMode === mode} halfWidth={true} @@ -59,7 +59,7 @@ export default class FacetMode extends React.PureComponent { onClick={this.handleItemClick} value={mode} /> - )} + ))} </FacetItemsList> </FacetBox> ); diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.js index aeb00d0fc0f..b3b85d83026 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.js @@ -96,7 +96,7 @@ export default class FileFacet extends React.PureComponent { return ( <FacetItemsList> - {files.map(file => + {files.map(file => ( <FacetItem active={this.props.files.includes(file)} key={file} @@ -105,7 +105,7 @@ export default class FileFacet extends React.PureComponent { stat={formatFacetStat(this.getStat(file), this.props.facetMode)} value={file} /> - )} + ))} </FacetItemsList> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/LanguageFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/LanguageFacet.js index 317cca77f28..5250e30be02 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/LanguageFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/LanguageFacet.js @@ -92,7 +92,7 @@ export default class LanguageFacet extends React.PureComponent { return ( <FacetItemsList> - {languages.map(language => + {languages.map(language => ( <FacetItem active={this.props.languages.includes(language)} key={language} @@ -101,7 +101,7 @@ export default class LanguageFacet extends React.PureComponent { stat={formatFacetStat(this.getStat(language), this.props.facetMode)} value={language} /> - )} + ))} </FacetItemsList> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ModuleFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/ModuleFacet.js index 6a01a9f51fd..7c787c479ec 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/ModuleFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ModuleFacet.js @@ -93,7 +93,7 @@ export default class ModuleFacet extends React.PureComponent { return ( <FacetItemsList> - {modules.map(module => + {modules.map(module => ( <FacetItem active={this.props.modules.includes(module)} key={module} @@ -102,7 +102,7 @@ export default class ModuleFacet extends React.PureComponent { stat={formatFacetStat(this.getStat(module), this.props.facetMode)} value={module} /> - )} + ))} </FacetItemsList> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.js index ab329263ce6..9bb838768b8 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.js @@ -108,20 +108,20 @@ export default class ProjectFacet extends React.PureComponent { renderName(project /*: string */) /*: React.Element<*> | string */ { const { organization, referencedComponents } = this.props; - return referencedComponents[project] - ? <span> - <QualifierIcon className="little-spacer-right" qualifier="TRK" /> - {!organization && - <Organization - link={false} - organizationKey={referencedComponents[project].organization} - />} - {referencedComponents[project].name} - </span> - : <span> - <QualifierIcon className="little-spacer-right" qualifier="TRK" /> - {project} - </span>; + return referencedComponents[project] ? ( + <span> + <QualifierIcon className="little-spacer-right" qualifier="TRK" /> + {!organization && ( + <Organization link={false} organizationKey={referencedComponents[project].organization} /> + )} + {referencedComponents[project].name} + </span> + ) : ( + <span> + <QualifierIcon className="little-spacer-right" qualifier="TRK" /> + {project} + </span> + ); } renderOption = (option /*: { label: string, organization: string } */) => { @@ -144,7 +144,7 @@ export default class ProjectFacet extends React.PureComponent { return ( <FacetItemsList> - {projects.map(project => + {projects.map(project => ( <FacetItem active={this.props.projects.includes(project)} key={project} @@ -153,7 +153,7 @@ export default class ProjectFacet extends React.PureComponent { stat={formatFacetStat(this.getStat(project), this.props.facetMode)} value={project} /> - )} + ))} </FacetItemsList> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.js index 5c09c1489bc..d3732a264ab 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.js @@ -116,10 +116,7 @@ export default class ResolutionFacet extends React.PureComponent { values={this.props.resolutions.length} /> - {this.props.open && - <FacetItemsList> - {resolutions.map(this.renderItem)} - </FacetItemsList>} + {this.props.open && <FacetItemsList>{resolutions.map(this.renderItem)}</FacetItemsList>} </FacetBox> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.js index 22e4e4194c3..120cf64f94b 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.js @@ -104,7 +104,7 @@ export default class RuleFacet extends React.PureComponent { return ( <FacetItemsList> - {rules.map(rule => + {rules.map(rule => ( <FacetItem active={this.props.rules.includes(rule)} key={rule} @@ -113,7 +113,7 @@ export default class RuleFacet extends React.PureComponent { stat={formatFacetStat(this.getStat(rule), this.props.facetMode)} value={rule} /> - )} + ))} </FacetItemsList> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.js index 96685a9c50b..2da4dece8af 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.js @@ -100,10 +100,7 @@ export default class SeverityFacet extends React.PureComponent { values={this.props.severities.length} /> - {this.props.open && - <FacetItemsList> - {severities.map(this.renderItem)} - </FacetItemsList>} + {this.props.open && <FacetItemsList>{severities.map(this.renderItem)}</FacetItemsList>} </FacetBox> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.js b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.js index 28164b903b1..0cf7de366c9 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.js @@ -142,7 +142,7 @@ export default class Sidebar extends React.PureComponent { stats={facets.tags} tags={query.tags} /> - {displayProjectsFacet && + {displayProjectsFacet && ( <ProjectFacet component={component} facetMode={query.facetMode} @@ -153,8 +153,9 @@ export default class Sidebar extends React.PureComponent { projects={query.projects} referencedComponents={this.props.referencedComponents} stats={facets.projects} - />} - {displayModulesFacet && + /> + )} + {displayModulesFacet && ( <ModuleFacet facetMode={query.facetMode} onChange={this.props.onFilterChange} @@ -163,8 +164,9 @@ export default class Sidebar extends React.PureComponent { modules={query.modules} referencedComponents={this.props.referencedComponents} stats={facets.modules} - />} - {displayDirectoriesFacet && + /> + )} + {displayDirectoriesFacet && ( <DirectoryFacet facetMode={query.facetMode} onChange={this.props.onFilterChange} @@ -173,8 +175,9 @@ export default class Sidebar extends React.PureComponent { directories={query.directories} referencedComponents={this.props.referencedComponents} stats={facets.directories} - />} - {displayFilesFacet && + /> + )} + {displayFilesFacet && ( <FileFacet facetMode={query.facetMode} onChange={this.props.onFilterChange} @@ -183,8 +186,9 @@ export default class Sidebar extends React.PureComponent { files={query.files} referencedComponents={this.props.referencedComponents} stats={facets.files} - />} - {!this.props.myIssues && + /> + )} + {!this.props.myIssues && ( <AssigneeFacet component={component} facetMode={query.facetMode} @@ -196,8 +200,9 @@ export default class Sidebar extends React.PureComponent { assignees={query.assignees} referencedUsers={this.props.referencedUsers} stats={facets.assignees} - />} - {displayAuthorFacet && + /> + )} + {displayAuthorFacet && ( <AuthorFacet facetMode={query.facetMode} onChange={this.props.onFilterChange} @@ -205,7 +210,8 @@ export default class Sidebar extends React.PureComponent { open={!!openFacets.authors} authors={query.authors} stats={facets.authors} - />} + /> + )} <LanguageFacet facetMode={query.facetMode} onChange={this.props.onFilterChange} diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.js index c2bc9188681..4c4ac2cc1f6 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.js @@ -107,10 +107,7 @@ export default class StatusFacet extends React.PureComponent { values={this.props.statuses.length} /> - {this.props.open && - <FacetItemsList> - {statuses.map(this.renderItem)} - </FacetItemsList>} + {this.props.open && <FacetItemsList>{statuses.map(this.renderItem)}</FacetItemsList>} </FacetBox> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.js index 3cd3c174c92..a42d19f5287 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.js @@ -108,7 +108,7 @@ export default class TagFacet extends React.PureComponent { return ( <FacetItemsList> - {tags.map(tag => + {tags.map(tag => ( <FacetItem active={this.props.tags.includes(tag)} key={tag} @@ -117,7 +117,7 @@ export default class TagFacet extends React.PureComponent { stat={formatFacetStat(this.getStat(tag), this.props.facetMode)} value={tag} /> - )} + ))} </FacetItemsList> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.js b/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.js index b0099e1e19b..aafbf49e471 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.js @@ -103,10 +103,7 @@ export default class TypeFacet extends React.PureComponent { values={this.props.types.length} /> - {this.props.open && - <FacetItemsList> - {types.map(this.renderItem)} - </FacetItemsList>} + {this.props.open && <FacetItemsList>{types.map(this.renderItem)}</FacetItemsList>} </FacetBox> ); } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AssigneeFacet-test.js b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AssigneeFacet-test.js index 9bd376753f4..b394c9f478e 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AssigneeFacet-test.js +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AssigneeFacet-test.js @@ -64,7 +64,10 @@ it('should render footer select option', () => { it('should call onChange', () => { const onChange = jest.fn(); const wrapper = renderAssigneeFacet({ assignees: ['foo'], onChange }); - const itemOnClick = wrapper.find('FacetItem').first().prop('onClick'); + const itemOnClick = wrapper + .find('FacetItem') + .first() + .prop('onClick'); itemOnClick(''); expect(onChange).lastCalledWith({ assigned: false, assignees: [] }); diff --git a/server/sonar-web/src/main/js/apps/organizations/components/MembersList.js b/server/sonar-web/src/main/js/apps/organizations/components/MembersList.js index ff31beaa424..c40344c98bd 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/MembersList.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/MembersList.js @@ -40,7 +40,7 @@ export default class MembersList extends React.PureComponent { return ( <table className="data zebra"> <tbody> - {this.props.members.map(member => + {this.props.members.map(member => ( <MembersListItem key={member.login} member={member} @@ -49,7 +49,7 @@ export default class MembersList extends React.PureComponent { removeMember={this.props.removeMember} updateMemberGroups={this.props.updateMemberGroups} /> - )} + ))} </tbody> </table> ); diff --git a/server/sonar-web/src/main/js/apps/organizations/components/MembersListHeader.js b/server/sonar-web/src/main/js/apps/organizations/components/MembersListHeader.js index b2337ae8499..8303d700623 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/MembersListHeader.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/MembersListHeader.js @@ -38,11 +38,12 @@ export default class MembersListHeader extends React.PureComponent { return ( <div className="panel panel-vertical bordered-bottom spacer-bottom"> <UsersSearch onSearch={this.props.handleSearch} className="display-inline-block" /> - {total != null && + {total != null && ( <span className="pull-right little-spacer-top"> <strong>{formatMeasure(total, 'INT')}</strong>{' '} {translate('organization.members.members')} - </span>} + </span> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/organizations/components/MembersListItem.js b/server/sonar-web/src/main/js/apps/organizations/components/MembersListItem.js index 9432c2ac707..b56f0a4e917 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/MembersListItem.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/MembersListItem.js @@ -50,21 +50,18 @@ export default class MembersListItem extends React.PureComponent { <Avatar hash={member.avatar} email={member.email} name={member.name} size={AVATAR_SIZE} /> </td> <td className="nowrap text-middle"> - <strong> - {member.name} - </strong> - <span className="note little-spacer-left"> - {member.login} - </span> + <strong>{member.name}</strong> + <span className="note little-spacer-left">{member.login}</span> </td> - {organization.canAdmin && + {organization.canAdmin && ( <td className="text-right text-middle"> {translateWithParameters( 'organization.members.x_groups', formatMeasure(member.groupCount || 0, 'INT') )} - </td>} - {organization.canAdmin && + </td> + )} + {organization.canAdmin && ( <td className="nowrap text-middle text-right"> <div className="dropdown"> <button @@ -91,7 +88,8 @@ export default class MembersListItem extends React.PureComponent { </li> </ul> </div> - </td>} + </td> + )} </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.js b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.js index 78c7637a840..ef7ebd4d5e4 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.js @@ -70,27 +70,25 @@ class OrganizationDelete extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.handleCloseModal}> <header className="modal-head"> - <h2> - {translate('organization.delete')} - </h2> + <h2>{translate('organization.delete')}</h2> </header> <form onSubmit={this.handleSubmit}> - <div className="modal-body"> - {translate('organization.delete.question')} - </div> + <div className="modal-body">{translate('organization.delete.question')}</div> <footer className="modal-foot"> - {this.state.loading - ? <i className="spinner" /> - : <div> - <button type="submit" className="button-red"> - {translate('delete')} - </button> - <button type="reset" className="button-link" onClick={this.handleCloseModal}> - {translate('cancel')} - </button> - </div>} + {this.state.loading ? ( + <i className="spinner" /> + ) : ( + <div> + <button type="submit" className="button-red"> + {translate('delete')} + </button> + <button type="reset" className="button-link" onClick={this.handleCloseModal}> + {translate('cancel')} + </button> + </div> + )} </footer> </form> </Modal> @@ -104,12 +102,8 @@ class OrganizationDelete extends React.PureComponent { <Helmet title={title} /> <header className="page-header"> - <h1 className="page-title"> - {title} - </h1> - <div className="page-description"> - {translate('organization.delete.description')} - </div> + <h1 className="page-title">{title}</h1> + <div className="page-description">{translate('organization.delete.description')}</div> </header> <div> diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.js b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.js index 1a406fa3109..22ea72f7c6a 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.js @@ -104,9 +104,7 @@ class OrganizationEdit extends React.PureComponent { <Helmet title={title} /> <header className="page-header"> - <h1 className="page-title"> - {title} - </h1> + <h1 className="page-title">{title}</h1> </header> <form onSubmit={this.handleSubmit}> @@ -130,9 +128,7 @@ class OrganizationEdit extends React.PureComponent { </div> </div> <div className="modal-field"> - <label htmlFor="organization-avatar"> - {translate('organization.avatar')} - </label> + <label htmlFor="organization-avatar">{translate('organization.avatar')}</label> <input id="organization-avatar" name="avatar" @@ -145,19 +141,18 @@ class OrganizationEdit extends React.PureComponent { <div className="modal-field-description"> {translate('organization.avatar.description')} </div> - {!!this.state.avatarImage && + {!!this.state.avatarImage && ( <div className="spacer-top spacer-bottom"> <div className="little-spacer-bottom"> {translate('organization.avatar.preview')} {':'} </div> <img src={this.state.avatarImage} alt="" height={30} /> - </div>} + </div> + )} </div> <div className="modal-field"> - <label htmlFor="organization-description"> - {translate('description')} - </label> + <label htmlFor="organization-description">{translate('description')}</label> <textarea id="organization-description" name="description" @@ -172,9 +167,7 @@ class OrganizationEdit extends React.PureComponent { </div> </div> <div className="modal-field"> - <label htmlFor="organization-url"> - {translate('organization.url')} - </label> + <label htmlFor="organization-url">{translate('organization.url')}</label> <input id="organization-url" name="url" diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationMembers.js b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationMembers.js index d6248f2579e..19f82e66de2 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationMembers.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationMembers.js @@ -90,7 +90,7 @@ export default class OrganizationMembers extends React.PureComponent { <div className="page page-limited"> <Helmet title={translate('organization.members.page')} /> <MembersPageHeader loading={status.loading} total={status.total}> - {organization.canAdmin && + {organization.canAdmin && ( <div className="page-actions"> <div className="button-group"> <AddMemberForm @@ -99,7 +99,8 @@ export default class OrganizationMembers extends React.PureComponent { memberLogins={this.props.memberLogins} /> </div> - </div>} + </div> + )} </MembersPageHeader> <MembersListHeader total={status.total} handleSearch={this.handleSearchMembers} /> <MembersList @@ -109,13 +110,14 @@ export default class OrganizationMembers extends React.PureComponent { removeMember={this.removeMember} updateMemberGroups={this.updateMemberGroups} /> - {status.total != null && + {status.total != null && ( <ListFooter count={members.length} total={status.total} ready={!status.loading} loadMore={this.handleLoadMoreMembers} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/organizations/components/forms/AddMemberForm.js b/server/sonar-web/src/main/js/apps/organizations/components/forms/AddMemberForm.js index 4e7720037a9..8eec0075670 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/forms/AddMemberForm.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/forms/AddMemberForm.js @@ -85,16 +85,12 @@ export default class AddMemberForm extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.closeForm}> <header className="modal-head"> - <h2> - {translate('users.add')} - </h2> + <h2>{translate('users.add')}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body"> <div className="modal-large-field"> - <label> - {translate('users.search_description')} - </label> + <label>{translate('users.search_description')}</label> <UsersSelectSearch autoFocus={true} selectedUser={this.state.selectedMember} diff --git a/server/sonar-web/src/main/js/apps/organizations/components/forms/ManageMemberGroupsForm.js b/server/sonar-web/src/main/js/apps/organizations/components/forms/ManageMemberGroupsForm.js index 7ff2d49fb2d..60892a2aa87 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/forms/ManageMemberGroupsForm.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/forms/ManageMemberGroupsForm.js @@ -113,9 +113,7 @@ export default class ManageMemberGroupsForm extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.closeForm}> <header className="modal-head"> - <h2> - {translate('organization.members.manage_groups')} - </h2> + <h2>{translate('organization.members.manage_groups')}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body"> @@ -126,23 +124,22 @@ export default class ManageMemberGroupsForm extends React.PureComponent { )} </strong>{' '} {this.state.loading && <i className="spinner" />} - {!this.state.loading && + {!this.state.loading && ( <ul className="list-spaced"> - {this.props.organizationGroups.map(group => + {this.props.organizationGroups.map(group => ( <OrganizationGroupCheckbox key={group.id} group={group} checked={this.isGroupSelected(group.name)} onCheck={this.onCheck} /> - )} - </ul>} + ))} + </ul> + )} </div> <footer className="modal-foot"> <div> - <button type="submit"> - {translate('save')} - </button> + <button type="submit">{translate('save')}</button> <button type="reset" className="button-link" onClick={this.closeForm}> {translate('cancel')} </button> diff --git a/server/sonar-web/src/main/js/apps/organizations/components/forms/RemoveMemberForm.js b/server/sonar-web/src/main/js/apps/organizations/components/forms/RemoveMemberForm.js index 3adb1be7f8c..7be06862158 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/forms/RemoveMemberForm.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/forms/RemoveMemberForm.js @@ -69,9 +69,7 @@ export default class RemoveMemberForm extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.closeForm}> <header className="modal-head"> - <h2> - {translate('users.remove')} - </h2> + <h2>{translate('users.remove')}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body markdown"> diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.js b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.js index 08732baa04d..aa28e0de170 100644 --- a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.js +++ b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.js @@ -86,12 +86,13 @@ export default class OrganizationNavigation extends React.PureComponent { {translate('edit')} </Link> </li> - {organization.canDelete && + {organization.canDelete && ( <li> <Link to={`/organizations/${organization.key}/delete`} activeClassName="active"> {translate('delete')} </Link> - </li>} + </li> + )} </ul> </li> ); @@ -126,9 +127,7 @@ export default class OrganizationNavigation extends React.PureComponent { href="#"> {translate('more')} <i className="icon-dropdown" /> </a> - <ul className="dropdown-menu"> - {extensions.map(this.renderExtension)} - </ul> + <ul className="dropdown-menu">{extensions.map(this.renderExtension)}</ul> </li> ); } else { @@ -160,23 +159,23 @@ export default class OrganizationNavigation extends React.PureComponent { <Link to={`/organizations/${organization.key}`} className="link-base-color link-no-underline"> - <strong> - {organization.name} - </strong> + <strong>{organization.name}</strong> </Link> </h1> - {organization.description != null && + {organization.description != null && ( <div className="navbar-context-description"> <p className="text-limited text-top" title={organization.description}> {organization.description} </p> - </div>} + </div> + )} </div> <div className="navbar-context-meta"> - {!!organization.avatar && - <img src={organization.avatar} height={30} alt={organization.name} />} - {organization.url != null && + {!!organization.avatar && ( + <img src={organization.avatar} height={30} alt={organization.name} /> + )} + {organization.url != null && ( <div> <p className="text-limited text-top"> <a @@ -187,7 +186,8 @@ export default class OrganizationNavigation extends React.PureComponent { {organization.url} </a> </p> - </div>} + </div> + )} </div> <NavBarTabs> diff --git a/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.js b/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.js index aaca5381cb4..814fa786ae2 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.js +++ b/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.js @@ -75,15 +75,17 @@ export default class ApplicationLeakPeriodLegend extends React.Component { }; renderOverlay = () => - this.state.leaks != null - ? <ul className="text-left"> - {this.state.leaks.map(leak => - <li key={leak.project}> - {leak.projectName}: <DateTooltipFormatter date={leak.date} /> - </li> - )} - </ul> - : <i className="spinner spinner-margin" />; + this.state.leaks != null ? ( + <ul className="text-left"> + {this.state.leaks.map(leak => ( + <li key={leak.project}> + {leak.projectName}: <DateTooltipFormatter date={leak.date} /> + </li> + ))} + </ul> + ) : ( + <i className="spinner spinner-margin" /> + ); render() { return ( diff --git a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js index 3d407d434ca..f89d83cf480 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js +++ b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js @@ -35,9 +35,7 @@ export default function EmptyOverview({ component } /*: Props */) { return ( <div className="page page-limited"> - <div className="alert alert-warning"> - {translate('provisioning.no_analysis')} - </div> + <div className="alert alert-warning">{translate('provisioning.no_analysis')}</div> <div className="big-spacer-top"> {head} @@ -50,12 +48,8 @@ export default function EmptyOverview({ component } /*: Props */) { </div> <div className="big-spacer-top"> - <h4> - {translate('key')} - </h4> - <code> - {component.key} - </code> + <h4>{translate('key')}</h4> + <code>{component.key}</code> </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.js b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.js index 89181eecc93..ff5273e8797 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.js +++ b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.js @@ -85,7 +85,7 @@ export default function LeakPeriodLegend({ period } /*: { period: Period } */) { const leakPeriodDate = getPeriodDate(period); const tooltip = ( <DateFormatter date={leakPeriodDate} long={true}> - {formattedLeakPeriodDate => + {formattedLeakPeriodDate => ( <span> {translateWithParameters( ['date'].includes(period.mode) @@ -93,7 +93,8 @@ export default function LeakPeriodLegend({ period } /*: { period: Period } */) { : 'overview.started_on_x', formattedLeakPeriodDate )} - </span>} + </span> + )} </DateFormatter> ); return ( @@ -102,13 +103,14 @@ export default function LeakPeriodLegend({ period } /*: { period: Period } */) { {translateWithParameters('overview.leak_period_x', leakPeriodLabel)} <br /> <DateFromNow date={leakPeriodDate}> - {fromNow => + {fromNow => ( <span className="note"> {translateWithParameters( ['date'].includes(period.mode) ? 'overview.last_analysis_x' : 'overview.started_x', fromNow )} - </span>} + </span> + )} </DateFromNow> </div> </Tooltip> diff --git a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js index e3dd3b349a8..d5cb1b15caf 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js +++ b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js @@ -180,9 +180,11 @@ export default class OverviewApp extends React.PureComponent { <div className="page page-limited"> <div className="overview page-with-sidebar"> <div className="overview-main page-main"> - {component.qualifier === 'APP' - ? <ApplicationQualityGate component={component} /> - : <QualityGate branch={branchName} component={component} measures={measures} />} + {component.qualifier === 'APP' ? ( + <ApplicationQualityGate component={component} /> + ) : ( + <QualityGate branch={branchName} component={component} measures={measures} /> + )} <div className="overview-domains-list"> <BugsAndVulnerabilities {...domainProps} /> diff --git a/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.js b/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.js index 9bb67dd44cc..1494366789d 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.js +++ b/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.js @@ -86,18 +86,14 @@ export default class AnalysesList extends React.PureComponent { renderList(analyses /*: Array<AnalysisType> */) { if (!analyses.length) { - return ( - <p className="spacer-top note"> - {translate('no_results')} - </p> - ); + return <p className="spacer-top note">{translate('no_results')}</p>; } return ( <ul className="spacer-top"> - {analyses.map(analysis => + {analyses.map(analysis => ( <Analysis key={analysis.key} analysis={analysis} qualifier={this.props.qualifier} /> - )} + ))} </ul> ); } @@ -111,9 +107,7 @@ export default class AnalysesList extends React.PureComponent { return ( <div className="overview-meta-card"> - <h4 className="overview-meta-header"> - {translate('project_activity.page')} - </h4> + <h4 className="overview-meta-header">{translate('project_activity.page')}</h4> <PreviewGraph branch={this.props.branch} diff --git a/server/sonar-web/src/main/js/apps/overview/events/Analysis.js b/server/sonar-web/src/main/js/apps/overview/events/Analysis.js index 5a9f7cc7807..66bf60bfc36 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/Analysis.js +++ b/server/sonar-web/src/main/js/apps/overview/events/Analysis.js @@ -50,13 +50,13 @@ export default function Analysis(props /*: Props */) { </strong> </div> - {sortedEvents.length > 0 - ? <div className="project-activity-events"> - {sortedEvents.map(event => <Event event={event} key={event.key} />)} - </div> - : <span className="note"> - {translate('project_activity.analyzed', props.qualifier)} - </span>} + {sortedEvents.length > 0 ? ( + <div className="project-activity-events"> + {sortedEvents.map(event => <Event event={event} key={event.key} />)} + </div> + ) : ( + <span className="note">{translate('project_activity.analyzed', props.qualifier)}</span> + )} </li> ); } diff --git a/server/sonar-web/src/main/js/apps/overview/events/Event.js b/server/sonar-web/src/main/js/apps/overview/events/Event.js index bf62a5bd1cc..7314cc4bb61 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/Event.js +++ b/server/sonar-web/src/main/js/apps/overview/events/Event.js @@ -27,25 +27,19 @@ export default function Event(props /*: { event: EventType } */) { const { event } = props; if (event.category === 'VERSION') { - return ( - <span className="overview-analysis-event badge"> - {props.event.name} - </span> - ); + return <span className="overview-analysis-event badge">{props.event.name}</span>; } return ( <span className="overview-analysis-event"> <span className="note">{translate('event.category', event.category)}:</span>{' '} - {event.description - ? <Tooltip overlay={event.description} placement="left" mouseEnterDelay={0.5}> - <strong> - {event.name} - </strong> - </Tooltip> - : <strong> - {event.name} - </strong>} + {event.description ? ( + <Tooltip overlay={event.description} placement="left" mouseEnterDelay={0.5}> + <strong>{event.name}</strong> + </Tooltip> + ) : ( + <strong>{event.name}</strong> + )} </span> ); } diff --git a/server/sonar-web/src/main/js/apps/overview/events/PreviewGraph.js b/server/sonar-web/src/main/js/apps/overview/events/PreviewGraph.js index 8560836595f..69a7f843797 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/PreviewGraph.js +++ b/server/sonar-web/src/main/js/apps/overview/events/PreviewGraph.js @@ -153,7 +153,7 @@ export default class PreviewGraph extends React.PureComponent { const { graph, selectedDate, series, tooltipIdx, tooltipXPos } = this.state; return ( <AutoSizer disableHeight={true}> - {({ width }) => + {({ width }) => ( <div> <AdvancedTimeline endDate={null} @@ -170,8 +170,8 @@ export default class PreviewGraph extends React.PureComponent { updateTooltip={this.updateTooltip} /> {selectedDate != null && - tooltipXPos != null && - tooltipIdx != null && + tooltipXPos != null && + tooltipIdx != null && ( <PreviewGraphTooltips formatValue={this.formatValue} graph={graph} @@ -181,8 +181,10 @@ export default class PreviewGraph extends React.PureComponent { series={series} tooltipIdx={tooltipIdx} tooltipPos={tooltipXPos} - />} - </div>} + /> + )} + </div> + )} </AutoSizer> ); } diff --git a/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js b/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js index 5f4cf9fbb8f..77d13e6fc5e 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js +++ b/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js @@ -36,17 +36,13 @@ class BugsAndVulnerabilities extends React.PureComponent { return ( <div className="overview-card-header"> <div className="overview-title"> - <span> - {translate('metric.bugs.name')} - </span> + <span>{translate('metric.bugs.name')}</span> <Link className="button button-small button-compact spacer-left text-text-bottom" to={getComponentDrilldownUrl(component.key, 'Reliability', branch)}> <BubblesIcon size={14} /> </Link> - <span className="big-spacer-left"> - {translate('metric.vulnerabilities.name')} - </span> + <span className="big-spacer-left">{translate('metric.vulnerabilities.name')}</span> <Link className="button button-small button-compact spacer-left text-text-bottom" to={getComponentDrilldownUrl(component.key, 'Security', branch)}> @@ -66,16 +62,16 @@ class BugsAndVulnerabilities extends React.PureComponent { return ( <div className="overview-domain-leak"> - {component.qualifier === 'APP' - ? <ApplicationLeakPeriodLegend component={component} /> - : <LeakPeriodLegend period={leakPeriod} />} + {component.qualifier === 'APP' ? ( + <ApplicationLeakPeriodLegend component={component} /> + ) : ( + <LeakPeriodLegend period={leakPeriod} /> + )} <div className="overview-domain-measures"> <div className="overview-domain-measure"> <div className="overview-domain-measure-value"> - <span style={{ marginLeft: 30 }}> - {this.props.renderIssues('new_bugs', 'BUG')} - </span> + <span style={{ marginLeft: 30 }}>{this.props.renderIssues('new_bugs', 'BUG')}</span> {this.props.renderRating('new_reliability_rating')} </div> <div className="overview-domain-measure-label"> diff --git a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js index 176c7e1c1d1..0b6b44c3d0a 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js +++ b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js @@ -46,10 +46,9 @@ class CodeSmells extends React.PureComponent { const tooltip = ( <DateTimeFormatter date={component.analysisDate}> - {formattedAnalysisDate => - <span> - {translateWithParameters('widget.as_calculated_on_x', formattedAnalysisDate)} - </span>} + {formattedAnalysisDate => ( + <span>{translateWithParameters('widget.as_calculated_on_x', formattedAnalysisDate)}</span> + )} </DateTimeFormatter> ); return ( @@ -67,10 +66,11 @@ class CodeSmells extends React.PureComponent { } return ( <DateFromNow date={this.props.historyStartDate}> - {fromNow => + {fromNow => ( <span className="overview-domain-timeline-date"> {translateWithParameters('overview.started_x', fromNow)} - </span>} + </span> + )} </DateFromNow> ); } @@ -100,9 +100,7 @@ class CodeSmells extends React.PureComponent { </span> {this.props.renderRating('new_maintainability_rating')} </div> - <div className="overview-domain-measure-label"> - {getMetricName('new_effort')} - </div> + <div className="overview-domain-measure-label">{getMetricName('new_effort')}</div> </div> <div className="overview-domain-measure"> <div className="overview-domain-measure-value"> diff --git a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js index c7c01b91a1a..baf8dcafbdc 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js +++ b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js @@ -96,42 +96,42 @@ class Coverage extends React.PureComponent { : null; const formattedValue = - newCoverageValue != null - ? <div> - <DrilldownLink - branch={branch} - component={component.key} - metric={newCoverageMeasure.metric.key}> - <span className="js-overview-main-new-coverage"> - {formatMeasure(newCoverageValue, 'PERCENT')} - </span> - </DrilldownLink> - </div> - : <span>—</span>; + newCoverageValue != null ? ( + <div> + <DrilldownLink + branch={branch} + component={component.key} + metric={newCoverageMeasure.metric.key}> + <span className="js-overview-main-new-coverage"> + {formatMeasure(newCoverageValue, 'PERCENT')} + </span> + </DrilldownLink> + </div> + ) : ( + <span>—</span> + ); const label = - newLinesToCoverValue != null && newLinesToCoverValue > 0 - ? <div className="overview-domain-measure-label"> - {translate('overview.coverage_on')} - <br /> - <DrilldownLink - branch={branch} - className="spacer-right overview-domain-secondary-measure-value" - component={component.key} - metric={newLinesToCover.metric.key}> - <span className="js-overview-main-new-coverage"> - {formatMeasure(newLinesToCoverValue, 'SHORT_INT')} - </span> - </DrilldownLink> - {getMetricName('new_lines_to_cover')} - </div> - : <div className="overview-domain-measure-label"> - {getMetricName('new_coverage')} - </div>; + newLinesToCoverValue != null && newLinesToCoverValue > 0 ? ( + <div className="overview-domain-measure-label"> + {translate('overview.coverage_on')} + <br /> + <DrilldownLink + branch={branch} + className="spacer-right overview-domain-secondary-measure-value" + component={component.key} + metric={newLinesToCover.metric.key}> + <span className="js-overview-main-new-coverage"> + {formatMeasure(newLinesToCoverValue, 'SHORT_INT')} + </span> + </DrilldownLink> + {getMetricName('new_lines_to_cover')} + </div> + ) : ( + <div className="overview-domain-measure-label">{getMetricName('new_coverage')}</div> + ); return ( <div className="overview-domain-measure"> - <div className="overview-domain-measure-value"> - {formattedValue} - </div> + <div className="overview-domain-measure-value">{formattedValue}</div> {label} </div> ); @@ -157,9 +157,7 @@ class Coverage extends React.PureComponent { } return ( <div className="overview-domain-leak"> - <div className="overview-domain-measures"> - {this.renderNewCoverage()} - </div> + <div className="overview-domain-measures">{this.renderNewCoverage()}</div> {this.renderTimeline('after')} </div> diff --git a/server/sonar-web/src/main/js/apps/overview/main/Duplications.js b/server/sonar-web/src/main/js/apps/overview/main/Duplications.js index 397641eec23..751e0a1a81b 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/Duplications.js +++ b/server/sonar-web/src/main/js/apps/overview/main/Duplications.js @@ -83,42 +83,42 @@ class Duplications extends React.PureComponent { : null; const formattedValue = - newDuplicationsValue != null - ? <div> - <DrilldownLink - branch={branch} - component={component.key} - metric={newDuplicationsMeasure.metric.key}> - <span className="js-overview-main-new-duplications"> - {formatMeasure(newDuplicationsValue, 'PERCENT')} - </span> - </DrilldownLink> - </div> - : <span>—</span>; + newDuplicationsValue != null ? ( + <div> + <DrilldownLink + branch={branch} + component={component.key} + metric={newDuplicationsMeasure.metric.key}> + <span className="js-overview-main-new-duplications"> + {formatMeasure(newDuplicationsValue, 'PERCENT')} + </span> + </DrilldownLink> + </div> + ) : ( + <span>—</span> + ); const label = - newLinesValue != null && newLinesValue > 0 - ? <div className="overview-domain-measure-label"> - {translate('overview.duplications_on')} - <br /> - <DrilldownLink - branch={branch} - className="spacer-right overview-domain-secondary-measure-value" - component={component.key} - metric={newLinesMeasure.metric.key}> - <span className="js-overview-main-new-lines"> - {formatMeasure(newLinesValue, 'SHORT_INT')} - </span> - </DrilldownLink> - {getMetricName('new_lines')} - </div> - : <div className="overview-domain-measure-label"> - {getMetricName('new_duplications')} - </div>; + newLinesValue != null && newLinesValue > 0 ? ( + <div className="overview-domain-measure-label"> + {translate('overview.duplications_on')} + <br /> + <DrilldownLink + branch={branch} + className="spacer-right overview-domain-secondary-measure-value" + component={component.key} + metric={newLinesMeasure.metric.key}> + <span className="js-overview-main-new-lines"> + {formatMeasure(newLinesValue, 'SHORT_INT')} + </span> + </DrilldownLink> + {getMetricName('new_lines')} + </div> + ) : ( + <div className="overview-domain-measure-label">{getMetricName('new_duplications')}</div> + ); return ( <div className="overview-domain-measure"> - <div className="overview-domain-measure-value"> - {formattedValue} - </div> + <div className="overview-domain-measure-value">{formattedValue}</div> {label} </div> ); @@ -144,9 +144,7 @@ class Duplications extends React.PureComponent { } return ( <div className="overview-domain-leak"> - <div className="overview-domain-measures"> - {this.renderNewDuplications()} - </div> + <div className="overview-domain-measures">{this.renderNewDuplications()}</div> {this.renderTimeline('after')} </div> diff --git a/server/sonar-web/src/main/js/apps/overview/main/enhance.js b/server/sonar-web/src/main/js/apps/overview/main/enhance.js index a3fbe1f8f86..73ab9386a3e 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/enhance.js +++ b/server/sonar-web/src/main/js/apps/overview/main/enhance.js @@ -63,9 +63,7 @@ export default function enhance(ComposedComponent) { return ( <div className="overview-card-header"> <div className="overview-title"> - <span> - {label} - </span> + <span>{label}</span> <Link className="button button-small button-compact spacer-left text-text-bottom" to={getComponentDrilldownUrl(component.key, domain, branch)}> @@ -113,13 +111,9 @@ export default function enhance(ComposedComponent) { : NO_VALUE; return ( <div className="overview-domain-measure"> - <div className="overview-domain-measure-value"> - {formatted} - </div> + <div className="overview-domain-measure-value">{formatted}</div> - <div className="overview-domain-measure-label"> - {customLabel || measure.metric.name} - </div> + <div className="overview-domain-measure-label">{customLabel || measure.metric.name}</div> </div> ); }; @@ -158,10 +152,11 @@ export default function enhance(ComposedComponent) { const tooltip = ( <DateTimeFormatter date={component.analysisDate}> - {formattedAnalysisDate => + {formattedAnalysisDate => ( <span> {translateWithParameters('widget.as_calculated_on_x', formattedAnalysisDate)} - </span>} + </span> + )} </DateTimeFormatter> ); diff --git a/server/sonar-web/src/main/js/apps/overview/meta/Meta.js b/server/sonar-web/src/main/js/apps/overview/meta/Meta.js index 8bf9ed046ba..00fefefe32a 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/Meta.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/Meta.js @@ -54,36 +54,38 @@ const Meta = ({ return ( <div className="overview-meta"> - {hasDescription && - <div className="overview-meta-card overview-meta-description"> - {description} - </div>} + {hasDescription && ( + <div className="overview-meta-card overview-meta-description">{description}</div> + )} <MetaSize branch={branch} component={component} measures={measures} /> {isProject && <MetaTags component={component} onComponentChange={onComponentChange} />} - {(isProject || isApplication) && + {(isProject || isApplication) && ( <AnalysesList branch={branch} project={component.key} qualifier={component.qualifier} history={history} router={router} - />} + /> + )} - {shouldShowQualityGate && + {shouldShowQualityGate && ( <MetaQualityGate gate={qualityGate} organization={hasOrganization && component.organization} - />} + /> + )} - {shouldShowQualityProfiles && + {shouldShowQualityProfiles && ( <MetaQualityProfiles component={component} customOrganizations={areThereCustomOrganizations} profiles={qualityProfiles} - />} + /> + )} {isProject && <MetaLinks component={component} />} diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaKey.js b/server/sonar-web/src/main/js/apps/overview/meta/MetaKey.js index e5d3e94f567..3fc7335d97c 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaKey.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaKey.js @@ -23,9 +23,7 @@ import { translate } from '../../../helpers/l10n'; const MetaKey = ({ component }) => { return ( <div className="overview-meta-card"> - <h4 className="overview-meta-header"> - {translate('key')} - </h4> + <h4 className="overview-meta-header">{translate('key')}</h4> <input className="overview-key" type="text" diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.js b/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.js index 569a28d75f0..5ae748ed6ad 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.js @@ -58,9 +58,11 @@ export default class MetaLink extends React.PureComponent { return <BugTrackerIcon />; } - return isProvided(link) - ? <i className={`icon-color-link icon-${link.type}`} /> - : <i className="icon-color-link icon-detach" />; + return isProvided(link) ? ( + <i className={`icon-color-link icon-${link.type}`} /> + ) : ( + <i className="icon-color-link icon-detach" /> + ); } render() { @@ -77,7 +79,7 @@ export default class MetaLink extends React.PureComponent { {link.name} </a> - {this.state.expanded && + {this.state.expanded && ( <div className="little-spacer-top"> <input type="text" @@ -86,7 +88,8 @@ export default class MetaLink extends React.PureComponent { readOnly={true} onClick={e => e.target.select()} /> - </div>} + </div> + )} </li> ); } diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaOrganizationKey.js b/server/sonar-web/src/main/js/apps/overview/meta/MetaOrganizationKey.js index 111e84d9b7a..738809e1b86 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaOrganizationKey.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaOrganizationKey.js @@ -23,9 +23,7 @@ import { translate } from '../../../helpers/l10n'; const MetaOrganizationKey = ({ component }) => { return ( <div className="overview-meta-card"> - <h4 className="overview-meta-header"> - {translate('organization_key')} - </h4> + <h4 className="overview-meta-header">{translate('organization_key')}</h4> <input className="overview-key" type="text" diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityGate.js b/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityGate.js index f9c3a1db5f6..800921550d0 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityGate.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityGate.js @@ -25,19 +25,14 @@ import { getQualityGateUrl } from '../../../helpers/urls'; const MetaQualityGate = ({ gate, organization }) => { return ( <div className="overview-meta-card"> - <h4 className="overview-meta-header"> - {translate('overview.quality_gate')} - </h4> + <h4 className="overview-meta-header">{translate('overview.quality_gate')}</h4> <ul className="overview-meta-list"> <li> - {gate.isDefault && - <span className="note spacer-right"> - {'(' + translate('default') + ')'} - </span>} - <Link to={getQualityGateUrl(gate.key, organization)}> - {gate.name} - </Link> + {gate.isDefault && ( + <span className="note spacer-right">{'(' + translate('default') + ')'}</span> + )} + <Link to={getQualityGateUrl(gate.key, organization)}>{gate.name}</Link> </li> </ul> </div> diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.js b/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.js index 648080544b0..99554d9e207 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.js @@ -92,12 +92,8 @@ class MetaQualityProfiles extends React.PureComponent { const inner = ( <div className="text-ellipsis"> - <span className="note spacer-right"> - {'(' + languageName + ')'} - </span> - <Link to={path}> - {profile.name} - </Link> + <span className="note spacer-right">{'(' + languageName + ')'}</span> + <Link to={path}>{profile.name}</Link> </div> ); @@ -107,18 +103,12 @@ class MetaQualityProfiles extends React.PureComponent { const tooltip = translateWithParameters('overview.deprecated_profile', count); return ( <Tooltip key={profile.key} overlay={tooltip}> - <li className="overview-deprecated-rules"> - {inner} - </li> + <li className="overview-deprecated-rules">{inner}</li> </Tooltip> ); } - return ( - <li key={profile.key}> - {inner} - </li> - ); + return <li key={profile.key}>{inner}</li>; } render() { @@ -126,9 +116,7 @@ class MetaQualityProfiles extends React.PureComponent { return ( <div className="overview-meta-card"> - <h4 className="overview-meta-header"> - {translate('overview.quality_profiles')} - </h4> + <h4 className="overview-meta-header">{translate('overview.quality_profiles')}</h4> <ul className="overview-meta-list"> {profiles.map(profile => this.renderProfile(profile))} diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.js b/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.js index a54c39edcf6..686611d5d91 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.js @@ -34,7 +34,7 @@ export default class MetaSize extends React.PureComponent { measures: PropTypes.array.isRequired }; - renderLoC = ncloc => + renderLoC = ncloc => ( <div id="overview-ncloc" className={classNames('overview-meta-size-ncloc', { @@ -46,41 +46,38 @@ export default class MetaSize extends React.PureComponent { <DrilldownLink branch={this.props.branch} component={this.props.component.key} metric="ncloc"> {formatMeasure(ncloc.value, 'SHORT_INT')} </DrilldownLink> - <div className="overview-domain-measure-label text-muted"> - {getMetricName('ncloc')} - </div> - </div>; + <div className="overview-domain-measure-label text-muted">{getMetricName('ncloc')}</div> + </div> + ); renderLoCDistribution = () => { const languageDistribution = this.props.measures.find( measure => measure.metric.key === 'ncloc_language_distribution' ); - return languageDistribution - ? <div id="overview-language-distribution" className="overview-meta-size-lang-dist"> - <LanguageDistribution distribution={languageDistribution.value} /> - </div> - : null; + return languageDistribution ? ( + <div id="overview-language-distribution" className="overview-meta-size-lang-dist"> + <LanguageDistribution distribution={languageDistribution.value} /> + </div> + ) : null; }; renderProjects = () => { const projects = this.props.measures.find(measure => measure.metric.key === 'projects'); - return projects - ? <div - id="overview-projects" - className="overview-meta-size-ncloc is-half-width bordered-left"> - <DrilldownLink - branch={this.props.branch} - component={this.props.component.key} - metric="projects"> - {formatMeasure(projects.value, 'SHORT_INT')} - </DrilldownLink> - <div className="overview-domain-measure-label text-muted"> - {translate('metric.projects.name')} - </div> + return projects ? ( + <div id="overview-projects" className="overview-meta-size-ncloc is-half-width bordered-left"> + <DrilldownLink + branch={this.props.branch} + component={this.props.component.key} + metric="projects"> + {formatMeasure(projects.value, 'SHORT_INT')} + </DrilldownLink> + <div className="overview-domain-measure-label text-muted"> + {translate('metric.projects.name')} </div> - : null; + </div> + ) : null; }; render() { @@ -93,9 +90,11 @@ export default class MetaSize extends React.PureComponent { return ( <div id="overview-size" className="overview-meta-card"> {this.renderLoC(ncloc)} - {this.props.component.qualifier === 'APP' - ? this.renderProjects() - : this.renderLoCDistribution()} + {this.props.component.qualifier === 'APP' ? ( + this.renderProjects() + ) : ( + this.renderLoCDistribution() + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaTags.js b/server/sonar-web/src/main/js/apps/overview/meta/MetaTags.js index 7254f0e2197..1af72b78b48 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaTags.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaTags.js @@ -126,7 +126,7 @@ export default class MetaTags extends React.PureComponent { ref={tagsList => (this.tagsList = tagsList)}> <TagsList tags={tags.length ? tags : [translate('no_tags')]} allowUpdate={true} /> </button> - {popupOpen && + {popupOpen && ( <div ref={tagsSelector => (this.tagsSelector = tagsSelector)}> <MetaTagsSelector position={popupPosition} @@ -134,7 +134,8 @@ export default class MetaTags extends React.PureComponent { selectedTags={tags} setProjectTags={this.handleSetProjectTags} /> - </div>} + </div> + )} </div> ); } else { diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.js b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.js index d91aaefa229..ba4e5e1a32c 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.js +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.js @@ -92,20 +92,21 @@ export default class ApplicationQualityGate extends React.PureComponent { {status != null && <Level level={status} />} </h2> - {projects != null && + {projects != null && ( <div id="overview-quality-gate-conditions-list" className="overview-quality-gate-conditions-list clearfix"> {projects .filter(project => project.status !== 'OK') - .map(project => + .map(project => ( <ApplicationQualityGateProject key={project.key} metrics={metrics} project={project} /> - )} - </div>} + ))} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.js b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.js index 0a83760305b..a5fb9b6a52b 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.js +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.js @@ -94,9 +94,7 @@ export default class ApplicationQualityGateProject extends React.PureComponent { )} to={getProjectUrl(project.key)}> <div className="application-quality-gate-project"> - <h4> - {project.name} - </h4> + <h4>{project.name}</h4> <ul className="application-quality-gate-project-conditions"> {project.conditions.filter(c => c.status !== 'OK').map(this.renderCondition)} </ul> diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/EmptyQualityGate.js b/server/sonar-web/src/main/js/apps/overview/qualityGate/EmptyQualityGate.js index cdb8b2eb66e..e9285438595 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/EmptyQualityGate.js +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/EmptyQualityGate.js @@ -23,9 +23,7 @@ import { translate } from '../../../helpers/l10n'; const EmptyQualityGate = () => { return ( <div className="overview-quality-gate"> - <h2 className="overview-title"> - {translate('overview.quality_gate')} - </h2> + <h2 className="overview-title">{translate('overview.quality_gate')}</h2> <p className="overview-quality-gate-warning"> {translate('overview.you_should_define_quality_gate')} </p> diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.js b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.js index 03e930b66fa..b840599b347 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.js +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.js @@ -63,8 +63,9 @@ export default function QualityGate({ branch, component, measures } /*: Props */ <Level level={level} /> </h2> - {conditions.length > 0 && - <QualityGateConditions branch={branch} component={component} conditions={conditions} />} + {conditions.length > 0 && ( + <QualityGateConditions branch={branch} component={component} conditions={conditions} /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.js b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.js index fa18175019a..d88d0e76e97 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.js +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.js @@ -108,18 +108,20 @@ export default class QualityGateCondition extends React.PureComponent { new_maintainability_rating: ['CODE_SMELL', true] }; - return RATING_METRICS_MAPPING[metricKey] - ? <Link to={this.getUrlForType(...RATING_METRICS_MAPPING[metricKey])} className={className}> - {children} - </Link> - : <DrilldownLink - branch={branch} - className={className} - component={component.key} - metric={condition.measure.metric.key} - sinceLeakPeriod={condition.period != null}> - {children} - </DrilldownLink>; + return RATING_METRICS_MAPPING[metricKey] ? ( + <Link to={this.getUrlForType(...RATING_METRICS_MAPPING[metricKey])} className={className}> + {children} + </Link> + ) : ( + <DrilldownLink + branch={branch} + className={className} + component={component.key} + metric={condition.measure.metric.key} + sinceLeakPeriod={condition.period != null}> + {children} + </DrilldownLink> + ); } render() { @@ -153,10 +155,11 @@ export default class QualityGateCondition extends React.PureComponent { {metric.name} </div> {!isDiff && - condition.period != null && + condition.period != null && ( <div className="overview-quality-gate-condition-period"> {translate('quality_gates.conditions.leak')} - </div>} + </div> + )} <div className="overview-quality-gate-threshold"> {operator} {formatMeasure(threshold, metric.type)} </div> diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.js b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.js index 18392b0b189..8ac19871039 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.js +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.js @@ -103,14 +103,14 @@ export default class QualityGateConditions extends React.PureComponent { <div id="overview-quality-gate-conditions-list" className="overview-quality-gate-conditions-list clearfix"> - {sortedConditions.map(condition => + {sortedConditions.map(condition => ( <QualityGateCondition key={condition.measure.metric.key} branch={branch} component={component} condition={condition} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.js b/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.js index 7282eecc45d..c2b33c0356d 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.js @@ -91,11 +91,7 @@ export default class ActionsCell extends React.PureComponent { marginRight: 4, textAlign: 'center' }; - return ( - <div style={style}> - {icon} - </div> - ); + return <div style={style}>{icon}</div>; } renderSetDefaultsControl() { @@ -129,9 +125,7 @@ export default class ActionsCell extends React.PureComponent { return availableQualifiers.map(qualifier => this.renderSetDefaultLink( qualifier, - <span> - {translate('permission_templates.set_default')} - </span> + <span>{translate('permission_templates.set_default')}</span> ) ); } @@ -164,13 +158,14 @@ export default class ActionsCell extends React.PureComponent { <ul className="dropdown-menu dropdown-menu-right"> {this.renderSetDefaultsControl()} - {!this.props.fromDetails && + {!this.props.fromDetails && ( <li> <Link to={{ pathname, query: { id: t.id } }}> {this.renderDropdownIcon(<i className="icon-edit" />)} Edit Permissions </Link> - </li>} + </li> + )} <li> <a href="#" className="js-update" onClick={this.handleUpdateClick.bind(this)}> @@ -179,13 +174,14 @@ export default class ActionsCell extends React.PureComponent { </a> </li> - {t.defaultFor.length === 0 && + {t.defaultFor.length === 0 && ( <li> <a href="#" className="js-delete" onClick={this.handleDeleteClick.bind(this)}> {this.renderDropdownIcon(<i className="icon-delete" />)} {translate('delete')} </a> - </li>} + </li> + )} </ul> </div> ); diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Header.js b/server/sonar-web/src/main/js/apps/permission-templates/components/Header.js index 74c4741fc64..64698920ca3 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/Header.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Header.js @@ -60,21 +60,15 @@ export default class Header extends React.PureComponent { render() { return ( <header id="project-permissions-header" className="page-header"> - <h1 className="page-title"> - {translate('permission_templates.page')} - </h1> + <h1 className="page-title">{translate('permission_templates.page')}</h1> {!this.props.ready && <i className="spinner" />} <div className="page-actions"> - <button onClick={this.handleCreateClick}> - {translate('create')} - </button> + <button onClick={this.handleCreateClick}>{translate('create')}</button> </div> - <p className="page-description"> - {translate('permission_templates.page.description')} - </p> + <p className="page-description">{translate('permission_templates.page.description')}</p> </header> ); } diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/List.js b/server/sonar-web/src/main/js/apps/permission-templates/components/List.js index 76b5570fd51..9448e9d5797 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/List.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/List.js @@ -33,7 +33,7 @@ export default class List extends React.PureComponent { }; render() { - const permissionTemplates = this.props.permissionTemplates.map(p => + const permissionTemplates = this.props.permissionTemplates.map(p => ( <ListItem key={p.id} organization={this.props.organization} @@ -41,14 +41,12 @@ export default class List extends React.PureComponent { topQualifiers={this.props.topQualifiers} refresh={this.props.refresh} /> - ); + )); return ( <table id="permission-templates" className="data zebra permissions-table"> <ListHeader organization={this.props.organization} permissions={this.props.permissions} /> - <tbody> - {permissionTemplates} - </tbody> + <tbody>{permissionTemplates}</tbody> </table> ); } diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/ListHeader.js b/server/sonar-web/src/main/js/apps/permission-templates/components/ListHeader.js index b09b86a3ee3..7dfea41232b 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/ListHeader.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/ListHeader.js @@ -29,24 +29,26 @@ export default class ListHeader extends React.PureComponent { }; renderTooltip = permission => - permission.key === 'user' || permission.key === 'codeviewer' - ? <div> - {permission.description} - <div className="alert alert-warning spacer-top"> - {translate('projects_role.public_projects_warning')} - </div> + permission.key === 'user' || permission.key === 'codeviewer' ? ( + <div> + {permission.description} + <div className="alert alert-warning spacer-top"> + {translate('projects_role.public_projects_warning')} </div> - : permission.description; + </div> + ) : ( + permission.description + ); render() { - const cells = this.props.permissions.map(permission => + const cells = this.props.permissions.map(permission => ( <th key={permission.key} className="permission-column"> {permission.name} <Tooltip overlay={this.renderTooltip(permission)}> <i className="icon-help little-spacer-left" /> </Tooltip> </th> - ); + )); return ( <thead> diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.js b/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.js index ea111a3e0c2..ddf9aa7da47 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.js @@ -33,9 +33,9 @@ export default class ListItem extends React.PureComponent { }; render() { - const permissions = this.props.permissionTemplate.permissions.map(p => + const permissions = this.props.permissionTemplate.permissions.map(p => ( <PermissionCell key={p.key} permission={p} /> - ); + )); return ( <tr data-id={this.props.permissionTemplate.id} data-name={this.props.permissionTemplate.name}> diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.js b/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.js index cb52710b803..66fda0943f1 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.js @@ -39,28 +39,25 @@ export default class NameCell extends React.PureComponent { return ( <td> <Link to={{ pathname, query: { id: t.id } }}> - <strong className="js-name"> - {t.name} - </strong> + <strong className="js-name">{t.name}</strong> </Link> - {t.defaultFor.length > 0 && + {t.defaultFor.length > 0 && ( <div className="spacer-top js-defaults"> <Defaults permissionTemplate={this.props.permissionTemplate} organization={organization} /> - </div>} + </div> + )} - {!!t.description && - <div className="spacer-top js-description"> - {t.description} - </div>} + {!!t.description && <div className="spacer-top js-description">{t.description}</div>} - {!!t.projectKeyPattern && + {!!t.projectKeyPattern && ( <div className="spacer-top js-project-key-pattern"> Project Key Pattern: <code>{t.projectKeyPattern}</code> - </div>} + </div> + )} </td> ); } diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/PermissionCell.js b/server/sonar-web/src/main/js/apps/permission-templates/components/PermissionCell.js index ed2554903bd..75a56f8466b 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/PermissionCell.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/PermissionCell.js @@ -33,20 +33,17 @@ export default class PermissionCell extends React.PureComponent { <td className="permission-column" data-permission={p.key}> <div className="permission-column-inner"> <ul> - {p.withProjectCreator && + {p.withProjectCreator && ( <li className="little-spacer-bottom"> {translate('permission_templates.project_creators')} - </li>} + </li> + )} <li className="little-spacer-bottom"> - <strong> - {p.usersCount} - </strong> + <strong>{p.usersCount}</strong> {' user(s)'} </li> <li> - <strong> - {p.groupsCount} - </strong> + <strong>{p.groupsCount}</strong> {' group(s)'} </li> </ul> diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateDetails.js b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateDetails.js index 541200c995b..c05a2908b74 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateDetails.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateDetails.js @@ -32,20 +32,21 @@ export default class TemplateDetails extends React.PureComponent { return ( <div className="big-spacer-bottom"> - {template.defaultFor.length > 0 && + {template.defaultFor.length > 0 && ( <div className="spacer-top js-defaults"> <Defaults permissionTemplate={template} organization={this.props.organization} /> - </div>} + </div> + )} - {!!template.description && - <div className="spacer-top js-description"> - {template.description} - </div>} + {!!template.description && ( + <div className="spacer-top js-description">{template.description}</div> + )} - {!!template.projectKeyPattern && + {!!template.projectKeyPattern && ( <div className="spacer-top js-project-key-pattern"> Project Key Pattern: <code>{template.projectKeyPattern}</code> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.js b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.js index 1e0417c2f7b..2a78bf1c3ea 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.js @@ -47,9 +47,7 @@ export default class TemplateHeader extends React.PureComponent { </Link> </div> - <h1 className="page-title"> - {template.name} - </h1> + <h1 className="page-title">{template.name}</h1> {this.props.loading && <i className="spinner" />} diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/PageHeader.js b/server/sonar-web/src/main/js/apps/permissions/global/components/PageHeader.js index 940c1cb731b..a02e819fa76 100644 --- a/server/sonar-web/src/main/js/apps/permissions/global/components/PageHeader.js +++ b/server/sonar-web/src/main/js/apps/permissions/global/components/PageHeader.js @@ -44,15 +44,11 @@ class PageHeader extends React.PureComponent { return ( <header className="page-header"> - <h1 className="page-title"> - {title} - </h1> + <h1 className="page-title">{title}</h1> {this.props.loading && <i className="spinner" />} - <div className="page-description"> - {description} - </div> + <div className="page-description">{description}</div> </header> ); } diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/App.js b/server/sonar-web/src/main/js/apps/permissions/project/components/App.js index c3e2fd8f5aa..78f32c6b949 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/App.js +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/App.js @@ -352,7 +352,7 @@ export default class App extends React.PureComponent { loadHolders={this.loadHolders} /> <PageError /> - {this.props.component.qualifier === 'TRK' && + {this.props.component.qualifier === 'TRK' && ( <div> <VisibilitySelector canTurnToPrivate={canTurnToPrivate} @@ -360,15 +360,18 @@ export default class App extends React.PureComponent { onChange={this.handleVisibilityChange} visibility={this.props.component.visibility} /> - {!canTurnToPrivate && - <UpgradeOrganizationBox organization={this.props.component.organization} />} - {this.state.disclaimer && + {!canTurnToPrivate && ( + <UpgradeOrganizationBox organization={this.props.component.organization} /> + )} + {this.state.disclaimer && ( <PublicProjectDisclaimer component={this.props.component} onClose={this.closeDisclaimer} onConfirm={this.turnProjectToPublic} - />} - </div>} + /> + )} + </div> + )} <AllHoldersList component={this.props.component} filter={this.state.filter} diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.js b/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.js index 62c5eff5ffb..3df9dbd8fc3 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.js +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.js @@ -68,27 +68,21 @@ export default class PageHeader extends React.PureComponent { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('permissions.page')} - </h1> + <h1 className="page-title">{translate('permissions.page')}</h1> {this.props.loading && <i className="spinner" />} - {canApplyPermissionTemplate && + {canApplyPermissionTemplate && ( <div className="page-actions"> <button className="js-apply-template" onClick={this.handleApplyTemplate}> Apply Template </button> - </div>} + </div> + )} <div className="page-description"> - <p> - {description} - </p> - {visibilityDescription != null && - <p> - {visibilityDescription} - </p>} + <p>{description}</p> + {visibilityDescription != null && <p>{visibilityDescription}</p>} </div> </header> ); diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.js b/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.js index b74b802b673..ce4039ad3fd 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.js +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.js @@ -61,9 +61,7 @@ export default class PublicProjectDisclaimer extends React.PureComponent { </header> <div className="modal-body"> - <p> - {translate('projects_role.are_you_sure_to_turn_project_to_public')} - </p> + <p>{translate('projects_role.are_you_sure_to_turn_project_to_public')}</p> <p className="spacer-top"> {translate('projects_role.are_you_sure_to_turn_project_to_public.2')} </p> diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.js b/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.js index 9fd34e34b5b..bf2962ca4f3 100644 --- a/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.js +++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.js @@ -38,18 +38,20 @@ export default class GroupHolder extends React.PureComponent { render() { const { selectedPermission } = this.props; - const permissionCells = this.props.permissionsOrder.map(p => + const permissionCells = this.props.permissionsOrder.map(p => ( <td key={p.key} className="text-center text-middle" style={{ backgroundColor: p.key === selectedPermission ? '#d9edf7' : 'transparent' }}> <button className="button-clean" onClick={this.handleClick.bind(this, p.key)}> - {this.props.permissions.includes(p.key) - ? <i className="icon-checkbox icon-checkbox-checked" /> - : <i className="icon-checkbox" />} + {this.props.permissions.includes(p.key) ? ( + <i className="icon-checkbox icon-checkbox-checked" /> + ) : ( + <i className="icon-checkbox" /> + )} </button> </td> - ); + )); const { group } = this.props; @@ -61,9 +63,7 @@ export default class GroupHolder extends React.PureComponent { </div> <div className="display-inline-block text-middle"> <div> - <strong> - {group.name} - </strong> + <strong>{group.name}</strong> </div> <div className="little-spacer-top" style={{ whiteSpace: 'normal' }}> {group.description} diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.js b/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.js index 710b6830ed2..cde163b432c 100644 --- a/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.js +++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.js @@ -48,18 +48,20 @@ export default class HoldersList extends React.PureComponent { renderTooltip = permission => this.props.showPublicProjectsWarning && - (permission.key === 'user' || permission.key === 'codeviewer') - ? <div> - {permission.description} - <div className="alert alert-warning spacer-top"> - {translate('projects_role.public_projects_warning')} - </div> + (permission.key === 'user' || permission.key === 'codeviewer') ? ( + <div> + {permission.description} + <div className="alert alert-warning spacer-top"> + {translate('projects_role.public_projects_warning')} </div> - : permission.description; + </div> + ) : ( + permission.description + ); renderTableHeader() { const { selectedPermission } = this.props; - const cells = this.props.permissions.map(p => + const cells = this.props.permissions.map(p => ( <th key={p.key} className="permission-column text-center" @@ -77,13 +79,11 @@ export default class HoldersList extends React.PureComponent { </Tooltip> </div> </th> - ); + )); return ( <thead> <tr> - <td className="nowrap bordered-bottom"> - {this.props.children} - </td> + <td className="nowrap bordered-bottom">{this.props.children}</td> {cells} </tr> </thead> @@ -94,15 +94,13 @@ export default class HoldersList extends React.PureComponent { const columns = this.props.permissions.length + 1; return ( <tr> - <td colSpan={columns}> - {translate('no_results_search')} - </td> + <td colSpan={columns}>{translate('no_results_search')}</td> </tr> ); } render() { - const users = this.props.users.map(user => + const users = this.props.users.map(user => ( <UserHolder key={'user-' + user.login} user={user} @@ -111,9 +109,9 @@ export default class HoldersList extends React.PureComponent { permissionsOrder={this.props.permissions} onToggle={this.props.onToggleUser} /> - ); + )); - const groups = this.props.groups.map(group => + const groups = this.props.groups.map(group => ( <GroupHolder key={'group-' + group.id} group={group} @@ -122,7 +120,7 @@ export default class HoldersList extends React.PureComponent { permissionsOrder={this.props.permissions} onToggle={this.props.onToggleGroup} /> - ); + )); return ( <table className="data zebra permissions-table"> diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/PageError.js b/server/sonar-web/src/main/js/apps/permissions/shared/components/PageError.js index 4b1ad1d8ede..e3d6266d94b 100644 --- a/server/sonar-web/src/main/js/apps/permissions/shared/components/PageError.js +++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/PageError.js @@ -34,11 +34,7 @@ class PageError extends React.PureComponent { return null; } - return ( - <div className="alert alert-danger"> - {message} - </div> - ); + return <div className="alert alert-danger">{message}</div>; } } diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/SearchForm.js b/server/sonar-web/src/main/js/apps/permissions/shared/components/SearchForm.js index 08f0654683c..f20431a06b8 100644 --- a/server/sonar-web/src/main/js/apps/permissions/shared/components/SearchForm.js +++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/SearchForm.js @@ -83,13 +83,12 @@ export default class SearchForm extends React.PureComponent { onChange={this.handleSearch.bind(this)} /> {query.length > 0 && - query.length < 3 && + query.length < 3 && ( <div className="search-box-input-note tooltip bottom fade in"> - <div className="tooltip-inner"> - {translateWithParameters('select2.tooShort', 3)} - </div> + <div className="tooltip-inner">{translateWithParameters('select2.tooShort', 3)}</div> <div className="tooltip-arrow" style={{ left: 23 }} /> - </div>} + </div> + )} </form> </div> ); diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.js b/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.js index 4ef61d7aa0b..0b0bf92735a 100644 --- a/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.js +++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.js @@ -39,18 +39,20 @@ export default class UserHolder extends React.PureComponent { render() { const { selectedPermission } = this.props; - const permissionCells = this.props.permissionsOrder.map(p => + const permissionCells = this.props.permissionsOrder.map(p => ( <td key={p.key} className="text-center text-middle" style={{ backgroundColor: p.key === selectedPermission ? '#d9edf7' : 'transparent' }}> <button className="button-clean" onClick={this.handleClick.bind(this, p.key)}> - {this.props.permissions.includes(p.key) - ? <i className="icon-checkbox icon-checkbox-checked" /> - : <i className="icon-checkbox" />} + {this.props.permissions.includes(p.key) ? ( + <i className="icon-checkbox icon-checkbox-checked" /> + ) : ( + <i className="icon-checkbox" /> + )} </button> </td> - ); + )); const { user } = this.props; @@ -59,31 +61,25 @@ export default class UserHolder extends React.PureComponent { return ( <tr> <td className="nowrap"> - {!isCreator && + {!isCreator && ( <Avatar email={user.email} name={user.name} size={36} className="text-middle big-spacer-right" - />} + /> + )} <div className="display-inline-block text-middle"> <div> - <strong> - {user.name} - </strong> - {!isCreator && - <span className="note spacer-left"> - {user.login} - </span>} + <strong>{user.name}</strong> + {!isCreator && <span className="note spacer-left">{user.login}</span>} </div> - {!isCreator && - <div className="little-spacer-top"> - {user.email} - </div>} - {isCreator && + {!isCreator && <div className="little-spacer-top">{user.email}</div>} + {isCreator && ( <div className="little-spacer-top" style={{ whiteSpace: 'normal' }}> {translate('permission_templates.project_creators.explanation')} - </div>} + </div> + )} </div> </td> {permissionCells} diff --git a/server/sonar-web/src/main/js/apps/project-admin/deletion/Form.js b/server/sonar-web/src/main/js/apps/project-admin/deletion/Form.js index 8c8352a27d3..e07afba43c5 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/deletion/Form.js +++ b/server/sonar-web/src/main/js/apps/project-admin/deletion/Form.js @@ -77,7 +77,7 @@ export default class Form extends React.PureComponent { {translate('delete')} </button> - {this.state.modalOpen && + {this.state.modalOpen && ( <Modal isOpen={true} contentLabel="project deletion" @@ -86,9 +86,7 @@ export default class Form extends React.PureComponent { onRequestClose={this.closeModal}> <form onSubmit={this.handleSubmit}> <div className="modal-head"> - <h2> - {translate('qualifier.delete.TRK')} - </h2> + <h2>{translate('qualifier.delete.TRK')}</h2> </div> <div className="modal-body"> <div className="js-modal-messages" /> @@ -110,7 +108,8 @@ export default class Form extends React.PureComponent { </a> </div> </form> - </Modal>} + </Modal> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/project-admin/deletion/Header.js b/server/sonar-web/src/main/js/apps/project-admin/deletion/Header.js index ce84b8c6e73..c95874e6264 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/deletion/Header.js +++ b/server/sonar-web/src/main/js/apps/project-admin/deletion/Header.js @@ -31,12 +31,8 @@ export default function Header(props /*: { component: { qualifier: string } } */ return ( <header className="page-header"> - <h1 className="page-title"> - {translate('deletion.page')} - </h1> - <div className="page-description"> - {description} - </div> + <h1 className="page-title">{translate('deletion.page')}</h1> + <div className="page-description">{description}</div> </header> ); } diff --git a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdate.js b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdate.js index c0452fc158b..93996b99b12 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdate.js +++ b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdate.js @@ -113,9 +113,7 @@ class BulkUpdate extends React.PureComponent { return ( <div id="project-key-bulk-update"> <header className="big-spacer-bottom"> - <div className="spacer-bottom"> - {translate('update_key.bulk_change_description')} - </div> + <div className="spacer-bottom">{translate('update_key.bulk_change_description')}</div> <div> {translateWithParameters( 'update_key.current_key_for_project_x_is_x', @@ -127,13 +125,14 @@ class BulkUpdate extends React.PureComponent { <BulkUpdateForm onSubmit={this.handleSubmit.bind(this)} /> - {results != null && + {results != null && ( <BulkUpdateResults results={results} replace={replace} by={by} onConfirm={this.handleConfirm.bind(this)} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateForm.js b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateForm.js index b549c19db05..ec92c2c579e 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateForm.js +++ b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateForm.js @@ -40,9 +40,7 @@ export default class BulkUpdateForm extends React.PureComponent { return ( <form onSubmit={this.handleSubmit.bind(this)}> <div className="modal-field"> - <label htmlFor="bulk-update-replace"> - {translate('update_key.replace')} - </label> + <label htmlFor="bulk-update-replace">{translate('update_key.replace')}</label> <input ref="replace" id="bulk-update-replace" @@ -54,9 +52,7 @@ export default class BulkUpdateForm extends React.PureComponent { </div> <div className="modal-field"> - <label htmlFor="bulk-update-by"> - {translate('update_key.by')} - </label> + <label htmlFor="bulk-update-by">{translate('update_key.by')}</label> <input ref="by" id="bulk-update-by" diff --git a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateResults.js b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateResults.js index bd96b8a225a..81071ed4902 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateResults.js +++ b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateResults.js @@ -42,56 +42,56 @@ export default class BulkUpdateResults extends React.PureComponent { return ( <div id="bulk-update-simulation" className="big-spacer-top"> - {isEmpty && + {isEmpty && ( <div id="bulk-update-nothing" className="spacer-bottom"> {translateWithParameters('update_key.no_key_to_update', replace)} - </div>} + </div> + )} - {hasDuplications && + {hasDuplications && ( <div id="bulk-update-duplicate" className="spacer-bottom"> {translateWithParameters('update_key.cant_update_because_duplicate_keys', replace, by)} - </div>} + </div> + )} - {canUpdate && + {canUpdate && ( <div className="spacer-bottom"> {translate('update_key.keys_will_be_updated_as_follows')} - </div>} + </div> + )} - {!isEmpty && + {!isEmpty && ( <table id="bulk-update-results" className="data zebra zebra-hover"> <thead> <tr> - <th> - {translate('update_key.old_key')} - </th> - <th> - {translate('update_key.new_key')} - </th> + <th>{translate('update_key.old_key')}</th> + <th>{translate('update_key.new_key')}</th> </tr> </thead> <tbody> - {results.map(result => + {results.map(result => ( <tr key={result.key} data-key={result.key}> - <td className="js-old-key"> - {result.key} - </td> + <td className="js-old-key">{result.key}</td> <td className="js-new-key"> - {result.duplicate && + {result.duplicate && ( <span className="spacer-right badge badge-danger"> {translate('update_key.duplicate_key')} - </span>} + </span> + )} {result.newKey} </td> </tr> - )} + ))} </tbody> - </table>} + </table> + )} <div className="big-spacer-top"> - {canUpdate && + {canUpdate && ( <button id="bulk-update-confirm" onClick={this.handleConfirm.bind(this)}> {translate('update_verb')} - </button>} + </button> + )} </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/project-admin/key/FineGrainedUpdate.js b/server/sonar-web/src/main/js/apps/project-admin/key/FineGrainedUpdate.js index 2bdd43a5fb3..411bb302e51 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/key/FineGrainedUpdate.js +++ b/server/sonar-web/src/main/js/apps/project-admin/key/FineGrainedUpdate.js @@ -29,7 +29,7 @@ export default function FineGrainedUpdate(props) { <div id="project-key-fine-grained-update"> <table className="data zebra"> <tbody> - {components.map(component => + {components.map(component => ( <tr key={component.key}> <td className="width-40"> <QualifierIcon qualifier={component.qualifier} /> {component.name} @@ -38,7 +38,7 @@ export default function FineGrainedUpdate(props) { <UpdateKeyForm component={component} onKeyChange={props.onKeyChange} /> </td> </tr> - )} + ))} </tbody> </table> </div> diff --git a/server/sonar-web/src/main/js/apps/project-admin/key/Header.js b/server/sonar-web/src/main/js/apps/project-admin/key/Header.js index 619326823fb..9626b6b83a0 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/key/Header.js +++ b/server/sonar-web/src/main/js/apps/project-admin/key/Header.js @@ -23,12 +23,8 @@ import { translate } from '../../../helpers/l10n'; export default function Header() { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('update_key.page')} - </h1> - <div className="page-description"> - {translate('update_key.page.description')} - </div> + <h1 className="page-title">{translate('update_key.page')}</h1> + <div className="page-description">{translate('update_key.page.description')}</div> </header> ); } diff --git a/server/sonar-web/src/main/js/apps/project-admin/key/Key.js b/server/sonar-web/src/main/js/apps/project-admin/key/Key.js index 4a340ab6371..18aa4ef3fc7 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/key/Key.js +++ b/server/sonar-web/src/main/js/apps/project-admin/key/Key.js @@ -94,12 +94,13 @@ class Key extends React.PureComponent { {modules == null && <i className="spinner" />} - {noModules && + {noModules && ( <div> <UpdateForm component={component} onKeyChange={this.handleChangeKey.bind(this)} /> - </div>} + </div> + )} - {hasModules && + {hasModules && ( <div> <div className="big-spacer-bottom"> <ul className="tabs"> @@ -126,15 +127,17 @@ class Key extends React.PureComponent { {tab === 'bulk' && <BulkUpdate component={component} />} - {tab === 'fine' && + {tab === 'fine' && ( <FineGrainedUpdate component={component} modules={modules} onKeyChange={this.handleChangeKey.bind(this)} onSuccess={this.props.closeAllGlobalMessages} onError={this.props.addGlobalErrorMessage} - />} - </div>} + /> + )} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/Header.js b/server/sonar-web/src/main/js/apps/project-admin/links/Header.js index 34faf7a76d4..66e49a0f0fd 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/links/Header.js +++ b/server/sonar-web/src/main/js/apps/project-admin/links/Header.js @@ -38,17 +38,13 @@ export default class Header extends React.PureComponent { render() { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('project_links.page')} - </h1> + <h1 className="page-title">{translate('project_links.page')}</h1> <div className="page-actions"> <button id="create-project-link" onClick={this.handleCreateClick.bind(this)}> {translate('create')} </button> </div> - <div className="page-description"> - {translate('project_links.page.description')} - </div> + <div className="page-description">{translate('project_links.page.description')}</div> </header> ); } diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/LinkRow.js b/server/sonar-web/src/main/js/apps/project-admin/links/LinkRow.js index ad0fcc33306..4c1843d3806 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/links/LinkRow.js +++ b/server/sonar-web/src/main/js/apps/project-admin/links/LinkRow.js @@ -57,9 +57,7 @@ export default class LinkRow extends React.PureComponent { {this.renderIcon(`icon-${link.type}`)} <div className="display-inline-block text-top"> <div> - <span className="js-name"> - {link.name} - </span> + <span className="js-name">{link.name}</span> </div> <div className="note little-spacer-top"> <span className="js-type">{`sonar.links.${link.type}`}</span> @@ -78,9 +76,7 @@ export default class LinkRow extends React.PureComponent { <div> {this.renderIcon('icon-detach')} <div className="display-inline-block text-top"> - <span className="js-name"> - {link.name} - </span> + <span className="js-name">{link.name}</span> </div> </div> ); @@ -115,15 +111,9 @@ export default class LinkRow extends React.PureComponent { return ( <tr data-name={link.name}> - <td className="nowrap"> - {this.renderName(link)} - </td> - <td className="nowrap js-url"> - {this.renderUrl(link)} - </td> - <td className="thin nowrap"> - {this.renderDeleteButton(link)} - </td> + <td className="nowrap">{this.renderName(link)}</td> + <td className="nowrap js-url">{this.renderUrl(link)}</td> + <td className="thin nowrap">{this.renderDeleteButton(link)}</td> </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/Table.js b/server/sonar-web/src/main/js/apps/project-admin/links/Table.js index acc5cf5ec96..580413d4d1f 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/links/Table.js +++ b/server/sonar-web/src/main/js/apps/project-admin/links/Table.js @@ -38,12 +38,8 @@ export default class Table extends React.PureComponent { return ( <thead> <tr> - <th className="nowrap"> - {translate('project_links.name')} - </th> - <th className="nowrap width-100"> - {translate('project_links.url')} - </th> + <th className="nowrap">{translate('project_links.name')}</th> + <th className="nowrap width-100">{translate('project_links.url')}</th> <th className="thin"> </th> </tr> </thead> @@ -53,16 +49,14 @@ export default class Table extends React.PureComponent { render() { const orderedLinks = orderLinks(this.props.links); - const linkRows = orderedLinks.map(link => + const linkRows = orderedLinks.map(link => ( <LinkRow key={link.id} link={link} onDelete={this.handleDeleteLink.bind(this, link)} /> - ); + )); return ( <table id="project-links" className="data zebra"> {this.renderHeader()} - <tbody> - {linkRows} - </tbody> + <tbody>{linkRows}</tbody> </table> ); } diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/views/CreationModal.js b/server/sonar-web/src/main/js/apps/project-admin/links/views/CreationModal.js index 9547362ecd5..c0ed8620108 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/links/views/CreationModal.js +++ b/server/sonar-web/src/main/js/apps/project-admin/links/views/CreationModal.js @@ -31,9 +31,12 @@ export default ModalForm.extend({ const name = this.$('#create-link-name').val(); const url = this.$('#create-link-url').val(); - this.options.onCreate(name, url).then(() => this.destroy()).catch(e => { - parseError(e).then(msg => this.showSingleError(msg)); - this.enableForm(); - }); + this.options + .onCreate(name, url) + .then(() => this.destroy()) + .catch(e => { + parseError(e).then(msg => this.showSingleError(msg)); + this.enableForm(); + }); } }); diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/Event.js b/server/sonar-web/src/main/js/apps/projectActivity/components/Event.js index 1b931a0f838..cf63eb85c13 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/Event.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/Event.js @@ -94,19 +94,22 @@ export default class Event extends React.PureComponent { <div className="project-activity-event"> <EventInner event={this.props.event} /> - {showActions && + {showActions && ( <div className="project-activity-event-actions spacer-left"> - {canChange && + {canChange && ( <button className="js-change-event button-clean" onClick={this.startChanging}> <ChangeIcon /> - </button>} - {canDelete && + </button> + )} + {canDelete && ( <button className="js-delete-event button-clean" onClick={this.startDeleting}> <DeleteIcon /> - </button>} - </div>} + </button> + )} + </div> + )} - {this.state.changing && + {this.state.changing && ( <ChangeEventForm changeEventButtonText={ 'project_activity.' + (isVersion ? 'change_version' : 'change_custom_event') @@ -114,9 +117,10 @@ export default class Event extends React.PureComponent { changeEvent={this.props.changeEvent} event={this.props.event} onClose={this.stopChanging} - />} + /> + )} - {this.state.deleting && + {this.state.deleting && ( <RemoveEventForm analysis={this.props.analysis} deleteEvent={this.props.deleteEvent} @@ -128,7 +132,8 @@ export default class Event extends React.PureComponent { removeEventQuestion={`project_activity.${isVersion ? 'remove_version' : 'remove_custom_event'}.question`} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/Events.js b/server/sonar-web/src/main/js/apps/projectActivity/components/Events.js index b68e776f112..ecbbe7c919b 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/Events.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/Events.js @@ -45,7 +45,7 @@ export default function Events(props /*: Props */) { return ( <div className="project-activity-events"> - {sortedEvents.map(event => + {sortedEvents.map(event => ( <Event analysis={props.analysis} canAdmin={props.canAdmin} @@ -55,7 +55,7 @@ export default function Events(props /*: Props */) { isFirst={props.isFirst} key={event.key} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.js index b5b6d776ee9..11cbe73667d 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.js @@ -81,12 +81,14 @@ export default class GraphHistory extends React.PureComponent { return ( <div className="project-activity-graph-container"> - {this.props.isCustom - ? <GraphsLegendCustom series={series} removeMetric={this.props.removeCustomMetric} /> - : <GraphsLegendStatic series={series} />} + {this.props.isCustom ? ( + <GraphsLegendCustom series={series} removeMetric={this.props.removeCustomMetric} /> + ) : ( + <GraphsLegendStatic series={series} /> + )} <div className="project-activity-graph"> <AutoSizer> - {({ height, width }) => + {({ height, width }) => ( <div> <AdvancedTimeline endDate={this.props.graphEndDate} @@ -105,7 +107,7 @@ export default class GraphHistory extends React.PureComponent { updateZoom={this.props.updateGraphZoom} /> {selectedDate != null && - tooltipXPos != null && + tooltipXPos != null && ( <GraphsTooltips events={this.props.events} formatValue={this.formatTooltipValue} @@ -116,8 +118,10 @@ export default class GraphHistory extends React.PureComponent { series={series} tooltipIdx={tooltipIdx} tooltipPos={tooltipXPos} - />} - </div>} + /> + )} + </div> + )} </AutoSizer> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsHistory.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsHistory.js index de15fb7c664..2b9d710508a 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsHistory.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsHistory.js @@ -140,7 +140,7 @@ export default class GraphsHistory extends React.PureComponent { const showAreas = ['coverage', 'duplications'].includes(graph); return ( <div className="project-activity-graphs"> - {this.props.graphs.map((series, idx) => + {this.props.graphs.map((series, idx) => ( <GraphHistory key={idx} events={events} @@ -159,7 +159,7 @@ export default class GraphsHistory extends React.PureComponent { updateSelectedDate={this.props.updateSelectedDate} updateTooltip={this.updateTooltip} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendCustom.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendCustom.js index 3130d415397..c03fbf4a3f1 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendCustom.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendCustom.js @@ -52,9 +52,7 @@ export default function GraphsLegendCustom({ removeMetric, series } /*: Props */ key={serie.name} overlay={translate('project_activity.graphs.custom.metric_no_history')} placement="bottom"> - <span className="spacer-left spacer-right"> - {legendItem} - </span> + <span className="spacer-left spacer-right">{legendItem}</span> </Tooltip> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendItem.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendItem.tsx index bef35fb734a..63be475f83f 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendItem.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendItem.tsx @@ -51,19 +51,22 @@ export default class GraphsLegendItem extends React.PureComponent<Props> { ); return ( <span className={legendClass}> - {this.props.showWarning - ? <AlertWarnIcon className="spacer-right" /> - : <ChartLegendIcon - className={classNames( - 'spacer-right line-chart-legend', - 'line-chart-legend-' + this.props.style - )} - />} + {this.props.showWarning ? ( + <AlertWarnIcon className="spacer-right" /> + ) : ( + <ChartLegendIcon + className={classNames( + 'spacer-right line-chart-legend', + 'line-chart-legend-' + this.props.style + )} + /> + )} {this.props.name} - {isActionable && + {isActionable && ( <a className="spacer-left button-clean text-text-top" href="#" onClick={this.handleClick}> <CloseIcon className="text-danger" /> - </a>} + </a> + )} </span> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendStatic.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendStatic.js index 2b8c85ed7b9..15e199d635c 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendStatic.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendStatic.js @@ -30,7 +30,7 @@ type Props = { export default function GraphsLegendStatic({ series } /*: Props */) { return ( <div className="project-activity-graph-legends"> - {series.map((serie, idx) => + {series.map((serie, idx) => ( <GraphsLegendItem className="big-spacer-left big-spacer-right" key={serie.name} @@ -38,7 +38,7 @@ export default function GraphsLegendStatic({ series } /*: Props */) { name={serie.translatedName} style={idx.toString()} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.js index 320f934e028..69065f1b708 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.js @@ -101,24 +101,25 @@ export default class GraphsTooltips extends React.PureComponent { <DateTimeFormatter date={this.props.selectedDate} /> </div> <table className="width-100"> - <tbody> - {tooltipContent} - </tbody> - {this.props.graph === 'coverage' && + <tbody>{tooltipContent}</tbody> + {this.props.graph === 'coverage' && ( <GraphsTooltipsContentCoverage addSeparator={addSeparator} measuresHistory={measuresHistory} tooltipIdx={tooltipIdx} - />} - {this.props.graph === 'duplications' && + /> + )} + {this.props.graph === 'duplications' && ( <GraphsTooltipsContentDuplication addSeparator={addSeparator} measuresHistory={measuresHistory} tooltipIdx={tooltipIdx} - />} + /> + )} {events && - events.length > 0 && - <GraphsTooltipsContentEvents addSeparator={addSeparator} events={events} />} + events.length > 0 && ( + <GraphsTooltipsContentEvents addSeparator={addSeparator} events={events} /> + )} </table> </div> </BubblePopup> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContent.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContent.js index 369482b4fbd..a6935dfd030 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContent.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContent.js @@ -39,12 +39,8 @@ export default function GraphsTooltipsContent({ name, style, translatedName, val className={classNames('spacer-right line-chart-legend', 'line-chart-legend-' + style)} /> </td> - <td className="project-activity-graph-tooltip-value text-right spacer-right thin"> - {value} - </td> - <td> - {translatedName} - </td> + <td className="project-activity-graph-tooltip-value text-right spacer-right thin">{value}</td> + <td>{translatedName}</td> </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentCoverage.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentCoverage.js index 77c630376f7..ebfb326d4aa 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentCoverage.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentCoverage.js @@ -43,34 +43,33 @@ export default function GraphsTooltipsContentCoverage( const coverageValue = coverage.history[tooltipIdx].value; return ( <tbody> - {addSeparator && + {addSeparator && ( <tr> <td className="project-activity-graph-tooltip-separator" colSpan="3"> <hr /> </td> - </tr>} - {uncoveredValue && + </tr> + )} + {uncoveredValue && ( <tr className="project-activity-graph-tooltip-line"> <td colSpan="2" className="project-activity-graph-tooltip-value text-right spacer-right thin"> {formatMeasure(uncoveredValue, 'SHORT_INT')} </td> - <td> - {translate('metric.uncovered_lines.name')} - </td> - </tr>} - {coverageValue && + <td>{translate('metric.uncovered_lines.name')}</td> + </tr> + )} + {coverageValue && ( <tr className="project-activity-graph-tooltip-line"> <td colSpan="2" className="project-activity-graph-tooltip-value text-right spacer-right thin"> {formatMeasure(coverageValue, 'PERCENT')} </td> - <td> - {translate('metric.coverage.name')} - </td> - </tr>} + <td>{translate('metric.coverage.name')}</td> + </tr> + )} </tbody> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentDuplication.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentDuplication.js index 3fb31334c8b..ed330aa1fda 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentDuplication.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentDuplication.js @@ -46,21 +46,20 @@ export default function GraphsTooltipsContentDuplication( } return ( <tbody> - {addSeparator && + {addSeparator && ( <tr> <td className="project-activity-graph-tooltip-separator" colSpan="3"> <hr /> </td> - </tr>} + </tr> + )} <tr className="project-activity-graph-tooltip-line"> <td colSpan="2" className="project-activity-graph-tooltip-value text-right spacer-right thin"> {formatMeasure(duplicationDensityValue, 'PERCENT')} </td> - <td> - {translate('metric.duplicated_lines_density.name')} - </td> + <td>{translate('metric.duplicated_lines_density.name')}</td> </tr> </tbody> ); diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.js index 675e6382be8..d251de8ac85 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.js @@ -33,22 +33,21 @@ type Props = { export default function GraphsTooltipsContentEvents({ addSeparator, events } /*: Props */) { return ( <tbody> - {addSeparator && + {addSeparator && ( <tr> <td className="project-activity-graph-tooltip-separator" colSpan="3"> <hr /> </td> - </tr>} + </tr> + )} <tr className="project-activity-graph-tooltip-line"> <td colSpan="3"> - <span> - {translate('events')}: - </span> - {events.map(event => + <span>{translate('events')}:</span> + {events.map(event => ( <span key={event.key} className="spacer-left"> <ProjectEventIcon className={'project-activity-event-icon ' + event.category} /> </span> - )} + ))} </td> </tr> </tbody> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentIssues.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentIssues.js index bbe85d7a25f..f50bc140a7e 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentIssues.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentIssues.js @@ -60,14 +60,10 @@ export default function GraphsTooltipsContentIssues(props /*: Props */) { /> </td> <td className="text-right spacer-right"> - <span className="project-activity-graph-tooltip-value"> - {props.value} - </span> + <span className="project-activity-graph-tooltip-value">{props.value}</span> {ratingValue && <Rating className="spacer-left" small={true} value={ratingValue} />} </td> - <td> - {props.translatedName} - </td> + <td>{props.translatedName}</td> </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsZoom.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsZoom.js index 810fcf755fd..0160d85a65b 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsZoom.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsZoom.js @@ -46,7 +46,7 @@ export default function GraphsZoom(props /*: Props */) { return ( <div className="project-activity-graph-zoom"> <AutoSizer disableHeight={true}> - {({ width }) => + {({ width }) => ( <ZoomTimeLine endDate={props.graphEndDate} height={64} @@ -59,7 +59,8 @@ export default function GraphsZoom(props /*: Props */) { showAreas={props.showAreas} startDate={props.graphStartDate} updateZoom={props.updateGraphZoom} - />} + /> + )} </AutoSizer> </div> ); diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js index 9afecfd778f..8b6b60adb9c 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js @@ -155,13 +155,13 @@ export default class ProjectActivityAnalysesList extends React.PureComponent { if (this.props.analyses.length === 0 || !hasFilteredData) { return ( <div className={this.props.className}> - {this.props.initializing - ? <div className="text-center"> - <i className="spinner" /> - </div> - : <span className="note"> - {translate('no_results')} - </span>} + {this.props.initializing ? ( + <div className="text-center"> + <i className="spinner" /> + </div> + ) : ( + <span className="note">{translate('no_results')}</span> + )} </div> ); } @@ -183,14 +183,13 @@ export default class ProjectActivityAnalysesList extends React.PureComponent { } return ( <li key={version.key || 'noversion'}> - {version.version && + {version.version && ( <div className={classNames('project-activity-version-badge', { first: idx === 0 })}> - <span className="badge"> - {version.version} - </span> - </div>} + <span className="badge">{version.version}</span> + </div> + )} <ul className="project-activity-days-list"> - {days.map(day => + {days.map(day => ( <li key={day} className="project-activity-day" @@ -200,7 +199,7 @@ export default class ProjectActivityAnalysesList extends React.PureComponent { </div> <ul className="project-activity-analyses-list"> {version.byDay[day] != null && - version.byDay[day].map(analysis => + version.byDay[day].map(analysis => ( <ProjectActivityAnalysis addCustomEvent={this.props.addCustomEvent} addVersion={this.props.addVersion} @@ -215,18 +214,19 @@ export default class ProjectActivityAnalysesList extends React.PureComponent { selected={analysis.date.valueOf() === selectedDate} updateSelectedDate={this.updateSelectedDate} /> - )} + ))} </ul> </li> - )} + ))} </ul> </li> ); })} - {this.props.analysesLoading && + {this.props.analysesLoading && ( <li className="text-center"> <i className="spinner" /> - </li>} + </li> + )} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.js index bc17b6a46b6..8b0ee390d57 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.js @@ -69,7 +69,7 @@ export default class ProjectActivityAnalysis extends React.PureComponent { </div> <div className="project-activity-analysis-icon big-spacer-right" title={analysisTitle} /> - {canAdmin && + {canAdmin && ( <div className="project-activity-analysis-actions spacer-left"> <div className="dropdown display-inline-block"> <button @@ -80,14 +80,15 @@ export default class ProjectActivityAnalysis extends React.PureComponent { </button> <ul className="dropdown-menu dropdown-menu-right"> {!hasVersion && - this.props.canCreateVersion && + this.props.canCreateVersion && ( <li> <AddEventForm addEvent={this.props.addVersion} analysis={analysis} addEventButtonText="project_activity.add_version" /> - </li>} + </li> + )} <li> <AddEventForm addEvent={this.props.addCustomEvent} @@ -96,18 +97,20 @@ export default class ProjectActivityAnalysis extends React.PureComponent { /> </li> {!isFirst && <li role="separator" className="divider" />} - {!isFirst && + {!isFirst && ( <li> <RemoveAnalysisForm analysis={analysis} deleteAnalysis={this.props.deleteAnalysis} /> - </li>} + </li> + )} </ul> </div> - </div>} + </div> + )} - {events.length > 0 && + {events.length > 0 && ( <Events analysis={analysis.key} canAdmin={canAdmin} @@ -115,7 +118,8 @@ export default class ProjectActivityAnalysis extends React.PureComponent { deleteEvent={this.props.deleteEvent} events={events} isFirst={this.props.isFirst} - />} + /> + )} </li> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityEventSelectOption.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityEventSelectOption.js index cac4aae8a01..5752f0d76dc 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityEventSelectOption.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityEventSelectOption.js @@ -66,9 +66,7 @@ export default class ProjectActivityEventSelectOption extends React.PureComponen onMouseMove={this.handleMouseMove} title={option.label}> <ProjectEventIcon className={'project-activity-event-icon ' + option.value} /> - <span className="little-spacer-left"> - {this.props.children} - </span> + <span className="little-spacer-left">{this.props.children}</span> </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityEventSelectValue.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityEventSelectValue.js index e06d0827f8d..76b43d819ee 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityEventSelectValue.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityEventSelectValue.js @@ -35,9 +35,7 @@ export default function ProjectActivityEventSelectValue(props /*: Props */) { <div className="Select-value" title={value.label}> <div className="Select-value-label"> <ProjectEventIcon className={'project-activity-event-icon ' + value.value} /> - <span className="little-spacer-left"> - {props.children} - </span> + <span className="little-spacer-left">{props.children}</span> </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphsHeader.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphsHeader.js index f9f298e9ab3..d6dce52077b 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphsHeader.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphsHeader.js @@ -61,14 +61,15 @@ export default class ProjectActivityGraphsHeader extends React.PureComponent { options={selectOptions} onChange={this.handleGraphChange} /> - {isCustomGraph(this.props.graph) && + {isCustomGraph(this.props.graph) && ( <AddGraphMetric addMetric={this.props.addCustomMetric} className="pull-left spacer-left" metrics={this.props.metrics} metricsTypeFilter={this.props.metricsTypeFilter} selectedMetrics={this.props.selectedMetrics} - />} + /> + )} </header> ); } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsHistory-test.js b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsHistory-test.js index 099d18fdfff..28a8f20c7b8 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsHistory-test.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsHistory-test.js @@ -96,9 +96,15 @@ it('should correctly render multiple graphs', () => { }); it('should correctly filter events', () => { - expect(shallow(<GraphsHistory {...DEFAULT_PROPS} />).instance().getEvents()).toMatchSnapshot(); expect( - shallow(<GraphsHistory {...DEFAULT_PROPS} eventFilter="OTHER" />).instance().getEvents() + shallow(<GraphsHistory {...DEFAULT_PROPS} />) + .instance() + .getEvents() + ).toMatchSnapshot(); + expect( + shallow(<GraphsHistory {...DEFAULT_PROPS} eventFilter="OTHER" />) + .instance() + .getEvents() ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.js b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.js index 62195f9d69d..21f7980a9bd 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.js @@ -105,17 +105,13 @@ export default class AddEventForm extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.closeForm}> <header className="modal-head"> - <h2> - {translate(this.props.addEventButtonText)} - </h2> + <h2>{translate(this.props.addEventButtonText)}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body"> <div className="modal-field"> - <label> - {translate('name')} - </label> + <label>{translate('name')}</label> <input value={this.state.name} autoFocus={true} @@ -128,16 +124,16 @@ export default class AddEventForm extends React.PureComponent { </div> <footer className="modal-foot"> - {this.state.processing - ? <i className="spinner" /> - : <div> - <button type="submit"> - {translate('save')} - </button> - <button type="reset" className="button-link" onClick={this.closeForm}> - {translate('cancel')} - </button> - </div>} + {this.state.processing ? ( + <i className="spinner" /> + ) : ( + <div> + <button type="submit">{translate('save')}</button> + <button type="reset" className="button-link" onClick={this.closeForm}> + {translate('cancel')} + </button> + </div> + )} </footer> </form> </Modal> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js index 7dec82030c7..c3ff24b0732 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js @@ -109,16 +109,12 @@ export default class AddGraphMetric extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.closeForm}> <header className="modal-head"> - <h2> - {translate('project_activity.graphs.custom.add_metric')} - </h2> + <h2>{translate('project_activity.graphs.custom.add_metric')}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body"> <div className="modal-large-field"> - <label> - {translate('project_activity.graphs.custom.search')} - </label> + <label>{translate('project_activity.graphs.custom.search')}</label> <Select autofocus={true} className="Select-big" @@ -131,15 +127,17 @@ export default class AddGraphMetric extends React.PureComponent { value={this.state.selectedMetric} /> <span className="alert alert-info"> - {metricsTypeFilter != null && metricsTypeFilter.length > 0 - ? translateWithParameters( - 'project_activity.graphs.custom.type_x_message', - metricsTypeFilter - .map(type => translate('metric.type', type)) - .sort() - .join(', ') - ) - : translate('project_activity.graphs.custom.add_metric_info')} + {metricsTypeFilter != null && metricsTypeFilter.length > 0 ? ( + translateWithParameters( + 'project_activity.graphs.custom.type_x_message', + metricsTypeFilter + .map(type => translate('metric.type', type)) + .sort() + .join(', ') + ) + ) : ( + translate('project_activity.graphs.custom.add_metric_info') + )} </span> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.js b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.js index ffd358c47d9..bf5714b0362 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.js @@ -103,17 +103,13 @@ export default class ChangeEventForm extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.closeForm}> <header className="modal-head"> - <h2> - {translate(this.props.changeEventButtonText)} - </h2> + <h2>{translate(this.props.changeEventButtonText)}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body"> <div className="modal-field"> - <label> - {translate('name')} - </label> + <label>{translate('name')}</label> <input value={this.state.name} autoFocus={true} @@ -126,16 +122,16 @@ export default class ChangeEventForm extends React.PureComponent { </div> <footer className="modal-foot"> - {this.state.processing - ? <i className="spinner" /> - : <div> - <button type="submit"> - {translate('change_verb')} - </button> - <button type="reset" className="button-link" onClick={this.closeForm}> - {translate('cancel')} - </button> - </div>} + {this.state.processing ? ( + <i className="spinner" /> + ) : ( + <div> + <button type="submit">{translate('change_verb')}</button> + <button type="reset" className="button-link" onClick={this.closeForm}> + {translate('cancel')} + </button> + </div> + )} </footer> </form> </Modal> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.js b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.js index 481f7f2be61..40e73827ff7 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.js @@ -96,27 +96,25 @@ export default class RemoveAnalysisForm extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.closeForm}> <header className="modal-head"> - <h2> - {translate('project_activity.delete_analysis')} - </h2> + <h2>{translate('project_activity.delete_analysis')}</h2> </header> <form onSubmit={this.handleSubmit}> - <div className="modal-body"> - {translate('project_activity.delete_analysis.question')} - </div> + <div className="modal-body">{translate('project_activity.delete_analysis.question')}</div> <footer className="modal-foot"> - {this.state.processing - ? <i className="spinner" /> - : <div> - <button type="submit" className="button-red" autoFocus={true}> - {translate('delete')} - </button> - <button type="reset" className="button-link" onClick={this.closeForm}> - {translate('cancel')} - </button> - </div>} + {this.state.processing ? ( + <i className="spinner" /> + ) : ( + <div> + <button type="submit" className="button-red" autoFocus={true}> + {translate('delete')} + </button> + <button type="reset" className="button-link" onClick={this.closeForm}> + {translate('cancel')} + </button> + </div> + )} </footer> </form> </Modal> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.js b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.js index 3ba867116a5..43cc1539aef 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.js @@ -89,27 +89,25 @@ export default class RemoveEventForm extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.closeForm}> <header className="modal-head"> - <h2> - {translate(this.props.removeEventButtonText)} - </h2> + <h2>{translate(this.props.removeEventButtonText)}</h2> </header> <form onSubmit={this.handleSubmit}> - <div className="modal-body"> - {translate(this.props.removeEventQuestion)} - </div> + <div className="modal-body">{translate(this.props.removeEventQuestion)}</div> <footer className="modal-foot"> - {this.state.processing - ? <i className="spinner" /> - : <div> - <button type="submit" className="button-red" autoFocus={true}> - {translate('delete')} - </button> - <button type="reset" className="button-link" onClick={this.closeForm}> - {translate('cancel')} - </button> - </div>} + {this.state.processing ? ( + <i className="spinner" /> + ) : ( + <div> + <button type="submit" className="button-red" autoFocus={true}> + {translate('delete')} + </button> + <button type="reset" className="button-link" onClick={this.closeForm}> + {translate('cancel')} + </button> + </div> + )} </footer> </form> </Modal> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/projectActivity.css b/server/sonar-web/src/main/js/apps/projectActivity/components/projectActivity.css index 41ba543df0b..25fd2bb2f8b 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/projectActivity.css +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/projectActivity.css @@ -185,7 +185,7 @@ border: 2px solid #4b9fd5; border-radius: 10px; box-sizing: border-box; - content: ""; + content: ''; } .project-activity-events { diff --git a/server/sonar-web/src/main/js/apps/projectActivity/utils.js b/server/sonar-web/src/main/js/apps/projectActivity/utils.js index c825610ce4e..54fcea9b53c 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/utils.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/utils.js @@ -157,7 +157,9 @@ export function getAnalysesByVersionByDay(analyses /*: Array<Analysis> */, query acc.push(currentVersion); } - const day = startOfDay(parseDate(analysis.date)).getTime().toString(); + const day = startOfDay(parseDate(analysis.date)) + .getTime() + .toString(); let matchFilters = true; if (query.category || query.from || query.to) { diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx index 442f2f2bc97..02a8e20365f 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx @@ -33,34 +33,26 @@ export default function App({ branches, component, onBranchesChange }: Props) { return ( <div className="page page-limited"> <header className="page-header"> - <h1 className="page-title"> - {translate('project_branches.page')} - </h1> + <h1 className="page-title">{translate('project_branches.page')}</h1> </header> <table className="data zebra zebra-hover"> <thead> <tr> - <th> - {translate('branch')} - </th> - <th className="text-right"> - {translate('status')} - </th> - <th className="text-right"> - {translate('actions')} - </th> + <th>{translate('branch')}</th> + <th className="text-right">{translate('status')}</th> + <th className="text-right">{translate('actions')}</th> </tr> </thead> <tbody> - {sortBranchesAsTree(branches).map(branch => + {sortBranchesAsTree(branches).map(branch => ( <BranchRow branch={branch} component={component.key} key={branch.name} onChange={onBranchesChange} /> - )} + ))} </tbody> </table> </div> diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx index 0cc92e8008e..e163481d759 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx @@ -93,49 +93,46 @@ export default class BranchRow extends React.PureComponent<Props, State> { })} /> {branch.name} - {branch.isMain && - <div className="outline-badge spacer-left"> - {translate('branches.main_branch')} - </div>} + {branch.isMain && ( + <div className="outline-badge spacer-left">{translate('branches.main_branch')}</div> + )} </td> <td className="thin nowrap text-right"> <BranchStatus branch={branch} /> </td> <td className="thin nowrap text-right"> - {branch.isMain - ? <Tooltip overlay={translate('branches.rename')}> - <a - className="js-rename link-no-underline" - href="#" - onClick={this.handleRenameClick}> - <ChangeIcon /> - </a> - </Tooltip> - : <Tooltip overlay={translate('branches.delete')}> - <a - className="js-delete link-no-underline" - href="#" - onClick={this.handleDeleteClick}> - <DeleteIcon /> - </a> - </Tooltip>} + {branch.isMain ? ( + <Tooltip overlay={translate('branches.rename')}> + <a className="js-rename link-no-underline" href="#" onClick={this.handleRenameClick}> + <ChangeIcon /> + </a> + </Tooltip> + ) : ( + <Tooltip overlay={translate('branches.delete')}> + <a className="js-delete link-no-underline" href="#" onClick={this.handleDeleteClick}> + <DeleteIcon /> + </a> + </Tooltip> + )} </td> - {this.state.deleting && + {this.state.deleting && ( <DeleteBranchModal branch={branch} component={component} onClose={this.handleDeletingStop} onDelete={this.handleChange} - />} + /> + )} - {this.state.renaming && + {this.state.renaming && ( <RenameBranchModal branch={branch} component={component} onClose={this.handleRenamingStop} onRename={this.handleChange} - />} + /> + )} </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx index 2e51b553c9a..66d14ed260f 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx @@ -81,9 +81,7 @@ export default class DeleteBranchModal extends React.PureComponent<Props, State> overlayClassName="modal-overlay" onRequestClose={this.props.onClose}> <header className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body"> diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx index bcc8eedceeb..181fee72365 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx @@ -91,9 +91,7 @@ export default class RenameBranchModal extends React.PureComponent<Props, State> overlayClassName="modal-overlay" onRequestClose={this.props.onClose}> <header className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body"> diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/App.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/App.tsx index 51d42a94526..4d254a56892 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/App.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/App.tsx @@ -119,9 +119,11 @@ export default class App extends React.PureComponent<Props> { <div id="project-quality-gate" className="page page-limited"> <Helmet title={translate('project_quality_gate.page')} /> <Header /> - {loading - ? <i className="spinner" /> - : allGates && <Form allGates={allGates} gate={gate} onChange={this.handleChangeGate} />} + {loading ? ( + <i className="spinner" /> + ) : ( + allGates && <Form allGates={allGates} gate={gate} onChange={this.handleChangeGate} /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx index 2e0e502db14..7c1d7a21ed5 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx @@ -75,20 +75,14 @@ export default class Form extends React.PureComponent<Props, State> { if (option.isDefault) { return ( <span> - <strong> - {translate('default')} - </strong> + <strong>{translate('default')}</strong> {': '} {option.label} </span> ); } - return ( - <span> - {option.label} - </span> - ); + return <span>{option.label}</span>; }; renderSelect() { diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/Header.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/Header.tsx index 4570192a235..fbde77ca2e6 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/Header.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/Header.tsx @@ -23,12 +23,8 @@ import { translate } from '../../helpers/l10n'; export default function Header() { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('project_quality_gate.page')} - </h1> - <div className="page-description"> - {translate('project_quality_gate.page.description')} - </div> + <h1 className="page-title">{translate('project_quality_gate.page')}</h1> + <div className="page-description">{translate('project_quality_gate.page.description')}</div> </header> ); } diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx index ccc85320a62..25c725019b1 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx @@ -124,15 +124,18 @@ export default class QualityProfiles extends React.PureComponent<Props, State> { <Header /> - {loading - ? <i className="spinner" /> - : allProfiles && - profiles && + {loading ? ( + <i className="spinner" /> + ) : ( + allProfiles && + profiles && ( <Table allProfiles={allProfiles} profiles={profiles} onChangeProfile={this.handleChangeProfile} - />} + /> + ) + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/Header.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/Header.tsx index a758189099d..83e62baefd6 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/Header.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/Header.tsx @@ -23,9 +23,7 @@ import { translate } from '../../helpers/l10n'; export default function Header() { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('project_quality_profiles.page')} - </h1> + <h1 className="page-title">{translate('project_quality_profiles.page')}</h1> <div className="page-description"> {translate('project_quality_profiles.page.description')} </div> diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx index 0679b4463b4..ad8340c2c20 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx @@ -63,20 +63,14 @@ export default class ProfileRow extends React.PureComponent<Props, State> { if (profileOption.isDefault) { return ( <span> - <strong> - {translate('default')} - </strong> + <strong>{translate('default')}</strong> {': '} {profileOption.label} </span> ); } - return ( - <span> - {profileOption.label} - </span> - ); + return <span>{profileOption.label}</span>; }; renderProfileSelect() { @@ -107,15 +101,9 @@ export default class ProfileRow extends React.PureComponent<Props, State> { return ( <tr data-key={profile.language}> - <td className="thin nowrap"> - {profile.languageName} - </td> - <td className="thin nowrap"> - {this.renderProfileSelect()} - </td> - <td> - {this.state.loading && <i className="spinner" />} - </td> + <td className="thin nowrap">{profile.languageName}</td> + <td className="thin nowrap">{this.renderProfileSelect()}</td> + <td>{this.state.loading && <i className="spinner" />}</td> </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/Table.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/Table.tsx index 43fca05f7ae..88f51601856 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/Table.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/Table.tsx @@ -34,32 +34,26 @@ export default function Table(props: Props) { const orderedProfiles = orderBy(props.profiles, 'languageName'); // set key to language to avoid destroying of component - const profileRows = orderedProfiles.map(profile => + const profileRows = orderedProfiles.map(profile => ( <ProfileRow key={profile.language} profile={profile} possibleProfiles={profilesByLanguage[profile.language]} onChangeProfile={props.onChangeProfile} /> - ); + )); return ( <table className="data zebra"> <thead> <tr> - <th className="thin nowrap"> - {translate('language')} - </th> - <th className="thin nowrap"> - {translate('quality_profile')} - </th> + <th className="thin nowrap">{translate('language')}</th> + <th className="thin nowrap">{translate('quality_profile')}</th> {/* keep one empty cell for the spinner */} <th> </th> </tr> </thead> - <tbody> - {profileRows} - </tbody> + <tbody>{profileRows}</tbody> </table> ); } diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/App-test.tsx index ab1f2ec7071..4a68195eba5 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/App-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/App-test.tsx @@ -39,8 +39,9 @@ const associateProject = require('../../../api/quality-profiles').associateProje any >; -const dissociateProject = require('../../../api/quality-profiles') - .dissociateProject as jest.Mock<any>; +const dissociateProject = require('../../../api/quality-profiles').dissociateProject as jest.Mock< + any +>; const searchQualityProfiles = require('../../../api/quality-profiles') .searchQualityProfiles as jest.Mock<any>; diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js index e07822b61bd..b87bf26551d 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js +++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js @@ -150,7 +150,7 @@ export default class AllProjects extends React.PureComponent { }); }; - renderSide = () => + renderSide = () => ( <div className="layout-page-side-outer"> <div className="layout-page-side projects-page-side" @@ -167,9 +167,10 @@ export default class AllProjects extends React.PureComponent { </div> </div> </div> - </div>; + </div> + ); - renderHeader = () => + renderHeader = () => ( <div className="layout-page-header-panel layout-page-main-header"> <div className="layout-page-header-panel-inner layout-page-main-header-inner"> <div className="layout-page-main-inner"> @@ -186,29 +187,32 @@ export default class AllProjects extends React.PureComponent { /> </div> </div> - </div>; + </div> + ); renderMain = () => - this.getView() === 'visualizations' - ? <div className="layout-page-main-inner"> - <VisualizationsContainer - sort={this.state.query.sort} - visualization={this.getVisualization()} - /> - </div> - : <div className="layout-page-main-inner"> - <ProjectsListContainer - isFavorite={this.props.isFavorite} - isFiltered={this.isFiltered()} - organization={this.props.organization} - cardType={this.getView()} - /> - <ProjectsListFooterContainer - query={this.state.query} - isFavorite={this.props.isFavorite} - organization={this.props.organization} - /> - </div>; + this.getView() === 'visualizations' ? ( + <div className="layout-page-main-inner"> + <VisualizationsContainer + sort={this.state.query.sort} + visualization={this.getVisualization()} + /> + </div> + ) : ( + <div className="layout-page-main-inner"> + <ProjectsListContainer + isFavorite={this.props.isFavorite} + isFiltered={this.isFiltered()} + organization={this.props.organization} + cardType={this.getView()} + /> + <ProjectsListFooterContainer + query={this.state.query} + isFavorite={this.props.isFavorite} + organization={this.props.organization} + /> + </div> + ); render() { return ( diff --git a/server/sonar-web/src/main/js/apps/projects/components/App.tsx b/server/sonar-web/src/main/js/apps/projects/components/App.tsx index 471331fb0b9..c3ebbadffc8 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/App.tsx @@ -35,10 +35,6 @@ export default class App extends React.PureComponent { } render() { - return ( - <div id="projects-page"> - {this.props.children} - </div> - ); + return <div id="projects-page">{this.props.children}</div>; } } diff --git a/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.js b/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.js index 00d1edf2c22..1eb2241cfb1 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.js +++ b/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.js @@ -23,9 +23,7 @@ import { translate } from '../../../helpers/l10n'; export default function EmptyInstance() { return ( <div className="projects-empty-list"> - <h3> - {translate('projects.no_projects.empty_instance')} - </h3> + <h3>{translate('projects.no_projects.empty_instance')}</h3> </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.js b/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.js index 86c62bd2a03..f69fbebc834 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.js +++ b/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.js @@ -24,12 +24,8 @@ import { translate } from '../../../helpers/l10n'; export default function NoFavoriteProjects() { return ( <div className="projects-empty-list"> - <h3> - {translate('projects.no_favorite_projects')} - </h3> - <p className="big-spacer-top"> - {translate('projects.no_favorite_projects.engagement')} - </p> + <h3>{translate('projects.no_favorite_projects')}</h3> + <p className="big-spacer-top">{translate('projects.no_favorite_projects.engagement')}</p> <p className="big-spacer-top"> <Link to="/projects/all" className="button"> {translate('projects.explore_projects')} diff --git a/server/sonar-web/src/main/js/apps/projects/components/PageHeader.js b/server/sonar-web/src/main/js/apps/projects/components/PageHeader.js index 7fddfd1553b..f4a616dc52b 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/PageHeader.js +++ b/server/sonar-web/src/main/js/apps/projects/components/PageHeader.js @@ -101,11 +101,12 @@ export default function PageHeader(props /*: Props */) { })}> {!!props.projectsAppState.loading && <i className="spinner spacer-right" />} - {props.projectsAppState.total != null && + {props.projectsAppState.total != null && ( <span> <strong id="projects-total">{props.projectsAppState.total}</strong>{' '} {translate('projects._projects')} - </span>} + </span> + )} </div> </header> ); diff --git a/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.js b/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.js index 28c3f42a14d..34c923669db 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.js +++ b/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.js @@ -75,16 +75,15 @@ export default function PageSidebar( <FavoriteFilterContainer query={linkQuery} organization={organization} /> <div className="projects-facets-header clearfix"> - {isFiltered && + {isFiltered && ( <div className="projects-facets-reset"> <Link to={{ pathname, query: linkQuery }} className="button button-red"> {translate('clear_all_filters')} </Link> - </div>} + </div> + )} - <h3> - {translate('filters')} - </h3> + <h3>{translate('filters')}</h3> </div> <QualityGateFilter {...facetProps} /> {!isLeakView && [ diff --git a/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.js b/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.js index c892a1eafba..2ed398b6e60 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.js +++ b/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.js @@ -70,9 +70,7 @@ export default class PerspectiveSelect extends React.PureComponent { const perspective = view === 'visualizations' ? visualization : view; return ( <div className={this.props.className}> - <label> - {translate('projects.perspective')}: - </label> + <label>{translate('projects.perspective')}:</label> <Select className="little-spacer-left input-medium" clearable={false} diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js index a79b33def4c..0b6cfab5cde 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js @@ -46,12 +46,12 @@ class ProjectCardLanguages extends React.PureComponent { const tooltip = ( <span> - {finalLanguages.map(language => + {finalLanguages.map(language => ( <span key={language}> {language} <br /> </span> - )} + ))} </span> ); @@ -61,9 +61,7 @@ class ProjectCardLanguages extends React.PureComponent { return ( <div className="project-card-languages"> <Tooltip placement="bottom" overlay={tooltip}> - <span> - {languagesText} - </span> + <span>{languagesText}</span> </Tooltip> </div> ); diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.js index 5e33a335fd9..4c6867a3dd8 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.js @@ -71,16 +71,16 @@ export default function ProjectCardLeak({ measures, organization, project } /*: return ( <div data-key={project.key} className={className}> <div className="boxed-group-header clearfix"> - {project.isFavorite != null && - <FavoriteContainer className="spacer-right" componentKey={project.key} />} + {project.isFavorite != null && ( + <FavoriteContainer className="spacer-right" componentKey={project.key} /> + )} <h2 className="project-card-name"> - {showOrganization && + {showOrganization && ( <span className="text-normal"> <Organization organizationKey={project.organization} /> - </span>} - <Link to={{ pathname: '/dashboard', query: { id: project.key } }}> - {project.name} - </Link> + </span> + )} + <Link to={{ pathname: '/dashboard', query: { id: project.key } }}>{project.name}</Link> </h2> {displayQualityGate && <ProjectCardQualityGate status={measures['alert_status']} />} <div className="pull-right text-right"> @@ -88,36 +88,45 @@ export default function ProjectCardLeak({ measures, organization, project } /*: {hasTags && <TagsList tags={project.tags} customClass="spacer-left" />} </div> {isProjectAnalyzed && - hasLeakPeriodStart && + hasLeakPeriodStart && ( <div className="project-card-dates note text-right pull-right"> - {hasLeakPeriodStart && + {hasLeakPeriodStart && ( <DateFromNow date={project.leakPeriodDate}> - {fromNow => + {fromNow => ( <span className="project-card-leak-date pull-right"> {translateWithParameters('projects.leak_period_x', fromNow)} - </span>} - </DateFromNow>} - {isProjectAnalyzed && + </span> + )} + </DateFromNow> + )} + {isProjectAnalyzed && ( <DateTimeFormatter date={project.analysisDate}> - {formattedDate => + {formattedDate => ( <span> {translateWithParameters('projects.last_analysis_on_x', formattedDate)} - </span>} - </DateTimeFormatter>} - </div>} + </span> + )} + </DateTimeFormatter> + )} + </div> + )} </div> - {isProjectAnalyzed && hasLeakPeriodStart - ? <div className="boxed-group-inner"> - {areProjectMeasuresLoaded && <ProjectCardLeakMeasures measures={measures} />} + {isProjectAnalyzed && hasLeakPeriodStart ? ( + <div className="boxed-group-inner"> + {areProjectMeasuresLoaded && <ProjectCardLeakMeasures measures={measures} />} + </div> + ) : ( + <div className="boxed-group-inner"> + <div className="note project-card-not-analyzed"> + {isProjectAnalyzed ? ( + translate('projects.no_leak_period') + ) : ( + translate('projects.not_analyzed') + )} </div> - : <div className="boxed-group-inner"> - <div className="note project-card-not-analyzed"> - {isProjectAnalyzed - ? translate('projects.no_leak_period') - : translate('projects.not_analyzed')} - </div> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeakMeasures.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeakMeasures.js index 88d1afde4f3..bcd27888e68 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeakMeasures.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeakMeasures.js @@ -110,9 +110,7 @@ export default function ProjectCardLeakMeasures({ measures } /*: Props */) { }} /> </div> - <div className="project-card-measure-label"> - {translate('metric.coverage.name')} - </div> + <div className="project-card-measure-label">{translate('metric.coverage.name')}</div> </div> </div> @@ -146,9 +144,7 @@ export default function ProjectCardLeakMeasures({ measures } /*: Props */) { }} /> </div> - <div className="project-card-measure-label"> - {translate('metric.lines.name')} - </div> + <div className="project-card-measure-label">{translate('metric.lines.name')}</div> </div> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.js index baea9ad442e..05c35ab14b3 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.js @@ -69,42 +69,44 @@ export default function ProjectCardOverall({ measures, organization, project } / return ( <div data-key={project.key} className={className}> <div className="boxed-group-header clearfix"> - {project.isFavorite != null && - <FavoriteContainer className="spacer-right" componentKey={project.key} />} + {project.isFavorite != null && ( + <FavoriteContainer className="spacer-right" componentKey={project.key} /> + )} <h2 className="project-card-name"> - {showOrganization && + {showOrganization && ( <span className="text-normal"> <Organization organizationKey={project.organization} /> - </span>} - <Link to={{ pathname: '/dashboard', query: { id: project.key } }}> - {project.name} - </Link> + </span> + )} + <Link to={{ pathname: '/dashboard', query: { id: project.key } }}>{project.name}</Link> </h2> {displayQualityGate && <ProjectCardQualityGate status={measures['alert_status']} />} <div className="pull-right text-right"> {isPrivate && <PrivateBadge className="spacer-left" tooltipPlacement="left" />} {hasTags && <TagsList tags={project.tags} customClass="spacer-left" />} </div> - {isProjectAnalyzed && + {isProjectAnalyzed && ( <div className="project-card-dates note text-right"> <DateTimeFormatter date={project.analysisDate}> - {formattedDate => + {formattedDate => ( <span className="big-spacer-left"> {translateWithParameters('projects.last_analysis_on_x', formattedDate)} - </span>} + </span> + )} </DateTimeFormatter> - </div>} + </div> + )} </div> - {isProjectAnalyzed - ? <div className="boxed-group-inner"> - {areProjectMeasuresLoaded && <ProjectCardOverallMeasures measures={measures} />} - </div> - : <div className="boxed-group-inner"> - <div className="note project-card-not-analyzed"> - {translate('projects.not_analyzed')} - </div> - </div>} + {isProjectAnalyzed ? ( + <div className="boxed-group-inner"> + {areProjectMeasuresLoaded && <ProjectCardOverallMeasures measures={measures} />} + </div> + ) : ( + <div className="boxed-group-inner"> + <div className="note project-card-not-analyzed">{translate('projects.not_analyzed')}</div> + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverallMeasures.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverallMeasures.js index fbfce28ae57..5fabe5635fe 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverallMeasures.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverallMeasures.js @@ -45,9 +45,7 @@ export default function ProjectCardOverallMeasures({ measures } /*: Props */) { <div className="project-card-measure-number"> <Rating value={measures['reliability_rating']} /> </div> - <div className="project-card-measure-label"> - {translate('metric_domain.Reliability')} - </div> + <div className="project-card-measure-label">{translate('metric_domain.Reliability')}</div> </div> </div> @@ -56,9 +54,7 @@ export default function ProjectCardOverallMeasures({ measures } /*: Props */) { <div className="project-card-measure-number"> <Rating value={measures['security_rating']} /> </div> - <div className="project-card-measure-label"> - {translate('metric_domain.Security')} - </div> + <div className="project-card-measure-label">{translate('metric_domain.Security')}</div> </div> </div> @@ -76,10 +72,11 @@ export default function ProjectCardOverallMeasures({ measures } /*: Props */) { <div className="project-card-measure" data-key="coverage"> <div className="project-card-measure-inner"> <div className="project-card-measure-number"> - {measures['coverage'] != null && + {measures['coverage'] != null && ( <span className="spacer-right"> <CoverageRating value={measures['coverage']} /> - </span>} + </span> + )} <Measure measure={{ metric: { key: 'coverage', name: 'coverage', type: 'PERCENT' }, @@ -87,19 +84,18 @@ export default function ProjectCardOverallMeasures({ measures } /*: Props */) { }} /> </div> - <div className="project-card-measure-label"> - {translate('metric.coverage.name')} - </div> + <div className="project-card-measure-label">{translate('metric.coverage.name')}</div> </div> </div> <div className="project-card-measure" data-key="duplicated_lines_density"> <div className="project-card-measure-inner"> <div className="project-card-measure-number"> - {measures['duplicated_lines_density'] != null && + {measures['duplicated_lines_density'] != null && ( <span className="spacer-right"> <DuplicationsRating value={Number(measures['duplicated_lines_density'])} /> - </span>} + </span> + )} <Measure measure={{ metric: { @@ -117,7 +113,7 @@ export default function ProjectCardOverallMeasures({ measures } /*: Props */) { </div> </div> - {measures['ncloc'] != null && + {measures['ncloc'] != null && ( <div className="project-card-measure pull-right" data-key="ncloc"> <div className="project-card-measure-inner pull-right"> <div className="project-card-measure-number"> @@ -135,7 +131,8 @@ export default function ProjectCardOverallMeasures({ measures } /*: Props */) { <ProjectCardLanguages distribution={measures['ncloc_language_distribution']} /> </div> </div> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.js index c806f94b6d7..c44468f8555 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.js @@ -56,16 +56,18 @@ export default class ProjectsList extends React.PureComponent { return ( <div className="projects-list"> - {projects.length > 0 - ? projects.map(projectKey => - <ProjectCardContainer - key={projectKey} - projectKey={projectKey} - organization={this.props.organization} - type={this.props.cardType} - /> - ) - : this.renderNoProjects()} + {projects.length > 0 ? ( + projects.map(projectKey => ( + <ProjectCardContainer + key={projectKey} + projectKey={projectKey} + organization={this.props.organization} + type={this.props.cardType} + /> + )) + ) : ( + this.renderNoProjects() + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.js index f4f21fa2bd2..1465efaa30c 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.js @@ -89,9 +89,7 @@ export default class ProjectsSortingSelect extends React.PureComponent { return ( <div className={this.props.className}> - <label> - {translate('projects.sort_by')}: - </label> + <label>{translate('projects.sort_by')}:</label> <Select className="little-spacer-left input-medium" clearable={false} @@ -106,9 +104,11 @@ export default class ProjectsSortingSelect extends React.PureComponent { sortDesc ? translate('projects.sort_descending') : translate('projects.sort_ascending') }> <a className="spacer-left button-icon" href="#" onClick={this.handleDescToggle}> - {sortDesc - ? <SortDescIcon className="little-spacer-top" /> - : <SortAscIcon className="little-spacer-top" />} + {sortDesc ? ( + <SortDescIcon className="little-spacer-top" /> + ) : ( + <SortAscIcon className="little-spacer-top" /> + )} </a> </Tooltip> </div> diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.js b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.js index 8ada7b20174..7be476e780e 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.js +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.js @@ -60,14 +60,18 @@ it('should display loading', () => { it('should display tags', () => { const project = { ...PROJECT, tags: ['foo', 'bar'] }; expect( - shallow(<ProjectCardLeak type="leak" project={project} />).find('TagsList').exists() + shallow(<ProjectCardLeak type="leak" project={project} />) + .find('TagsList') + .exists() ).toBeTruthy(); }); it('should private badge', () => { const project = { ...PROJECT, visibility: 'private' }; expect( - shallow(<ProjectCardLeak type="leak" project={project} />).find('PrivateBadge').exists() + shallow(<ProjectCardLeak type="leak" project={project} />) + .find('PrivateBadge') + .exists() ).toBeTruthy(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.js b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.js index 91144662ec5..e51b333a35e 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.js +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.js @@ -73,13 +73,19 @@ it('should not display the quality gate', () => { it('should display tags', () => { const project = { ...PROJECT, tags: ['foo', 'bar'] }; - expect(shallow(<ProjectCardOverall project={project} />).find('TagsList').exists()).toBeTruthy(); + expect( + shallow(<ProjectCardOverall project={project} />) + .find('TagsList') + .exists() + ).toBeTruthy(); }); it('should private badge', () => { const project = { ...PROJECT, visibility: 'private' }; expect( - shallow(<ProjectCardOverall type="overall" project={project} />).find('PrivateBadge').exists() + shallow(<ProjectCardOverall type="overall" project={project} />) + .find('PrivateBadge') + .exists() ).toBeTruthy(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.js index 368069368ef..701b9439eca 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.js @@ -46,18 +46,19 @@ export default class CoverageFilter extends React.PureComponent { renderOption(option, selected) { return ( <span> - {option < 6 && + {option < 6 && ( <CoverageRating value={getCoverageRatingAverageValue(option)} size="small" muted={!selected} - />} + /> + )} <span className="spacer-left"> - {option < 6 - ? getCoverageRatingLabel(option) - : <span className="big-spacer-left"> - {translate('no_data')} - </span>} + {option < 6 ? ( + getCoverageRatingLabel(option) + ) : ( + <span className="big-spacer-left">{translate('no_data')}</span> + )} </span> </span> ); diff --git a/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.js index 74ed1033c6d..3758cb3518d 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.js @@ -49,18 +49,19 @@ export default class DuplicationsFilter extends React.PureComponent { renderOption(option, selected) { return ( <span> - {option < 6 && + {option < 6 && ( <DuplicationsRating value={getDuplicationsRatingAverageValue(option)} size="small" muted={!selected} - />} + /> + )} <span className="spacer-left"> - {option < 6 - ? getDuplicationsRatingLabel(option) - : <span className="big-spacer-left"> - {translate('no_data')} - </span>} + {option < 6 ? ( + getDuplicationsRatingLabel(option) + ) : ( + <span className="big-spacer-left">{translate('no_data')}</span> + )} </span> </span> ); diff --git a/server/sonar-web/src/main/js/apps/projects/filters/Filter.js b/server/sonar-web/src/main/js/apps/projects/filters/Filter.js index 0e8646e5242..01e7051c7cd 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/Filter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/Filter.js @@ -129,11 +129,12 @@ export default class Filter extends React.PureComponent { <span className="facet-name"> {this.props.renderOption(option, this.isSelected(option) || isUnderSelectedOption)} </span> - {facetValue != null && + {facetValue != null && ( <span className="facet-stat"> {formatMeasure(facetValue, 'SHORT_INT')} {this.renderOptionBar(facetValue)} - </span>} + </span> + )} </Link> ); } @@ -163,11 +164,7 @@ export default class Filter extends React.PureComponent { ); } } else { - return ( - <div className="search-navigator-facet-empty"> - {translate('no_results')} - </div> - ); + return <div className="search-navigator-facet-empty">{translate('no_results')}</div>; } } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.js index 0d790a7b0c4..88ff9bc42f8 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.js @@ -44,10 +44,7 @@ export default class IssuesFilter extends React.PureComponent { <span> <Rating value={option} small={true} muted={!selected} /> {option > 1 && - option < 5 && - <span className="note spacer-left"> - {translate('and_worse')} - </span>} + option < 5 && <span className="note spacer-left">{translate('and_worse')}</span>} </span> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js index 833a7d810e7..822b80d30f2 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js @@ -65,11 +65,12 @@ export default class LanguagesFilter extends React.PureComponent { getFacetValueForOption = (facet /*: {} */ = {}, option /*: string */) => facet[option]; - renderOption = (option /*: string */) => + renderOption = (option /*: string */) => ( <SearchableFilterOption optionKey={option} option={getLanguageByKey(this.props.languages, option)} - />; + /> + ); render() { return ( diff --git a/server/sonar-web/src/main/js/apps/projects/filters/NewLinesFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/NewLinesFilter.js index d060e1259b7..2593f06a3a0 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/NewLinesFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/NewLinesFilter.js @@ -49,11 +49,7 @@ export default class NewLinesFilter extends React.PureComponent { } renderOption(option) { - return ( - <span> - {getSizeRatingLabel(option)} - </span> - ); + return <span>{getSizeRatingLabel(option)}</span>; } render() { diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SearchFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/SearchFilter.js index 5439403b3ad..76cbdb067ca 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/SearchFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/SearchFilter.js @@ -76,10 +76,9 @@ export default class SearchFilter extends React.PureComponent { onChange={this.handleQueryChange} autoComplete="off" /> - {shortQuery && - <span className="note spacer-left"> - {translateWithParameters('select2.tooShort', 2)} - </span>} + {shortQuery && ( + <span className="note spacer-left">{translateWithParameters('select2.tooShort', 2)}</span> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SearchableFilterOption.js b/server/sonar-web/src/main/js/apps/projects/filters/SearchableFilterOption.js index 99eff214d0c..16831ee169e 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/SearchableFilterOption.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/SearchableFilterOption.js @@ -29,10 +29,6 @@ export default class SearchableFilterOption extends React.PureComponent { render() { const optionName = this.props.option ? this.props.option.name : this.props.optionKey; - return ( - <span> - {this.props.optionKey !== '<null>' ? optionName : translate('unknown')} - </span> - ); + return <span>{this.props.optionKey !== '<null>' ? optionName : translate('unknown')}</span>; } } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.js index 1677be82ff0..566f799ef8d 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.js @@ -53,9 +53,7 @@ export default class SizeFilter extends React.PureComponent { return ( <span> <SizeRating value={getSizeRatingAverageValue(option)} small={true} muted={!selected} /> - <span className="spacer-left"> - {getSizeRatingLabel(option)} - </span> + <span className="spacer-left">{getSizeRatingLabel(option)}</span> </span> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/styles.css b/server/sonar-web/src/main/js/apps/projects/styles.css index bcb611740c6..fd464b6618c 100644 --- a/server/sonar-web/src/main/js/apps/projects/styles.css +++ b/server/sonar-web/src/main/js/apps/projects/styles.css @@ -129,7 +129,7 @@ height: 24px; margin-top: -12px; border-left: 1px solid #e6e6e6; - content: ""; + content: ''; } .project-card-measure.pull-right { @@ -241,8 +241,10 @@ } .search-navigator-facet.active .projects-facet-bar-inner, -.search-navigator-facet-highlight-under-container .search-navigator-facet.active - ~ .search-navigator-facet .projects-facet-bar-inner { +.search-navigator-facet-highlight-under-container + .search-navigator-facet.active + ~ .search-navigator-facet + .projects-facet-bar-inner { background-color: #4b9fd5; } diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.js b/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.js index a1ccdf18a0b..88ca5cafbef 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.js +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.js @@ -130,13 +130,14 @@ export default class SimpleBubbleChart extends React.PureComponent { {translate('metric', yMetric.key, 'name')} </div> <div className="measure-details-bubble-chart-axis size"> - {colorMetric != null && + {colorMetric != null && ( <span className="spacer-right"> {translateWithParameters( 'component_measures.legend.color_x', translate('metric', colorMetric, 'name') )} - </span>} + </span> + )} {translateWithParameters( 'component_measures.legend.size_x', translate('metric', sizeMetric.key, 'name') diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/Visualizations.js b/server/sonar-web/src/main/js/apps/projects/visualizations/Visualizations.js index 661a67d0b21..65ce3c044d5 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/Visualizations.js +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/Visualizations.js @@ -49,9 +49,9 @@ export default class Visualizations extends React.PureComponent { }; const Component = visualizationToComponent[this.props.visualization]; - return Component - ? <Component displayOrganizations={this.props.displayOrganizations} projects={projects} /> - : null; + return Component ? ( + <Component displayOrganizations={this.props.displayOrganizations} projects={projects} /> + ) : null; } renderFooter() { @@ -61,10 +61,8 @@ export default class Visualizations extends React.PureComponent { return ( <footer className="projects-visualizations-footer"> - <p> - {translate('projects.visualization', this.props.visualization, 'description')} - </p> - {limitReached && + <p>{translate('projects.visualization', this.props.visualization, 'description')}</p> + {limitReached && ( <p className="note spacer-top"> {translateWithParameters( 'projects.limited_set_of_projects', @@ -72,7 +70,8 @@ export default class Visualizations extends React.PureComponent { projects.length, localizeSorting(sort) )} - </p>} + </p> + )} </footer> ); } diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx index 6ede35e8917..f92519a6a9e 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx @@ -206,12 +206,13 @@ export default class App extends React.PureComponent<Props, State> { loadMore={this.loadMore} /> - {this.state.createProjectForm && + {this.state.createProjectForm && ( <CreateProjectForm onClose={this.closeCreateProjectForm} onProjectCreated={this.requestProjects} organization={this.props.organization} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx index 60a361c1dbb..314988d7eed 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx @@ -123,21 +123,24 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S this.setState({ permissionTemplate: value }); }; - renderWarning = () => + renderWarning = () => ( <div className="alert alert-warning modal-alert"> <AlertWarnIcon className="spacer-right" /> - {this.props.selection.length - ? translateWithParameters( - 'permission_templates.bulk_apply_permission_template.apply_to_selected', - this.props.selection.length - ) - : translateWithParameters( - 'permission_templates.bulk_apply_permission_template.apply_to_all', - this.props.total - )} - </div>; - - renderSelect = () => + {this.props.selection.length ? ( + translateWithParameters( + 'permission_templates.bulk_apply_permission_template.apply_to_selected', + this.props.selection.length + ) + ) : ( + translateWithParameters( + 'permission_templates.bulk_apply_permission_template.apply_to_all', + this.props.total + ) + )} + </div> + ); + + renderSelect = () => ( <div className="modal-field"> <label> {translate('template')} @@ -151,7 +154,8 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S searchable={false} value={this.state.permissionTemplate} /> - </div>; + </div> + ); render() { const { done, loading, permissionTemplates, submitting } = this.state; @@ -165,16 +169,15 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S overlayClassName="modal-overlay" onRequestClose={this.props.onClose}> <header className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </header> <div className="modal-body"> - {done && + {done && ( <div className="alert alert-success"> {translate('projects_role.apply_template.success')} - </div>} + </div> + )} {loading && <i className="spinner" />} @@ -185,11 +188,12 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S <footer className="modal-foot"> {submitting && <i className="spinner spacer-right" />} {!loading && - !done && - permissionTemplates && + !done && + permissionTemplates && ( <button disabled={submitting} onClick={this.handleConfirmClick}> {translate('apply')} - </button>} + </button> + )} <a className="js-modal-close" href="#" onClick={this.handleCancelClick}> {done ? translate('close') : translate('cancel')} </a> diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx index 41261da71e3..148172bb3c4 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx @@ -69,48 +69,50 @@ export default class ChangeVisibilityForm extends React.PureComponent<Props, Sta overlayClassName="modal-overlay" onRequestClose={this.props.onClose}> <header className="modal-head"> - <h2> - {translate('organization.change_visibility_form.header')} - </h2> + <h2>{translate('organization.change_visibility_form.header')}</h2> </header> <div className="modal-body"> - {[Visibility.Public, Visibility.Private].map(visibility => + {[Visibility.Public, Visibility.Private].map(visibility => ( <div className="big-spacer-bottom" key={visibility}> <p> - {visibility === Visibility.Private && !canUpdateProjectsVisibilityToPrivate - ? <span className="text-muted cursor-not-allowed"> - <i - className={classNames('icon-radio', 'spacer-right', { - 'is-checked': this.state.visibility === visibility - })} - /> - {translate('visibility', visibility)} - </span> - : <a - className="link-base-color link-no-underline" - data-visibility={visibility} - href="#" - onClick={this.handleVisibilityClick}> - <i - className={classNames('icon-radio', 'spacer-right', { - 'is-checked': this.state.visibility === visibility - })} - /> - {translate('visibility', visibility)} - </a>} + {visibility === Visibility.Private && !canUpdateProjectsVisibilityToPrivate ? ( + <span className="text-muted cursor-not-allowed"> + <i + className={classNames('icon-radio', 'spacer-right', { + 'is-checked': this.state.visibility === visibility + })} + /> + {translate('visibility', visibility)} + </span> + ) : ( + <a + className="link-base-color link-no-underline" + data-visibility={visibility} + href="#" + onClick={this.handleVisibilityClick}> + <i + className={classNames('icon-radio', 'spacer-right', { + 'is-checked': this.state.visibility === visibility + })} + /> + {translate('visibility', visibility)} + </a> + )} </p> <p className="text-muted spacer-top" style={{ paddingLeft: 22 }}> {translate('visibility', visibility, 'description.short')} </p> </div> - )} + ))} - {canUpdateProjectsVisibilityToPrivate - ? <div className="alert alert-warning"> - {translate('organization.change_visibility_form.warning')} - </div> - : <UpgradeOrganizationBox organization={this.props.organization.key} />} + {canUpdateProjectsVisibilityToPrivate ? ( + <div className="alert alert-warning"> + {translate('organization.change_visibility_form.warning')} + </div> + ) : ( + <UpgradeOrganizationBox organization={this.props.organization.key} /> + )} </div> <footer className="modal-foot"> diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx index 22a81acf160..9c4d70c270e 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx @@ -118,108 +118,103 @@ export default class CreateProjectForm extends React.PureComponent<Props, State> className="modal" overlayClassName="modal-overlay" onRequestClose={this.props.onClose}> - {createdProject - ? <div> - <header className="modal-head"> - <h2> - {translate('qualifiers.create.TRK')} - </h2> - </header> - - <div className="modal-body"> - <div className="alert alert-success"> - Project <Link to={getProjectUrl(createdProject.key)}> - {createdProject.name} - </Link>{' '} - has been successfully created. - </div> + {createdProject ? ( + <div> + <header className="modal-head"> + <h2>{translate('qualifiers.create.TRK')}</h2> + </header> + + <div className="modal-body"> + <div className="alert alert-success"> + Project <Link to={getProjectUrl(createdProject.key)}> + {createdProject.name} + </Link>{' '} + has been successfully created. </div> - - <footer className="modal-foot"> - <a href="#" id="create-project-close" onClick={this.handleCancelClick}> - {translate('close')} - </a> - </footer> </div> - : <form id="create-project-form" onSubmit={this.handleFormSubmit}> - <header className="modal-head"> - <h2> - {translate('qualifiers.create.TRK')} - </h2> - </header> - - <div className="modal-body"> - <div className="modal-field"> - <label htmlFor="create-project-name"> - {translate('name')} - <em className="mandatory">*</em> - </label> - <input - autoFocus={true} - id="create-project-name" - maxLength={2000} - name="name" - onChange={this.handleInputChange} - required={true} - type="text" - value={this.state.name} - /> - </div> - <div className="modal-field"> - <label htmlFor="create-project-branch"> - {translate('branch')} - </label> - <input - id="create-project-branch" - maxLength={200} - name="branch" - onChange={this.handleInputChange} - type="text" - value={this.state.branch} - /> - </div> - <div className="modal-field"> - <label htmlFor="create-project-key"> - {translate('key')} - <em className="mandatory">*</em> - </label> - <input - id="create-project-key" - maxLength={400} - name="key" - onChange={this.handleInputChange} - required={true} - type="text" - value={this.state.key} - /> - </div> - <div className="modal-field"> - <label> - {translate('visibility')} - </label> - <VisibilitySelector - canTurnToPrivate={organization.canUpdateProjectsVisibilityToPrivate} - className="little-spacer-top" - onChange={this.handleVisibilityChange} - visibility={this.state.visibility} - /> - {!organization.canUpdateProjectsVisibilityToPrivate && - <div className="spacer-top"> - <UpgradeOrganizationBox organization={organization.key} /> - </div>} - </div> + + <footer className="modal-foot"> + <a href="#" id="create-project-close" onClick={this.handleCancelClick}> + {translate('close')} + </a> + </footer> + </div> + ) : ( + <form id="create-project-form" onSubmit={this.handleFormSubmit}> + <header className="modal-head"> + <h2>{translate('qualifiers.create.TRK')}</h2> + </header> + + <div className="modal-body"> + <div className="modal-field"> + <label htmlFor="create-project-name"> + {translate('name')} + <em className="mandatory">*</em> + </label> + <input + autoFocus={true} + id="create-project-name" + maxLength={2000} + name="name" + onChange={this.handleInputChange} + required={true} + type="text" + value={this.state.name} + /> + </div> + <div className="modal-field"> + <label htmlFor="create-project-branch">{translate('branch')}</label> + <input + id="create-project-branch" + maxLength={200} + name="branch" + onChange={this.handleInputChange} + type="text" + value={this.state.branch} + /> </div> + <div className="modal-field"> + <label htmlFor="create-project-key"> + {translate('key')} + <em className="mandatory">*</em> + </label> + <input + id="create-project-key" + maxLength={400} + name="key" + onChange={this.handleInputChange} + required={true} + type="text" + value={this.state.key} + /> + </div> + <div className="modal-field"> + <label>{translate('visibility')}</label> + <VisibilitySelector + canTurnToPrivate={organization.canUpdateProjectsVisibilityToPrivate} + className="little-spacer-top" + onChange={this.handleVisibilityChange} + visibility={this.state.visibility} + /> + {!organization.canUpdateProjectsVisibilityToPrivate && ( + <div className="spacer-top"> + <UpgradeOrganizationBox organization={organization.key} /> + </div> + )} + </div> + </div> - <footer className="modal-foot"> - {this.state.loading && <i className="spinner spacer-right" />} - <button disabled={this.state.loading} id="create-project-submit" type="submit"> - {translate('create')} - </button> - <a href="#" id="create-project-cancel" onClick={this.handleCancelClick}> - {translate('cancel')} - </a> - </footer> - </form>} + <footer className="modal-foot"> + {this.state.loading && <i className="spinner spacer-right" />} + <button disabled={this.state.loading} id="create-project-submit" type="submit"> + {translate('create')} + </button> + <a href="#" id="create-project-cancel" onClick={this.handleCancelClick}> + {translate('cancel')} + </a> + </footer> + </form> + )} </Modal> ); } diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx index c04cd202ab4..ae0640d1c1e 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx @@ -84,16 +84,19 @@ export default class DeleteModal extends React.PureComponent<Props, State> { ); }; - renderWarning = () => + renderWarning = () => ( <div className="alert alert-warning modal-alert"> <AlertWarnIcon className="spacer-right" /> - {this.props.selection.length - ? translateWithParameters( - 'projects_management.delete_selected_warning', - this.props.selection.length - ) - : translateWithParameters('projects_management.delete_all_warning', this.props.total)} - </div>; + {this.props.selection.length ? ( + translateWithParameters( + 'projects_management.delete_selected_warning', + this.props.selection.length + ) + ) : ( + translateWithParameters('projects_management.delete_all_warning', this.props.total) + )} + </div> + ); render() { const header = translate('qualifiers.delete', this.props.qualifier); @@ -106,9 +109,7 @@ export default class DeleteModal extends React.PureComponent<Props, State> { overlayClassName="modal-overlay" onRequestClose={this.props.onClose}> <header className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </header> <div className="modal-body"> diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx index 905c873d42e..f3ea88491a2 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx @@ -55,9 +55,7 @@ export default class Header extends React.PureComponent<Props, State> { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('projects_management')} - </h1> + <h1 className="page-title">{translate('projects_management')}</h1> <div className="page-actions"> <span className="big-spacer-right"> @@ -69,22 +67,22 @@ export default class Header extends React.PureComponent<Props, State> { onClick={this.handleChangeVisibilityClick} /> </span> - {this.props.hasProvisionPermission && + {this.props.hasProvisionPermission && ( <button id="create-project" onClick={this.handleCreateProjectClick}> {translate('qualifiers.create.TRK')} - </button>} + </button> + )} </div> - <p className="page-description"> - {translate('projects_management.page.description')} - </p> + <p className="page-description">{translate('projects_management.page.description')}</p> - {this.state.visibilityForm && + {this.state.visibilityForm && ( <ChangeVisibilityForm onClose={this.closeVisiblityForm} onConfirm={this.props.onVisibilityChange} organization={organization} - />} + /> + )} </header> ); } diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx index e6612a26d19..c87abea71e4 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx @@ -68,15 +68,15 @@ export default class ProjectRow extends React.PureComponent<Props> { </td> <td className="nowrap"> - <span className="note"> - {project.key} - </span> + <span className="note">{project.key}</span> </td> <td className="thin nowrap text-right"> - {project.lastAnalysisDate - ? <DateTooltipFormatter date={project.lastAnalysisDate} /> - : <span className="note">—</span>} + {project.lastAnalysisDate ? ( + <DateTooltipFormatter date={project.lastAnalysisDate} /> + ) : ( + <span className="note">—</span> + )} </td> <td className="thin nowrap"> diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx index af1b365a771..2a2b3c1cb2c 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx @@ -62,7 +62,7 @@ export default class Projects extends React.PureComponent<Props> { </tr> </thead> <tbody> - {this.props.projects.map(project => + {this.props.projects.map(project => ( <ProjectRow key={project.key} onApplyTemplateClick={this.onApplyTemplateClick} @@ -70,7 +70,7 @@ export default class Projects extends React.PureComponent<Props> { project={project} selected={this.props.selection.includes(project.key)} /> - )} + ))} </tbody> </table> ); diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx index 50e94342396..bb5851221ca 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx @@ -132,11 +132,12 @@ export default class Search extends React.PureComponent<Props, State> { ); }; - renderQualifierOption = (option: { label: string; value: string }) => + renderQualifierOption = (option: { label: string; value: string }) => ( <span> <QualifierIcon className="little-spacer-right" qualifier={option.value} /> {option.label} - </span>; + </span> + ); renderQualifierFilter = () => { const options = this.getQualifierOptions(); @@ -162,22 +163,22 @@ export default class Search extends React.PureComponent<Props, State> { }; renderTypeFilter = () => - this.props.qualifiers === 'TRK' - ? <td className="thin nowrap text-middle"> - <Checkbox - className="link-checkbox-control" - checked={this.props.provisioned} - id="projects-provisioned" - onCheck={this.props.onProvisionedChanged}> - <span className="little-spacer-left"> - {translate('provisioning.only_provisioned')} - <Tooltip overlay={translate('provisioning.only_provisioned.tooltip')}> - <i className="spacer-left icon-help" /> - </Tooltip> - </span> - </Checkbox> - </td> - : null; + this.props.qualifiers === 'TRK' ? ( + <td className="thin nowrap text-middle"> + <Checkbox + className="link-checkbox-control" + checked={this.props.provisioned} + id="projects-provisioned" + onCheck={this.props.onProvisionedChanged}> + <span className="little-spacer-left"> + {translate('provisioning.only_provisioned')} + <Tooltip overlay={translate('provisioning.only_provisioned.tooltip')}> + <i className="spacer-left icon-help" /> + </Tooltip> + </span> + </Checkbox> + </td> + ) : null; renderDateFilter = () => { return ( @@ -238,7 +239,7 @@ export default class Search extends React.PureComponent<Props, State> { </tbody> </table> - {this.state.bulkApplyTemplateModal && + {this.state.bulkApplyTemplateModal && ( <BulkApplyTemplateModal analyzedBefore={this.props.analyzedBefore} onClose={this.closeBulkApplyTemplateModal} @@ -248,9 +249,10 @@ export default class Search extends React.PureComponent<Props, State> { query={this.props.query} selection={this.props.selection} total={this.props.total} - />} + /> + )} - {this.state.deleteModal && + {this.state.deleteModal && ( <DeleteModal analyzedBefore={this.props.analyzedBefore} onClose={this.closeDeleteModal} @@ -261,7 +263,8 @@ export default class Search extends React.PureComponent<Props, State> { query={this.props.query} selection={this.props.selection} total={this.props.total} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx index 2cc0ec841ef..792e29ccc48 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx @@ -41,16 +41,25 @@ it('selects and deselects project', () => { const onProjectSelected = jest.fn(); const wrapper = shallowRender({ onProjectDeselected, onProjectSelected, projects }); - wrapper.find('ProjectRow').first().prop<Function>('onProjectCheck')(projects[0], true); + wrapper + .find('ProjectRow') + .first() + .prop<Function>('onProjectCheck')(projects[0], true); expect(onProjectSelected).toBeCalledWith('a'); - wrapper.find('ProjectRow').first().prop<Function>('onProjectCheck')(projects[0], false); + wrapper + .find('ProjectRow') + .first() + .prop<Function>('onProjectCheck')(projects[0], false); expect(onProjectDeselected).toBeCalledWith('a'); }); it('opens modal to apply permission template', () => { const wrapper = shallowRender({ projects }); - wrapper.find('ProjectRow').first().prop<Function>('onApplyTemplateClick')(projects[0]); + wrapper + .find('ProjectRow') + .first() + .prop<Function>('onApplyTemplateClick')(projects[0]); expect(ApplyTemplateView).toBeCalledWith({ organization, project: projects[0] }); }); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js index 81a6003f7dc..6f865126100 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js @@ -153,18 +153,12 @@ export default class Condition extends Component { if (isDiffMetric) { return ( - <span className="note"> - {translate('quality_gates.condition.leak.unconditional')} - </span> + <span className="note">{translate('quality_gates.condition.leak.unconditional')}</span> ); } if (isRating) { - return ( - <span className="note"> - {translate('quality_gates.condition.leak.never')} - </span> - ); + return <span className="note">{translate('quality_gates.condition.leak.never')}</span>; } return isLeakSelected @@ -196,11 +190,7 @@ export default class Condition extends Component { } if (metric.type === 'RATING') { - return ( - <span className="note"> - {translate('quality_gates.operator.GT.rating')} - </span> - ); + return <span className="note">{translate('quality_gates.operator.GT.rating')}</span>; } const operators = ['LT', 'GT', 'EQ', 'NE']; @@ -229,70 +219,72 @@ export default class Condition extends Component { <tr> <td className="text-middle"> {getLocalizedMetricName(metric)} - {metric.hidden && - <span className="text-danger little-spacer-left"> - {translate('deprecated')} - </span>} + {metric.hidden && ( + <span className="text-danger little-spacer-left">{translate('deprecated')}</span> + )} </td> - <td className="thin text-middle nowrap"> - {this.renderPeriod()} - </td> + <td className="thin text-middle nowrap">{this.renderPeriod()}</td> - <td className="thin text-middle nowrap"> - {this.renderOperator()} - </td> + <td className="thin text-middle nowrap">{this.renderOperator()}</td> <td className="thin text-middle nowrap"> - {edit - ? <ThresholdInput - name="warning" - value={this.state.warning} - metric={metric} - onChange={value => this.handleWarningChange(value)} - /> - : formatMeasure(condition.warning, metric.type)} + {edit ? ( + <ThresholdInput + name="warning" + value={this.state.warning} + metric={metric} + onChange={value => this.handleWarningChange(value)} + /> + ) : ( + formatMeasure(condition.warning, metric.type) + )} </td> <td className="thin text-middle nowrap"> - {edit - ? <ThresholdInput - name="error" - value={this.state.error} - metric={metric} - onChange={value => this.handleErrorChange(value)} - /> - : formatMeasure(condition.error, metric.type)} + {edit ? ( + <ThresholdInput + name="error" + value={this.state.error} + metric={metric} + onChange={value => this.handleErrorChange(value)} + /> + ) : ( + formatMeasure(condition.error, metric.type) + )} </td> - {edit && + {edit && ( <td className="thin text-middle nowrap"> - {condition.id - ? <div className="button-group"> - <button - className="update-condition" - disabled={!this.state.changed} - onClick={this.handleUpdateClick.bind(this)}> - {translate('update_verb')} - </button> - <button - className="button-red delete-condition" - onClick={this.handleDeleteClick.bind(this)}> - {translate('delete')} - </button> - </div> - : <div className="button-group"> - <button className="add-condition" onClick={this.handleSaveClick.bind(this)}> - {translate('add_verb')} - </button> - <a - className="action cancel-add-condition" - href="#" - onClick={this.handleCancelClick.bind(this)}> - {translate('cancel')} - </a> - </div>} - </td>} + {condition.id ? ( + <div className="button-group"> + <button + className="update-condition" + disabled={!this.state.changed} + onClick={this.handleUpdateClick.bind(this)}> + {translate('update_verb')} + </button> + <button + className="button-red delete-condition" + onClick={this.handleDeleteClick.bind(this)}> + {translate('delete')} + </button> + </div> + ) : ( + <div className="button-group"> + <button className="add-condition" onClick={this.handleSaveClick.bind(this)}> + {translate('add_verb')} + </button> + <a + className="action cancel-add-condition" + href="#" + onClick={this.handleCancelClick.bind(this)}> + {translate('cancel')} + </a> + </div> + )} + </td> + )} </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js index b9e07816788..3d4b9ff3aed 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js @@ -87,72 +87,54 @@ export default class Conditions extends React.PureComponent { return ( <div id="quality-gate-conditions" className="quality-gate-section"> - <h3 className="spacer-bottom"> - {translate('quality_gates.conditions')} - </h3> + <h3 className="spacer-bottom">{translate('quality_gates.conditions')}</h3> <ConditionsAlert /> - {this.state.error && - <div className="alert alert-danger"> - {this.state.error} - </div>} + {this.state.error && <div className="alert alert-danger">{this.state.error}</div>} - {uniqDuplicates.length > 0 && + {uniqDuplicates.length > 0 && ( <div className="alert alert-warning"> - <p> - {translate('quality_gates.duplicated_conditions')} - </p> + <p>{translate('quality_gates.duplicated_conditions')}</p> <ul className="list-styled spacer-top"> - {uniqDuplicates.map(d => - <li key={d.metric.key}> - {getLocalizedMetricName(d.metric)} - </li> - )} + {uniqDuplicates.map(d => ( + <li key={d.metric.key}>{getLocalizedMetricName(d.metric)}</li> + ))} </ul> - </div>} + </div> + )} - {sortedConditions.length - ? <table id="quality-gate-conditions" className="data zebra zebra-hover"> - <thead> - <tr> - <th className="nowrap"> - {translate('quality_gates.conditions.metric')} - </th> - <th className="thin nowrap"> - {translate('quality_gates.conditions.leak')} - </th> - <th className="thin nowrap"> - {translate('quality_gates.conditions.operator')} - </th> - <th className="thin nowrap"> - {translate('quality_gates.conditions.warning')} - </th> - <th className="thin nowrap"> - {translate('quality_gates.conditions.error')} - </th> - {edit && <th />} - </tr> - </thead> - <tbody> - {sortedConditions.map((condition, index) => - <Condition - key={getKey(condition, index)} - qualityGate={qualityGate} - condition={condition} - metric={metrics.find(metric => metric.key === condition.metric)} - edit={edit} - onSaveCondition={onSaveCondition} - onDeleteCondition={onDeleteCondition} - onError={this.handleError.bind(this)} - onResetError={this.handleResetError.bind(this)} - /> - )} - </tbody> - </table> - : <div className="big-spacer-top"> - {translate('quality_gates.no_conditions')} - </div>} + {sortedConditions.length ? ( + <table id="quality-gate-conditions" className="data zebra zebra-hover"> + <thead> + <tr> + <th className="nowrap">{translate('quality_gates.conditions.metric')}</th> + <th className="thin nowrap">{translate('quality_gates.conditions.leak')}</th> + <th className="thin nowrap">{translate('quality_gates.conditions.operator')}</th> + <th className="thin nowrap">{translate('quality_gates.conditions.warning')}</th> + <th className="thin nowrap">{translate('quality_gates.conditions.error')}</th> + {edit && <th />} + </tr> + </thead> + <tbody> + {sortedConditions.map((condition, index) => ( + <Condition + key={getKey(condition, index)} + qualityGate={qualityGate} + condition={condition} + metric={metrics.find(metric => metric.key === condition.metric)} + edit={edit} + onSaveCondition={onSaveCondition} + onDeleteCondition={onDeleteCondition} + onError={this.handleError.bind(this)} + onResetError={this.handleResetError.bind(this)} + /> + ))} + </tbody> + </table> + ) : ( + <div className="big-spacer-top">{translate('quality_gates.no_conditions')}</div> + )} {edit && <AddConditionForm metrics={metrics} onSelect={onAddCondition} />} </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionsAlert.js b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionsAlert.js index 334b4d2a397..30e36b2dbbd 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionsAlert.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionsAlert.js @@ -36,11 +36,12 @@ export default class ConditionsAlert extends Component { return ( <div className="big-spacer-bottom"> {translate('quality_gates.introduction')} - {!expanded && + {!expanded && ( <a className="spacer-left" href="#" onClick={this.handleMoreClick.bind(this)}> {translate('more')} - </a>} - {expanded && + </a> + )} + {expanded && ( <div className="spacer-top"> {translate('quality_gates.health_icons')} <ul> @@ -54,7 +55,8 @@ export default class ConditionsAlert extends Component { <i className="icon-alert-error" /> {translate('alerts.notes.error')} </li> </ul> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.js b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.js index 5c826c2c302..e5418420447 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.js @@ -45,9 +45,7 @@ export default class DetailsContent extends React.PureComponent { /> <div id="quality-gate-projects" className="quality-gate-section"> - <h3 className="spacer-bottom"> - {translate('quality_gates.projects')} - </h3> + <h3 className="spacer-bottom">{translate('quality_gates.projects')}</h3> {gate.isDefault ? defaultMessage : <Projects qualityGate={gate} edit={canEdit} />} </div> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.js b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.js index 2f6091184d6..6acb20708d8 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.js @@ -48,10 +48,8 @@ export default class DetailsHeader extends React.PureComponent { <div className="layout-page-header-panel layout-page-main-header issues-main-header"> <div className="layout-page-header-panel-inner layout-page-main-header-inner"> <div className="layout-page-main-inner"> - <h2 className="pull-left"> - {qualityGate.name} - </h2> - {edit && + <h2 className="pull-left">{qualityGate.name}</h2> + {edit && ( <div className="pull-right"> <div className="button-group"> <button id="quality-gate-rename" onClick={this.handleRenameClick}> @@ -61,9 +59,11 @@ export default class DetailsHeader extends React.PureComponent { {translate('copy')} </button> <button id="quality-gate-toggle-default" onClick={this.handleSetAsDefaultClick}> - {qualityGate.isDefault - ? translate('unset_as_default') - : translate('set_as_default')} + {qualityGate.isDefault ? ( + translate('unset_as_default') + ) : ( + translate('set_as_default') + )} </button> <button id="quality-gate-delete" @@ -72,7 +72,8 @@ export default class DetailsHeader extends React.PureComponent { {translate('delete')} </button> </div> - </div>} + </div> + )} </div> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.js index 03b2c9ef28b..2de9b9e5218 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.js @@ -25,12 +25,8 @@ export default function Intro() { <div className="layout-page-main"> <div className="layout-page-main-inner"> <div className="search-navigator-intro markdown"> - <p> - {translate('quality_gates.intro.1')} - </p> - <p> - {translate('quality_gates.intro.2')} - </p> + <p>{translate('quality_gates.intro.1')}</p> + <p>{translate('quality_gates.intro.2')}</p> </div> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/List.js b/server/sonar-web/src/main/js/apps/quality-gates/components/List.js index b6a4d3a8c23..8d84ec0e677 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/List.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/List.js @@ -25,7 +25,7 @@ import { getQualityGateUrl } from '../../../helpers/urls'; export default function List({ organization, qualityGates }) { return ( <div className="list-group"> - {qualityGates.map(qualityGate => + {qualityGates.map(qualityGate => ( <Link key={qualityGate.id} to={getQualityGateUrl(qualityGate.id, organization && organization.key)} @@ -35,20 +35,17 @@ export default function List({ organization, qualityGates }) { <table> <tbody> <tr> - <td className="text-top"> - {qualityGate.name} - </td> + <td className="text-top">{qualityGate.name}</td> <td className="text-top thin nowrap spacer-left"> - {qualityGate.isDefault && - <span className="badge pull-right"> - {translate('default')} - </span>} + {qualityGate.isDefault && ( + <span className="badge pull-right">{translate('default')}</span> + )} </td> </tr> </tbody> </table> </Link> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.js b/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.js index 6c4b912b8df..686d17f3489 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.js @@ -29,17 +29,16 @@ export default function ListHeader({ canEdit, onAdd }) { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('quality_gates.page')} - </h1> - {canEdit && + <h1 className="page-title">{translate('quality_gates.page')}</h1> + {canEdit && ( <div className="page-actions"> <div className="button-group"> <button id="quality-gate-add" onClick={handleAddClick}> {translate('create')} </button> </div> - </div>} + </div> + )} </header> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx index 9fef642d8e7..021f1d3dca0 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx @@ -52,17 +52,15 @@ export default function Changelog(props: Props) { return ( <tr key={index} className={className}> - <td className="thin nowrap"> - {!isBulkChange && <DateTimeFormatter date={event.date} />} - </td> + <td className="thin nowrap">{!isBulkChange && <DateTimeFormatter date={event.date} />}</td> <td className="thin nowrap"> {!isBulkChange && - (event.authorName - ? <span> - {event.authorName} - </span> - : <span className="note">System</span>)} + (event.authorName ? ( + <span>{event.authorName}</span> + ) : ( + <span className="note">System</span> + ))} </td> <td className="thin nowrap"> @@ -75,9 +73,7 @@ export default function Changelog(props: Props) { </Link> </td> - <td className="thin nowrap"> - {event.params && <ChangesList changes={event.params} />} - </td> + <td className="thin nowrap">{event.params && <ChangesList changes={event.params} />}</td> </tr> ); }); @@ -89,23 +85,13 @@ export default function Changelog(props: Props) { <th className="thin nowrap"> {translate('date')} <i className="icon-sort-desc" /> </th> - <th className="thin nowrap"> - {translate('user')} - </th> - <th className="thin nowrap"> - {translate('action')} - </th> - <th> - {translate('rule')} - </th> - <th className="thin nowrap"> - {translate('parameters')} - </th> + <th className="thin nowrap">{translate('user')}</th> + <th className="thin nowrap">{translate('action')}</th> + <th>{translate('rule')}</th> + <th className="thin nowrap">{translate('parameters')}</th> </tr> </thead> - <tbody> - {rows} - </tbody> + <tbody>{rows}</tbody> </table> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx index c045d1e2208..27cc49278d9 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx @@ -185,15 +185,17 @@ export default class ChangelogContainer extends React.PureComponent<Props, State {this.state.events != null && this.state.events.length === 0 && <ChangelogEmpty />} {this.state.events != null && - this.state.events.length > 0 && - <Changelog events={this.state.events} organization={this.props.organization} />} + this.state.events.length > 0 && ( + <Changelog events={this.state.events} organization={this.props.organization} /> + )} - {shouldDisplayFooter && + {shouldDisplayFooter && ( <footer className="text-center spacer-top small"> <a href="#" onClick={this.loadMore.bind(this)}> {translate('show_more')} </a> - </footer>} + </footer> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogEmpty.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogEmpty.tsx index b8a9fbaa35e..dc72938eb38 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogEmpty.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogEmpty.tsx @@ -21,9 +21,5 @@ import * as React from 'react'; import { translate } from '../../../helpers/l10n'; export default function ChangelogEmpty() { - return ( - <div className="big-spacer-top"> - {translate('no_results')} - </div> - ); + return <div className="big-spacer-top">{translate('no_results')}</div>; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx index c800e44e918..b4800eeafa2 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx @@ -28,13 +28,15 @@ interface Props { export default function ChangesList({ changes }: Props) { return ( <ul> - {Object.keys(changes).map(key => + {Object.keys(changes).map(key => ( <li key={key}> - {key === 'severity' - ? <SeverityChange severity={changes[key]} /> - : <ParameterChange name={key} value={changes[key]} />} + {key === 'severity' ? ( + <SeverityChange severity={changes[key]} /> + ) : ( + <ParameterChange name={key} value={changes[key]} /> + )} </li> - )} + ))} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx index 5ce25c758e8..afa8646f50b 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx @@ -126,10 +126,10 @@ export default class ComparisonContainer extends React.PureComponent<Props, Stat </header> {left != null && - inLeft != null && - right != null && - inRight != null && - modified != null && + inLeft != null && + right != null && + inRight != null && + modified != null && ( <ComparisonResults left={left} right={right} @@ -137,7 +137,8 @@ export default class ComparisonContainer extends React.PureComponent<Props, Stat inRight={inRight} modified={modified} organization={this.props.organization} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonEmpty.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonEmpty.tsx index a6a2c390289..6804cfa5e04 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonEmpty.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonEmpty.tsx @@ -21,9 +21,5 @@ import * as React from 'react'; import { translate } from '../../../helpers/l10n'; export default function ComparisonEmpty() { - return ( - <div className="big-spacer-top"> - {translate('quality_profile.empty_comparison')} - </div> - ); + return <div className="big-spacer-top">{translate('quality_profile.empty_comparison')}</div>; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx index a65bd9f73e2..37711f160a2 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx @@ -42,9 +42,7 @@ export default class ComparisonForm extends React.PureComponent<Props> { return ( <div className="display-inline-block"> - <label className="spacer-right"> - {translate('quality_profiles.compare_with')} - </label> + <label className="spacer-right">{translate('quality_profiles.compare_with')}</label> <Select value={withKey} options={options} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx index f29c2ec1c2b..175ba7f003e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx @@ -56,7 +56,7 @@ export default class ComparisonResults extends React.PureComponent<Props> { } return ( <ul> - {Object.keys(params).map(key => + {Object.keys(params).map(key => ( <li key={key} className="spacer-top"> <code> {key} @@ -64,7 +64,7 @@ export default class ComparisonResults extends React.PureComponent<Props> { {params[key]} </code> </li> - )} + ))} </ul> ); } @@ -87,14 +87,12 @@ export default class ComparisonResults extends React.PureComponent<Props> { <td> </td> </tr> ); - const rows = this.props.inLeft.map(rule => + const rows = this.props.inLeft.map(rule => ( <tr key={`left-${rule.key}`} className="js-comparison-in-left"> - <td> - {this.renderRule(rule, rule.severity)} - </td> + <td>{this.renderRule(rule, rule.severity)}</td> <td> </td> </tr> - ); + )); return [header, ...rows]; } @@ -116,14 +114,12 @@ export default class ComparisonResults extends React.PureComponent<Props> { </td> </tr> ); - const rows = this.props.inRight.map(rule => + const rows = this.props.inRight.map(rule => ( <tr key={`right-${rule.key}`} className="js-comparison-in-right"> <td> </td> - <td> - {this.renderRule(rule, rule.severity)} - </td> + <td>{this.renderRule(rule, rule.severity)}</td> </tr> - ); + )); return [header, ...rows]; } @@ -146,18 +142,14 @@ export default class ComparisonResults extends React.PureComponent<Props> { const secondHeader = ( <tr key="modified-second-header"> <td> - <h6> - {this.props.left.name} - </h6> + <h6>{this.props.left.name}</h6> </td> <td> - <h6> - {this.props.right.name} - </h6> + <h6>{this.props.right.name}</h6> </td> </tr> ); - const rows = this.props.modified.map(rule => + const rows = this.props.modified.map(rule => ( <tr key={`modified-${rule.key}`} className="js-comparison-modified"> <td> {this.renderRule(rule, rule.left.severity)} @@ -168,7 +160,7 @@ export default class ComparisonResults extends React.PureComponent<Props> { {this.renderParameters(rule.right.params)} </td> </tr> - ); + )); return [header, secondHeader, ...rows]; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx index c3200b06612..a4bdea43e7b 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx @@ -81,15 +81,40 @@ it('should compare', () => { const rightDiffs = output.find('.js-comparison-in-right'); expect(rightDiffs.length).toBe(2); expect(rightDiffs.at(0).find(Link).length).toBe(1); - expect(rightDiffs.at(0).find(Link).prop('to')).toContain('rule_key=rule2'); - expect(rightDiffs.at(0).find(Link).prop('children')).toContain('rule2'); + expect( + rightDiffs + .at(0) + .find(Link) + .prop('to') + ).toContain('rule_key=rule2'); + expect( + rightDiffs + .at(0) + .find(Link) + .prop('children') + ).toContain('rule2'); expect(rightDiffs.at(0).find(SeverityIcon).length).toBe(1); - expect(rightDiffs.at(0).find(SeverityIcon).prop('severity')).toBe('CRITICAL'); + expect( + rightDiffs + .at(0) + .find(SeverityIcon) + .prop('severity') + ).toBe('CRITICAL'); const modifiedDiffs = output.find('.js-comparison-modified'); expect(modifiedDiffs.length).toBe(1); - expect(modifiedDiffs.find(Link).at(0).prop('to')).toContain('rule_key=rule4'); - expect(modifiedDiffs.find(Link).at(0).prop('children')).toContain('rule4'); + expect( + modifiedDiffs + .find(Link) + .at(0) + .prop('to') + ).toContain('rule_key=rule4'); + expect( + modifiedDiffs + .find(Link) + .at(0) + .prop('children') + ).toContain('rule4'); expect(modifiedDiffs.find(SeverityIcon).length).toBe(2); expect(modifiedDiffs.text()).toContain('bar'); expect(modifiedDiffs.text()).toContain('qwe'); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInBadge.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInBadge.tsx index 7a70614d3e5..c0113215f4f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInBadge.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInBadge.tsx @@ -41,9 +41,5 @@ export default function BuiltInBadge({ className, tooltip = true }: Props) { </span> ); - return tooltip - ? <Tooltip overlay={overlay}> - {badge} - </Tooltip> - : badge; + return tooltip ? <Tooltip overlay={overlay}>{badge}</Tooltip> : badge; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx index 0488d31b863..70f58f01ea6 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx @@ -94,9 +94,7 @@ export default class CopyProfileForm extends React.PureComponent<Props, State> { onRequestClose={this.props.onClose}> <form id="copy-profile-form" onSubmit={this.handleFormSubmit}> <div className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </div> <div className="modal-body"> <div className="modal-field"> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx index 2b7b1cbe26c..9a25f9c3007 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx @@ -76,32 +76,32 @@ export default class DeleteProfileForm extends React.PureComponent<Props, State> onRequestClose={this.props.onClose}> <form id="delete-profile-form" onSubmit={this.handleFormSubmit}> <div className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </div> <div className="modal-body"> <div className="js-modal-messages" /> - {profile.childrenCount > 0 - ? <div> - <div className="alert alert-warning"> - {translate('quality_profiles.this_profile_has_descendants')} - </div> - <p> - {translateWithParameters( - 'quality_profiles.are_you_sure_want_delete_profile_x_and_descendants', - profile.name, - profile.languageName - )} - </p> + {profile.childrenCount > 0 ? ( + <div> + <div className="alert alert-warning"> + {translate('quality_profiles.this_profile_has_descendants')} </div> - : <p> + <p> {translateWithParameters( - 'quality_profiles.are_you_sure_want_delete_profile_x', + 'quality_profiles.are_you_sure_want_delete_profile_x_and_descendants', profile.name, profile.languageName )} - </p>} + </p> + </div> + ) : ( + <p> + {translateWithParameters( + 'quality_profiles.are_you_sure_want_delete_profile_x', + profile.name, + profile.languageName + )} + </p> + )} </div> <div className="modal-foot"> {this.state.loading && <i className="spinner spacer-right" />} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx index 7d3f250244a..0fb083d48f3 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx @@ -138,18 +138,18 @@ export default class ProfileActions extends React.PureComponent<Props, State> { return ( <ul className="dropdown-menu dropdown-menu-right"> {canAdmin && - !profile.isBuiltIn && + !profile.isBuiltIn && ( <li> - <Link to={activateMoreUrl}> - {translate('quality_profiles.activate_more_rules')} - </Link> - </li>} - {!profile.isBuiltIn && + <Link to={activateMoreUrl}>{translate('quality_profiles.activate_more_rules')}</Link> + </li> + )} + {!profile.isBuiltIn && ( <li> <a id="quality-profile-backup" href={backupUrl}> {translate('backup_verb')} </a> - </li>} + </li> + )} <li> <Link to={getProfileComparePath(profile.name, profile.language, this.props.organization)} @@ -157,58 +157,65 @@ export default class ProfileActions extends React.PureComponent<Props, State> { {translate('compare')} </Link> </li> - {canAdmin && + {canAdmin && ( <li> <a id="quality-profile-copy" href="#" onClick={this.handleCopyClick}> {translate('copy')} </a> - </li>} + </li> + )} {canAdmin && - !profile.isBuiltIn && + !profile.isBuiltIn && ( <li> <a id="quality-profile-rename" href="#" onClick={this.handleRenameClick}> {translate('rename')} </a> - </li>} + </li> + )} {canAdmin && - !profile.isDefault && + !profile.isDefault && ( <li> <a id="quality-profile-set-as-default" href="#" onClick={this.handleSetDefaultClick}> {translate('set_as_default')} </a> - </li>} + </li> + )} {canAdmin && - !profile.isDefault && - !profile.isBuiltIn && + !profile.isDefault && + !profile.isBuiltIn && ( <li> <a id="quality-profile-delete" href="#" onClick={this.handleDeleteClick}> {translate('delete')} </a> - </li>} + </li> + )} - {this.state.copyFormOpen && + {this.state.copyFormOpen && ( <CopyProfileForm onClose={this.closeCopyForm} onCopy={this.handleProfileCopy} onRequestFail={this.props.onRequestFail} profile={profile} - />} + /> + )} - {this.state.deleteFormOpen && + {this.state.deleteFormOpen && ( <DeleteProfileForm onClose={this.closeDeleteForm} onDelete={this.handleProfileDelete} onRequestFail={this.props.onRequestFail} profile={profile} - />} + /> + )} - {this.state.renameFormOpen && + {this.state.renameFormOpen && ( <RenameProfileForm onClose={this.closeRenameForm} onRename={this.handleProfileRename} onRequestFail={this.props.onRequestFail} profile={profile} - />} + /> + )} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileDate.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileDate.tsx index 01c08688af9..5e2723f0fe8 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileDate.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileDate.tsx @@ -28,13 +28,13 @@ interface Props { } export default function ProfileDate({ date }: Props) { - return date - ? <Tooltip overlay={<DateTimeFormatter date={date} />}> - <span> - <DateFromNow date={date} /> - </span> - </Tooltip> - : <span> - {translate('never')} - </span>; + return date ? ( + <Tooltip overlay={<DateTimeFormatter date={date} />}> + <span> + <DateFromNow date={date} /> + </span> + </Tooltip> + ) : ( + <span>{translate('never')}</span> + ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.tsx index a6fd496502c..2fa920969ff 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.tsx @@ -35,9 +35,7 @@ export default function ProfileNotFound(props: Props) { </IndexLink> </div> - <div> - {translate('quality_profiles.not_found')} - </div> + <div>{translate('quality_profiles.not_found')}</div> </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx index afc7e5f9c62..d8c4951f02c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx @@ -94,9 +94,7 @@ export default class RenameProfileForm extends React.PureComponent<Props, State> onRequestClose={this.props.onClose}> <form id="rename-profile-form" onSubmit={this.handleFormSubmit}> <div className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </div> <div className="modal-body"> <div className="modal-field"> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx index 082aad2b5bf..2c4d94a9544 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx @@ -107,9 +107,7 @@ export default class ChangeParentForm extends React.PureComponent<Props, State> onRequestClose={this.props.onClose}> <form id="change-profile-parent-form" onSubmit={this.handleFormSubmit}> <div className="modal-head"> - <h2> - {translate('quality_profiles.change_parent')} - </h2> + <h2>{translate('quality_profiles.change_parent')}</h2> </div> <div className="modal-body"> <div className="modal-field"> @@ -122,9 +120,11 @@ export default class ChangeParentForm extends React.PureComponent<Props, State> onChange={this.handleSelectChange} options={options} value={ - this.state.selected != null - ? this.state.selected - : this.props.profile.parentKey || '' + this.state.selected != null ? ( + this.state.selected + ) : ( + this.props.profile.parentKey || '' + ) } /> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx index 5da1b7c6056..3467fb01b19 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx @@ -81,9 +81,7 @@ export default class ChangeProjectsForm extends React.PureComponent<Props> { overlayClassName="modal-overlay" onRequestClose={this.props.onClose}> <div className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </div> <div className="modal-body"> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx index 8dc0ec280a7..be7f0d8b433 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx @@ -55,18 +55,16 @@ export default class ProfileExporters extends React.PureComponent<Props> { return ( <div className="quality-profile-box quality-profile-exporters"> <header className="big-spacer-bottom"> - <h2> - {translate('quality_profiles.exporters')} - </h2> + <h2>{translate('quality_profiles.exporters')}</h2> </header> <ul> - {exportersForLanguage.map(exporter => + {exportersForLanguage.map(exporter => ( <li key={exporter.key} data-key={exporter.key} className="spacer-top"> <a href={this.getExportUrl(exporter)} target="_blank"> {exporter.name} </a> </li> - )} + ))} </ul> </div> ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx index c611571269f..d0091653d08 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx @@ -49,17 +49,9 @@ export default class ProfileHeader extends React.PureComponent<Props> { </span> ); if (isStagnant(profile)) { - inner = ( - <span className="badge badge-normal-size badge-focus"> - {inner} - </span> - ); + inner = <span className="badge badge-normal-size badge-focus">{inner}</span>; } - return ( - <li className="small spacer-right"> - {inner} - </li> - ); + return <li className="small spacer-right">{inner}</li>; } renderUsageDate() { @@ -70,18 +62,10 @@ export default class ProfileHeader extends React.PureComponent<Props> { </span> ); if (!profile.lastUsed) { - inner = ( - <span className="badge badge-normal-size badge-focus"> - {inner} - </span> - ); + inner = <span className="badge badge-normal-size badge-focus">{inner}</span>; } - return ( - <li className="small big-spacer-right"> - {inner} - </li> - ); + return <li className="small big-spacer-right">{inner}</li>; } render() { @@ -107,9 +91,7 @@ export default class ProfileHeader extends React.PureComponent<Props> { language={profile.language} name={profile.name} organization={organization}> - <span> - {profile.name} - </span> + <span>{profile.name}</span> </ProfileLink> {profile.isBuiltIn && <BuiltInBadge className="spacer-left" tooltip={false} />} </h1> @@ -142,12 +124,13 @@ export default class ProfileHeader extends React.PureComponent<Props> { </ul> </div> - {profile.isBuiltIn && + {profile.isBuiltIn && ( <div className="page-description"> {translate('quality_profiles.built_in.description.1')} <br /> {translate('quality_profiles.built_in.description.2')} - </div>} + </div> + )} </header> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx index 6ae17d29f37..53a6333126a 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx @@ -121,21 +121,20 @@ export default class ProfileInheritance extends React.PureComponent<Props, State return ( <div className="quality-profile-inheritance"> <header className="big-spacer-bottom clearfix"> - <h2 className="pull-left"> - {translate('quality_profiles.profile_inheritance')} - </h2> + <h2 className="pull-left">{translate('quality_profiles.profile_inheritance')}</h2> {this.props.canAdmin && - !this.props.profile.isBuiltIn && + !this.props.profile.isBuiltIn && ( <button className="pull-right js-change-parent" onClick={this.handleChangeParentClick}> {translate('quality_profiles.change_parent')} - </button>} + </button> + )} </header> - {!this.state.loading && + {!this.state.loading && ( <table className="data zebra"> <tbody> {ancestors != null && - ancestors.map((ancestor, index) => + ancestors.map((ancestor, index) => ( <ProfileInheritanceBox className="js-inheritance-ancestor" depth={index} @@ -144,9 +143,9 @@ export default class ProfileInheritance extends React.PureComponent<Props, State organization={this.props.organization} profile={ancestor} /> - )} + ))} - {this.state.profile != null && + {this.state.profile != null && ( <ProfileInheritanceBox className={currentClassName} depth={ancestors ? ancestors.length : 0} @@ -155,10 +154,11 @@ export default class ProfileInheritance extends React.PureComponent<Props, State language={profile.language} organization={this.props.organization} profile={this.state.profile} - />} + /> + )} {this.state.children != null && - this.state.children.map(child => + this.state.children.map(child => ( <ProfileInheritanceBox className="js-inheritance-child" depth={ancestors ? ancestors.length + 1 : 0} @@ -167,18 +167,20 @@ export default class ProfileInheritance extends React.PureComponent<Props, State organization={this.props.organization} profile={child} /> - )} + ))} </tbody> - </table>} + </table> + )} - {this.state.formOpen && + {this.state.formOpen && ( <ChangeParentForm onChange={this.handleParentChange} onClose={this.closeForm} onRequestFail={this.props.onRequestFail} profile={profile} profiles={profiles.filter(p => p !== profile && p.language === profile.language)} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx index 2455e39ae03..12e27f57594 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx @@ -48,34 +48,36 @@ export default function ProfileInheritanceBox({ displayLink = true, ...props }: <tr className={className}> <td> <div style={{ paddingLeft: offset }}> - {displayLink - ? <ProfileLink - language={props.language} - name={profile.name} - organization={props.organization}> - {profile.name} - </ProfileLink> - : profile.name} + {displayLink ? ( + <ProfileLink + language={props.language} + name={profile.name} + organization={props.organization}> + {profile.name} + </ProfileLink> + ) : ( + profile.name + )} {profile.isBuiltIn && <BuiltInBadge className="spacer-left" />} - {extendsBuiltIn && + {extendsBuiltIn && ( <Tooltip overlay={translate('quality_profiles.extends_built_in')}> <i className="icon-help spacer-left" /> - </Tooltip>} + </Tooltip> + )} </div> </td> - <td> - {translateWithParameters('quality_profile.x_active_rules', profile.activeRuleCount)} - </td> + <td>{translateWithParameters('quality_profile.x_active_rules', profile.activeRuleCount)}</td> <td> - {profile.overridingRuleCount != null && + {profile.overridingRuleCount != null && ( <p> {translateWithParameters( 'quality_profiles.x_overridden_rules', profile.overridingRuleCount )} - </p>} + </p> + )} </td> </tr> ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx index f04e4cd5c4d..75171f440c9 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx @@ -93,9 +93,7 @@ export default class ProfileProjects extends React.PureComponent<Props, State> { renderDefault() { return ( <div> - <span className="badge spacer-right"> - {translate('default')} - </span> + <span className="badge spacer-right">{translate('default')}</span> {translate('quality_profiles.projects_for_default')} </div> ); @@ -109,16 +107,12 @@ export default class ProfileProjects extends React.PureComponent<Props, State> { } if (projects.length === 0) { - return ( - <div> - {translate('quality_profiles.no_projects_associated_to_profile')} - </div> - ); + return <div>{translate('quality_profiles.no_projects_associated_to_profile')}</div>; } return ( <ul> - {projects.map(project => + {projects.map(project => ( <li key={project.uuid} className="spacer-top js-profile-project" data-key={project.key}> <Link to={{ pathname: '/dashboard', query: { id: project.key } }} @@ -126,7 +120,7 @@ export default class ProfileProjects extends React.PureComponent<Props, State> { <QualifierIcon qualifier="TRK" /> <span>{project.name}</span> </Link> </li> - )} + ))} </ul> ); } @@ -135,27 +129,27 @@ export default class ProfileProjects extends React.PureComponent<Props, State> { return ( <div className="quality-profile-projects"> <header className="page-header"> - <h2 className="page-title"> - {translate('projects')} - </h2> + <h2 className="page-title">{translate('projects')}</h2> {this.props.canAdmin && - !this.props.profile.isDefault && + !this.props.profile.isDefault && ( <div className="pull-right"> <button className="js-change-projects" onClick={this.handleChangeClick}> {translate('quality_profiles.change_projects')} </button> - </div>} + </div> + )} </header> {this.props.profile.isDefault ? this.renderDefault() : this.renderProjects()} - {this.state.formOpen && + {this.state.formOpen && ( <ChangeProjectsForm onClose={this.closeForm} organization={this.props.organization} profile={this.props.profile} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx index 106636460f4..c4ec8b3dfa5 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx @@ -154,16 +154,10 @@ export default class ProfileRules extends React.PureComponent<Props, State> { <thead> <tr> <th> - <h2> - {translate('rules')} - </h2> - </th> - <th> - {translate('active')} - </th> - <th> - {translate('inactive')} + <h2>{translate('rules')}</h2> </th> + <th>{translate('active')}</th> + <th>{translate('inactive')}</th> </tr> </thead> <tbody> @@ -174,7 +168,7 @@ export default class ProfileRules extends React.PureComponent<Props, State> { qprofile={profile.key} total={this.state.total} /> - {TYPES.map(type => + {TYPES.map(type => ( <ProfileRulesRowOfType key={type} count={this.getRulesCountForType(type)} @@ -183,33 +177,36 @@ export default class ProfileRules extends React.PureComponent<Props, State> { total={this.getRulesTotalForType(type)} type={type} /> - )} + ))} </tbody> </table> {this.props.canAdmin && - !profile.isBuiltIn && + !profile.isBuiltIn && ( <div className="text-right big-spacer-top"> <Link to={activateMoreUrl} className="button js-activate-rules"> {translate('quality_profiles.activate_more')} </Link> - </div>} + </div> + )} </div> - {profile.activeDeprecatedRuleCount > 0 && + {profile.activeDeprecatedRuleCount > 0 && ( <ProfileRulesDeprecatedWarning activeDeprecatedRules={profile.activeDeprecatedRuleCount} organization={organization} profile={profile.key} - />} + /> + )} {compareToSonarWay != null && - compareToSonarWay.missingRuleCount > 0 && + compareToSonarWay.missingRuleCount > 0 && ( <ProfileRulesSonarWayComparison language={profile.language} organization={organization} profile={profile.key} sonarway={compareToSonarWay.profile} sonarWayMissingRules={compareToSonarWay.missingRuleCount} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx index b13a5ed9797..a0ee16d9f52 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx @@ -55,18 +55,19 @@ export default function ProfileRulesRowOfType(props: Props) { </span> </td> <td className="thin nowrap text-right"> - {props.count != null && - <Link to={activeRulesUrl}> - {formatMeasure(props.count, 'SHORT_INT', null)} - </Link>} + {props.count != null && ( + <Link to={activeRulesUrl}>{formatMeasure(props.count, 'SHORT_INT', null)}</Link> + )} </td> <td className="thin nowrap text-right"> {inactiveCount != null && - (inactiveCount > 0 - ? <Link to={inactiveRulesUrl} className="small text-muted"> - {formatMeasure(inactiveCount, 'SHORT_INT', null)} - </Link> - : <span className="note text-muted">0</span>)} + (inactiveCount > 0 ? ( + <Link to={inactiveRulesUrl} className="small text-muted"> + {formatMeasure(inactiveCount, 'SHORT_INT', null)} + </Link> + ) : ( + <span className="note text-muted">0</span> + ))} </td> </tr> ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx index 4f97d20776b..c58cb701e22 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx @@ -47,27 +47,24 @@ export default function ProfileRulesRowTotal(props: Props) { return ( <tr> <td> - <strong> - {translate('total')} - </strong> + <strong>{translate('total')}</strong> </td> <td className="thin nowrap text-right"> - {props.count != null && + {props.count != null && ( <Link to={activeRulesUrl}> - <strong> - {formatMeasure(props.count, 'SHORT_INT', null)} - </strong> - </Link>} + <strong>{formatMeasure(props.count, 'SHORT_INT', null)}</strong> + </Link> + )} </td> <td className="thin nowrap text-right"> {inactiveCount != null && - (inactiveCount > 0 - ? <Link to={inactiveRulesUrl} className="small text-muted"> - <strong> - {formatMeasure(inactiveCount, 'SHORT_INT', null)} - </strong> - </Link> - : <span className="note text-muted">0</span>)} + (inactiveCount > 0 ? ( + <Link to={inactiveRulesUrl} className="small text-muted"> + <strong>{formatMeasure(inactiveCount, 'SHORT_INT', null)}</strong> + </Link> + ) : ( + <span className="note text-muted">0</span> + ))} </td> </tr> ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx index 8f6d589cff8..ed4dbb325ac 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx @@ -116,75 +116,76 @@ export default class CreateProfileForm extends React.PureComponent<Props, State> onRequestClose={this.props.onClose}> <form id="create-profile-form" onSubmit={this.handleFormSubmit}> <div className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </div> - {this.state.preloading - ? <div className="modal-body"> - <i className="spinner" /> + {this.state.preloading ? ( + <div className="modal-body"> + <i className="spinner" /> + </div> + ) : ( + <div className="modal-body"> + <div className="modal-field"> + <label htmlFor="create-profile-name"> + {translate('name')} + <em className="mandatory">*</em> + </label> + <input + autoFocus={true} + id="create-profile-name" + maxLength={100} + name="name" + onChange={this.handleNameChange} + required={true} + size={50} + type="text" + value={this.state.name} + /> </div> - : <div className="modal-body"> - <div className="modal-field"> - <label htmlFor="create-profile-name"> - {translate('name')} - <em className="mandatory">*</em> + <div className="modal-field spacer-bottom"> + <label htmlFor="create-profile-language"> + {translate('language')} + <em className="mandatory">*</em> + </label> + <Select + clearable={false} + name="language" + onChange={this.handleLanguageChange} + options={languages.map(language => ({ + label: language.name, + value: language.key + }))} + value={selectedLanguage} + /> + </div> + {importers.map(importer => ( + <div + className="modal-field spacer-bottom js-importer" + data-key={importer.key} + key={importer.key}> + <label htmlFor={'create-profile-form-backup-' + importer.key}> + {importer.name} </label> <input - autoFocus={true} - id="create-profile-name" - maxLength={100} - name="name" - onChange={this.handleNameChange} - required={true} - size={50} - type="text" - value={this.state.name} - /> - </div> - <div className="modal-field spacer-bottom"> - <label htmlFor="create-profile-language"> - {translate('language')} - <em className="mandatory">*</em> - </label> - <Select - clearable={false} - name="language" - onChange={this.handleLanguageChange} - options={languages.map(language => ({ - label: language.name, - value: language.key - }))} - value={selectedLanguage} + id={'create-profile-form-backup-' + importer.key} + name={'backup_' + importer.key} + type="file" /> + <p className="note"> + {translate('quality_profiles.optional_configuration_file')} + </p> </div> - {importers.map(importer => - <div - className="modal-field spacer-bottom js-importer" - data-key={importer.key} - key={importer.key}> - <label htmlFor={'create-profile-form-backup-' + importer.key}> - {importer.name} - </label> - <input - id={'create-profile-form-backup-' + importer.key} - name={'backup_' + importer.key} - type="file" - /> - <p className="note"> - {translate('quality_profiles.optional_configuration_file')} - </p> - </div> - )} - </div>} + ))} + </div> + )} <div className="modal-foot"> {this.state.loading && <i className="spinner spacer-right" />} - {!this.state.preloading && + {!this.state.preloading && ( <button disabled={this.state.loading} id="create-profile-submit"> {translate('create')} - </button>} + </button> + )} <a href="#" id="create-profile-cancel" onClick={this.handleCancelClick}> {translate('cancel')} </a> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx index 9357f905e21..1183addbd89 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx @@ -44,9 +44,7 @@ export default function EvolutionDeprecated(props: Props) { return ( <div className="quality-profile-box quality-profiles-evolution-deprecated"> <div className="spacer-bottom"> - <strong> - {translate('quality_profiles.deprecated_rules')} - </strong> + <strong>{translate('quality_profiles.deprecated_rules')}</strong> </div> <div className="spacer-bottom"> {translateWithParameters( @@ -55,7 +53,7 @@ export default function EvolutionDeprecated(props: Props) { )} </div> <ul> - {sortedProfiles.map(profile => + {sortedProfiles.map(profile => ( <li key={profile.key} className="spacer-top"> <div className="text-ellipsis"> <ProfileLink @@ -79,7 +77,7 @@ export default function EvolutionDeprecated(props: Props) { </Link> </div> </li> - )} + ))} </ul> </div> ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx index 2119c23ae3e..0d526ee0063 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx @@ -105,41 +105,43 @@ export default class EvolutionRules extends React.PureComponent<Props, State> { return ( <div className="quality-profile-box quality-profiles-evolution-rules"> <div className="clearfix"> - <strong className="pull-left"> - {translate('quality_profiles.latest_new_rules')} - </strong> + <strong className="pull-left">{translate('quality_profiles.latest_new_rules')}</strong> </div> <ul> - {this.state.latestRules.map(rule => + {this.state.latestRules.map(rule => ( <li key={rule.key} className="spacer-top"> <div className="text-ellipsis"> <Link to={getRulesUrl({ rule_key: rule.key }, this.props.organization)} className="link-no-underline"> - {' '}{rule.name} + {' '} + {rule.name} </Link> <div className="note"> - {rule.activations - ? translateWithParameters( - 'quality_profiles.latest_new_rules.activated', - rule.langName, - rule.activations - ) - : translateWithParameters( - 'quality_profiles.latest_new_rules.not_activated', - rule.langName - )} + {rule.activations ? ( + translateWithParameters( + 'quality_profiles.latest_new_rules.activated', + rule.langName, + rule.activations + ) + ) : ( + translateWithParameters( + 'quality_profiles.latest_new_rules.not_activated', + rule.langName + ) + )} </div> </div> </li> - )} + ))} </ul> - {this.state.latestRulesTotal > RULES_LIMIT && + {this.state.latestRulesTotal > RULES_LIMIT && ( <div className="spacer-top"> <Link to={newRulesUrl} className="small"> {translate('see_all')} {formatMeasure(this.state.latestRulesTotal, 'SHORT_INT', null)} </Link> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx index 957fa4790a2..eaf2ab86589 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx @@ -41,15 +41,13 @@ export default function EvolutionStagnant(props: Props) { return ( <div className="quality-profile-box quality-profiles-evolution-stagnant"> <div className="spacer-bottom"> - <strong> - {translate('quality_profiles.stagnant_profiles')} - </strong> + <strong>{translate('quality_profiles.stagnant_profiles')}</strong> </div> <div className="spacer-bottom"> {translate('quality_profiles.not_updated_more_than_year')} </div> <ul> - {outdated.map(profile => + {outdated.map(profile => ( <li key={profile.key} className="spacer-top"> <div className="text-ellipsis"> <ProfileLink @@ -60,19 +58,21 @@ export default function EvolutionStagnant(props: Props) { {profile.name} </ProfileLink> </div> - {profile.rulesUpdatedAt && + {profile.rulesUpdatedAt && ( <DateFormatter date={profile.rulesUpdatedAt} long={true}> - {formattedDate => + {formattedDate => ( <div className="note"> {translateWithParameters( 'quality_profiles.x_updated_on_y', profile.languageName, formattedDate )} - </div>} - </DateFormatter>} + </div> + )} + </DateFormatter> + )} </li> - )} + ))} </ul> </div> ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx index d1cec0e51de..d80b8cc1b7e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx @@ -78,11 +78,9 @@ export default class PageHeader extends React.PureComponent<Props, State> { render() { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('quality_profiles.page')} - </h1> + <h1 className="page-title">{translate('quality_profiles.page')}</h1> - {this.props.canAdmin && + {this.props.canAdmin && ( <div className="page-actions button-group dropdown"> <button id="quality-profiles-create" onClick={this.handleCreateClick}> {translate('create')} @@ -97,7 +95,8 @@ export default class PageHeader extends React.PureComponent<Props, State> { </a> </li> </ul> - </div>} + </div> + )} <div className="page-description markdown"> {translate('quality_profiles.intro1')} @@ -105,22 +104,24 @@ export default class PageHeader extends React.PureComponent<Props, State> { {translate('quality_profiles.intro2')} </div> - {this.state.restoreFormOpen && + {this.state.restoreFormOpen && ( <RestoreProfileForm onClose={this.closeRestoreForm} onRequestFail={this.props.onRequestFail} onRestore={this.props.updateProfiles} organization={this.props.organization} - />} + /> + )} - {this.state.createFormOpen && + {this.state.createFormOpen && ( <CreateProfileForm languages={this.props.languages} onClose={this.closeCreateForm} onRequestFail={this.props.onRequestFail} onCreate={this.handleCreate} organization={this.props.organization} - />} + /> + )} </header> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx index 49e5e23b668..bdc506df3a9 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx @@ -36,7 +36,7 @@ interface Props { export default class ProfilesList extends React.PureComponent<Props> { renderProfiles(profiles: Profile[]) { - return profiles.map(profile => + return profiles.map(profile => ( <ProfilesListRow canAdmin={this.props.canAdmin} key={profile.key} @@ -45,7 +45,7 @@ export default class ProfilesList extends React.PureComponent<Props> { profile={profile} updateProfiles={this.props.updateProfiles} /> - ); + )); } renderHeader(languageKey: string, profilesCount: number) { @@ -63,18 +63,10 @@ export default class ProfilesList extends React.PureComponent<Props> { {', '} {translateWithParameters('quality_profiles.x_profiles', profilesCount)} </th> - <th className="text-right nowrap"> - {translate('quality_profiles.list.projects')} - </th> - <th className="text-right nowrap"> - {translate('quality_profiles.list.rules')} - </th> - <th className="text-right nowrap"> - {translate('quality_profiles.list.updated')} - </th> - <th className="text-right nowrap"> - {translate('quality_profiles.list.used')} - </th> + <th className="text-right nowrap">{translate('quality_profiles.list.projects')}</th> + <th className="text-right nowrap">{translate('quality_profiles.list.rules')}</th> + <th className="text-right nowrap">{translate('quality_profiles.list.updated')}</th> + <th className="text-right nowrap">{translate('quality_profiles.list.used')}</th> {this.props.canAdmin && <th> </th>} </tr> </thead> @@ -104,12 +96,11 @@ export default class ProfilesList extends React.PureComponent<Props> { organization={this.props.organization} /> - {Object.keys(profilesToShow).length === 0 && - <div className="alert alert-warning spacer-top"> - {translate('no_results')} - </div>} + {Object.keys(profilesToShow).length === 0 && ( + <div className="alert alert-warning spacer-top">{translate('no_results')}</div> + )} - {languagesToShow.map(languageKey => + {languagesToShow.map(languageKey => ( <div key={languageKey} className="quality-profile-box quality-profiles-table"> <table data-language={languageKey} className="data zebra zebra-hover"> {profilesToShow[languageKey] != null && @@ -121,7 +112,7 @@ export default class ProfilesList extends React.PureComponent<Props> { </tbody> </table> </div> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.tsx index 15b98d6a2d4..995747e5aa9 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.tsx @@ -55,7 +55,7 @@ export default class ProfilesListHeader extends React.PureComponent<Props> { {translate('quality_profiles.all_profiles')} </IndexLink> </li> - {this.props.languages.map(language => + {this.props.languages.map(language => ( <li key={language.key}> <IndexLink to={getProfilesForLanguagePath(language.key, this.props.organization)} @@ -64,7 +64,7 @@ export default class ProfilesListHeader extends React.PureComponent<Props> { {language.name} </IndexLink> </li> - )} + ))} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx index 5d61f000f48..4768acc094f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx @@ -58,18 +58,10 @@ export default class ProfilesListRow extends React.PureComponent<Props> { const { profile } = this.props; if (profile.isDefault) { - return ( - <span className="badge"> - {translate('default')} - </span> - ); + return <span className="badge">{translate('default')}</span>; } - return ( - <span> - {profile.projectCount} - </span> - ); + return <span>{profile.projectCount}</span>; } renderRules() { @@ -94,18 +86,17 @@ export default class ProfilesListRow extends React.PureComponent<Props> { return ( <div> - {profile.activeDeprecatedRuleCount > 0 && + {profile.activeDeprecatedRuleCount > 0 && ( <span className="spacer-right"> <Tooltip overlay={translate('quality_profiles.deprecated_rules')}> <Link to={deprecatedRulesUrl} className="badge badge-normal-size badge-danger-light"> {profile.activeDeprecatedRuleCount} </Link> </Tooltip> - </span>} + </span> + )} - <Link to={activeRulesUrl}> - {profile.activeRuleCount} - </Link> + <Link to={activeRulesUrl}>{profile.activeRuleCount}</Link> </div> ); } @@ -113,11 +104,7 @@ export default class ProfilesListRow extends React.PureComponent<Props> { renderUpdateDate() { const date = <ProfileDate date={this.props.profile.userUpdatedAt} />; if (isStagnant(this.props.profile)) { - return ( - <span className="badge badge-normal-size badge-focus"> - {date} - </span> - ); + return <span className="badge badge-normal-size badge-focus">{date}</span>; } else { return date; } @@ -127,11 +114,7 @@ export default class ProfilesListRow extends React.PureComponent<Props> { const { lastUsed } = this.props.profile; const date = <ProfileDate date={lastUsed} />; if (!lastUsed) { - return ( - <span className="badge badge-normal-size badge-focus"> - {date} - </span> - ); + return <span className="badge badge-normal-size badge-focus">{date}</span>; } else { return date; } @@ -143,9 +126,7 @@ export default class ProfilesListRow extends React.PureComponent<Props> { className="quality-profiles-table-row" data-key={this.props.profile.key} data-name={this.props.profile.name}> - <td className="quality-profiles-table-name"> - {this.renderName()} - </td> + <td className="quality-profiles-table-name">{this.renderName()}</td> <td className="quality-profiles-table-projects thin nowrap text-right"> {this.renderProjects()} </td> @@ -158,7 +139,7 @@ export default class ProfilesListRow extends React.PureComponent<Props> { <td className="quality-profiles-table-date thin nowrap text-right"> {this.renderUsageDate()} </td> - {this.props.canAdmin && + {this.props.canAdmin && ( <td className="quality-profiles-table-actions thin nowrap text-right"> <div className="dropdown"> <button className="dropdown-toggle" data-toggle="dropdown"> @@ -173,7 +154,8 @@ export default class ProfilesListRow extends React.PureComponent<Props> { updateProfiles={this.props.updateProfiles} /> </div> - </td>} + </td> + )} </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx index 5f12d61f662..021f5951af8 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx @@ -98,53 +98,55 @@ export default class RestoreProfileForm extends React.PureComponent<Props, State onRequestClose={this.props.onClose}> <form id="restore-profile-form" onSubmit={this.handleFormSubmit}> <div className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </div> <div className="modal-body"> - {profile != null && ruleSuccesses != null - ? ruleFailures - ? <div className="alert alert-warning"> - {translateWithParameters( - 'quality_profiles.restore_profile.warning', - profile.name, - ruleSuccesses, - ruleFailures - )} - </div> - : <div className="alert alert-success"> - {translateWithParameters( - 'quality_profiles.restore_profile.success', - profile.name, - ruleSuccesses - )} - </div> - : <div className="modal-field"> - <label htmlFor="restore-profile-backup"> - {translate('backup')} - <em className="mandatory">*</em> - </label> - <input id="restore-profile-backup" name="backup" required={true} type="file" /> - </div>} + {profile != null && ruleSuccesses != null ? ruleFailures ? ( + <div className="alert alert-warning"> + {translateWithParameters( + 'quality_profiles.restore_profile.warning', + profile.name, + ruleSuccesses, + ruleFailures + )} + </div> + ) : ( + <div className="alert alert-success"> + {translateWithParameters( + 'quality_profiles.restore_profile.success', + profile.name, + ruleSuccesses + )} + </div> + ) : ( + <div className="modal-field"> + <label htmlFor="restore-profile-backup"> + {translate('backup')} + <em className="mandatory">*</em> + </label> + <input id="restore-profile-backup" name="backup" required={true} type="file" /> + </div> + )} </div> - {ruleSuccesses == null - ? <div className="modal-foot"> - {loading && <i className="spinner spacer-right" />} - <button disabled={loading} id="restore-profile-submit"> - {translate('restore')} - </button> - <a href="#" id="restore-profile-cancel" onClick={this.handleCancelClick}> - {translate('cancel')} - </a> - </div> - : <div className="modal-foot"> - <a href="#" onClick={this.handleCancelClick}> - {translate('close')} - </a> - </div>} + {ruleSuccesses == null ? ( + <div className="modal-foot"> + {loading && <i className="spinner spacer-right" />} + <button disabled={loading} id="restore-profile-submit"> + {translate('restore')} + </button> + <a href="#" id="restore-profile-cancel" onClick={this.handleCancelClick}> + {translate('cancel')} + </a> + </div> + ) : ( + <div className="modal-foot"> + <a href="#" onClick={this.handleCancelClick}> + {translate('close')} + </a> + </div> + )} </form> </Modal> ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/routes.ts b/server/sonar-web/src/main/js/apps/quality-profiles/routes.ts index cac3704b319..6f8e8730ded 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/routes.ts +++ b/server/sonar-web/src/main/js/apps/quality-profiles/routes.ts @@ -22,15 +22,17 @@ import { withRouter, RouterState, IndexRouteProps, RouteComponent } from 'react- const routes = [ { getComponent(state: RouterState, callback: (err: any, component: RouteComponent) => any) { - import('./components/AppContainer').then(i => i.default).then(AppContainer => { - if (state.params.organizationKey) { - callback(null, AppContainer); - } else { - import('../organizations/forSingleOrganization') - .then(i => i.default) - .then(forSingleOrganization => callback(null, forSingleOrganization(AppContainer))); - } - }); + import('./components/AppContainer') + .then(i => i.default) + .then(AppContainer => { + if (state.params.organizationKey) { + callback(null, AppContainer); + } else { + import('../organizations/forSingleOrganization') + .then(i => i.default) + .then(forSingleOrganization => callback(null, forSingleOrganization(AppContainer))); + } + }); }, getIndexRoute(_: RouterState, callback: (err: any, route: IndexRouteProps) => any) { import('./home/HomeContainer').then(i => callback(null, { component: i.default })); diff --git a/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.js b/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.js index 361a4404774..4ae970f2481 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.js +++ b/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.js @@ -69,70 +69,71 @@ export default class LoginForm extends React.PureComponent { render() { return ( <div id="login_form"> - <h1 className="maintenance-title text-center"> - {translate('login.login_to_sonarqube')} - </h1> + <h1 className="maintenance-title text-center">{translate('login.login_to_sonarqube')}</h1> - {this.props.identityProviders.length > 0 && - <OAuthProviders identityProviders={this.props.identityProviders} />} + {this.props.identityProviders.length > 0 && ( + <OAuthProviders identityProviders={this.props.identityProviders} /> + )} - {this.state.collapsed - ? <div className="text-center"> - <a - className="small text-muted js-more-options" - href="#" - onClick={this.handleMoreOptionsClick}> - {translate('login.more_options')} - </a> - </div> - : <form onSubmit={this.handleSubmit}> - <GlobalMessagesContainer /> + {this.state.collapsed ? ( + <div className="text-center"> + <a + className="small text-muted js-more-options" + href="#" + onClick={this.handleMoreOptionsClick}> + {translate('login.more_options')} + </a> + </div> + ) : ( + <form onSubmit={this.handleSubmit}> + <GlobalMessagesContainer /> - <div className="big-spacer-bottom"> - <label htmlFor="login" className="login-label"> - {translate('login')} - </label> - <input - type="text" - id="login" - name="login" - className="login-input" - maxLength="255" - required={true} - autoFocus={true} - placeholder={translate('login')} - value={this.state.login} - onChange={e => this.setState({ login: e.target.value })} - /> - </div> + <div className="big-spacer-bottom"> + <label htmlFor="login" className="login-label"> + {translate('login')} + </label> + <input + type="text" + id="login" + name="login" + className="login-input" + maxLength="255" + required={true} + autoFocus={true} + placeholder={translate('login')} + value={this.state.login} + onChange={e => this.setState({ login: e.target.value })} + /> + </div> - <div className="big-spacer-bottom"> - <label htmlFor="password" className="login-label"> - {translate('password')} - </label> - <input - type="password" - id="password" - name="password" - className="login-input" - required={true} - placeholder={translate('password')} - value={this.state.password} - onChange={e => this.setState({ password: e.target.value })} - /> - </div> + <div className="big-spacer-bottom"> + <label htmlFor="password" className="login-label"> + {translate('password')} + </label> + <input + type="password" + id="password" + name="password" + className="login-input" + required={true} + placeholder={translate('password')} + value={this.state.password} + onChange={e => this.setState({ password: e.target.value })} + /> + </div> - <div> - <div className="text-right overflow-hidden"> - <button name="commit" type="submit"> - {translate('sessions.log_in')} - </button> - <a className="spacer-left" href={window.baseUrl + '/'}> - {translate('cancel')} - </a> - </div> + <div> + <div className="text-right overflow-hidden"> + <button name="commit" type="submit"> + {translate('sessions.log_in')} + </button> + <a className="spacer-left" href={window.baseUrl + '/'}> + {translate('cancel')} + </a> </div> - </form>} + </div> + </form> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.js b/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.js index 3ce1cd7f7c4..d06a2019558 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.js +++ b/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.js @@ -37,7 +37,7 @@ export default function OAuthProviders(props /*: Props */) { return ( <section className="oauth-providers"> <ul> - {props.identityProviders.map(identityProvider => + {props.identityProviders.map(identityProvider => ( <li key={identityProvider.key}> <a href={`${window.baseUrl}/sessions/init/${identityProvider.key}`} @@ -56,7 +56,7 @@ export default function OAuthProviders(props /*: Props */) { </span> </a> </li> - )} + ))} </ul> </section> ); diff --git a/server/sonar-web/src/main/js/apps/sessions/components/SimpleSessionsContainer.js b/server/sonar-web/src/main/js/apps/sessions/components/SimpleSessionsContainer.js index 3350e400475..29efdcd38a9 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/SimpleSessionsContainer.js +++ b/server/sonar-web/src/main/js/apps/sessions/components/SimpleSessionsContainer.js @@ -28,9 +28,5 @@ type Props = { */ export default function SimpleSessionsContainer({ children } /*: Props */) { - return ( - <SimpleContainer hideLoggedInInfo={true}> - {children} - </SimpleContainer> - ); + return <SimpleContainer hideLoggedInInfo={true}>{children}</SimpleContainer>; } diff --git a/server/sonar-web/src/main/js/apps/sessions/components/Unauthorized.tsx b/server/sonar-web/src/main/js/apps/sessions/components/Unauthorized.tsx index edfa3d62d26..12bc8b8724c 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/Unauthorized.tsx +++ b/server/sonar-web/src/main/js/apps/sessions/components/Unauthorized.tsx @@ -37,10 +37,7 @@ export default function Unauthorized(props: Props) { {"You're not authorized to access this page. Please contact the administrator."} </p> - {!!message && - <p className="spacer-top"> - Reason : {message} - </p>} + {!!message && <p className="spacer-top">Reason : {message}</p>} <div className="big-spacer-top"> <Link to="/">Home</Link> diff --git a/server/sonar-web/src/main/js/apps/settings/components/App.js b/server/sonar-web/src/main/js/apps/settings/components/App.js index 4f466e19461..866830fbb69 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/App.js +++ b/server/sonar-web/src/main/js/apps/settings/components/App.js @@ -89,27 +89,29 @@ export default class App extends React.PureComponent { <div id="settings-page" className="page page-limited"> <Helmet title={translate('settings.page')} /> - {branchName - ? <div className="alert alert-info"> - <FormattedMessage - defaultMessage={translate('branches.settings_hint')} - id="branches.settings_hint" - values={{ - link: ( - <Link - to={{ - pathname: '/project/branches', - query: { id: this.props.component && this.props.component.key } - }}> - {translate('branches.settings_hint_tab')} - </Link> - ) - }} - /> - </div> - : <PageHeader branch={branchName} component={this.props.component} />} + {branchName ? ( + <div className="alert alert-info"> + <FormattedMessage + defaultMessage={translate('branches.settings_hint')} + id="branches.settings_hint" + values={{ + link: ( + <Link + to={{ + pathname: '/project/branches', + query: { id: this.props.component && this.props.component.key } + }}> + {translate('branches.settings_hint_tab')} + </Link> + ) + }} + /> + </div> + ) : ( + <PageHeader branch={branchName} component={this.props.component} /> + )} <div className="side-tabs-layout settings-layout"> - {branchName == null && + {branchName == null && ( <div className="side-tabs-side"> <AllCategoriesList branch={branchName} @@ -117,7 +119,8 @@ export default class App extends React.PureComponent { selectedCategory={selectedCategory} defaultCategory={this.props.defaultCategory} /> - </div>} + </div> + )} <div className="side-tabs-main"> <CategoryDefinitionsList branch={branchName} diff --git a/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js b/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js index b9f61bfc68c..8cbda6596c7 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js +++ b/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js @@ -75,11 +75,7 @@ export default class CategoriesList extends React.PureComponent { return ( <ul className="side-tabs-menu"> - {sortedCategories.map(category => - <li key={category.key}> - {this.renderLink(category)} - </li> - )} + {sortedCategories.map(category => <li key={category.key}>{this.renderLink(category)}</li>)} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/Definition.js b/server/sonar-web/src/main/js/apps/settings/components/Definition.js index 3ae60c1afcc..91eec4f2433 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/Definition.js +++ b/server/sonar-web/src/main/js/apps/settings/components/Definition.js @@ -155,14 +155,15 @@ class Definition extends React.PureComponent { <div className="settings-definition-right"> <div className="settings-definition-state"> - {loading && + {loading && ( <span className="text-info"> <i className="spinner spacer-right" /> {translate('settings.state.saving')} - </span>} + </span> + )} {!loading && - this.props.validationMessage != null && + this.props.validationMessage != null && ( <span className="text-danger"> <i className="icon-alert-error spacer-right" /> <span> @@ -171,30 +172,34 @@ class Definition extends React.PureComponent { this.props.validationMessage )} </span> - </span>} + </span> + )} {!loading && - this.state.success && + this.state.success && ( <span className="text-success"> <i className="icon-check spacer-right" /> {translate('settings.state.saved')} - </span>} + </span> + )} </div> <Input setting={setting} value={effectiveValue} onChange={this.handleChange.bind(this)} /> - {!hasValueChanged && + {!hasValueChanged && ( <DefinitionDefaults setting={setting} isDefault={isDefault} onReset={() => this.handleReset()} - />} + /> + )} - {hasValueChanged && + {hasValueChanged && ( <DefinitionChanges onSave={this.handleSave.bind(this)} onCancel={this.handleCancel.bind(this)} - />} + /> + )} </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/settings/components/DefinitionDefaults.js b/server/sonar-web/src/main/js/apps/settings/components/DefinitionDefaults.js index 8c2061a9b7c..563b0dc59a1 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/DefinitionDefaults.js +++ b/server/sonar-web/src/main/js/apps/settings/components/DefinitionDefaults.js @@ -64,20 +64,14 @@ export default class DefinitionDefaults extends React.PureComponent { overlayClassName="modal-overlay" onRequestClose={this.handleClose}> <header className="modal-head"> - <h2> - {header} - </h2> + <h2>{header}</h2> </header> <form onSubmit={this.handleSubmit}> <div className="modal-body"> - <p> - {translate('settings.reset_confirm.description')} - </p> + <p>{translate('settings.reset_confirm.description')}</p> </div> <footer className="modal-foot"> - <button className="button-red"> - {translate('reset_verb')} - </button> + <button className="button-red">{translate('reset_verb')}</button> <button type="reset" className="button-link" onClick={this.handleClose}> {translate('cancel')} </button> @@ -95,22 +89,22 @@ export default class DefinitionDefaults extends React.PureComponent { return ( <div> - {isDefault && + {isDefault && ( <div className="spacer-top note" style={{ lineHeight: '24px' }}> {translate('settings._default')} - </div>} + </div> + )} - {isExplicitlySet && + {isExplicitlySet && ( <div className="spacer-top nowrap"> - <button onClick={this.handleReset}> - {translate('reset_verb')} - </button> + <button onClick={this.handleReset}>{translate('reset_verb')}</button> <span className="spacer-left note"> {translate('default')} {': '} {getDefaultValue(setting)} </span> - </div>} + </div> + )} {this.state.reseting && this.renderModal()} </div> ); diff --git a/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.js b/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.js index f8e6230a52b..7cb111b297a 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.js +++ b/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.js @@ -32,7 +32,7 @@ export default class DefinitionsList extends React.PureComponent { render() { return ( <ul className="settings-definitions-list"> - {this.props.settings.map(setting => + {this.props.settings.map(setting => ( <li key={setting.definition.key}> <Definition branch={this.props.branch} @@ -40,7 +40,7 @@ export default class DefinitionsList extends React.PureComponent { setting={setting} /> </li> - )} + ))} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/EmailForm.js b/server/sonar-web/src/main/js/apps/settings/components/EmailForm.js index 89e821bc5fb..8e0e37737f9 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/EmailForm.js +++ b/server/sonar-web/src/main/js/apps/settings/components/EmailForm.js @@ -50,12 +50,10 @@ class EmailForm extends React.PureComponent { render() { return ( <div className="huge-spacer-top"> - <h3 className="spacer-bottom"> - {translate('email_configuration.test.title')} - </h3> + <h3 className="spacer-bottom">{translate('email_configuration.test.title')}</h3> <form style={{ marginLeft: 201 }} onSubmit={e => this.handleFormSubmit(e)}> - {this.state.success && + {this.state.success && ( <div className="modal-field"> <div className="alert alert-success"> {translateWithParameters( @@ -63,14 +61,14 @@ class EmailForm extends React.PureComponent { this.state.recipient )} </div> - </div>} + </div> + )} - {this.state.error != null && + {this.state.error != null && ( <div className="modal-field"> - <div className="alert alert-danger"> - {this.state.error} - </div> - </div>} + <div className="alert alert-danger">{this.state.error}</div> + </div> + )} <div className="modal-field"> <label htmlFor="test-email-to"> diff --git a/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js b/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js index e7bc08f10e3..d70bb1e1b13 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js +++ b/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js @@ -41,12 +41,8 @@ export default class PageHeader extends React.PureComponent { return ( <header className="page-header"> - <h1 className="page-title"> - {title} - </h1> - <div className="page-description"> - {description} - </div> + <h1 className="page-title">{title}</h1> + <div className="page-description">{description}</div> </header> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js index ca8443fbfc1..e779f1105c9 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js +++ b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js @@ -53,16 +53,15 @@ export default class SubCategoryDefinitionsList extends React.PureComponent { return ( <ul className="settings-sub-categories-list"> - {sortedSubCategories.map(subCategory => + {sortedSubCategories.map(subCategory => ( <li key={subCategory.key}> - <h2 className="settings-sub-category-name"> - {subCategory.name} - </h2> - {subCategory.description != null && + <h2 className="settings-sub-category-name">{subCategory.name}</h2> + {subCategory.description != null && ( <div className="settings-sub-category-description markdown" dangerouslySetInnerHTML={{ __html: subCategory.description }} - />} + /> + )} <DefinitionsList branch={this.props.branch} component={this.props.component} @@ -70,7 +69,7 @@ export default class SubCategoryDefinitionsList extends React.PureComponent { /> {this.renderEmailForm(subCategory.key)} </li> - )} + ))} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js index fa95e12b7b1..e7f6d002ed9 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js @@ -37,10 +37,7 @@ export default class InputForBoolean extends React.PureComponent { <div className="display-inline-block text-top"> <Toggle name={this.props.name} value={displayedValue} onChange={this.props.onChange} /> - {!hasValue && - <span className="spacer-left note"> - {translate('settings.not_set')} - </span>} + {!hasValue && <span className="spacer-left note">{translate('settings.not_set')}</span>} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForPassword.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForPassword.js index 0d95d4d5c17..9f7a35f3f4e 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForPassword.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForPassword.js @@ -66,9 +66,7 @@ export default class InputForPassword extends React.PureComponent { onChange={e => this.handleInputChange(e)} /> - <button className="spacer-left button-success"> - {translate('save')} - </button> + <button className="spacer-left button-success">{translate('save')}</button> <a className="spacer-left" href="#" onClick={e => this.handleCancelChangeClick(e)}> {translate('cancel')} diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js index 668f9fe5720..14b98fceadb 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js @@ -67,14 +67,15 @@ export default class MultiValueInput extends React.PureComponent { onChange={this.handleSingleInputChange.bind(this, index)} /> - {!isLast && + {!isLast && ( <div className="display-inline-block spacer-left"> <button className="js-remove-value button-clean" onClick={e => this.handleDeleteValue(e, index)}> <i className="icon-delete" /> </button> - </div>} + </div> + )} </li> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js index a77603fb388..845ca62d952 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js @@ -59,7 +59,7 @@ export default class PropertySetInput extends React.PureComponent { return ( <tr key={index}> - {setting.definition.fields.map(field => + {setting.definition.fields.map(field => ( <td key={field.key}> <PrimitiveInput name={this.getFieldName(field)} @@ -68,14 +68,15 @@ export default class PropertySetInput extends React.PureComponent { onChange={this.handleInputChange.bind(this, index, field.key)} /> </td> - )} + ))} <td className="thin nowrap"> - {!isLast && + {!isLast && ( <button className="js-remove-value button-link" onClick={e => this.handleDeleteValue(e, index)}> <i className="icon-delete" /> - </button>} + </button> + )} </td> </tr> ); @@ -93,15 +94,14 @@ export default class PropertySetInput extends React.PureComponent { style={{ width: 'auto', minWidth: 480, marginTop: -12 }}> <thead> <tr> - {setting.definition.fields.map(field => + {setting.definition.fields.map(field => ( <th key={field.key}> {field.name} - {field.description != null && - <span className="spacer-top small"> - {field.description} - </span>} + {field.description != null && ( + <span className="spacer-top small">{field.description}</span> + )} </th> - )} + ))} <th> </th> </tr> </thead> diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js index 5742801f356..725d60db935 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js @@ -64,7 +64,10 @@ it('should change existing value', () => { const multiValueInput = shallow( <MultiValueInput setting={{ definition }} value={['foo', 'bar', 'baz']} onChange={onChange} /> ); - multiValueInput.find(PrimitiveInput).at(1).prop('onChange')('qux'); + multiValueInput + .find(PrimitiveInput) + .at(1) + .prop('onChange')('qux'); expect(onChange).toBeCalledWith(['foo', 'qux', 'baz']); }); @@ -73,6 +76,9 @@ it('should add new value', () => { const multiValueInput = shallow( <MultiValueInput setting={{ definition }} value={['foo']} onChange={onChange} /> ); - multiValueInput.find(PrimitiveInput).at(1).prop('onChange')('bar'); + multiValueInput + .find(PrimitiveInput) + .at(1) + .prop('onChange')('bar'); expect(onChange).toBeCalledWith(['foo', 'bar']); }); diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js index e9f59b8c2df..7c9727e99f4 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js +++ b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js @@ -46,25 +46,25 @@ export default class EncryptionApp extends React.PureComponent { <div id="encryption-page" className="page page-limited"> <Helmet title={translate('property.category.security.encryption')} /> <header className="page-header"> - <h1 className="page-title"> - {translate('property.category.security.encryption')} - </h1> + <h1 className="page-title">{translate('property.category.security.encryption')}</h1> {this.props.loading && <i className="spinner" />} </header> {!this.props.loading && - !this.props.secretKeyAvailable && + !this.props.secretKeyAvailable && ( <GenerateSecretKeyForm secretKey={this.props.secretKey} generateSecretKey={this.props.generateSecretKey} - />} + /> + )} - {this.props.secretKeyAvailable && + {this.props.secretKeyAvailable && ( <EncryptionForm encryptedValue={this.props.encryptedValue} encryptValue={this.props.encryptValue} generateSecretKey={this.props.startGeneration} - />} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.js b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.js index c3301970686..e62b431277c 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.js +++ b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.js @@ -62,7 +62,7 @@ export default class EncryptionForm extends React.PureComponent { <button className="spacer-left">Encrypt</button> </form> - {this.props.encryptedValue != null && + {this.props.encryptedValue != null && ( <div> Encrypted Value:{' '} <input @@ -72,7 +72,8 @@ export default class EncryptionForm extends React.PureComponent { readOnly={true} value={this.props.encryptedValue} /> - </div>} + </div> + )} <div className="huge-spacer-top bordered-top"> <div className="big-spacer-top spacer-bottom"> diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.js b/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.js index 79166acc968..899c60dcaf0 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.js +++ b/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.js @@ -34,58 +34,59 @@ export default class GenerateSecretKeyForm extends React.PureComponent { render() { return ( <div id="generate-secret-key-form-container"> - {this.props.secretKey != null - ? <div> - <div className="big-spacer-bottom"> - <h3 className="spacer-bottom">Secret Key</h3> - <input - id="secret-key" - className="input-large" - type="text" - readOnly={true} - value={this.props.secretKey} - /> - </div> + {this.props.secretKey != null ? ( + <div> + <div className="big-spacer-bottom"> + <h3 className="spacer-bottom">Secret Key</h3> + <input + id="secret-key" + className="input-large" + type="text" + readOnly={true} + value={this.props.secretKey} + /> + </div> - <h3 className="spacer-bottom">How To Use</h3> + <h3 className="spacer-bottom">How To Use</h3> - <ul className="list-styled markdown"> - <li className="spacer-bottom"> - Store the secret key in the file <code>~/.sonar/sonar-secret.txt</code> of the - server. This file can be relocated by defining the property{' '} - <code>sonar.secretKeyPath</code> in <code>conf/sonar.properties</code> - </li> - <li className="spacer-bottom"> - Restrict access to this file by making it readable and by owner only - </li> - <li className="spacer-bottom"> - Restart the server if the property <code>sonar.secretKeyPath</code> has been set - or changed. - </li> - <li className="spacer-bottom"> - Copy this file on all the machines that execute code inspection. Define the{' '} - property <code>sonar.secretKeyPath</code> on those machines if the path is not{' '} - <code>~/.sonar/sonar-secret.txt</code>. - </li> - <li> - For each property that you want to encrypt, generate the encrypted value and{' '} - replace the original value wherever it is stored (configuration files, command - lines). - </li> - </ul> - </div> - : <div> - <p className="spacer-bottom"> - Secret key is required to be able to encrypt properties.{' '} - <a href="https://redirect.sonarsource.com/doc/settings-encryption.html"> - More information - </a> - </p> + <ul className="list-styled markdown"> + <li className="spacer-bottom"> + Store the secret key in the file <code>~/.sonar/sonar-secret.txt</code> of the + server. This file can be relocated by defining the property{' '} + <code>sonar.secretKeyPath</code> in <code>conf/sonar.properties</code> + </li> + <li className="spacer-bottom"> + Restrict access to this file by making it readable and by owner only + </li> + <li className="spacer-bottom"> + Restart the server if the property <code>sonar.secretKeyPath</code> has been set or + changed. + </li> + <li className="spacer-bottom"> + Copy this file on all the machines that execute code inspection. Define the property{' '} + <code>sonar.secretKeyPath</code> on those machines if the path is not{' '} + <code>~/.sonar/sonar-secret.txt</code>. + </li> + <li> + For each property that you want to encrypt, generate the encrypted value and replace + the original value wherever it is stored (configuration files, command lines). + </li> + </ul> + </div> + ) : ( + <div> + <p className="spacer-bottom"> + Secret key is required to be able to encrypt properties.{' '} + <a href="https://redirect.sonarsource.com/doc/settings-encryption.html"> + More information + </a> + </p> - <form id="generate-secret-key-form" onSubmit={e => this.handleSubmit(e)}> - <button>Generate Secret Key</button> - </form> - </div>} + <form id="generate-secret-key-form" onSubmit={e => this.handleSubmit(e)}> + <button>Generate Secret Key</button> + </form> + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js index 36fa5ff8a70..afea2682e97 100644 --- a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js +++ b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js @@ -68,7 +68,7 @@ export default class LicenseChangeForm extends React.PureComponent { <button className="js-change" onClick={e => this.onClick(e)}> {translate('update_verb')} - {this.state.modalOpen && + {this.state.modalOpen && ( <Modal isOpen={true} contentLabel="license update" @@ -77,14 +77,10 @@ export default class LicenseChangeForm extends React.PureComponent { onRequestClose={this.closeModal}> <form onSubmit={this.handleSubmit}> <div className="modal-head"> - <h2> - {translateWithParameters('licenses.update_license_for_x', productName)} - </h2> + <h2>{translateWithParameters('licenses.update_license_for_x', productName)}</h2> </div> <div className="modal-body"> - <label htmlFor="license-input"> - {translate('licenses.license_input_label')} - </label> + <label htmlFor="license-input">{translate('licenses.license_input_label')}</label> <textarea autoFocus={true} className="width-100 spacer-top" @@ -93,9 +89,7 @@ export default class LicenseChangeForm extends React.PureComponent { id="license-input" defaultValue={license.value} /> - <div className="spacer-top note"> - {translate('licenses.license_input_note')} - </div> + <div className="spacer-top note">{translate('licenses.license_input_note')}</div> </div> <div className="modal-foot"> {this.state.loading && <i className="js-modal-spinner spinner spacer-right" />} @@ -107,7 +101,8 @@ export default class LicenseChangeForm extends React.PureComponent { </a> </div> </form> - </Modal>} + </Modal> + )} </button> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js index d6b26fd3a75..56529f76c33 100644 --- a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js +++ b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js @@ -44,22 +44,17 @@ export default class LicenseRow extends React.PureComponent { {license.name || license.key} </div> </td> - <td className="js-organization text-middle"> - {license.organization} - </td> + <td className="js-organization text-middle">{license.organization}</td> <td className="js-expiration text-middle"> - {license.expiration != null && + {license.expiration != null && ( <div className={license.invalidExpiration ? 'text-danger' : null}> <DateFormatter date={license.expiration} long={true} /> - </div>} - </td> - <td className="js-type text-middle"> - {license.type} + </div> + )} </td> + <td className="js-type text-middle">{license.type}</td> <td className="js-server-id text-middle"> - <div className={license.invalidServerId ? 'text-danger' : null}> - {license.serverId} - </div> + <div className={license.invalidServerId ? 'text-danger' : null}>{license.serverId}</div> </td> <td className="text-right"> <LicenseChangeForm license={license} onChange={this.handleSet} /> diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js index c512f32a770..153efb04fa5 100644 --- a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js +++ b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js @@ -23,9 +23,7 @@ import { translate } from '../../../helpers/l10n'; export default function LicensesAppHeader() { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('property.category.licenses')} - </h1> + <h1 className="page-title">{translate('property.category.licenses')}</h1> <div className="page-description" dangerouslySetInnerHTML={{ __html: translate('property.category.licenses.description') }} diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js index 91fcdcb1889..da90958613b 100644 --- a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js +++ b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js @@ -40,28 +40,18 @@ export default class LicensesList extends React.PureComponent { <thead> <tr> <th width={40}> </th> - <th> - {translate('licenses.list.product')} - </th> - <th width={150}> - {translate('licenses.list.organization')} - </th> - <th width={150}> - {translate('licenses.list.expiration')} - </th> - <th width={150}> - {translate('licenses.list.type')} - </th> - <th width={150}> - {translate('licenses.list.server')} - </th> + <th>{translate('licenses.list.product')}</th> + <th width={150}>{translate('licenses.list.organization')}</th> + <th width={150}>{translate('licenses.list.expiration')}</th> + <th width={150}>{translate('licenses.list.type')}</th> + <th width={150}>{translate('licenses.list.server')}</th> <th width={80}> </th> </tr> </thead> <tbody> - {this.props.licenses.map(licenseKey => + {this.props.licenses.map(licenseKey => ( <LicenseRowContainer key={licenseKey} licenseKey={licenseKey} /> - )} + ))} </tbody> </table> ); diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js index a1335084928..220d0707360 100644 --- a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js +++ b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js @@ -36,6 +36,16 @@ it('should fetch licenses', () => { it('should render rows', () => { const list = shallow(<LicensesList licenses={['foo', 'bar']} fetchLicenses={jest.fn()} />); expect(list.find(LicenseRowContainer).length).toBe(2); - expect(list.find(LicenseRowContainer).at(0).prop('licenseKey')).toBe('foo'); - expect(list.find(LicenseRowContainer).at(1).prop('licenseKey')).toBe('bar'); + expect( + list + .find(LicenseRowContainer) + .at(0) + .prop('licenseKey') + ).toBe('foo'); + expect( + list + .find(LicenseRowContainer) + .at(1) + .prop('licenseKey') + ).toBe('bar'); }); diff --git a/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js b/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js index a6adaec83b9..2edff5822cd 100644 --- a/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js +++ b/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js @@ -80,16 +80,12 @@ export default class ServerIdApp extends React.PureComponent { <div id="server-id-page" className="page page-limited"> <Helmet title={translate('property.category.server_id')} /> <header className="page-header"> - <h1 className="page-title"> - {translate('property.category.server_id')} - </h1> + <h1 className="page-title">{translate('property.category.server_id')}</h1> {this.state.loading && <i className="spinner" />} - <div className="page-description"> - {translate('server_id_configuration.information')} - </div> + <div className="page-description">{translate('server_id_configuration.information')}</div> </header> - {this.state.serverId != null && + {this.state.serverId != null && ( <div className={this.state.invalidServerId ? 'panel panel-danger' : 'panel'}> Server ID: <input @@ -99,11 +95,11 @@ export default class ServerIdApp extends React.PureComponent { readOnly={true} value={this.state.serverId} /> - {!!this.state.invalidServerId && - <span className="spacer-left"> - {translate('server_id_configuration.bad_key')} - </span>} - </div>} + {!!this.state.invalidServerId && ( + <span className="spacer-left">{translate('server_id_configuration.bad_key')}</span> + )} + </div> + )} <div className="panel"> <form id="server-id-form" onSubmit={e => this.handleSubmit(e)}> @@ -143,11 +139,11 @@ export default class ServerIdApp extends React.PureComponent { <div className="modal-field-description"> {translate('server_id_configuration.ip.desc')} <ul className="list-styled"> - {this.state.validIpAddresses.map(ip => + {this.state.validIpAddresses.map(ip => ( <li key={ip} className="little-spacer-top"> {ip} </li> - )} + ))} </ul> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/system/__tests__/system-test.js b/server/sonar-web/src/main/js/apps/system/__tests__/system-test.js index 20caf0f7311..0ad07b2794a 100644 --- a/server/sonar-web/src/main/js/apps/system/__tests__/system-test.js +++ b/server/sonar-web/src/main/js/apps/system/__tests__/system-test.js @@ -62,8 +62,18 @@ describe('ItemObject', () => { <ItemObject value={{ users: { docs: 1, shards: 5 }, tests: { docs: 68, shards: 5 } }} /> ); expect(result.find(ItemValue).length).toBe(2); - expect(result.find(ItemValue).at(0).prop('value')).toEqual({ docs: 1, shards: 5 }); - expect(result.find(ItemValue).at(1).prop('value')).toEqual({ docs: 68, shards: 5 }); + expect( + result + .find(ItemValue) + .at(0) + .prop('value') + ).toEqual({ docs: 1, shards: 5 }); + expect( + result + .find(ItemValue) + .at(1) + .prop('value') + ).toEqual({ docs: 68, shards: 5 }); }); }); diff --git a/server/sonar-web/src/main/js/apps/system/item-log-level.js b/server/sonar-web/src/main/js/apps/system/item-log-level.js index 3a0a5019cf3..89364f164d8 100644 --- a/server/sonar-web/src/main/js/apps/system/item-log-level.js +++ b/server/sonar-web/src/main/js/apps/system/item-log-level.js @@ -37,17 +37,17 @@ export default class ItemLogLevel extends React.PureComponent { }; render() { - const options = LOG_LEVELS.map(level => + const options = LOG_LEVELS.map(level => ( <option key={level} value={level}> {level} </option> - ); + )); const warning = - this.state.level !== 'INFO' - ? <div className="alert alert-danger spacer-top" style={{ wordBreak: 'normal' }}> - {translate('system.log_level.warning')} - </div> - : null; + this.state.level !== 'INFO' ? ( + <div className="alert alert-danger spacer-top" style={{ wordBreak: 'normal' }}> + {translate('system.log_level.warning')} + </div> + ) : null; return ( <div> <select ref="select" onChange={this.onChange} value={this.state.level}> diff --git a/server/sonar-web/src/main/js/apps/system/item-object.js b/server/sonar-web/src/main/js/apps/system/item-object.js index d5e2b127efa..d9386cbce8d 100644 --- a/server/sonar-web/src/main/js/apps/system/item-object.js +++ b/server/sonar-web/src/main/js/apps/system/item-object.js @@ -25,9 +25,7 @@ export default class ItemObject extends React.PureComponent { const rows = Object.keys(this.props.value).map(key => { return ( <tr key={key}> - <td className="thin nowrap"> - {key} - </td> + <td className="thin nowrap">{key}</td> <td> <ItemValue value={this.props.value[key]} /> </td> @@ -36,9 +34,7 @@ export default class ItemObject extends React.PureComponent { }); return ( <table className="data"> - <tbody> - {rows} - </tbody> + <tbody>{rows}</tbody> </table> ); } diff --git a/server/sonar-web/src/main/js/apps/system/item-value.js b/server/sonar-web/src/main/js/apps/system/item-value.js index 09b1220ea2b..5461aa95e8b 100644 --- a/server/sonar-web/src/main/js/apps/system/item-value.js +++ b/server/sonar-web/src/main/js/apps/system/item-value.js @@ -38,11 +38,7 @@ export default class ItemValue extends React.PureComponent { formattedValue = <ItemObject value={rawValue} />; break; default: - formattedValue = ( - <code> - {rawValue} - </code> - ); + formattedValue = <code>{rawValue}</code>; } return formattedValue; } diff --git a/server/sonar-web/src/main/js/apps/system/main.js b/server/sonar-web/src/main/js/apps/system/main.js index 591c2802b79..411170e6f75 100644 --- a/server/sonar-web/src/main/js/apps/system/main.js +++ b/server/sonar-web/src/main/js/apps/system/main.js @@ -69,18 +69,16 @@ export default class Main extends React.PureComponent { if (this.state && this.state.sections) { sections = this.state.sections .filter(section => SECTIONS_ORDER.indexOf(section.name) >= 0) - .map(section => + .map(section => ( <Section key={section.name} section={section.name} items={section.items} /> - ); + )); } return ( <div className="page page-limited"> <Helmet title={translate('system_info.page')} /> <header className="page-header"> - <h1 className="page-title"> - {translate('system_info.page')} - </h1> + <h1 className="page-title">{translate('system_info.page')}</h1> <div className="page-actions"> <a href={window.baseUrl + '/api/system/info'} id="download-link"> Download diff --git a/server/sonar-web/src/main/js/apps/system/section.js b/server/sonar-web/src/main/js/apps/system/section.js index e9f540cc3ea..89b90e99c5d 100644 --- a/server/sonar-web/src/main/js/apps/system/section.js +++ b/server/sonar-web/src/main/js/apps/system/section.js @@ -39,13 +39,9 @@ export default class Section extends React.PureComponent { return ( <div className="big-spacer-bottom"> - <h3 className="spacer-bottom"> - {this.props.section} - </h3> + <h3 className="spacer-bottom">{this.props.section}</h3> <table className="data zebra" id={this.props.section}> - <tbody> - {items} - </tbody> + <tbody>{items}</tbody> </table> </div> ); diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js index bf535694f94..ebf9d57e49c 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js @@ -77,18 +77,15 @@ export default class AnalysisStep extends React.PureComponent { sonarCloud={this.props.sonarCloud} /> </div> - <div className="flex-column flex-column-half"> - {this.renderCommand()} - </div> + <div className="flex-column flex-column-half">{this.renderCommand()}</div> </div> </div> ); }; - renderFormattedCommand = (...lines /*: Array<string> */) => - <pre> - {lines.join(' ' + '\\' + '\n' + ' ')} - </pre>; + renderFormattedCommand = (...lines /*: Array<string> */) => ( + <pre>{lines.join(' ' + '\\' + '\n' + ' ')}</pre> + ); renderCommand = () => { const { result } = this.state; @@ -112,19 +109,21 @@ export default class AnalysisStep extends React.PureComponent { } }; - renderCommandForMaven = () => + renderCommandForMaven = () => ( <JavaMaven host={this.getHost()} organization={this.props.organization} token={this.props.token} - />; + /> + ); - renderCommandForGradle = () => + renderCommandForGradle = () => ( <JavaGradle host={this.getHost()} organization={this.props.organization} token={this.props.token} - />; + /> + ); renderCommandForDotNet = () => { return ( @@ -150,7 +149,7 @@ export default class AnalysisStep extends React.PureComponent { ); }; - renderCommandForClangGCC = () => + renderCommandForClangGCC = () => ( <ClangGCC host={this.getHost()} organization={this.props.organization} @@ -159,9 +158,10 @@ export default class AnalysisStep extends React.PureComponent { // $FlowFixMe projectKey={this.state.result.projectKey} token={this.props.token} - />; + /> + ); - renderCommandForOther = () => + renderCommandForOther = () => ( <Other host={this.getHost()} organization={this.props.organization} @@ -170,7 +170,8 @@ export default class AnalysisStep extends React.PureComponent { // $FlowFixMe projectKey={this.state.result.projectKey} token={this.props.token} - />; + /> + ); renderResult = () => null; diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/LanguageStep.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/LanguageStep.js index 282b86150ae..45b2efd37d7 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/LanguageStep.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/LanguageStep.js @@ -95,11 +95,9 @@ export default class LanguageStep extends React.PureComponent { this.setState({ projectKey: undefined }, this.handleChange); }; - renderJavaBuild = () => + renderJavaBuild = () => ( <div className="big-spacer-top"> - <h4 className="spacer-bottom"> - {translate('onboarding.language.java.build_technology')} - </h4> + <h4 className="spacer-bottom">{translate('onboarding.language.java.build_technology')}</h4> <RadioToggle name="java-build" onCheck={this.handleJavaBuildChange} @@ -109,13 +107,12 @@ export default class LanguageStep extends React.PureComponent { }))} value={this.state.javaBuild} /> - </div>; + </div> + ); - renderCFamilyCompiler = () => + renderCFamilyCompiler = () => ( <div className="big-spacer-top"> - <h4 className="spacer-bottom"> - {translate('onboarding.language.c-family.compiler')} - </h4> + <h4 className="spacer-bottom">{translate('onboarding.language.c-family.compiler')}</h4> <RadioToggle name="c-family-compiler" onCheck={this.handleCFamilyCompilerChange} @@ -125,13 +122,12 @@ export default class LanguageStep extends React.PureComponent { }))} value={this.state.cFamilyCompiler} /> - </div>; + </div> + ); - renderOS = () => + renderOS = () => ( <div className="big-spacer-top"> - <h4 className="spacer-bottom"> - {translate('onboarding.language.os')} - </h4> + <h4 className="spacer-bottom">{translate('onboarding.language.os')}</h4> <RadioToggle name="os" onCheck={this.handleOSChange} @@ -141,15 +137,17 @@ export default class LanguageStep extends React.PureComponent { }))} value={this.state.os} /> - </div>; + </div> + ); - renderProjectKey = () => + renderProjectKey = () => ( <NewProjectForm onDelete={this.handleProjectKeyDelete} onDone={this.handleProjectKeyDone} organization={this.props.organization} projectKey={this.state.projectKey} - />; + /> + ); render() { const shouldAskProjectKey = @@ -166,9 +164,7 @@ export default class LanguageStep extends React.PureComponent { return ( <div> <div> - <h4 className="spacer-bottom"> - {translate('onboarding.language')} - </h4> + <h4 className="spacer-bottom">{translate('onboarding.language')}</h4> <RadioToggle name="language" onCheck={this.handleLanguageChange} diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/NewOrganizationForm.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/NewOrganizationForm.js index 4ef88d7077f..aee2e30489d 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/NewOrganizationForm.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/NewOrganizationForm.js @@ -84,7 +84,10 @@ export default class NewOrganizationForm extends React.PureComponent { }; sanitizeOrganization = (organization /*: string */) => - organization.toLowerCase().replace(/[^a-z0-9-]/, '').replace(/^-/, ''); + organization + .toLowerCase() + .replace(/[^a-z0-9-]/, '') + .replace(/^-/, ''); handleOrganizationChange = (event /*: { target: HTMLInputElement } */) => { const organization = this.sanitizeOrganization(event.target.value); @@ -125,42 +128,47 @@ export default class NewOrganizationForm extends React.PureComponent { const valid = unique && organization.length >= 2; - return done - ? <form onSubmit={this.handleOrganizationDelete}> - <span className="spacer-right text-middle"> - {organization} + return done ? ( + <form onSubmit={this.handleOrganizationDelete}> + <span className="spacer-right text-middle">{organization}</span> + {loading ? ( + <i className="spinner text-middle" /> + ) : ( + <button className="button-clean text-middle"> + <CloseIcon className="icon-red" /> + </button> + )} + </form> + ) : ( + <form onSubmit={this.handleOrganizationCreate}> + <input + autoFocus={true} + className="input-super-large spacer-right text-middle" + onChange={this.handleOrganizationChange} + maxLength={32} + minLength={2} + placeholder={translate('onboarding.organization.placeholder')} + required={true} + type="text" + value={organization} + /> + {loading ? ( + <i className="spinner text-middle" /> + ) : ( + <button className="text-middle" disabled={!valid}> + {translate('create')} + </button> + )} + {!unique && ( + <span className="big-spacer-left text-danger text-middle"> + <i className="icon-alert-error little-spacer-right text-text-top" /> + {translate('this_name_is_already_taken')} </span> - {loading - ? <i className="spinner text-middle" /> - : <button className="button-clean text-middle"> - <CloseIcon className="icon-red" /> - </button>} - </form> - : <form onSubmit={this.handleOrganizationCreate}> - <input - autoFocus={true} - className="input-super-large spacer-right text-middle" - onChange={this.handleOrganizationChange} - maxLength={32} - minLength={2} - placeholder={translate('onboarding.organization.placeholder')} - required={true} - type="text" - value={organization} - /> - {loading - ? <i className="spinner text-middle" /> - : <button className="text-middle" disabled={!valid}> - {translate('create')} - </button>} - {!unique && - <span className="big-spacer-left text-danger text-middle"> - <i className="icon-alert-error little-spacer-right text-text-top" /> - {translate('this_name_is_already_taken')} - </span>} - <div className="note spacer-top abs-width-300"> - {translate('onboarding.organization.key_requirement')} - </div> - </form>; + )} + <div className="note spacer-top abs-width-300"> + {translate('onboarding.organization.key_requirement')} + </div> + </form> + ); } } diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/NewProjectForm.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/NewProjectForm.js index 65a73530d21..da09a96dcb8 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/NewProjectForm.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/NewProjectForm.js @@ -110,43 +110,45 @@ export default class NewProjectForm extends React.PureComponent { const valid = projectKey.length > 0; - const form = done - ? <form onSubmit={this.handleProjectDelete}> - <span className="spacer-right text-middle"> - {projectKey} - </span> - {loading - ? <i className="spinner text-middle" /> - : <button className="button-clean text-middle"> - <CloseIcon className="icon-red" /> - </button>} - </form> - : <form onSubmit={this.handleProjectCreate}> - <input - autoFocus={true} - className="input-large spacer-right text-middle" - minLength={1} - maxLength={400} - onChange={this.handleProjectKeyChange} - required={true} - type="text" - value={projectKey} - /> - {loading - ? <i className="spinner text-middle" /> - : <button className="text-middle" disabled={!valid}> - {translate('Done')} - </button>} - <div className="note spacer-top abs-width-300"> - {translate('onboarding.project_key_requirement')} - </div> - </form>; + const form = done ? ( + <form onSubmit={this.handleProjectDelete}> + <span className="spacer-right text-middle">{projectKey}</span> + {loading ? ( + <i className="spinner text-middle" /> + ) : ( + <button className="button-clean text-middle"> + <CloseIcon className="icon-red" /> + </button> + )} + </form> + ) : ( + <form onSubmit={this.handleProjectCreate}> + <input + autoFocus={true} + className="input-large spacer-right text-middle" + minLength={1} + maxLength={400} + onChange={this.handleProjectKeyChange} + required={true} + type="text" + value={projectKey} + /> + {loading ? ( + <i className="spinner text-middle" /> + ) : ( + <button className="text-middle" disabled={!valid}> + {translate('Done')} + </button> + )} + <div className="note spacer-top abs-width-300"> + {translate('onboarding.project_key_requirement')} + </div> + </form> + ); return ( <div className="big-spacer-top"> - <h4 className="spacer-bottom"> - {translate('onboarding.language.project_key')} - </h4> + <h4 className="spacer-bottom">{translate('onboarding.language.project_key')}</h4> {form} </div> ); diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/Onboarding.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/Onboarding.js index 4b250ce081c..03dd358299a 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/Onboarding.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/Onboarding.js @@ -144,22 +144,20 @@ export default class Onboarding extends React.PureComponent { <div className="page page-limited onboarding"> <header className="page-header"> - <h1 className="page-title"> - {header} - </h1> + <h1 className="page-title">{header}</h1> <div className="page-actions"> - {this.state.skipping - ? <i className="spinner" /> - : <a className="js-skip text-muted" href="#" onClick={this.handleSkipClick}> - {translate('tutorials.skip')} - </a>} - </div> - <div className="page-description"> - {translate('onboarding.header.description')} + {this.state.skipping ? ( + <i className="spinner" /> + ) : ( + <a className="js-skip text-muted" href="#" onClick={this.handleSkipClick}> + {translate('tutorials.skip')} + </a> + )} </div> + <div className="page-description">{translate('onboarding.header.description')}</div> </header> - {organizationsEnabled && + {organizationsEnabled && ( <OrganizationStep currentUser={this.props.currentUser} finished={this.state.organization != null} @@ -167,7 +165,8 @@ export default class Onboarding extends React.PureComponent { onOpen={this.handleOrganizationOpen} open={step === 'organization'} stepNumber={stepNumber++} - />} + /> + )} <TokenStep finished={this.state.token != null} @@ -189,17 +188,19 @@ export default class Onboarding extends React.PureComponent { {this.state.finished && !this.state.skipping && - (this.state.projectKey - ? <ProjectWatcher - onFinish={this.finishOnboarding} - onTimeout={this.handleTimeout} - projectKey={this.state.projectKey} - /> - : <footer className="text-right"> - <a className="button" href="#" onClick={this.handleSkipClick}> - {translate('tutorials.finish')} - </a> - </footer>)} + (this.state.projectKey ? ( + <ProjectWatcher + onFinish={this.finishOnboarding} + onTimeout={this.handleTimeout} + projectKey={this.state.projectKey} + /> + ) : ( + <footer className="text-right"> + <a className="button" href="#" onClick={this.handleSkipClick}> + {translate('tutorials.finish')} + </a> + </footer> + ))} </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OrganizationStep.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OrganizationStep.js index 6979adf8198..116b4c7d8c4 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OrganizationStep.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OrganizationStep.js @@ -142,7 +142,7 @@ export default class OrganizationStep extends React.PureComponent { } }; - renderPersonalOrganizationOption = () => + renderPersonalOrganizationOption = () => ( <div> <a className="link-base-color link-no-underline" href="#" onClick={this.handlePersonalClick}> <i @@ -151,13 +151,12 @@ export default class OrganizationStep extends React.PureComponent { })} /> {translate('onboarding.organization.my_personal_organization')} - <span className="note spacer-left"> - {this.state.personalOrganization} - </span> + <span className="note spacer-left">{this.state.personalOrganization}</span> </a> - </div>; + </div> + ); - renderExistingOrganizationOption = () => + renderExistingOrganizationOption = () => ( <div className="big-spacer-top"> <a className="js-existing link-base-color link-no-underline" @@ -170,7 +169,7 @@ export default class OrganizationStep extends React.PureComponent { /> {translate('onboarding.organization.exising_organization')} </a> - {this.state.selection === 'existing' && + {this.state.selection === 'existing' && ( <div className="big-spacer-top"> <Select className="input-super-large" @@ -182,10 +181,12 @@ export default class OrganizationStep extends React.PureComponent { }))} value={this.state.existingOrganization} /> - </div>} - </div>; + </div> + )} + </div> + ); - renderNewOrganizationOption = () => + renderNewOrganizationOption = () => ( <div className="big-spacer-top"> <a className="js-new link-base-color link-no-underline" @@ -198,15 +199,17 @@ export default class OrganizationStep extends React.PureComponent { /> {translate('onboarding.organization.create_another_organization')} </a> - {this.state.selection === 'new' && + {this.state.selection === 'new' && ( <div className="big-spacer-top"> <NewOrganizationForm onDelete={this.handleOrganizationDelete} onDone={this.handleOrganizationCreate} organization={this.state.newOrganization} /> - </div>} - </div>; + </div> + )} + </div> + ); renderForm = () => { return ( @@ -215,22 +218,24 @@ export default class OrganizationStep extends React.PureComponent { {translate('onboarding.organization.text')} </div> - {this.state.loading - ? <i className="spinner" /> - : <div> - {this.state.personalOrganization && this.renderPersonalOrganizationOption()} - {this.state.existingOrganizations.length > 0 && - this.renderExistingOrganizationOption()} - {this.renderNewOrganizationOption()} - </div>} + {this.state.loading ? ( + <i className="spinner" /> + ) : ( + <div> + {this.state.personalOrganization && this.renderPersonalOrganizationOption()} + {this.state.existingOrganizations.length > 0 && this.renderExistingOrganizationOption()} + {this.renderNewOrganizationOption()} + </div> + )} {this.getSelectedOrganization() != null && - !this.state.loading && + !this.state.loading && ( <div className="big-spacer-top"> <button className="js-continue" onClick={this.handleContinueClick}> {translate('continue')} </button> - </div>} + </div> + )} </div> ); }; @@ -238,14 +243,12 @@ export default class OrganizationStep extends React.PureComponent { renderResult = () => { const result = this.getSelectedOrganization(); - return result != null - ? <div className="boxed-group-actions"> - <i className="icon-check spacer-right" /> - <strong> - {result} - </strong> - </div> - : null; + return result != null ? ( + <div className="boxed-group-actions"> + <i className="icon-check spacer-right" /> + <strong>{result}</strong> + </div> + ) : null; }; render() { diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/ProjectKeyStep.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/ProjectKeyStep.js index 002626b16ee..fc74db42541 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/ProjectKeyStep.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/ProjectKeyStep.js @@ -109,43 +109,45 @@ export default class ProjectKeyStep extends React.PureComponent { const valid = projectKey.length > 0; - const form = done - ? <form onSubmit={this.handleProjectDelete}> - <span className="spacer-right text-middle"> - {projectKey} - </span> - {loading - ? <i className="spinner" /> - : <button className="button-clean"> - <i className="icon-delete" /> - </button>} - </form> - : <form onSubmit={this.handleProjectCreate}> - <input - autoFocus={true} - className="input-large spacer-right text-middle" - minLength={1} - maxLength={400} - onChange={this.handleProjectKeyChange} - required={true} - type="text" - value={projectKey} - /> - {loading - ? <i className="spinner" /> - : <button className="text-middle" disabled={!valid}> - {translate('Done')} - </button>} - <div className="note spacer-top abs-width-300"> - {translate('onboarding.project_key_requirement')} - </div> - </form>; + const form = done ? ( + <form onSubmit={this.handleProjectDelete}> + <span className="spacer-right text-middle">{projectKey}</span> + {loading ? ( + <i className="spinner" /> + ) : ( + <button className="button-clean"> + <i className="icon-delete" /> + </button> + )} + </form> + ) : ( + <form onSubmit={this.handleProjectCreate}> + <input + autoFocus={true} + className="input-large spacer-right text-middle" + minLength={1} + maxLength={400} + onChange={this.handleProjectKeyChange} + required={true} + type="text" + value={projectKey} + /> + {loading ? ( + <i className="spinner" /> + ) : ( + <button className="text-middle" disabled={!valid}> + {translate('Done')} + </button> + )} + <div className="note spacer-top abs-width-300"> + {translate('onboarding.project_key_requirement')} + </div> + </form> + ); return ( <div className="big-spacer-top"> - <h4 className="spacer-bottom"> - {translate('onboarding.language.project_key')} - </h4> + <h4 className="spacer-bottom">{translate('onboarding.language.project_key')}</h4> {form} </div> ); diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/Step.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/Step.js index a814a008aee..c7935ed7a58 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/Step.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/Step.js @@ -52,14 +52,10 @@ export default function Step(props /*: Props */) { onClick={clickable ? handleClick : undefined} role={clickable ? 'button' : undefined} tabIndex={clickable ? 0 : undefined}> - <div className="onboarding-step-number"> - {props.stepNumber} - </div> + <div className="onboarding-step-number">{props.stepNumber}</div> {!props.open && props.renderResult()} <div className="boxed-group-header"> - <h2> - {props.stepTitle} - </h2> + <h2>{props.stepTitle}</h2> </div> {props.open ? props.renderForm() : <div className="boxed-group-inner" />} </div> diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/TokenStep.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/TokenStep.js index 6c903e32ae2..80ed22c805d 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/TokenStep.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/TokenStep.js @@ -113,48 +113,49 @@ export default class TokenStep extends React.PureComponent { return ( <div className="boxed-group-inner"> - {token != null - ? <form onSubmit={this.handleTokenRevoke}> - <span className="text-middle"> - {tokenName} - {': '} - </span> - <strong className="spacer-right text-middle"> - {token} - </strong> - {loading - ? <i className="spinner text-middle" /> - : <button className="button-clean text-middle" onClick={this.handleTokenRevoke}> - <CloseIcon className="icon-red" /> - </button>} - </form> - : <form onSubmit={this.handleTokenGenerate}> - <input - autoFocus={true} - className="input-large spacer-right text-middle" - onChange={this.handleTokenNameChange} - placeholder={translate('onboarding.token.placeholder')} - required={true} - type="text" - value={tokenName || ''} - /> - {loading - ? <i className="spinner text-middle" /> - : <button className="text-middle"> - {translate('onboarding.token.generate')} - </button>} - </form>} - - <div className="note big-spacer-top width-50"> - {translate('onboarding.token.text')} - </div> - - {token != null && + {token != null ? ( + <form onSubmit={this.handleTokenRevoke}> + <span className="text-middle"> + {tokenName} + {': '} + </span> + <strong className="spacer-right text-middle">{token}</strong> + {loading ? ( + <i className="spinner text-middle" /> + ) : ( + <button className="button-clean text-middle" onClick={this.handleTokenRevoke}> + <CloseIcon className="icon-red" /> + </button> + )} + </form> + ) : ( + <form onSubmit={this.handleTokenGenerate}> + <input + autoFocus={true} + className="input-large spacer-right text-middle" + onChange={this.handleTokenNameChange} + placeholder={translate('onboarding.token.placeholder')} + required={true} + type="text" + value={tokenName || ''} + /> + {loading ? ( + <i className="spinner text-middle" /> + ) : ( + <button className="text-middle">{translate('onboarding.token.generate')}</button> + )} + </form> + )} + + <div className="note big-spacer-top width-50">{translate('onboarding.token.text')}</div> + + {token != null && ( <div className="big-spacer-top"> <button className="js-continue" onClick={this.handleContinueClick}> {translate('continue')} </button> - </div>} + </div> + )} </div> ); }; @@ -171,9 +172,7 @@ export default class TokenStep extends React.PureComponent { <i className="icon-check spacer-right" /> {tokenName} {': '} - <strong> - {token} - </strong> + <strong>{token}</strong> </div> ); }; diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/LanguageStep-test.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/LanguageStep-test.js index 414b0dba7fe..b9407c21fb3 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/LanguageStep-test.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/LanguageStep-test.js @@ -30,12 +30,18 @@ it('selects java', () => { wrapper.update(); expect(wrapper).toMatchSnapshot(); - wrapper.find('RadioToggle').at(1).prop('onCheck')('maven'); + wrapper + .find('RadioToggle') + .at(1) + .prop('onCheck')('maven'); wrapper.update(); expect(wrapper).toMatchSnapshot(); expect(onDone).lastCalledWith({ language: 'java', javaBuild: 'maven' }); - wrapper.find('RadioToggle').at(1).prop('onCheck')('gradle'); + wrapper + .find('RadioToggle') + .at(1) + .prop('onCheck')('gradle'); wrapper.update(); expect(wrapper).toMatchSnapshot(); expect(onDone).lastCalledWith({ language: 'java', javaBuild: 'gradle' }); @@ -61,7 +67,10 @@ it('selects c-family', () => { wrapper.update(); expect(wrapper).toMatchSnapshot(); - wrapper.find('RadioToggle').at(1).prop('onCheck')('msvc'); + wrapper + .find('RadioToggle') + .at(1) + .prop('onCheck')('msvc'); wrapper.update(); expect(wrapper).toMatchSnapshot(); @@ -72,11 +81,17 @@ it('selects c-family', () => { projectKey: 'project-foo' }); - wrapper.find('RadioToggle').at(1).prop('onCheck')('clang-gcc'); + wrapper + .find('RadioToggle') + .at(1) + .prop('onCheck')('clang-gcc'); wrapper.update(); expect(wrapper).toMatchSnapshot(); - wrapper.find('RadioToggle').at(2).prop('onCheck')('linux'); + wrapper + .find('RadioToggle') + .at(2) + .prop('onCheck')('linux'); wrapper.update(); expect(wrapper).toMatchSnapshot(); @@ -97,7 +112,10 @@ it('selects other', () => { wrapper.update(); expect(wrapper).toMatchSnapshot(); - wrapper.find('RadioToggle').at(1).prop('onCheck')('mac'); + wrapper + .find('RadioToggle') + .at(1) + .prop('onCheck')('mac'); wrapper.update(); expect(wrapper).toMatchSnapshot(); diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Command.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Command.js index f5336761d0c..aa6ad03916e 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Command.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Command.js @@ -81,14 +81,14 @@ export default class Command extends React.PureComponent { return ( <div className="onboarding-command"> - <pre> - {finalCommand} - </pre> - {this.state.tooltipShown - ? <Tooltip defaultVisible={true} placement="top" overlay="Copied!" trigger="manual"> - {button} - </Tooltip> - : button} + <pre>{finalCommand}</pre> + {this.state.tooltipShown ? ( + <Tooltip defaultVisible={true} placement="top" overlay="Copied!" trigger="manual"> + {button} + </Tooltip> + ) : ( + button + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaGradle.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaGradle.js index 00b6ff5ba90..08949f10140 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaGradle.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaGradle.js @@ -42,9 +42,7 @@ export default function JavaGradle(props /*: Props */) { return ( <div> - <h4 className="spacer-bottom"> - {translate('onboarding.analysis.java.gradle.header')} - </h4> + <h4 className="spacer-bottom">{translate('onboarding.analysis.java.gradle.header')}</h4> <p className="spacer-bottom markdown" dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.java.gradle.text.1') }} diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaMaven.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaMaven.js index 74f1e5b0729..c5669d3c79f 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaMaven.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaMaven.js @@ -40,12 +40,8 @@ export default function JavaMaven(props /*: Props */) { return ( <div> - <h4 className="spacer-bottom"> - {translate('onboarding.analysis.java.maven.header')} - </h4> - <p className="spacer-bottom markdown"> - {translate('onboarding.analysis.java.maven.text')} - </p> + <h4 className="spacer-bottom">{translate('onboarding.analysis.java.maven.header')}</h4> + <p className="spacer-bottom markdown">{translate('onboarding.analysis.java.maven.text')}</p> <Command command={command} /> <p className="big-spacer-top markdown" diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/MSBuildScanner.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/MSBuildScanner.js index 725ceb936b9..1272559afea 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/MSBuildScanner.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/MSBuildScanner.js @@ -30,9 +30,7 @@ type Props = { export default function MSBuildScanner(props /*: Props */) { return ( <div className={props.className}> - <h4 className="spacer-bottom"> - {translate('onboarding.analysis.msbuild.header')} - </h4> + <h4 className="spacer-bottom">{translate('onboarding.analysis.msbuild.header')}</h4> <p className="spacer-bottom markdown" dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.msbuild.text') }} diff --git a/server/sonar-web/src/main/js/apps/update-center/plugins.js b/server/sonar-web/src/main/js/apps/update-center/plugins.js index 3cb1cb45ef5..7389bc4179d 100644 --- a/server/sonar-web/src/main/js/apps/update-center/plugins.js +++ b/server/sonar-web/src/main/js/apps/update-center/plugins.js @@ -62,7 +62,9 @@ const Plugins = Backbone.Collection.extend({ _fetchInstalled() { if (this._installed) { - return $.Deferred().resolve().promise(); + return $.Deferred() + .resolve() + .promise(); } const that = this; const opts = { @@ -77,7 +79,9 @@ const Plugins = Backbone.Collection.extend({ _fetchUpdates() { if (this._updates) { - return $.Deferred().resolve().promise(); + return $.Deferred() + .resolve() + .promise(); } const that = this; const opts = { @@ -92,7 +96,9 @@ const Plugins = Backbone.Collection.extend({ _fetchAvailable() { if (this._available) { - return $.Deferred().resolve().promise(); + return $.Deferred() + .resolve() + .promise(); } const that = this; const opts = { @@ -131,7 +137,9 @@ const Plugins = Backbone.Collection.extend({ _fetchSystemUpgrades() { if (this._systemUpdates) { - return $.Deferred().resolve().promise(); + return $.Deferred() + .resolve() + .promise(); } const that = this; const opts = { diff --git a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearchOption.js b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearchOption.js index e148e31d78c..f1f0dfe3014 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearchOption.js +++ b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearchOption.js @@ -65,12 +65,8 @@ export default class UsersSelectSearchOption extends React.PureComponent { onMouseMove={this.handleMouseMove} title={user.name}> <Avatar hash={user.avatar} email={user.email} name={user.name} size={AVATAR_SIZE} /> - <strong className="spacer-left"> - {this.props.children} - </strong> - <span className="note little-spacer-left"> - {user.login} - </span> + <strong className="spacer-left">{this.props.children}</strong> + <span className="note little-spacer-left">{user.login}</span> </div> ); } diff --git a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearchValue.js b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearchValue.js index b9823f264a7..70643cb34a8 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearchValue.js +++ b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearchValue.js @@ -39,16 +39,13 @@ export default class UsersSelectSearchValue extends React.PureComponent { return ( <div className="Select-value" title={user ? user.name : ''}> {user && - user.login && + user.login && ( <div className="Select-value-label"> <Avatar hash={user.avatar} email={user.email} name={user.name} size={AVATAR_SIZE} /> - <strong className="spacer-left"> - {this.props.children} - </strong> - <span className="note little-spacer-left"> - {user.login} - </span> - </div>} + <strong className="spacer-left">{this.props.children}</strong> + <span className="note little-spacer-left">{user.login}</span> + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearchOption-test.js b/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearchOption-test.js index 090808dc979..3023f73918c 100644 --- a/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearchOption-test.js +++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearchOption-test.js @@ -35,18 +35,14 @@ const user2 = { it('should render correctly without all parameters', () => { const wrapper = shallow( - <UsersSelectSearchOption option={user}> - {user.name} - </UsersSelectSearchOption> + <UsersSelectSearchOption option={user}>{user.name}</UsersSelectSearchOption> ); expect(wrapper).toMatchSnapshot(); }); it('should render correctly with email instead of hash', () => { const wrapper = shallow( - <UsersSelectSearchOption option={user2}> - {user.name} - </UsersSelectSearchOption> + <UsersSelectSearchOption option={user2}>{user.name}</UsersSelectSearchOption> ); expect(wrapper).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearchValue-test.js b/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearchValue-test.js index cd182e98fc5..357365a0826 100644 --- a/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearchValue-test.js +++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearchValue-test.js @@ -35,18 +35,14 @@ const user2 = { it('should render correctly with a user', () => { const wrapper = shallow( - <UsersSelectSearchValue value={user}> - {user.name} - </UsersSelectSearchValue> + <UsersSelectSearchValue value={user}>{user.name}</UsersSelectSearchValue> ); expect(wrapper).toMatchSnapshot(); }); it('should render correctly with email instead of hash', () => { const wrapper = shallow( - <UsersSelectSearchValue value={user2}> - {user2.name} - </UsersSelectSearchValue> + <UsersSelectSearchValue value={user2}>{user2.name}</UsersSelectSearchValue> ); expect(wrapper).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/users/form-view.js b/server/sonar-web/src/main/js/apps/users/form-view.js index 7fec06166db..9fccdea1f39 100644 --- a/server/sonar-web/src/main/js/apps/users/form-view.js +++ b/server/sonar-web/src/main/js/apps/users/form-view.js @@ -62,6 +62,10 @@ export default ModalForm.extend({ addScmAccount() { const fields = this.$('[name="scmAccounts"]'); - fields.first().clone().val('').insertAfter(fields.last()); + fields + .first() + .clone() + .val('') + .insertAfter(fields.last()); } }); diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx index 92cea769d0a..06bce67949d 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx @@ -84,7 +84,7 @@ export default class Action extends React.PureComponent<Props, State> { if (action.params || action.hasResponseExample || action.changelog.length > 0) { return ( <ul className="web-api-action-actions tabs"> - {action.params && + {action.params && ( <li> <a className={classNames({ selected: showParams })} @@ -92,9 +92,10 @@ export default class Action extends React.PureComponent<Props, State> { onClick={this.handleShowParamsClick}> {translate('api_documentation.parameters')} </a> - </li>} + </li> + )} - {action.hasResponseExample && + {action.hasResponseExample && ( <li> <a className={classNames({ selected: showResponse })} @@ -102,9 +103,10 @@ export default class Action extends React.PureComponent<Props, State> { onClick={this.handleShowResponseClick}> {translate('api_documentation.response_example')} </a> - </li>} + </li> + )} - {action.changelog.length > 0 && + {action.changelog.length > 0 && ( <li> <a className={classNames({ selected: showChangelog })} @@ -112,7 +114,8 @@ export default class Action extends React.PureComponent<Props, State> { onClick={this.handleChangelogClick}> {translate('api_documentation.changelog')} </a> - </li>} + </li> + )} </ul> ); } @@ -139,20 +142,23 @@ export default class Action extends React.PureComponent<Props, State> { {verb} {actionKey} </h3> - {action.internal && + {action.internal && ( <span className="spacer-left"> <InternalBadge /> - </span>} + </span> + )} - {action.since && + {action.since && ( <span className="spacer-left badge"> {translateWithParameters('since_x', action.since)} - </span>} + </span> + )} - {action.deprecatedSince && + {action.deprecatedSince && ( <span className="spacer-left"> <DeprecatedBadge since={action.deprecatedSince} /> - </span>} + </span> + )} </header> <div @@ -163,16 +169,16 @@ export default class Action extends React.PureComponent<Props, State> { {this.renderTabs()} {showParams && - action.params && + action.params && ( <Params params={action.params} showDeprecated={this.props.showDeprecated} showInternal={this.props.showInternal} - />} + /> + )} {showResponse && - action.hasResponseExample && - <ResponseExample domain={domain} action={action} />} + action.hasResponseExample && <ResponseExample domain={domain} action={action} />} {showChangelog && <ActionChangelog changelog={action.changelog} />} </div> diff --git a/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx b/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx index 7e33e9719ae..25df7b9a993 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx @@ -27,14 +27,12 @@ interface Props { export default function ActionChangelog({ changelog }: Props) { return ( <ul className="big-spacer-top"> - {changelog.map((item, index) => + {changelog.map((item, index) => ( <li key={index} className="spacer-top"> - <span className="spacer-right badge"> - {item.version} - </span> + <span className="spacer-right badge">{item.version}</span> {item.description} </li> - )} + ))} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/web-api/components/DeprecatedBadge.tsx b/server/sonar-web/src/main/js/apps/web-api/components/DeprecatedBadge.tsx index 504d0553823..c2a786f62b2 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/DeprecatedBadge.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/DeprecatedBadge.tsx @@ -27,9 +27,7 @@ export default function DeprecatedBadge({ since }: { since?: string }) { : translate('api_documentation.depracated'); return ( <Tooltip overlay={translate('api_documentation.deprecation_tooltip')}> - <span className="badge badge-warning"> - {label} - </span> + <span className="badge badge-warning">{label}</span> </Tooltip> ); } diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx index 8e70e2ed767..492027a232a 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx @@ -39,29 +39,30 @@ export default function Domain({ domain, showInternal, showDeprecated, searchQue return ( <div className="web-api-domain"> <header className="web-api-domain-header"> - <h2 className="web-api-domain-title"> - {domain.path} - </h2> + <h2 className="web-api-domain-title">{domain.path}</h2> - {domain.deprecated && + {domain.deprecated && ( <span className="spacer-left"> <DeprecatedBadge /> - </span>} + </span> + )} - {domain.internal && + {domain.internal && ( <span className="spacer-left"> <InternalBadge /> - </span>} + </span> + )} </header> - {domain.description && + {domain.description && ( <div className="web-api-domain-description markdown" dangerouslySetInnerHTML={{ __html: domain.description }} - />} + /> + )} <div className="web-api-domain-actions"> - {filteredActions.map(action => + {filteredActions.map(action => ( <Action key={getActionKey(domain.path, action.key)} action={action} @@ -69,7 +70,7 @@ export default function Domain({ domain, showInternal, showDeprecated, searchQue showDeprecated={showDeprecated} showInternal={showInternal} /> - )} + ))} </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/web-api/components/InternalBadge.tsx b/server/sonar-web/src/main/js/apps/web-api/components/InternalBadge.tsx index 4b7ed15fede..34a66309f7e 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/InternalBadge.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/InternalBadge.tsx @@ -24,9 +24,7 @@ import { translate } from '../../../helpers/l10n'; export default function InternalBadge() { return ( <Tooltip overlay={translate('api_documentation.internal_tooltip')}> - <span className="badge badge-danger"> - {translate('internal')} - </span> + <span className="badge badge-danger">{translate('internal')}</span> </Tooltip> ); } diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx index d33ddade68b..2b5218293d8 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx @@ -47,7 +47,7 @@ export default function Menu(props: Props) { return ( <div className="api-documentation-results panel"> <div className="list-group"> - {filteredDomains.map(domain => + {filteredDomains.map(domain => ( <Link key={domain.path} className={classNames('list-group-item', { @@ -59,13 +59,14 @@ export default function Menu(props: Props) { {domain.deprecated && <DeprecatedBadge />} {domain.internal && <InternalBadge />} </h3> - {domain.description && + {domain.description && ( <div className="list-group-item-text markdown" dangerouslySetInnerHTML={{ __html: domain.description }} - />} + /> + )} </Link> - )} + ))} </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx index e0691804e7d..9f32210fc63 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx @@ -37,46 +37,47 @@ export default function Params({ params, showDeprecated, showInternal }: Props) <div className="web-api-params"> <table> <tbody> - {displayedParameters.map(param => + {displayedParameters.map(param => ( <tr key={param.key}> <td className="markdown" style={{ width: 180 }}> - <code> - {param.key} - </code> + <code>{param.key}</code> - {param.internal && + {param.internal && ( <div className="little-spacer-top"> <InternalBadge /> - </div>} + </div> + )} - {param.deprecatedSince && + {param.deprecatedSince && ( <div className="little-spacer-top"> <DeprecatedBadge since={param.deprecatedSince} /> - </div>} + </div> + )} {showDeprecated && - param.deprecatedKey && + param.deprecatedKey && ( <div className="little-spacer-top"> - <code> - {param.deprecatedKey} - </code> - </div>} + <code>{param.deprecatedKey}</code> + </div> + )} {showDeprecated && - param.deprecatedKey && - param.deprecatedKeySince && + param.deprecatedKey && + param.deprecatedKeySince && ( <div className="little-spacer-top"> <DeprecatedBadge since={param.deprecatedKeySince} /> - </div>} + </div> + )} <div className="note little-spacer-top"> {param.required ? 'required' : 'optional'} </div> - {param.since && + {param.since && ( <div className="note little-spacer-top"> {translateWithParameters('since_x', param.since)} - </div>} + </div> + )} </td> <td> @@ -84,54 +85,42 @@ export default function Params({ params, showDeprecated, showInternal }: Props) </td> <td style={{ width: 250 }}> - {param.possibleValues && + {param.possibleValues && ( <div> - <h4> - {translate('api_documentation.possible_values')} - </h4> + <h4>{translate('api_documentation.possible_values')}</h4> <ul className="list-styled"> - {param.possibleValues.map(value => + {param.possibleValues.map(value => ( <li key={value} className="little-spacer-top"> - <code> - {value} - </code> + <code>{value}</code> </li> - )} + ))} </ul> - </div>} + </div> + )} - {param.defaultValue && + {param.defaultValue && ( <div className="little-spacer-top"> - <h4> - {translate('api_documentation.default_values')} - </h4> - <code> - {param.defaultValue} - </code> - </div>} + <h4>{translate('api_documentation.default_values')}</h4> + <code>{param.defaultValue}</code> + </div> + )} - {param.exampleValue && + {param.exampleValue && ( <div className="little-spacer-top"> - <h4> - {translate('api_documentation.example_values')} - </h4> - <code> - {param.exampleValue} - </code> - </div>} + <h4>{translate('api_documentation.example_values')}</h4> + <code>{param.exampleValue}</code> + </div> + )} - {param.maxValuesAllowed != null && + {param.maxValuesAllowed != null && ( <div className="little-spacer-top"> - <h4> - {translate('api_documentation.max_values')} - </h4> - <code> - {param.maxValuesAllowed} - </code> - </div>} + <h4>{translate('api_documentation.max_values')}</h4> + <code>{param.maxValuesAllowed}</code> + </div> + )} </td> </tr> - )} + ))} </tbody> </table> </div> diff --git a/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx b/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx index 746fb398e11..c20fc9c7515 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx @@ -65,10 +65,7 @@ export default class ResponseExample extends React.PureComponent<Props, State> { return ( <div className="web-api-response"> - {responseExample && - <pre style={{ whiteSpace: 'pre-wrap' }}> - {responseExample.example} - </pre>} + {responseExample && <pre style={{ whiteSpace: 'pre-wrap' }}>{responseExample.example}</pre>} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx index 68cb7e591d4..3a69c4bc4c6 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx @@ -147,9 +147,7 @@ export default class WebApiApp extends React.PureComponent<Props, State> { <div className="layout-page-filters"> <div className="web-api-page-header"> <Link to="/web_api/"> - <h1> - {translate('api_documentation.page')} - </h1> + <h1>{translate('api_documentation.page')}</h1> </Link> </div> @@ -175,14 +173,15 @@ export default class WebApiApp extends React.PureComponent<Props, State> { <div className="layout-page-main"> <div className="layout-page-main-inner"> - {domain && + {domain && ( <Domain key={domain.path} domain={domain} showDeprecated={showDeprecated} showInternal={showInternal} searchQuery={searchQuery} - />} + /> + )} </div> </div> </div> diff --git a/server/sonar-web/src/main/js/components/SelectList/index.js b/server/sonar-web/src/main/js/components/SelectList/index.js index 23e2c7184eb..af02287019c 100644 --- a/server/sonar-web/src/main/js/components/SelectList/index.js +++ b/server/sonar-web/src/main/js/components/SelectList/index.js @@ -202,9 +202,12 @@ const SelectListView = Backbone.View.extend({ this.$listContainer = this.$('.select-list-list-container'); if (!this.settings.readOnly) { - this.$listContainer.height(this.settings.height).css('overflow', 'auto').on('scroll', () => { - that.scroll(); - }); + this.$listContainer + .height(this.settings.height) + .css('overflow', 'auto') + .on('scroll', () => { + that.scroll(); + }); } else { this.$listContainer.addClass('select-list-list-container-readonly'); } @@ -230,7 +233,10 @@ const SelectListView = Backbone.View.extend({ } that.$el.prevAll('.alert').remove(); - $('<div>').addClass('alert alert-danger').text(message).insertBefore(that.$el); + $('<div>') + .addClass('alert alert-danger') + .text(message) + .insertBefore(that.$el); }; if (this.settings.readOnly) { diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js index 9f41c7a8a8e..6d3a4378b2f 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js @@ -653,14 +653,16 @@ export default class SourceViewerBase extends React.PureComponent { component={this.state.component} showMeasures={this.showMeasures} /> - {notAccessible && + {notAccessible && ( <div className="alert alert-warning spacer-top"> {translate('code_viewer.no_source_code_displayed_due_to_security')} - </div>} - {sourceRemoved && + </div> + )} + {sourceRemoved && ( <div className="alert alert-warning spacer-top"> {translate('code_viewer.no_source_code_displayed_due_to_source_removed')} - </div>} + </div> + )} {displaySources && sources != null && this.renderCode(sources)} </div> ); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js index f928aa8f5fc..55fb081c59d 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js @@ -198,21 +198,24 @@ export default class SourceViewerCode extends React.PureComponent { return ( <div> - {this.props.hasSourcesBefore && + {this.props.hasSourcesBefore && ( <div className="source-viewer-more-code"> - {this.props.loadingSourcesBefore - ? <div className="js-component-viewer-loading-before"> - <i className="spinner" /> - <span className="note spacer-left"> - {translate('source_viewer.loading_more_code')} - </span> - </div> - : <button - className="js-component-viewer-source-before" - onClick={this.props.loadSourcesBefore}> - {translate('source_viewer.load_more_code')} - </button>} - </div>} + {this.props.loadingSourcesBefore ? ( + <div className="js-component-viewer-loading-before"> + <i className="spinner" /> + <span className="note spacer-left"> + {translate('source_viewer.loading_more_code')} + </span> + </div> + ) : ( + <button + className="js-component-viewer-source-before" + onClick={this.props.loadSourcesBefore}> + {translate('source_viewer.load_more_code')} + </button> + )} + </div> + )} <table className="source-table"> <tbody> @@ -231,21 +234,24 @@ export default class SourceViewerCode extends React.PureComponent { </tbody> </table> - {this.props.hasSourcesAfter && + {this.props.hasSourcesAfter && ( <div className="source-viewer-more-code"> - {this.props.loadingSourcesAfter - ? <div className="js-component-viewer-loading-after"> - <i className="spinner" /> - <span className="note spacer-left"> - {translate('source_viewer.loading_more_code')} - </span> - </div> - : <button - className="js-component-viewer-source-after" - onClick={this.props.loadSourcesAfter}> - {translate('source_viewer.load_more_code')} - </button>} - </div>} + {this.props.loadingSourcesAfter ? ( + <div className="js-component-viewer-loading-after"> + <i className="spinner" /> + <span className="note spacer-left"> + {translate('source_viewer.loading_more_code')} + </span> + </div> + ) : ( + <button + className="js-component-viewer-source-after" + onClick={this.props.loadSourcesAfter}> + {translate('source_viewer.load_more_code')} + </button> + )} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js index 991ec78a765..282f7211b1a 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js @@ -96,18 +96,20 @@ export default class SourceViewerHeader extends React.PureComponent { </Link> </div> - {subProject != null && + {subProject != null && ( <div className="component-name-parent"> <Link to={getProjectUrl(subProject, this.props.branch)} className="link-with-icon"> <QualifierIcon qualifier="BRC" /> <span>{subProjectName}</span> </Link> - </div>} + </div> + )} <div className="component-name-path"> <QualifierIcon qualifier={q} /> <span>{collapsedDirFromPath(path)}</span> <span className="component-name-file">{fileFromPath(path)}</span> - {this.props.component.canMarkAsFavorite && - <FavoriteContainer className="component-name-favorite" componentKey={key} />} + {this.props.component.canMarkAsFavorite && ( + <FavoriteContainer className="component-name-favorite" componentKey={key} /> + )} </div> </div> </div> @@ -135,12 +137,13 @@ export default class SourceViewerHeader extends React.PureComponent { {translate('component_viewer.new_window')} </Link> </li> - {!workspace && + {!workspace && ( <li> <a className="js-workspace" href="#" onClick={this.openInWorkspace}> {translate('component_viewer.open_in_workspace')} </a> - </li>} + </li> + )} <li> <a className="js-raw-source" href={rawSourcesLink} target="_blank"> {translate('component_viewer.show_raw_source')} @@ -150,7 +153,7 @@ export default class SourceViewerHeader extends React.PureComponent { </div> <div className="source-viewer-header-measures"> - {isUnitTest && + {isUnitTest && ( <div className="source-viewer-header-measure"> <span className="source-viewer-header-measure-value"> {formatMeasure(measures.tests, 'SHORT_INT')} @@ -158,9 +161,10 @@ export default class SourceViewerHeader extends React.PureComponent { <span className="source-viewer-header-measure-label"> {translate('metric.tests.name')} </span> - </div>} + </div> + )} - {!isUnitTest && + {!isUnitTest && ( <div className="source-viewer-header-measure"> <span className="source-viewer-header-measure-value"> {formatMeasure(measures.lines, 'SHORT_INT')} @@ -168,7 +172,8 @@ export default class SourceViewerHeader extends React.PureComponent { <span className="source-viewer-header-measure-label"> {translate('metric.lines.name')} </span> - </div>} + </div> + )} <div className="source-viewer-header-measure"> <span className="source-viewer-header-measure-value"> @@ -189,7 +194,7 @@ export default class SourceViewerHeader extends React.PureComponent { </span> </div> - {measures.coverage != null && + {measures.coverage != null && ( <div className="source-viewer-header-measure"> <span className="source-viewer-header-measure-value"> {formatMeasure(measures.coverage, 'PERCENT')} @@ -197,9 +202,10 @@ export default class SourceViewerHeader extends React.PureComponent { <span className="source-viewer-header-measure-label"> {translate('metric.coverage.name')} </span> - </div>} + </div> + )} - {measures.duplicationDensity != null && + {measures.duplicationDensity != null && ( <div className="source-viewer-header-measure"> <span className="source-viewer-header-measure-value"> {formatMeasure(measures.duplicationDensity, 'PERCENT')} @@ -207,7 +213,8 @@ export default class SourceViewerHeader extends React.PureComponent { <span className="source-viewer-header-measure-label"> {translate('duplications')} </span> - </div>} + </div> + )} </div> </div> ); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.js b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.js index 10f84254b27..1d81eb24712 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.js @@ -113,13 +113,15 @@ export default class Line extends React.PureComponent { previousLine={this.props.previousLine} /> - {this.props.displayCoverage && - <LineCoverage line={line} onClick={this.props.onCoverageClick} />} + {this.props.displayCoverage && ( + <LineCoverage line={line} onClick={this.props.onCoverageClick} /> + )} - {this.props.displayDuplications && - <LineDuplications line={line} onClick={this.props.loadDuplications} />} + {this.props.displayDuplications && ( + <LineDuplications line={line} onClick={this.props.loadDuplications} /> + )} - {times(duplicationsCount).map(index => + {times(duplicationsCount).map(index => ( <LineDuplicationBlock duplicated={duplications.includes(index)} index={index} @@ -127,20 +129,22 @@ export default class Line extends React.PureComponent { line={this.props.line} onClick={this.props.onDuplicationClick} /> - )} + ))} {this.props.displayIssues && - !this.props.displayAllIssues && + !this.props.displayAllIssues && ( <LineIssuesIndicator issues={this.props.issues} line={line} onClick={this.handleIssuesIndicatorClick} - />} + /> + )} - {this.props.displayFiltered && + {this.props.displayFiltered && ( <td className="source-meta source-line-filtered-container" data-line-number={line.line}> <div className="source-line-bar" /> - </td>} + </td> + )} <LineCode highlightedLocationMessage={this.props.highlightedLocationMessage} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.js index e2bd3eaeb7e..63782ced438 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.js @@ -142,10 +142,7 @@ export default class LineCode extends React.PureComponent { <span href="#" ref={ref}> {index + 1} </span> - {message != null && - <LocationMessage selected={true}> - {message} - </LocationMessage>} + {message != null && <LocationMessage selected={true}>{message}</LocationMessage>} </LocationIndex> ); } @@ -213,12 +210,10 @@ export default class LineCode extends React.PureComponent { return ( <td className={className} data-line-number={line.line}> <div className="source-line-code-inner"> - <pre ref={node => (this.codeNode = node)}> - {renderedTokens} - </pre> + <pre ref={node => (this.codeNode = node)}>{renderedTokens}</pre> </div> {showIssues && - issues.length > 0 && + issues.length > 0 && ( <LineIssuesList issues={issues} onIssueChange={this.props.onIssueChange} @@ -226,7 +221,8 @@ export default class LineCode extends React.PureComponent { onPopupToggle={this.props.onPopupToggle} openPopup={this.props.openPopup} selectedIssue={selectedIssue} - />} + /> + )} </td> ); } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.js index 70d3bc3d258..a8821c57a24 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.js @@ -54,12 +54,12 @@ export default class LineCoverage extends React.PureComponent { </td> ); - return line.coverageStatus != null - ? <Tooltip - overlay={translate('source_viewer.tooltip', line.coverageStatus)} - placement="right"> - {cell} - </Tooltip> - : cell; + return line.coverageStatus != null ? ( + <Tooltip overlay={translate('source_viewer.tooltip', line.coverageStatus)} placement="right"> + {cell} + </Tooltip> + ) : ( + cell + ); } } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.js index c079ee52490..396d7244dee 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.js @@ -60,10 +60,12 @@ export default class LineDuplicationBlock extends React.PureComponent { </td> ); - return duplicated - ? <Tooltip overlay={translate('source_viewer.tooltip.duplicated_block')} placement="right"> - {cell} - </Tooltip> - : cell; + return duplicated ? ( + <Tooltip overlay={translate('source_viewer.tooltip.duplicated_block')} placement="right"> + {cell} + </Tooltip> + ) : ( + cell + ); } } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.js index 2e394b89b9c..4c5c90a7e0f 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.js @@ -55,10 +55,12 @@ export default class LineDuplications extends React.PureComponent { </td> ); - return line.duplicated - ? <Tooltip overlay={translate('source_viewer.tooltip.duplicated_line')} placement="right"> - {cell} - </Tooltip> - : cell; + return line.duplicated ? ( + <Tooltip overlay={translate('source_viewer.tooltip.duplicated_line')} placement="right"> + {cell} + </Tooltip> + ) : ( + cell + ); } } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.js index 1c3db0733f5..43a7b4561a0 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.js @@ -57,10 +57,7 @@ export default class LineIssuesIndicator extends React.PureComponent { tabIndex={hasIssues ? '0' : undefined} onClick={hasIssues ? this.handleClick : undefined}> {mostImportantIssue != null && <SeverityIcon severity={mostImportantIssue.severity} />} - {issues.length > 1 && - <span className="source-line-issues-counter"> - {issues.length} - </span>} + {issues.length > 1 && <span className="source-line-issues-counter">{issues.length}</span>} </td> ); } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.js index 470cf536cea..e3f12d153be 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.js @@ -41,7 +41,7 @@ export default class LineIssuesList extends React.PureComponent { return ( <div className="issue-list"> - {issues.map(issue => + {issues.map(issue => ( <Issue issue={issue} key={issue.key} @@ -51,7 +51,7 @@ export default class LineIssuesList extends React.PureComponent { openPopup={openPopup && openPopup.issue === issue.key ? openPopup.name : null} selected={selectedIssue === issue.key} /> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineSCM.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineSCM.js index abcaa287007..01ef4805057 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineSCM.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineSCM.js @@ -55,8 +55,9 @@ export default class LineSCM extends React.PureComponent { role={clickable ? 'button' : undefined} tabIndex={clickable ? 0 : undefined} onClick={clickable ? this.handleClick : undefined}> - {this.isSCMChanged(line, previousLine) && - <div className="source-line-scm-inner" data-author={line.scmAuthor} />} + {this.isSCMChanged(line, previousLine) && ( + <div className="source-line-scm-inner" data-author={line.scmAuthor} /> + )} </td> ); } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/views/measures-overlay.js b/server/sonar-web/src/main/js/components/SourceViewer/views/measures-overlay.js index d9d7eb25c31..e9db36ae7b7 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/views/measures-overlay.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/views/measures-overlay.js @@ -74,16 +74,27 @@ export default ModalView.extend({ const radius = options.size / 2; const container = select(this); - const svg = container.append('svg').attr('width', options.size).attr('height', options.size); + const svg = container + .append('svg') + .attr('width', options.size) + .attr('height', options.size); const plot = svg.append('g').attr('transform', trans(radius, radius)); - const arc = d3Arc().innerRadius(radius - options.thickness).outerRadius(radius); - const pie = d3Pie().sort(null).value(d => d); + const arc = d3Arc() + .innerRadius(radius - options.thickness) + .outerRadius(radius); + const pie = d3Pie() + .sort(null) + .value(d => d); const colors = function(i) { return i === 0 ? options.color : options.baseColor; }; const sectors = plot.selectAll('path').data(pie(data)); - sectors.enter().append('path').style('fill', (d, i) => colors(i)).attr('d', arc); + sectors + .enter() + .append('path') + .style('fill', (d, i) => colors(i)) + .attr('d', arc); }); }, @@ -250,7 +261,9 @@ export default ModalView.extend({ const testId = $(e.currentTarget).data('id'); const url = window.baseUrl + '/api/tests/covered_files'; const options = { testId }; - this.testsScroll = $(e.currentTarget).scrollParent().scrollTop(); + this.testsScroll = $(e.currentTarget) + .scrollParent() + .scrollTop(); return $.get(url, options).done(data => { this.coveredFiles = data.files; this.selectedTest = this.tests.find(test => test.id === testId); diff --git a/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.js b/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.js index d359b8c0e54..eb566d16706 100644 --- a/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.js +++ b/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.js @@ -134,10 +134,14 @@ export default class AdvancedTimeline extends React.PureComponent { } getRatingScale = (availableHeight /*: number */) => - scalePoint().domain([5, 4, 3, 2, 1]).range([availableHeight, 0]); + scalePoint() + .domain([5, 4, 3, 2, 1]) + .range([availableHeight, 0]); getLevelScale = (availableHeight /*: number */) => - scalePoint().domain(['ERROR', 'WARN', 'OK']).range([availableHeight, 0]); + scalePoint() + .domain(['ERROR', 'WARN', 'OK']) + .range([availableHeight, 0]); getYScale = (props /*: Props */, availableHeight /*: number */, flatData /*: Array<Point> */) => { if (props.metricType === 'RATING') { @@ -160,7 +164,10 @@ export default class AdvancedTimeline extends React.PureComponent { const dateRange = extent(flatData, d => d.x); const start = startDate && startDate > dateRange[0] ? startDate : dateRange[0]; const end = endDate && endDate < dateRange[1] ? endDate : dateRange[1]; - const xScale = scaleTime().domain(sortBy([start, end])).range([0, availableWidth]).clamp(false); + const xScale = scaleTime() + .domain(sortBy([start, end])) + .range([0, availableWidth]) + .clamp(false); return { xScale, maxXRange: dateRange.map(xScale) @@ -302,9 +309,9 @@ export default class AdvancedTimeline extends React.PureComponent { return ( <g> - {ticks.map(tick => + {ticks.map(tick => ( <g key={tick}> - {formatYTick != null && + {formatYTick != null && ( <text className="line-chart-tick line-chart-tick-x" dx="-1em" @@ -313,7 +320,8 @@ export default class AdvancedTimeline extends React.PureComponent { x={xScale.range()[0]} y={yScale(tick)}> {formatYTick(tick)} - </text>} + </text> + )} <line className="line-chart-grid" x1={xScale.range()[0]} @@ -322,7 +330,7 @@ export default class AdvancedTimeline extends React.PureComponent { y2={yScale(tick)} /> </g> - )} + ))} </g> ); }; @@ -376,13 +384,13 @@ export default class AdvancedTimeline extends React.PureComponent { } return ( <g> - {this.props.series.map((serie, idx) => + {this.props.series.map((serie, idx) => ( <path key={serie.name} className={classNames('line-chart-path', 'line-chart-path-' + idx)} d={lineGenerator(serie.data)} /> - )} + ))} </g> ); }; @@ -398,13 +406,13 @@ export default class AdvancedTimeline extends React.PureComponent { } return ( <g> - {this.props.series.map((serie, idx) => + {this.props.series.map((serie, idx) => ( <path key={serie.name} className={classNames('line-chart-area', 'line-chart-area-' + idx)} d={areaGenerator(serie.data)} /> - )} + ))} </g> ); }; @@ -421,14 +429,14 @@ export default class AdvancedTimeline extends React.PureComponent { const offset = eventSize / 2; return ( <g> - {inRangeEvents.map((event, idx) => + {inRangeEvents.map((event, idx) => ( <path d={this.getEventMarker(eventSize)} className={classNames('line-chart-event', event.className)} key={`${idx}-${event.date.getTime()}`} transform={`translate(${xScale(event.date) - offset}, ${yScale.range()[0] + offset})`} /> - )} + ))} </g> ); }; diff --git a/server/sonar-web/src/main/js/components/charts/BubbleChart.js b/server/sonar-web/src/main/js/components/charts/BubbleChart.js index 3426761dc5f..4b733da414c 100644 --- a/server/sonar-web/src/main/js/components/charts/BubbleChart.js +++ b/server/sonar-web/src/main/js/components/charts/BubbleChart.js @@ -77,20 +77,16 @@ export class Bubble extends React.PureComponent { ); if (this.props.link && !this.props.onClick) { - circle = ( - <Link to={this.props.link}> - {circle} - </Link> - ); + circle = <Link to={this.props.link}>{circle}</Link>; } - return this.props.tooltip - ? <TooltipsContainer> - <g> - {circle} - </g> - </TooltipsContainer> - : circle; + return this.props.tooltip ? ( + <TooltipsContainer> + <g>{circle}</g> + </TooltipsContainer> + ) : ( + circle + ); } } @@ -166,11 +162,7 @@ export default class BubbleChart extends React.PureComponent { return <line key={index} x1={x} x2={x} y1={y1} y2={y2} className="bubble-chart-grid" />; }); - return ( - <g ref="xGrid"> - {lines} - </g> - ); + return <g ref="xGrid">{lines}</g>; } renderYGrid(ticks /*: Array<number> */, xScale /*: Scale */, yScale /*: Scale */) { @@ -185,11 +177,7 @@ export default class BubbleChart extends React.PureComponent { return <line key={index} x1={x1} x2={x2} y1={y} y2={y} className="bubble-chart-grid" />; }); - return ( - <g ref="yGrid"> - {lines} - </g> - ); + return <g ref="yGrid">{lines}</g>; } renderXTicks(xTicks /*: Array<number> */, xScale /*: Scale */, yScale /*: Scale */) { @@ -208,11 +196,7 @@ export default class BubbleChart extends React.PureComponent { ); }); - return ( - <g> - {ticks} - </g> - ); + return <g>{ticks}</g>; } renderYTicks(yTicks /*: Array<number> */, xScale /*: Scale */, yScale /*: Scale */) { @@ -237,11 +221,7 @@ export default class BubbleChart extends React.PureComponent { ); }); - return ( - <g> - {ticks} - </g> - ); + return <g>{ticks}</g>; } renderChart(width /*: number */) { @@ -298,10 +278,6 @@ export default class BubbleChart extends React.PureComponent { } render() { - return ( - <AutoSizer disableHeight={true}> - {size => this.renderChart(size.width)} - </AutoSizer> - ); + return <AutoSizer disableHeight={true}>{size => this.renderChart(size.width)}</AutoSizer>; } } diff --git a/server/sonar-web/src/main/js/components/charts/ColorBoxLegend.js b/server/sonar-web/src/main/js/components/charts/ColorBoxLegend.js index da60f2f7ab1..4c6633c26b1 100644 --- a/server/sonar-web/src/main/js/components/charts/ColorBoxLegend.js +++ b/server/sonar-web/src/main/js/components/charts/ColorBoxLegend.js @@ -36,7 +36,7 @@ export default function ColorBoxLegend( const colorRange = colorScale.range(); return ( <div className={classNames('color-box-legend', className)}> - {colorDomain.map((value, idx) => + {colorDomain.map((value, idx) => ( <div key={value}> <span className="color-box-legend-rect" style={{ borderColor: colorRange[idx] }}> <span @@ -46,14 +46,15 @@ export default function ColorBoxLegend( </span> {formatMeasure(value, metricType)} </div> - )} - {colorNA && + ))} + {colorNA && ( <div> <span className="color-box-legend-rect" style={{ borderColor: colorNA }}> <span className="color-box-legend-rect-inner" style={{ backgroundColor: colorNA }} /> </span> N/A - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/components/charts/ColorGradientLegend.js b/server/sonar-web/src/main/js/components/charts/ColorGradientLegend.js index e67d19644c9..78b09098b1e 100644 --- a/server/sonar-web/src/main/js/components/charts/ColorGradientLegend.js +++ b/server/sonar-web/src/main/js/components/charts/ColorGradientLegend.js @@ -57,14 +57,14 @@ export default function ColorGradientLegend( <svg className={className} width={width} height={height}> <defs> <linearGradient id="gradient-legend"> - {colorRange.map((color, idx) => + {colorRange.map((color, idx) => ( <stop key={idx} offset={idx / lastColorIdx} stopColor={color} /> - )} + ))} </linearGradient> </defs> <g transform={`translate(${padding[3]}, ${padding[0]})`}> <rect fill="url(#gradient-legend)" x={0} y={0} height={rectHeight} width={widthNoPadding} /> - {colorDomain.map((d, idx) => + {colorDomain.map((d, idx) => ( <text className="gradient-legend-text" key={idx} @@ -73,9 +73,9 @@ export default function ColorGradientLegend( dy="-2px"> {d} </text> - )} + ))} </g> - {colorNA && + {colorNA && ( <g transform={`translate(${widthNoPadding}, ${padding[0]})`}> <rect fill={colorNA} @@ -91,7 +91,8 @@ export default function ColorGradientLegend( dy="-2px"> N/A </text> - </g>} + </g> + )} </svg> ); } diff --git a/server/sonar-web/src/main/js/components/charts/ColorRatingsLegend.js b/server/sonar-web/src/main/js/components/charts/ColorRatingsLegend.js index 67017ea7d80..daa623fb780 100644 --- a/server/sonar-web/src/main/js/components/charts/ColorRatingsLegend.js +++ b/server/sonar-web/src/main/js/components/charts/ColorRatingsLegend.js @@ -26,7 +26,7 @@ import { RATING_COLORS } from '../../helpers/constants'; export default function ColorRatingsLegend({ className } /*: { className?: string } */) { return ( <div className={classNames('color-box-legend', className)}> - {[1, 2, 3, 4, 5].map(rating => + {[1, 2, 3, 4, 5].map(rating => ( <div key={rating}> <span className="color-box-legend-rect" @@ -38,7 +38,7 @@ export default function ColorRatingsLegend({ className } /*: { className?: strin </span> {formatMeasure(rating, 'RATING')} </div> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/components/charts/TreeMap.js b/server/sonar-web/src/main/js/components/charts/TreeMap.js index 21ae66da1bb..256a5afb1d2 100644 --- a/server/sonar-web/src/main/js/components/charts/TreeMap.js +++ b/server/sonar-web/src/main/js/components/charts/TreeMap.js @@ -80,7 +80,9 @@ export default class TreeMap extends React.PureComponent { .sum(d => d.size) .sort((a, b) => b.value - a.value); - const treemap = d3Treemap().round(true).size([width, height]); + const treemap = d3Treemap() + .round(true) + .size([width, height]); const nodes = treemap(hierarchy).leaves(); const prefix = this.mostCommitPrefix(items.map(item => item.label)); @@ -88,7 +90,7 @@ export default class TreeMap extends React.PureComponent { return ( <div className="sonar-d3"> <div className="treemap-container" style={{ width, height }}> - {nodes.map(node => + {nodes.map(node => ( <TreeMapRect key={node.data.key} x={node.x0} @@ -105,7 +107,7 @@ export default class TreeMap extends React.PureComponent { onClick={this.props.onRectangleClick} placement={node.x0 === 0 || node.x1 < halfWidth ? 'right' : 'left'} /> - )} + ))} </div> </div> ); diff --git a/server/sonar-web/src/main/js/components/charts/TreeMapRect.js b/server/sonar-web/src/main/js/components/charts/TreeMapRect.js index 357bd6e5c4e..42013d0cf2b 100644 --- a/server/sonar-web/src/main/js/components/charts/TreeMapRect.js +++ b/server/sonar-web/src/main/js/components/charts/TreeMapRect.js @@ -25,7 +25,10 @@ import { scaleLinear } from 'd3-scale'; import LinkIcon from '../icons-components/LinkIcon'; import Tooltip from '../controls/Tooltip'; -const SIZE_SCALE = scaleLinear().domain([3, 15]).range([11, 18]).clamp(true); +const SIZE_SCALE = scaleLinear() + .domain([3, 15]) + .range([11, 18]) + .clamp(true); /*:: type Props = {| x: number, @@ -93,12 +96,14 @@ export default class TreeMapRect extends React.PureComponent { role="treeitem" tabIndex={0}> <div className="treemap-inner" style={{ maxWidth: this.props.width }}> - {isIconVisible && + {isIconVisible && ( <span className={classNames('treemap-icon', { 'spacer-right': isTextVisible })}> {this.props.icon} - </span>} - {isTextVisible && - <span className="treemap-text" dangerouslySetInnerHTML={{ __html: label }} />} + </span> + )} + {isTextVisible && ( + <span className="treemap-text" dangerouslySetInnerHTML={{ __html: label }} /> + )} </div> {this.renderLink()} </div> diff --git a/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.js b/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.js index 22205dfdf73..ec1957e2f5b 100644 --- a/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.js +++ b/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.js @@ -71,10 +71,14 @@ export default class ZoomTimeLine extends React.PureComponent { } getRatingScale = (availableHeight /*: number */) => - scalePoint().domain([5, 4, 3, 2, 1]).range([availableHeight, 0]); + scalePoint() + .domain([5, 4, 3, 2, 1]) + .range([availableHeight, 0]); getLevelScale = (availableHeight /*: number */) => - scalePoint().domain(['ERROR', 'WARN', 'OK']).range([availableHeight, 0]); + scalePoint() + .domain(['ERROR', 'WARN', 'OK']) + .range([availableHeight, 0]); getYScale = (availableHeight /*: number */, flatData /*: Array<Point> */) => { if (this.props.metricType === 'RATING') { @@ -82,12 +86,18 @@ export default class ZoomTimeLine extends React.PureComponent { } else if (this.props.metricType === 'LEVEL') { return this.getLevelScale(availableHeight); } else { - return scaleLinear().range([availableHeight, 0]).domain([0, max(flatData, d => d.y)]).nice(); + return scaleLinear() + .range([availableHeight, 0]) + .domain([0, max(flatData, d => d.y)]) + .nice(); } }; getXScale = (availableWidth /*: number */, flatData /*: Array<Point> */) => - scaleTime().domain(extent(flatData, d => d.x)).range([0, availableWidth]).clamp(true); + scaleTime() + .domain(extent(flatData, d => d.x)) + .range([0, availableWidth]) + .clamp(true); getScales = () => { const availableWidth = this.props.width - this.props.padding[1] - this.props.padding[3]; @@ -241,13 +251,13 @@ export default class ZoomTimeLine extends React.PureComponent { } return ( <g> - {this.props.series.map((serie, idx) => + {this.props.series.map((serie, idx) => ( <path key={serie.name} className={classNames('line-chart-path', 'line-chart-path-' + idx)} d={lineGenerator(serie.data)} /> - )} + ))} </g> ); }; @@ -263,13 +273,13 @@ export default class ZoomTimeLine extends React.PureComponent { } return ( <g> - {this.props.series.map((serie, idx) => + {this.props.series.map((serie, idx) => ( <path key={serie.name} className={classNames('line-chart-area', 'line-chart-area-' + idx)} d={areaGenerator(serie.data)} /> - )} + ))} </g> ); }; @@ -283,7 +293,7 @@ export default class ZoomTimeLine extends React.PureComponent { xDim: Array<number>, direction: string } */ - ) => + ) => ( <Draggable axis="x" bounds={{ left: options.xDim[0], right: options.xDim[1] }} @@ -308,7 +318,8 @@ export default class ZoomTimeLine extends React.PureComponent { height={options.yDim[0] - options.yDim[1] + 1} width={6} /> - </Draggable>; + </Draggable> + ); renderZoom = (xScale /*: Scale */, yScale /*: Scale */) => { const xRange = xScale.range(); @@ -338,7 +349,7 @@ export default class ZoomTimeLine extends React.PureComponent { width={xDim[1] - xDim[0]} /> </DraggableCore> - {showZoomArea && + {showZoomArea && ( <Draggable axis="x" bounds={{ left: xDim[0], right: Math.floor(xDim[1] - zoomBoxWidth) }} @@ -353,7 +364,8 @@ export default class ZoomTimeLine extends React.PureComponent { width={zoomBoxWidth} onDoubleClick={this.handleDoubleClick(xScale, xDim)} /> - </Draggable>} + </Draggable> + )} {showZoomArea && this.renderZoomHandle({ xScale, diff --git a/server/sonar-web/src/main/js/components/charts/bar-chart.js b/server/sonar-web/src/main/js/components/charts/bar-chart.js index 37e847d580d..8e963366f67 100644 --- a/server/sonar-web/src/main/js/components/charts/bar-chart.js +++ b/server/sonar-web/src/main/js/components/charts/bar-chart.js @@ -84,11 +84,7 @@ export const BarChart = createReactClass({ </text> ); }); - return ( - <g> - {ticks} - </g> - ); + return <g>{ticks}</g>; }, renderXValues(xScale, yScale) { @@ -119,11 +115,7 @@ export const BarChart = createReactClass({ </text> ); }); - return ( - <g> - {ticks} - </g> - ); + return <g>{ticks}</g>; }, renderBars(xScale, yScale) { @@ -151,11 +143,7 @@ export const BarChart = createReactClass({ /> ); }); - return ( - <g> - {bars} - </g> - ); + return <g>{bars}</g>; }, render() { @@ -176,7 +164,9 @@ export const BarChart = createReactClass({ .domain(this.props.data.map(d => d.x)) .range([0, availableWidth]) .paddingInner(relativeInnerPadding); - const yScale = scaleLinear().domain([0, maxY]).range([availableHeight, 0]); + const yScale = scaleLinear() + .domain([0, maxY]) + .range([availableHeight, 0]); return ( <TooltipsContainer> diff --git a/server/sonar-web/src/main/js/components/charts/donut-chart.js b/server/sonar-web/src/main/js/components/charts/donut-chart.js index 9acec66a199..6cbf26f5d8b 100644 --- a/server/sonar-web/src/main/js/components/charts/donut-chart.js +++ b/server/sonar-web/src/main/js/components/charts/donut-chart.js @@ -25,7 +25,9 @@ import { ResizeMixin } from './../mixins/resize-mixin'; import { TooltipsMixin } from './../mixins/tooltips-mixin'; function Sector(props) { - const arc = d3Arc().outerRadius(props.radius).innerRadius(props.radius - props.thickness); + const arc = d3Arc() + .outerRadius(props.radius) + .innerRadius(props.radius - props.thickness); return <path d={arc(props.data)} style={{ fill: props.fill }} />; } @@ -57,7 +59,9 @@ export const DonutChart = createReactClass({ const size = Math.min(availableWidth, availableHeight); const radius = Math.floor(size / 2); - const pie = d3Pie().sort(null).value(d => d.value); + const pie = d3Pie() + .sort(null) + .value(d => d.value); const sectors = pie(this.props.data).map((d, i) => { return ( <Sector @@ -73,9 +77,7 @@ export const DonutChart = createReactClass({ return ( <svg className="donut-chart" width={this.state.width} height={this.state.height}> <g transform={`translate(${this.props.padding[3]}, ${this.props.padding[0]})`}> - <g transform={`translate(${radius}, ${radius})`}> - {sectors} - </g> + <g transform={`translate(${radius}, ${radius})`}>{sectors}</g> </g> </svg> ); diff --git a/server/sonar-web/src/main/js/components/charts/histogram.js b/server/sonar-web/src/main/js/components/charts/histogram.js index ddf8726181e..2201cf025c0 100644 --- a/server/sonar-web/src/main/js/components/charts/histogram.js +++ b/server/sonar-web/src/main/js/components/charts/histogram.js @@ -86,11 +86,7 @@ export const Histogram = createReactClass({ </text> ); }); - return ( - <g> - {ticks} - </g> - ); + return <g>{ticks}</g>; }, renderValues(xScale, yScale) { @@ -115,11 +111,7 @@ export const Histogram = createReactClass({ </text> ); }); - return ( - <g> - {ticks} - </g> - ); + return <g>{ticks}</g>; }, renderBars(xScale, yScale) { @@ -140,11 +132,7 @@ export const Histogram = createReactClass({ /> ); }); - return ( - <g> - {bars} - </g> - ); + return <g>{bars}</g>; }, render() { @@ -156,7 +144,9 @@ export const Histogram = createReactClass({ const availableHeight = this.state.height - this.props.padding[0] - this.props.padding[2]; const maxX = max(this.props.data, d => d.x); - const xScale = scaleLinear().domain([0, maxX]).range([0, availableWidth]); + const xScale = scaleLinear() + .domain([0, maxX]) + .range([0, availableWidth]); const yScale = scaleBand() .domain(this.props.data.map(d => d.y)) .rangeRound([0, availableHeight]); diff --git a/server/sonar-web/src/main/js/components/charts/line-chart.js b/server/sonar-web/src/main/js/components/charts/line-chart.js index ea56aa7e6ca..20df2fce140 100644 --- a/server/sonar-web/src/main/js/components/charts/line-chart.js +++ b/server/sonar-web/src/main/js/components/charts/line-chart.js @@ -87,11 +87,7 @@ export const LineChart = createReactClass({ const y = yScale(point.y); return <circle key={index} className="line-chart-point" r="3" cx={x} cy={y} />; }); - return ( - <g> - {points} - </g> - ); + return <g>{points}</g>; }, renderVerticalGrid(xScale, yScale) { @@ -104,11 +100,7 @@ export const LineChart = createReactClass({ const y2 = yScale(point.y); return <line key={index} className="line-chart-grid" x1={x} x2={x} y1={y1} y2={y2} />; }); - return ( - <g> - {lines} - </g> - ); + return <g>{lines}</g>; }, renderXTicks(xScale, yScale) { @@ -125,11 +117,7 @@ export const LineChart = createReactClass({ </text> ); }); - return ( - <g> - {ticks} - </g> - ); + return <g>{ticks}</g>; }, renderXValues(xScale, yScale) { @@ -146,11 +134,7 @@ export const LineChart = createReactClass({ </text> ); }); - return ( - <g> - {ticks} - </g> - ); + return <g>{ticks}</g>; }, renderLine(xScale, yScale) { diff --git a/server/sonar-web/src/main/js/components/charts/word-cloud.js b/server/sonar-web/src/main/js/components/charts/word-cloud.js index c7547ebdf87..8cc711a4eec 100644 --- a/server/sonar-web/src/main/js/components/charts/word-cloud.js +++ b/server/sonar-web/src/main/js/components/charts/word-cloud.js @@ -67,13 +67,13 @@ export const WordCloud = createReactClass({ const len = this.props.items.length; const sortedItems = sortBy(this.props.items, (item, idx) => { const index = len - idx; - return index % 2 * (len - index) + index / 2; + return (index % 2) * (len - index) + index / 2; }); const sizeScale = scaleLinear() .domain([0, max(this.props.items, d => d.size)]) .range(this.props.sizeRange); - const words = sortedItems.map((item, index) => + const words = sortedItems.map((item, index) => ( <Word key={index} text={item.text} @@ -81,11 +81,7 @@ export const WordCloud = createReactClass({ link={item.link} tooltip={item.tooltip} /> - ); - return ( - <div className="word-cloud"> - {words} - </div> - ); + )); + return <div className="word-cloud">{words}</div>; } }); diff --git a/server/sonar-web/src/main/js/components/common/BranchStatus.tsx b/server/sonar-web/src/main/js/components/common/BranchStatus.tsx index ae36462f6f5..ea1604dfa5c 100644 --- a/server/sonar-web/src/main/js/components/common/BranchStatus.tsx +++ b/server/sonar-web/src/main/js/components/common/BranchStatus.tsx @@ -51,25 +51,25 @@ export default function BranchStatus({ branch, concise = false }: Props) { })} /> </li> - {concise && - <li> - {totalIssues} - </li>} - {!concise && + {concise && <li>{totalIssues}</li>} + {!concise && ( <li> {branch.status.bugs} <BugIcon className="little-spacer-left" /> - </li>} - {!concise && + </li> + )} + {!concise && ( <li> {branch.status.vulnerabilities} <VulnerabilityIcon className="little-spacer-left" /> - </li>} - {!concise && + </li> + )} + {!concise && ( <li> {branch.status.codeSmells} <CodeSmellIcon className="little-spacer-left" /> - </li>} + </li> + )} </ul> ); } else { diff --git a/server/sonar-web/src/main/js/components/common/BubblePopupHelper.tsx b/server/sonar-web/src/main/js/components/common/BubblePopupHelper.tsx index f24365adf57..5ea55cabf6b 100644 --- a/server/sonar-web/src/main/js/components/common/BubblePopupHelper.tsx +++ b/server/sonar-web/src/main/js/components/common/BubblePopupHelper.tsx @@ -93,12 +93,13 @@ export default class BubblePopupHelper extends React.PureComponent<Props, State> tabIndex={0} role="tooltip"> {this.props.children} - {this.props.isOpen && + {this.props.isOpen && ( <div ref={popupContainer => (this.popupContainer = popupContainer)}> {React.cloneElement(this.props.popup, { popupPosition: this.state.position })} - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/components/common/DeferredSpinner.js b/server/sonar-web/src/main/js/components/common/DeferredSpinner.js index 4224bdf786a..f638257ad79 100644 --- a/server/sonar-web/src/main/js/components/common/DeferredSpinner.js +++ b/server/sonar-web/src/main/js/components/common/DeferredSpinner.js @@ -80,8 +80,10 @@ export default class DeferredSpinner extends React.PureComponent { }; render() { - return this.state.showSpinner - ? <i className={classNames('spinner', this.props.className)} /> - : this.props.children || null; + return this.state.showSpinner ? ( + <i className={classNames('spinner', this.props.className)} /> + ) : ( + this.props.children || null + ); } } diff --git a/server/sonar-web/src/main/js/components/common/EmptySearch.js b/server/sonar-web/src/main/js/components/common/EmptySearch.js index 8a426f4474c..719a2239c90 100644 --- a/server/sonar-web/src/main/js/components/common/EmptySearch.js +++ b/server/sonar-web/src/main/js/components/common/EmptySearch.js @@ -22,14 +22,11 @@ import React from 'react'; import { translate } from '../../helpers/l10n'; import './EmptySearch.css'; -const EmptySearch = () => +const EmptySearch = () => ( <div className="empty-search"> - <h3> - {translate('no_results_search')} - </h3> - <p className="big-spacer-top"> - {translate('no_results_search.2')} - </p> - </div>; + <h3>{translate('no_results_search')}</h3> + <p className="big-spacer-top">{translate('no_results_search.2')}</p> + </div> +); export default EmptySearch; diff --git a/server/sonar-web/src/main/js/components/common/LocationMessage.css b/server/sonar-web/src/main/js/components/common/LocationMessage.css index 0d9951513c1..c2021568b94 100644 --- a/server/sonar-web/src/main/js/components/common/LocationMessage.css +++ b/server/sonar-web/src/main/js/components/common/LocationMessage.css @@ -34,7 +34,7 @@ border-top: 5px solid #475760; border-left: 5px solid transparent; border-right: 5px solid transparent; - content: ""; + content: ''; } .source-line-code .location-message { diff --git a/server/sonar-web/src/main/js/components/common/MarkdownTips.js b/server/sonar-web/src/main/js/components/common/MarkdownTips.js index b57bce846f0..12479be7596 100644 --- a/server/sonar-web/src/main/js/components/common/MarkdownTips.js +++ b/server/sonar-web/src/main/js/components/common/MarkdownTips.js @@ -35,15 +35,9 @@ export default class MarkdownTips extends React.PureComponent { {translate('markdown.helplink')} </a> {':'} - <span className="spacer-left"> - *{translate('bold')}* - </span> - <span className="spacer-left"> - ``{translate('code')}`` - </span> - <span className="spacer-left"> - * {translate('bulleted_point')} - </span> + <span className="spacer-left">*{translate('bold')}*</span> + <span className="spacer-left">``{translate('code')}``</span> + <span className="spacer-left">* {translate('bulleted_point')}</span> </div> ); } diff --git a/server/sonar-web/src/main/js/components/common/MultiSelect.js b/server/sonar-web/src/main/js/components/common/MultiSelect.js index 2f7ca2aa923..2547da0d2b5 100644 --- a/server/sonar-web/src/main/js/components/common/MultiSelect.js +++ b/server/sonar-web/src/main/js/components/common/MultiSelect.js @@ -246,7 +246,7 @@ export default class MultiSelect extends React.PureComponent { </div> <ul className="menu"> {selectedElements.length > 0 && - selectedElements.map(element => + selectedElements.map(element => ( <MultiSelectOption key={element} element={element} @@ -255,9 +255,9 @@ export default class MultiSelect extends React.PureComponent { onSelectChange={this.handleSelectChange} onHover={this.handleElementHover} /> - )} + ))} {unselectedElements.length > 0 && - unselectedElements.map(element => + unselectedElements.map(element => ( <MultiSelectOption key={element} element={element} @@ -265,8 +265,8 @@ export default class MultiSelect extends React.PureComponent { onSelectChange={this.handleSelectChange} onHover={this.handleElementHover} /> - )} - {this.isNewElement(query, this.props) && + ))} + {this.isNewElement(query, this.props) && ( <MultiSelectOption key={query} element={query} @@ -274,7 +274,8 @@ export default class MultiSelect extends React.PureComponent { active={activeElement === query} onSelectChange={this.handleSelectChange} onHover={this.handleElementHover} - />} + /> + )} </ul> </div> ); diff --git a/server/sonar-web/src/main/js/components/common/SelectList.js b/server/sonar-web/src/main/js/components/common/SelectList.js index 02483a86e55..b235e9abec9 100644 --- a/server/sonar-web/src/main/js/components/common/SelectList.js +++ b/server/sonar-web/src/main/js/components/common/SelectList.js @@ -148,7 +148,7 @@ export default class SelectList extends React.PureComponent { }) )} {!hasChildren && - this.props.items.map(item => + this.props.items.map(item => ( <SelectListItem active={this.state.active} item={item} @@ -156,7 +156,7 @@ export default class SelectList extends React.PureComponent { onHover={this.handleHover} onSelect={this.handleSelect} /> - )} + ))} </ul> ); } diff --git a/server/sonar-web/src/main/js/components/common/UpgradeOrganizationBox.js b/server/sonar-web/src/main/js/components/common/UpgradeOrganizationBox.js index 35e56013aef..23456925d25 100644 --- a/server/sonar-web/src/main/js/components/common/UpgradeOrganizationBox.js +++ b/server/sonar-web/src/main/js/components/common/UpgradeOrganizationBox.js @@ -32,15 +32,11 @@ type Props = { export default function UpgradeOrganizationBox(props /*: Props */) { return ( <div className="boxed-group boxed-group-inner upgrade-organization-box"> - <h3 className="spacer-bottom"> - {translate('billing.upgrade_box.header')} - </h3> + <h3 className="spacer-bottom">{translate('billing.upgrade_box.header')}</h3> - <p> - {translate('billing.upgrade_box.text')} - </p> + <p>{translate('billing.upgrade_box.text')}</p> - {hasMessage('billing.upgrade_box.button') && + {hasMessage('billing.upgrade_box.button') && ( <div className="big-spacer-top"> <Link className="button" @@ -50,7 +46,8 @@ export default function UpgradeOrganizationBox(props /*: Props */) { }}> {translate('billing.upgrade_box.button')} </Link> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx b/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx index 4e3642d03b0..4412feec4d1 100644 --- a/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx +++ b/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx @@ -54,38 +54,32 @@ export default class VisibilitySelector extends React.PureComponent<Props> { 'is-checked': this.props.visibility === 'public' })} /> - <span className="spacer-left"> - {translate('visibility.public')} - </span> + <span className="spacer-left">{translate('visibility.public')}</span> </a> - {this.props.canTurnToPrivate - ? <a - className="link-base-color link-no-underline huge-spacer-left" - id="visibility-private" - href="#" - onClick={this.handlePrivateClick}> - <i - className={classNames('icon-radio', { - 'is-checked': this.props.visibility === 'private' - })} - /> - <span className="spacer-left"> - {translate('visibility.private')} - </span> - </a> - : <span - className="huge-spacer-left text-muted cursor-not-allowed" - id="visibility-private"> - <i - className={classNames('icon-radio', { - 'is-checked': this.props.visibility === 'private' - })} - /> - <span className="spacer-left"> - {translate('visibility.private')} - </span> - </span>} + {this.props.canTurnToPrivate ? ( + <a + className="link-base-color link-no-underline huge-spacer-left" + id="visibility-private" + href="#" + onClick={this.handlePrivateClick}> + <i + className={classNames('icon-radio', { + 'is-checked': this.props.visibility === 'private' + })} + /> + <span className="spacer-left">{translate('visibility.private')}</span> + </a> + ) : ( + <span className="huge-spacer-left text-muted cursor-not-allowed" id="visibility-private"> + <i + className={classNames('icon-radio', { + 'is-checked': this.props.visibility === 'private' + })} + /> + <span className="spacer-left">{translate('visibility.private')}</span> + </span> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.js b/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.js index 817f852d023..58afbecad26 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.js +++ b/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.js @@ -42,11 +42,11 @@ it('should render correctly with children', () => { expect( shallow( <SelectList items={items} currentItem="seconditem" onSelect={onSelect}> - {items.map(item => + {items.map(item => ( <SelectListItem key={item} item={item}> <i className="myicon" />item </SelectListItem> - )} + ))} </SelectList> ) ).toMatchSnapshot(); @@ -57,11 +57,11 @@ it('should correclty handle user actions', () => { const items = ['item', 'seconditem', 'third']; const list = mount( <SelectList items={items} currentItem="seconditem" onSelect={onSelect}> - {items.map(item => + {items.map(item => ( <SelectListItem key={item} item={item}> <i className="myicon" />item </SelectListItem> - )} + ))} </SelectList> ); keydown(40); diff --git a/server/sonar-web/src/main/js/components/common/action-options-view.js b/server/sonar-web/src/main/js/components/common/action-options-view.js index a538e22b88e..a3ac45902ce 100644 --- a/server/sonar-web/src/main/js/components/common/action-options-view.js +++ b/server/sonar-web/src/main/js/components/common/action-options-view.js @@ -55,7 +55,9 @@ export default PopupView.extend({ makeActive(option) { if (option.length > 0) { - this.getOptions().removeClass('active').tooltip('hide'); + this.getOptions() + .removeClass('active') + .tooltip('hide'); option.addClass('active').tooltip('show'); } }, @@ -66,14 +68,22 @@ export default PopupView.extend({ selectNextOption() { this.makeActive( - this.getActiveOption().parent().nextAll('li:not(.divider)').first().children('a') + this.getActiveOption() + .parent() + .nextAll('li:not(.divider)') + .first() + .children('a') ); return false; }, selectPreviousOption() { this.makeActive( - this.getActiveOption().parent().prevAll('li:not(.divider)').first().children('a') + this.getActiveOption() + .parent() + .prevAll('li:not(.divider)') + .first() + .children('a') ); return false; }, diff --git a/server/sonar-web/src/main/js/components/common/modal-form.js b/server/sonar-web/src/main/js/components/common/modal-form.js index 2629ce5b077..0610c634f0a 100644 --- a/server/sonar-web/src/main/js/components/common/modal-form.js +++ b/server/sonar-web/src/main/js/components/common/modal-form.js @@ -38,7 +38,10 @@ export default ModalView.extend({ ModalView.prototype.onRender.apply(this, arguments); const that = this; setTimeout(() => { - that.$(':tabbable').first().focus(); + that + .$(':tabbable') + .first() + .focus(); }, 0); }, diff --git a/server/sonar-web/src/main/js/components/controls/DateInput.tsx b/server/sonar-web/src/main/js/components/controls/DateInput.tsx index 6a226b1b398..807625faa1c 100644 --- a/server/sonar-web/src/main/js/components/controls/DateInput.tsx +++ b/server/sonar-web/src/main/js/components/controls/DateInput.tsx @@ -88,10 +88,11 @@ export default class DateInput extends React.PureComponent<Props> { <path d="M5.5 6h2v2h-2V6zm3 0h2v2h-2V6zm3 0h2v2h-2V6zm-9 6h2v2h-2v-2zm3 0h2v2h-2v-2zm3 0h2v2h-2v-2zm-3-3h2v2h-2V9zm3 0h2v2h-2V9zm3 0h2v2h-2V9zm-9 0h2v2h-2V9zm11-9v1h-2V0h-7v1h-2V0h-2v16h15V0h-2zm1 15h-13V4h13v11z" /> </svg> </span> - {this.props.value != undefined && + {this.props.value != undefined && ( <a className="date-input-control-reset" href="#" onClick={this.handleResetClick}> <CloseIcon className="" /> - </a>} + </a> + )} </span> ); } diff --git a/server/sonar-web/src/main/js/components/controls/GlobalMessages.js b/server/sonar-web/src/main/js/components/controls/GlobalMessages.js index ac3c07535bf..3053996688b 100644 --- a/server/sonar-web/src/main/js/components/controls/GlobalMessages.js +++ b/server/sonar-web/src/main/js/components/controls/GlobalMessages.js @@ -59,10 +59,6 @@ export default class GlobalMessages extends React.PureComponent { return null; } - return ( - <div className="processes-container"> - {messages.map(this.renderMessage)} - </div> - ); + return <div className="processes-container">{messages.map(this.renderMessage)}</div>; } } diff --git a/server/sonar-web/src/main/js/components/controls/RadioToggle.tsx b/server/sonar-web/src/main/js/components/controls/RadioToggle.tsx index fd27b3752dc..bfb7c4cfee1 100644 --- a/server/sonar-web/src/main/js/components/controls/RadioToggle.tsx +++ b/server/sonar-web/src/main/js/components/controls/RadioToggle.tsx @@ -51,18 +51,12 @@ export default class RadioToggle extends React.PureComponent<Props> { onChange={this.handleChange} /> - <label htmlFor={htmlId}> - {option.label} - </label> + <label htmlFor={htmlId}>{option.label}</label> </li> ); }; render() { - return ( - <ul className="radio-toggle"> - {this.props.options.map(this.renderOption)} - </ul> - ); + return <ul className="radio-toggle">{this.props.options.map(this.renderOption)}</ul>; } } diff --git a/server/sonar-web/src/main/js/components/controls/SearchSelect.js b/server/sonar-web/src/main/js/components/controls/SearchSelect.js index f8eaf43665b..84eb5253b9b 100644 --- a/server/sonar-web/src/main/js/components/controls/SearchSelect.js +++ b/server/sonar-web/src/main/js/components/controls/SearchSelect.js @@ -110,9 +110,11 @@ export default class SearchSelect extends React.PureComponent { filterOption={this.handleFilterOption} isLoading={this.state.loading} noResultsText={ - this.state.query.length < this.props.minimumQueryLength - ? translateWithParameters('select2.tooShort', this.props.minimumQueryLength) - : translate('select2.noMatches') + this.state.query.length < this.props.minimumQueryLength ? ( + translateWithParameters('select2.tooShort', this.props.minimumQueryLength) + ) : ( + translate('select2.noMatches') + ) } onBlur={this.props.resetOnBlur ? this.handleBlur : undefined} onChange={this.handleChange} diff --git a/server/sonar-web/src/main/js/components/controls/styles.css b/server/sonar-web/src/main/js/components/controls/styles.css index d54cab0df84..0917ddd28ac 100644 --- a/server/sonar-web/src/main/js/components/controls/styles.css +++ b/server/sonar-web/src/main/js/components/controls/styles.css @@ -62,7 +62,7 @@ border-radius: 22px; box-sizing: border-box; background-color: #f6f6f6; - transition: transform 0.3s cubic-bezier(.87, -.41, .19, 1.44), border 0.3s ease; + transition: transform 0.3s cubic-bezier(0.87, -0.41, 0.19, 1.44), border 0.3s ease; } .boolean-toggle-on { diff --git a/server/sonar-web/src/main/js/components/facet/FacetBox.js b/server/sonar-web/src/main/js/components/facet/FacetBox.js index bc77ac7b6f1..e77f27bb78d 100644 --- a/server/sonar-web/src/main/js/components/facet/FacetBox.js +++ b/server/sonar-web/src/main/js/components/facet/FacetBox.js @@ -27,9 +27,5 @@ type Props = {| */ export default function FacetBox(props /*: Props */) { - return ( - <div className="search-navigator-facet-box"> - {props.children} - </div> - ); + return <div className="search-navigator-facet-box">{props.children}</div>; } diff --git a/server/sonar-web/src/main/js/components/facet/FacetHeader.js b/server/sonar-web/src/main/js/components/facet/FacetHeader.js index b80cec0f7a6..7950444a2e0 100644 --- a/server/sonar-web/src/main/js/components/facet/FacetHeader.js +++ b/server/sonar-web/src/main/js/components/facet/FacetHeader.js @@ -66,15 +66,17 @@ export default class FacetHeader extends React.PureComponent { width="10" height="10" style={{ paddingTop: 3 }}> - {this.props.open - ? <path - style={{ fill: 'currentColor ' }} - d="M1683 808l-742 741q-19 19-45 19t-45-19l-742-741q-19-19-19-45.5t19-45.5l166-165q19-19 45-19t45 19l531 531 531-531q19-19 45-19t45 19l166 165q19 19 19 45.5t-19 45.5z" - /> - : <path - style={{ fill: 'currentColor ' }} - d="M1363 877l-742 742q-19 19-45 19t-45-19l-166-166q-19-19-19-45t19-45l531-531-531-531q-19-19-19-45t19-45l166-166q19-19 45-19t45 19l742 742q19 19 19 45t-19 45z" - />} + {this.props.open ? ( + <path + style={{ fill: 'currentColor ' }} + d="M1683 808l-742 741q-19 19-45 19t-45-19l-742-741q-19-19-19-45.5t19-45.5l166-165q19-19 45-19t45 19l531 531 531-531q19-19 45-19t45 19l166 165q19 19 19 45.5t-19 45.5z" + /> + ) : ( + <path + style={{ fill: 'currentColor ' }} + d="M1363 877l-742 742q-19 19-45 19t-45-19l-166-166q-19-19-19-45t19-45l531-531-531-531q-19-19-19-45t19-45l166-166q19-19 45-19t45 19l742 742q19 19 19 45t-19 45z" + /> + )} </svg> ); } @@ -97,9 +99,7 @@ export default class FacetHeader extends React.PureComponent { return null; } return ( - <span className="spacer-left badge badge-secondary is-rounded"> - {this.props.values} - </span> + <span className="spacer-left badge badge-secondary is-rounded">{this.props.values}</span> ); } @@ -108,26 +108,29 @@ export default class FacetHeader extends React.PureComponent { return ( <div> - {showClearButton && + {showClearButton && ( <button className="search-navigator-facet-header-button button-small button-red" onClick={this.handleClearClick}> {translate('clear')} - </button>} + </button> + )} - {this.props.onClick - ? <span className="search-navigator-facet-header"> - <a href="#" onClick={this.handleClick}> - {this.renderCheckbox()} - {this.props.name} - </a> - {this.renderHelper()} - {this.renderValueIndicator()} - </span> - : <span className="search-navigator-facet-header"> + {this.props.onClick ? ( + <span className="search-navigator-facet-header"> + <a href="#" onClick={this.handleClick}> + {this.renderCheckbox()} {this.props.name} - {this.renderHelper()} - </span>} + </a> + {this.renderHelper()} + {this.renderValueIndicator()} + </span> + ) : ( + <span className="search-navigator-facet-header"> + {this.props.name} + {this.renderHelper()} + </span> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/components/facet/FacetItem.js b/server/sonar-web/src/main/js/components/facet/FacetItem.js index 0c238732209..3237bf66a5d 100644 --- a/server/sonar-web/src/main/js/components/facet/FacetItem.js +++ b/server/sonar-web/src/main/js/components/facet/FacetItem.js @@ -52,24 +52,16 @@ export default class FacetItem extends React.PureComponent { 'search-navigator-facet-half': this.props.halfWidth }); - return this.props.disabled - ? <span className={className}> - <span className="facet-name"> - {this.props.name} - </span> - {this.props.stat != null && - <span className="facet-stat"> - {this.props.stat} - </span>} - </span> - : <a className={className} href="#" onClick={this.handleClick}> - <span className="facet-name"> - {this.props.name} - </span> - {this.props.stat != null && - <span className="facet-stat"> - {this.props.stat} - </span>} - </a>; + return this.props.disabled ? ( + <span className={className}> + <span className="facet-name">{this.props.name}</span> + {this.props.stat != null && <span className="facet-stat">{this.props.stat}</span>} + </span> + ) : ( + <a className={className} href="#" onClick={this.handleClick}> + <span className="facet-name">{this.props.name}</span> + {this.props.stat != null && <span className="facet-stat">{this.props.stat}</span>} + </a> + ); } } diff --git a/server/sonar-web/src/main/js/components/facet/FacetItemsList.js b/server/sonar-web/src/main/js/components/facet/FacetItemsList.js index 8267eaa6582..ca431b594e1 100644 --- a/server/sonar-web/src/main/js/components/facet/FacetItemsList.js +++ b/server/sonar-web/src/main/js/components/facet/FacetItemsList.js @@ -27,9 +27,5 @@ type Props = {| */ export default function FacetItemsList(props /*: Props */) { - return ( - <div className="search-navigator-facet-list"> - {props.children} - </div> - ); + return <div className="search-navigator-facet-list">{props.children}</div>; } diff --git a/server/sonar-web/src/main/js/components/icons-components/BranchIcon.tsx b/server/sonar-web/src/main/js/components/icons-components/BranchIcon.tsx index a1b1a363b3d..62c4bf0d741 100644 --- a/server/sonar-web/src/main/js/components/icons-components/BranchIcon.tsx +++ b/server/sonar-web/src/main/js/components/icons-components/BranchIcon.tsx @@ -32,7 +32,9 @@ interface Props { } export default function BranchIcon({ branch, ...props }: Props) { - return isShortLivingBranch(branch) - ? <ShortLivingBranchIcon {...props} /> - : <LongLivingBranchIcon {...props} />; + return isShortLivingBranch(branch) ? ( + <ShortLivingBranchIcon {...props} /> + ) : ( + <LongLivingBranchIcon {...props} /> + ); } diff --git a/server/sonar-web/src/main/js/components/icons-components/QualifierIcon.js b/server/sonar-web/src/main/js/components/icons-components/QualifierIcon.js index be71c1f128a..d11732bcb90 100644 --- a/server/sonar-web/src/main/js/components/icons-components/QualifierIcon.js +++ b/server/sonar-web/src/main/js/components/icons-components/QualifierIcon.js @@ -23,57 +23,66 @@ import React from 'react'; const DEFAULT_COLOR = '#2D88C0'; const ICONS /*: Object */ = { - dir: (color = '#F90') => + dir: (color = '#F90') => ( <path fill={color} strokeLinejoin="round" d="M14 12.286V5.703c0-.198-.058-.36-.195-.5S13.512 5 13.315 5H6.704c-.196 0-.36-.075-.5-.214-.136-.14-.203-.312-.203-.51v-.57c0-.2-.07-.363-.207-.502C5.655 3.064 5.487 3 5.29 3H2.707c-.196 0-.363.065-.5.204-.137.14-.206.302-.206.5v8.582c0 .2.07.367.206.506.137.14.304.208.5.208h10.61c.196 0 .352-.07.49-.208.137-.14.194-.307.194-.506zm1-6.598v6.65c0 .458-.152.83-.475 1.16-.324.326-.7.502-1.15.502H2.647c-.452 0-.84-.175-1.162-.503-.324-.328-.486-.7-.486-1.158V3.654c0-.457.162-.842.486-1.17C1.81 2.158 2.196 2 2.648 2h2.7c.45 0 .84.157 1.164.485.324.328.488.714.488 1.17V4h6.373c.452 0 .83.174 1.152.5.323.33.475.73.475 1.187z" - />, - trk: (color = DEFAULT_COLOR) => + /> + ), + trk: (color = DEFAULT_COLOR) => ( <path fill={color} strokeLinejoin="round" d="M14.985 13.988L1 14.005 1.02 5h13.966v8.988zM1.998 5.995l.006 7.02L14.022 13 14 6.004l-12.002-.01zM3 4.5V4h9.996l.004.5h1l-.005-1.497-11.98.003L2 4.5zm1-2v-.504h8.002L12 2.5h1l-.004-1.495H3.003L3 2.5z" - />, - brc: (color = DEFAULT_COLOR) => + /> + ), + brc: (color = DEFAULT_COLOR) => ( <g fill={color}> <path d="M16 16H6v-6h10v6zm-9-1h8v-4H7v4zM7 9h8v1H7zM8 8h6v1H8z" /> <path d="M5 12H1V5h12v2h1V4H0v9h5zM3 1h8v.5h1V0H2v1.5h1zM2 3h10v.5h1V2H1v1.5h1z" /> - </g>, - uts: (color = DEFAULT_COLOR) => + </g> + ), + uts: (color = DEFAULT_COLOR) => ( <g fill={color}> <path d="M3 14h10V6H9V2H3zm7.012-9h3.008c-.012-.674-.78-1.258-1.27-1.752-.488-.495-.973-1.243-1.75-1.24v2.96zM14 4.995V15H2V1l7.997.02c1.013-.03 1.57.893 2.239 1.555.667.663 1.75 1.47 1.763 2.42z" /> <path d="M7 8l-3 2.5L7 13zM8 13l3-2.5L8 8z" /> - </g>, - fil: (color = DEFAULT_COLOR) => + </g> + ), + fil: (color = DEFAULT_COLOR) => ( <g fill={color}> <path d="M3 14h10v-8h-4v-4h-6zM10.012 5h3.008c-0.012-0.674-0.78-1.258-1.27-1.752-0.488-0.495-0.973-1.243-1.75-1.24v2.96zM14 4.995v10.005h-12v-14l7.997 0.020c1.013-0.030 1.57 0.893 2.239 1.555 0.667 0.663 1.75 1.47 1.763 2.42z" /> <path d="M4 11h8v1h-8zM4 9h8v1h-8z" /> - </g>, - lib: (color = DEFAULT_COLOR) => + </g> + ), + lib: (color = DEFAULT_COLOR) => ( <path fill={color} strokeLinejoin="round" d="M1 13h4V3H1zm3-1H2v-2h2v2zM2 4h2v4H2zM6 13h4V3H6zm3-1H7v-2h2v2zM7 4h2v4H7zM11 13h4V3h-4zm3-1h-2v-2h2v2zm-2-8h2v4h-2z" - />, - vw: (color = DEFAULT_COLOR) => + /> + ), + vw: (color = DEFAULT_COLOR) => ( <g fill={color} fillRule="evenodd" strokeLinejoin="round"> <path d="M1.016 14.97V1.015H14.97V14.97H1.015zm1-1H13.97V2.015H2.015V13.97z" /> <path d="M3.006 7V3.006H7V7H3.006zm1-1H6V4.006H4.006V6zM9 7V3.015h3.985V7H9zm1-1h1.985V4.015H10V6zM3.004 12.996V9H7v3.996H3.004zm1-1H6V10H4.004v1.996zM9 12.997V9h3.997v3.997H9zm1-1h1.997V10H10v1.997z" /> - </g>, - svw: (color = DEFAULT_COLOR) => + </g> + ), + svw: (color = DEFAULT_COLOR) => ( <g fill={color}> <path d="M13 7.2V1H1v12h7v1H0V0h14v7.2" /> <path d="M2 6V2h4v4H2zm1-1h2V3H3v2zm5 1V2h4v4H8zm1-1h2V3H9v2zm-7 7V8h4v4H2zm1-1h2V9H3v2zM16 16H7V7h9v9zm-8-1h7V8H8v7z" /> <path d="M9 9h2v2H9zM12 9h2v2h-2zM9 12h2v2H9zM12 12h2v2h-2z" /> - </g>, - dev: (color = DEFAULT_COLOR) => + </g> + ), + dev: (color = DEFAULT_COLOR) => ( <path fill={color} strokeLinejoin="round" d="M7.974 8.02c-.938 0-1.82-.36-2.482-1.017-.663-.655-1.028-1.527-1.028-2.455 0-.927.365-1.8 1.028-2.455.663-.656 1.544-1.017 2.482-1.017.937 0 1.82.36 2.482 1.017.662.656 1.027 1.528 1.027 2.455 0 .928-.365 1.8-1.027 2.455C9.793 7.66 8.91 8.02 7.974 8.02zm0-5.778c-1.286 0-2.332 1.034-2.332 2.306s1.046 2.307 2.332 2.307c1.285 0 2.332-1.035 2.332-2.307S9.258 2.242 7.974 2.242zm3.534 6.418c.127.016.243.045.348.086.17.066.302.146.406.246.132.124.253.282.36.47.126.218.226.442.3.668.08.253.15.535.206.838.056.313.095.604.113.867.02.28.03.57.03.862 0 .532-.174.758-.306.882-.142.132-.397.31-.973.31H3.948c-.233 0-.437-.03-.606-.09-.14-.05-.26-.123-.366-.222-.13-.123-.306-.35-.306-.88 0-.294.01-.584.03-.863.018-.263.056-.554.112-.867.055-.303.125-.585.207-.838.073-.226.173-.45.298-.667.108-.19.23-.347.36-.47.106-.1.238-.18.407-.247.105-.04.22-.07.348-.086.202.13.432.277.683.435.342.217.756.4 1.265.564.523.166 1.06.25 1.59.25.534 0 1.07-.084 1.592-.25.51-.164.923-.348 1.266-.565.25-.158.48-.304.682-.435zm-.244-1.18c-.055 0-.184.066-.387.196-.202.13-.43.276-.685.437-.255.16-.586.307-.994.437-.408.13-.818.196-1.23.196-.41 0-.82-.065-1.228-.196-.408-.13-.74-.276-.993-.437-.255-.16-.484-.306-.686-.437-.202-.13-.33-.196-.386-.196-.374 0-.716.06-1.026.183-.31.12-.572.283-.787.487-.213.203-.404.45-.57.737-.165.288-.297.584-.395.888-.098.303-.18.633-.244.988-.063.355-.106.685-.128.992-.02.306-.032.62-.032.942 0 .73.224 1.304.672 1.726.448.42 1.043.632 1.785.632h8.044c.743 0 1.34-.21 1.787-.633.447-.42.67-.996.67-1.725 0-.32-.01-.635-.03-.942-.022-.307-.065-.637-.13-.992-.064-.355-.146-.685-.244-.988-.098-.304-.23-.6-.395-.888-.166-.288-.356-.534-.57-.737-.216-.204-.478-.366-.788-.487-.31-.122-.652-.183-1.026-.183z" - />, - app: (color = '#4A9ED5') => + /> + ), + app: (color = '#4A9ED5') => ( <g fill="none" stroke={color} strokeMiterlimit={10}> <circle cx="3" cy="3" r="1.5" /> <circle cx="8" cy="3" r="1.5" /> @@ -85,6 +94,7 @@ const ICONS /*: Object */ = { <circle cx="8" cy="13" r="1.5" /> <circle cx="13" cy="13" r="1.5" /> </g> + ) }; ICONS.pac = ICONS.dir; diff --git a/server/sonar-web/src/main/js/components/intl/DateTooltipFormatter.tsx b/server/sonar-web/src/main/js/components/intl/DateTooltipFormatter.tsx index 8f9aaa32191..1943512ff8c 100644 --- a/server/sonar-web/src/main/js/components/intl/DateTooltipFormatter.tsx +++ b/server/sonar-web/src/main/js/components/intl/DateTooltipFormatter.tsx @@ -33,7 +33,7 @@ export default function DateTooltipFormatter({ className, date, placement }: Pro const parsedDate = parseDate(date); return ( <DateFormatter date={parsedDate} long={true}> - {formattedDate => + {formattedDate => ( <Tooltip overlay={<DateTimeFormatter date={parsedDate} />} placement={placement} @@ -41,7 +41,8 @@ export default function DateTooltipFormatter({ className, date, placement }: Pro <time className={className} dateTime={parsedDate.toISOString()}> {formattedDate} </time> - </Tooltip>} + </Tooltip> + )} </DateFormatter> ); } diff --git a/server/sonar-web/src/main/js/components/intl/TimeTooltipFormatter.tsx b/server/sonar-web/src/main/js/components/intl/TimeTooltipFormatter.tsx index 857ed31e2f9..082074da474 100644 --- a/server/sonar-web/src/main/js/components/intl/TimeTooltipFormatter.tsx +++ b/server/sonar-web/src/main/js/components/intl/TimeTooltipFormatter.tsx @@ -32,7 +32,7 @@ export default function TimeTooltipFormatter({ className, date, placement }: Pro const parsedDate = parseDate(date); return ( <TimeFormatter date={parsedDate} long={false}> - {formattedTime => + {formattedTime => ( <Tooltip overlay={<TimeFormatter date={parsedDate} long={true} />} placement={placement} @@ -40,7 +40,8 @@ export default function TimeTooltipFormatter({ className, date, placement }: Pro <time className={className} dateTime={parsedDate.toISOString()}> {formattedTime} </time> - </Tooltip>} + </Tooltip> + )} </TimeFormatter> ); } diff --git a/server/sonar-web/src/main/js/components/issue/IssueView.js b/server/sonar-web/src/main/js/components/issue/IssueView.js index 5800390c44c..49de5e25b6c 100644 --- a/server/sonar-web/src/main/js/components/issue/IssueView.js +++ b/server/sonar-web/src/main/js/components/issue/IssueView.js @@ -102,29 +102,31 @@ export default class IssueView extends React.PureComponent { onChange={this.props.onChange} /> {issue.comments && - issue.comments.length > 0 && + issue.comments.length > 0 && ( <div className="issue-comments"> - {issue.comments.map(comment => + {issue.comments.map(comment => ( <IssueCommentLine comment={comment} key={comment.key} onEdit={this.editComment} onDelete={this.deleteComment} /> - )} - </div>} + ))} + </div> + )} <a className="issue-navigate js-issue-navigate"> <i className="issue-navigate-to-left icon-chevron-left" /> <i className="issue-navigate-to-right icon-chevron-right" /> </a> - {hasCheckbox && + {hasCheckbox && ( <a className="js-toggle issue-checkbox-container" href="#" onClick={this.handleCheck}> <i className={classNames('issue-checkbox', 'icon-checkbox', { 'icon-checkbox-checked': this.props.checked })} /> - </a>} + </a> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js index 03837602471..f36ac5d3504 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js @@ -136,13 +136,14 @@ export default class IssueActionsBar extends React.PureComponent { togglePopup={this.props.togglePopup} /> </li> - {issue.effort && + {issue.effort && ( <li className="issue-meta"> <span className="issue-meta-label"> {translateWithParameters('issue.x_effort', issue.effort)} </span> - </li>} - {canComment && + </li> + )} + {canComment && ( <IssueCommentAction commentPlaceholder={this.state.commentPlaceholder} currentPopup={this.props.currentPopup} @@ -150,7 +151,8 @@ export default class IssueActionsBar extends React.PureComponent { onChange={this.props.onChange} onFail={this.props.onFail} toggleComment={this.toggleComment} - />} + /> + )} </ul> </td> <td className="issue-table-meta-cell"> diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueAssign.js b/server/sonar-web/src/main/js/components/issue/components/IssueAssign.js index 249c9ae969d..ba6e67dda76 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueAssign.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueAssign.js @@ -47,7 +47,7 @@ export default class IssueAssign extends React.PureComponent { const { issue } = this.props; return ( <span> - {issue.assignee && + {issue.assignee && ( <span className="text-top"> <Avatar className="little-spacer-right" @@ -55,7 +55,8 @@ export default class IssueAssign extends React.PureComponent { name={issue.assigneeName} size={16} /> - </span>} + </span> + )} <span className="issue-meta-label"> {issue.assignee ? issue.assigneeName : translate('unassigned')} </span> diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueChangelogDiff.js b/server/sonar-web/src/main/js/components/issue/components/IssueChangelogDiff.js index 4c11eb707e6..e0b1a93556b 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueChangelogDiff.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueChangelogDiff.js @@ -69,9 +69,5 @@ export default function IssueChangelogDiff(props /*: { diff: ChangelogDiff } */) } message += ` (${translateWithParameters('issue.changelog.was', oldValue)})`; } - return ( - <p> - {message} - </p> - ); + return <p>{message}</p>; } diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.js b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.js index b756e185da9..c427818c403 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.js @@ -69,9 +69,7 @@ export default class IssueCommentAction extends React.PureComponent { <button className="button-link issue-action js-issue-comment" onClick={this.handleCommentClick}> - <span className="issue-meta-label"> - {translate('issue.comment.formlink')} - </span> + <span className="issue-meta-label">{translate('issue.comment.formlink')}</span> </button> </BubblePopupHelper> </li> diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.js b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.js index aa6eeb9013f..f6c73044282 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.js @@ -101,7 +101,7 @@ export default class IssueCommentLine extends React.PureComponent { <DateFromNow date={comment.createdAt} /> </div> <div className="issue-comment-actions"> - {comment.updatable && + {comment.updatable && ( <BubblePopupHelper className="bubble-popup-helper-inline" isOpen={this.state.openPopup === 'edit'} @@ -121,8 +121,9 @@ export default class IssueCommentLine extends React.PureComponent { className="js-issue-comment-edit button-link icon-edit icon-half-transparent" onClick={this.toggleEditPopup} /> - </BubblePopupHelper>} - {comment.updatable && + </BubblePopupHelper> + )} + {comment.updatable && ( <BubblePopupHelper className="bubble-popup-helper-inline" isOpen={this.state.openPopup === 'delete'} @@ -134,7 +135,8 @@ export default class IssueCommentLine extends React.PureComponent { className="js-issue-comment-delete button-link icon-delete icon-half-transparent" onClick={this.toggleDeletePopup} /> - </BubblePopupHelper>} + </BubblePopupHelper> + )} </div> </div> ); diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js index 82aa5852ef4..97bf195fdac 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js @@ -58,9 +58,7 @@ export default function IssueTitleBar(props /*: Props */) { formatMeasure(locationsCount) )} placement="left"> - <LocationIndex> - {locationsCount} - </LocationIndex> + <LocationIndex>{locationsCount}</LocationIndex> </Tooltip> ); @@ -91,20 +89,24 @@ export default function IssueTitleBar(props /*: Props */) { onFail={props.onFail} /> </li> - {issue.textRange != null && + {issue.textRange != null && ( <li className="issue-meta"> <span className="issue-meta-label" title={translate('line_number')}> L{issue.textRange.endLine} </span> - </li>} - {locationsCount > 0 && + </li> + )} + {locationsCount > 0 && ( <li className="issue-meta"> - {onIssuesPage - ? locationsBadge - : <Link onClick={stopPropagation} target="_blank" to={issueUrl}> - {locationsBadge} - </Link>} - </li>} + {onIssuesPage ? ( + locationsBadge + ) : ( + <Link onClick={stopPropagation} target="_blank" to={issueUrl}> + {locationsBadge} + </Link> + )} + </li> + )} <li className="issue-meta"> <Link className="js-issue-permalink link-no-underline" @@ -114,7 +116,7 @@ export default function IssueTitleBar(props /*: Props */) { <LinkIcon /> </Link> </li> - {hasSimilarIssuesFilter && + {hasSimilarIssuesFilter && ( <li className="issue-meta"> <SimilarIssuesFilter isOpen={props.currentPopup === 'similarIssues'} @@ -123,7 +125,8 @@ export default function IssueTitleBar(props /*: Props */) { onFail={props.onFail} onFilter={props.onFilter} /> - </li>} + </li> + )} </ul> </td> </tr> diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js index 007163c6666..02e2bce9e13 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js @@ -66,5 +66,10 @@ it('should count all code locations', () => { secondaryLocations: [{}, {}] }; const element = shallow(<IssueTitleBar issue={issueWithLocations} />); - expect(element.find('LocationIndex').children().text()).toBe('7'); + expect( + element + .find('LocationIndex') + .children() + .text() + ).toBe('7'); }); diff --git a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.js b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.js index 01549d5dac7..ac9bfa546bb 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.js +++ b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.js @@ -93,13 +93,13 @@ export default class ChangelogPopup extends React.PureComponent { </td> </tr> - {this.state.changelogs.map((item, idx) => + {this.state.changelogs.map((item, idx) => ( <tr key={idx}> <td className="thin text-left text-top nowrap"> <DateTimeFormatter date={item.creationDate} /> </td> <td className="text-left text-top"> - {item.userName && + {item.userName && ( <p> <Avatar className="little-spacer-right" @@ -108,11 +108,12 @@ export default class ChangelogPopup extends React.PureComponent { size={16} /> {item.userName} - </p>} + </p> + )} {item.diffs.map(diff => <IssueChangelogDiff key={diff.key} diff={diff} />)} </td> </tr> - )} + ))} </tbody> </table> </div> diff --git a/server/sonar-web/src/main/js/components/issue/popups/CommentDeletePopup.js b/server/sonar-web/src/main/js/components/issue/popups/CommentDeletePopup.js index 428efc6a6b9..aed14996166 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/CommentDeletePopup.js +++ b/server/sonar-web/src/main/js/components/issue/popups/CommentDeletePopup.js @@ -33,9 +33,7 @@ export default function CommentDeletePopup(props /*: Props */) { return ( <BubblePopup position={props.popupPosition} customClass="bubble-popup-bottom-right"> <div className="text-right"> - <div className="spacer-bottom"> - {translate('issue.comment.delete_confirm_message')} - </div> + <div className="spacer-bottom">{translate('issue.comment.delete_confirm_message')}</div> <button className="button-red" onClick={props.onDelete}> {translate('delete')} </button> diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.js b/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.js index 074f3345ba5..9c6b6187c65 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.js +++ b/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.js @@ -145,23 +145,24 @@ export default class SetAssigneePopup extends React.PureComponent { items={map(this.state.users, 'login')} currentItem={this.state.currentUser} onSelect={this.props.onSelect}> - {this.state.users.map(user => + {this.state.users.map(user => ( <SelectListItem key={user.login} item={user.login}> - {!!user.login && + {!!user.login && ( <Avatar className="spacer-right" email={user.email} hash={user.avatar} name={user.name} size={16} - />} + /> + )} <span className="vertical-middle" style={{ marginLeft: !user.login ? 24 : undefined }}> {user.name} </span> </SelectListItem> - )} + ))} </SelectList> </div> </BubblePopup> diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.js b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.js index 033ea8e72a8..35c98b4a389 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.js +++ b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.js @@ -48,12 +48,12 @@ export default class SetSeverityPopup extends React.PureComponent { items={SEVERITY} currentItem={this.props.issue.severity} onSelect={this.props.onSelect}> - {SEVERITY.map(severity => + {SEVERITY.map(severity => ( <SelectListItem key={severity} item={severity}> <SeverityIcon className="little-spacer-right" severity={severity} /> {translate('severity', severity)} </SelectListItem> - )} + ))} </SelectList> </BubblePopup> ); diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.js b/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.js index e3c4d466f28..9085235dea4 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.js +++ b/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.js @@ -48,12 +48,12 @@ export default class SetTypePopup extends React.PureComponent { items={TYPES} currentItem={this.props.issue.type} onSelect={this.props.onSelect}> - {TYPES.map(type => + {TYPES.map(type => ( <SelectListItem key={type} item={type}> <IssueTypeIcon className="little-spacer-right" query={type} /> {translate('issue.type', type)} </SelectListItem> - )} + ))} </SelectList> </BubblePopup> ); diff --git a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.js b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.js index 4a2642f01ac..ca556766fc9 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.js +++ b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.js @@ -68,9 +68,7 @@ export default class SimilarIssuesPopup extends React.PureComponent { position={this.props.popupPosition} customClass="bubble-popup-menu bubble-popup-bottom-right"> <header className="menu-search"> - <h6> - {translate('issue.filter_similar_issues')} - </h6> + <h6>{translate('issue.filter_similar_issues')}</h6> </header> <SelectList currentItem={items[0]} items={items} onSelect={this.handleSelect}> @@ -88,48 +86,51 @@ export default class SimilarIssuesPopup extends React.PureComponent { </SelectListItem> <SelectListItem item="resolution"> - {issue.resolution != null - ? translate('issue.resolution', issue.resolution) - : translate('unresolved')} + {issue.resolution != null ? ( + translate('issue.resolution', issue.resolution) + ) : ( + translate('unresolved') + )} </SelectListItem> <SelectListItem item="assignee"> - {issue.assignee != null - ? <span> - {translate('assigned_to')} - <Avatar - className="little-spacer-left little-spacer-right" - hash={issue.assigneeAvatar} - name={issue.assigneeName} - size={16} - /> - {issue.assigneeName} - </span> - : translate('unassigned')} + {issue.assignee != null ? ( + <span> + {translate('assigned_to')} + <Avatar + className="little-spacer-left little-spacer-right" + hash={issue.assigneeAvatar} + name={issue.assigneeName} + size={16} + /> + {issue.assigneeName} + </span> + ) : ( + translate('unassigned') + )} </SelectListItem> - <SelectListItem item="rule"> - {limitComponentName(issue.ruleName)} - </SelectListItem> + <SelectListItem item="rule">{limitComponentName(issue.ruleName)}</SelectListItem> {issue.tags != null && - issue.tags.map(tag => + issue.tags.map(tag => ( <SelectListItem key={`tag###${tag}`} item={`tag###${tag}`}> <i className="icon-tags icon-half-transparent little-spacer-right" /> {tag} </SelectListItem> - )} + ))} <SelectListItem item="project"> <QualifierIcon className="little-spacer-right" qualifier="TRK" /> {issue.projectName} </SelectListItem> - {issue.subProject != null && + {issue.subProject != null && ( <SelectListItem item="module"> <QualifierIcon className="little-spacer-right" qualifier="BRC" /> {issue.subProjectName} - </SelectListItem>} + </SelectListItem> + )} <SelectListItem item="file"> <QualifierIcon className="little-spacer-right" qualifier={issue.componentQualifier} /> diff --git a/server/sonar-web/src/main/js/components/measure/Measure.js b/server/sonar-web/src/main/js/components/measure/Measure.js index 513d54e5699..c95d52f8280 100644 --- a/server/sonar-web/src/main/js/components/measure/Measure.js +++ b/server/sonar-web/src/main/js/components/measure/Measure.js @@ -43,11 +43,7 @@ export default function Measure({ className, decimals, measure } /*: Props */) { const formattedValue = isDiffMetric(metric.key) ? formatLeak(measure.leak, metric, { decimals }) : formatMeasure(measure.value, metric.type, { decimals }); - return ( - <span className={className}> - {formattedValue != null ? formattedValue : '–'} - </span> - ); + return <span className={className}>{formattedValue != null ? formattedValue : '–'}</span>; } const value = isDiffMetric(metric.key) ? measure.leak : measure.value; @@ -56,9 +52,7 @@ export default function Measure({ className, decimals, measure } /*: Props */) { if (tooltip) { return ( <Tooltips overlay={tooltip}> - <span className={className}> - {rating} - </span> + <span className={className}>{rating}</span> </Tooltips> ); } diff --git a/server/sonar-web/src/main/js/components/nav/NavBar.css b/server/sonar-web/src/main/js/components/nav/NavBar.css index df1c0738245..e37b1188948 100644 --- a/server/sonar-web/src/main/js/components/nav/NavBar.css +++ b/server/sonar-web/src/main/js/components/nav/NavBar.css @@ -1,6 +1,6 @@ .navbar, -[class^="navbar-"], -[class*=" navbar-"] { +[class^='navbar-'], +[class*=' navbar-'] { box-sizing: border-box; } diff --git a/server/sonar-web/src/main/js/components/nav/NavBar.tsx b/server/sonar-web/src/main/js/components/nav/NavBar.tsx index 08d0e18b511..bc760ba35a0 100644 --- a/server/sonar-web/src/main/js/components/nav/NavBar.tsx +++ b/server/sonar-web/src/main/js/components/nav/NavBar.tsx @@ -31,9 +31,7 @@ export default function NavBar({ children, className, height, ...other }: Props) return ( <nav {...other} className={classNames('navbar', className)} style={{ height }}> <div className="navbar-inner" style={{ height }}> - <div className="navbar-limited clearfix"> - {children} - </div> + <div className="navbar-limited clearfix">{children}</div> </div> </nav> ); diff --git a/server/sonar-web/src/main/js/components/select-list/list.js b/server/sonar-web/src/main/js/components/select-list/list.js index c752367bb8e..0651189fedd 100644 --- a/server/sonar-web/src/main/js/components/select-list/list.js +++ b/server/sonar-web/src/main/js/components/select-list/list.js @@ -35,10 +35,6 @@ export default class List extends React.PureComponent { const key = this.props.getItemKey(item); return <Item key={key} {...this.props} item={item} />; }); - return ( - <ul> - {renderedItems} - </ul> - ); + return <ul>{renderedItems}</ul>; } } diff --git a/server/sonar-web/src/main/js/components/shared/Organization.js b/server/sonar-web/src/main/js/components/shared/Organization.js index 3debbb2a878..1c3d5abf574 100644 --- a/server/sonar-web/src/main/js/components/shared/Organization.js +++ b/server/sonar-web/src/main/js/components/shared/Organization.js @@ -55,11 +55,13 @@ class Organization extends React.PureComponent { return ( <span> - {this.props.link - ? <OrganizationLink className={this.props.linkClassName} organization={organization}> - {organization.name} - </OrganizationLink> - : organization.name} + {this.props.link ? ( + <OrganizationLink className={this.props.linkClassName} organization={organization}> + {organization.name} + </OrganizationLink> + ) : ( + organization.name + )} <span className="slash-separator" /> </span> ); diff --git a/server/sonar-web/src/main/js/components/shared/TypeHelper.js b/server/sonar-web/src/main/js/components/shared/TypeHelper.js index e734f22a8d5..9f423a5f489 100644 --- a/server/sonar-web/src/main/js/components/shared/TypeHelper.js +++ b/server/sonar-web/src/main/js/components/shared/TypeHelper.js @@ -28,10 +28,11 @@ type Props = { }; */ -const TypeHelper = (props /*: Props */) => +const TypeHelper = (props /*: Props */) => ( <span> <IssueTypeIcon className="little-spacer-right" query={props.type} /> {translate('issue.type', props.type)} - </span>; + </span> +); export default TypeHelper; diff --git a/server/sonar-web/src/main/js/components/tags/TagsList.js b/server/sonar-web/src/main/js/components/tags/TagsList.js index 36cd65af6d4..c85ad16c00a 100644 --- a/server/sonar-web/src/main/js/components/tags/TagsList.js +++ b/server/sonar-web/src/main/js/components/tags/TagsList.js @@ -45,9 +45,7 @@ export default class TagsList extends React.PureComponent { return ( <span className={tagListClass} title={tags.join(', ')}> <i className="icon-tags icon-half-transparent" /> - <span className={spanClass}> - {tags.join(', ')} - </span> + <span className={spanClass}>{tags.join(', ')}</span> {allowUpdate && <i className="icon-dropdown" />} </span> ); diff --git a/server/sonar-web/src/main/js/components/ui/DuplicationsRating.css b/server/sonar-web/src/main/js/components/ui/DuplicationsRating.css index 77d99af4129..0cb22a681ce 100644 --- a/server/sonar-web/src/main/js/components/ui/DuplicationsRating.css +++ b/server/sonar-web/src/main/js/components/ui/DuplicationsRating.css @@ -40,7 +40,7 @@ .duplications-rating:after { border-radius: 24px; - content: ""; + content: ''; } .duplications-rating-A { diff --git a/server/sonar-web/src/main/js/components/ui/IssueTypeIcon.tsx b/server/sonar-web/src/main/js/components/ui/IssueTypeIcon.tsx index 63aae3cc815..1d54a61692a 100644 --- a/server/sonar-web/src/main/js/components/ui/IssueTypeIcon.tsx +++ b/server/sonar-web/src/main/js/components/ui/IssueTypeIcon.tsx @@ -52,9 +52,5 @@ export default function IssueTypeIcon(props: Props) { return null; } - return props.className - ? <span className={props.className}> - {icon} - </span> - : icon; + return props.className ? <span className={props.className}>{icon}</span> : icon; } diff --git a/server/sonar-web/src/main/js/components/ui/Level.tsx b/server/sonar-web/src/main/js/components/ui/Level.tsx index b5495695578..e18d1b9f0f5 100644 --- a/server/sonar-web/src/main/js/components/ui/Level.tsx +++ b/server/sonar-web/src/main/js/components/ui/Level.tsx @@ -35,9 +35,5 @@ export default function Level(props: Props) { 'level-small': props.small, 'level-muted': props.muted }); - return ( - <span className={className}> - {formatted} - </span> - ); + return <span className={className}>{formatted}</span>; } diff --git a/server/sonar-web/src/main/js/components/ui/Rating.js b/server/sonar-web/src/main/js/components/ui/Rating.js index 1f30a388d04..0ec18df9e7c 100644 --- a/server/sonar-web/src/main/js/components/ui/Rating.js +++ b/server/sonar-web/src/main/js/components/ui/Rating.js @@ -53,10 +53,6 @@ export default class Rating extends React.PureComponent { }, this.props.className ); - return ( - <span className={className}> - {formatted} - </span> - ); + return <span className={className}>{formatted}</span>; } } diff --git a/server/sonar-web/src/main/js/components/ui/SizeRating.js b/server/sonar-web/src/main/js/components/ui/SizeRating.js index c4fd00c2bb6..3518c901225 100644 --- a/server/sonar-web/src/main/js/components/ui/SizeRating.js +++ b/server/sonar-web/src/main/js/components/ui/SizeRating.js @@ -61,10 +61,6 @@ export default class SizeRating extends React.PureComponent { 'size-rating-muted': this.props.muted }); - return ( - <div className={className}> - {letter} - </div> - ); + return <div className={className}>{letter}</div>; } } diff --git a/server/sonar-web/src/main/js/components/widgets/barchart.js b/server/sonar-web/src/main/js/components/widgets/barchart.js index dadb5788eac..ab376ca1a3d 100644 --- a/server/sonar-web/src/main/js/components/widgets/barchart.js +++ b/server/sonar-web/src/main/js/components/widgets/barchart.js @@ -132,7 +132,9 @@ $.fn.barchart = function(data) { isValueShown = d.count === maxValue; return text; }); - $(this).find('[data-toggle=tooltip]').tooltip({ container: 'body', html: true }); + $(this) + .find('[data-toggle=tooltip]') + .tooltip({ container: 'body', html: true }); } }); }; diff --git a/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js b/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js index 4534781a090..524cb75fc68 100644 --- a/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js +++ b/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js @@ -77,7 +77,9 @@ export default Marionette.ItemView.extend({ this.initialResizeHeight = $('.workspace-viewer-container').height(); const processResizing = this.processResizing.bind(this); const stopResizing = this.stopResizing.bind(this); - $('body').on('mousemove.workspace', processResizing).on('mouseup.workspace', stopResizing); + $('body') + .on('mousemove.workspace', processResizing) + .on('mouseup.workspace', stopResizing); }, processResizing(e) { @@ -88,7 +90,9 @@ export default Marionette.ItemView.extend({ }, stopResizing() { - $('body').off('mousemove.workspace').off('mouseup.workspace'); + $('body') + .off('mousemove.workspace') + .off('mouseup.workspace'); }, toFullScreen() { diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js index 1dcccdb9529..bdd207a6a28 100644 --- a/server/sonar-web/src/main/js/helpers/measures.js +++ b/server/sonar-web/src/main/js/helpers/measures.js @@ -365,7 +365,10 @@ function getMaintainabilityRatingGrid() { } const str = getRatingGrid(); - const numbers = str.split(',').map(s => parseFloat(s)).filter(n => !isNaN(n)); + const numbers = str + .split(',') + .map(s => parseFloat(s)) + .filter(n => !isNaN(n)); if (numbers.length === 4) { maintainabilityRatingGrid = numbers; diff --git a/server/sonar-web/src/main/js/helpers/request.ts b/server/sonar-web/src/main/js/helpers/request.ts index 1acb519e000..1abef7a8399 100644 --- a/server/sonar-web/src/main/js/helpers/request.ts +++ b/server/sonar-web/src/main/js/helpers/request.ts @@ -156,14 +156,23 @@ export function parseJSON(response: Response): Promise<any> { * Shortcut to do a GET request and return response json */ export function getJSON(url: string, data?: RequestData): Promise<any> { - return request(url).setData(data).submit().then(checkStatus).then(parseJSON); + return request(url) + .setData(data) + .submit() + .then(checkStatus) + .then(parseJSON); } /** * Shortcut to do a POST request and return response json */ export function postJSON(url: string, data?: RequestData): Promise<any> { - return request(url).setMethod('POST').setData(data).submit().then(checkStatus).then(parseJSON); + return request(url) + .setMethod('POST') + .setData(data) + .submit() + .then(checkStatus) + .then(parseJSON); } /** @@ -171,9 +180,14 @@ export function postJSON(url: string, data?: RequestData): Promise<any> { */ export function post(url: string, data?: RequestData): Promise<void> { return new Promise((resolve, reject) => { - request(url).setMethod('POST').setData(data).submit().then(checkStatus).then(() => { - resolve(); - }, reject); + request(url) + .setMethod('POST') + .setData(data) + .submit() + .then(checkStatus) + .then(() => { + resolve(); + }, reject); }); } @@ -181,7 +195,11 @@ export function post(url: string, data?: RequestData): Promise<void> { * Shortcut to do a POST request and return response json */ export function requestDelete(url: string, data?: RequestData): Promise<any> { - return request(url).setMethod('DELETE').setData(data).submit().then(checkStatus); + return request(url) + .setMethod('DELETE') + .setData(data) + .submit() + .then(checkStatus); } /** diff --git a/server/sonar-web/src/main/less/components/bubble-popup.less b/server/sonar-web/src/main/less/components/bubble-popup.less index b438adc84e5..25c7072b530 100644 --- a/server/sonar-web/src/main/less/components/bubble-popup.less +++ b/server/sonar-web/src/main/less/components/bubble-popup.less @@ -56,7 +56,7 @@ border-right-color: @barBorderColor; &:after { - content: " "; + content: ' '; left: 1px; bottom: -@popupArrowSize; border-left-width: 0; diff --git a/server/sonar-web/src/main/less/components/columns.less b/server/sonar-web/src/main/less/components/columns.less index 23d8041173e..269c3bc3721 100644 --- a/server/sonar-web/src/main/less/components/columns.less +++ b/server/sonar-web/src/main/less/components/columns.less @@ -69,9 +69,9 @@ } .flex-column-third { - width: ~"calc(100% / 3)"; + width: ~'calc(100% / 3)'; } .flex-column-two-thirds { - width: ~"calc(100% / 3 * 2)"; + width: ~'calc(100% / 3 * 2)'; } diff --git a/server/sonar-web/src/main/less/components/dropdowns.less b/server/sonar-web/src/main/less/components/dropdowns.less index 53371a95b8f..fc72bee00fd 100644 --- a/server/sonar-web/src/main/less/components/dropdowns.less +++ b/server/sonar-web/src/main/less/components/dropdowns.less @@ -69,7 +69,7 @@ } .dropdown-menu-shadow { - box-shadow: 0 6px 12px rgba(0, 0, 0, .175); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); } .dropdown-header { diff --git a/server/sonar-web/src/main/less/components/issues.less b/server/sonar-web/src/main/less/components/issues.less index 9f0274fcfc6..453e9e456bf 100644 --- a/server/sonar-web/src/main/less/components/issues.less +++ b/server/sonar-web/src/main/less/components/issues.less @@ -120,7 +120,7 @@ font-size: @smallFontSize; &:before { - content: " "; + content: ' '; position: absolute; top: 0; bottom: 0; diff --git a/server/sonar-web/src/main/less/components/modals.less b/server/sonar-web/src/main/less/components/modals.less index 0d40cb9c65e..3121933a32a 100644 --- a/server/sonar-web/src/main/less/components/modals.less +++ b/server/sonar-web/src/main/less/components/modals.less @@ -49,7 +49,7 @@ } .modal-large { - width: ~"calc(100% - 40px)"; + width: ~'calc(100% - 40px)'; max-width: 1280px; min-width: 1040px; margin-left: 0; @@ -184,8 +184,8 @@ ul.modal-head-metadata li { margin-bottom: 10px; } - input[type="radio"], - input[type="checkbox"] { + input[type='radio'], + input[type='checkbox'] { margin-top: 5px; margin-bottom: 4px; } @@ -197,9 +197,9 @@ ul.modal-head-metadata li { } .modal-field { - input[type=text], - input[type=email], - input[type=password], + input[type='text'], + input[type='email'], + input[type='password'], textarea, select, .Select { @@ -208,9 +208,9 @@ ul.modal-head-metadata li { } .modal-large-field { - input[type=text], - input[type=email], - input[type=password], + input[type='text'], + input[type='email'], + input[type='password'], textarea, select, .Select { @@ -236,8 +236,8 @@ ul.modal-head-metadata li { button, .button, - input[type=submit], - input[type=button] { + input[type='submit'], + input[type='button'] { margin-right: 10px; } } diff --git a/server/sonar-web/src/main/less/components/page.less b/server/sonar-web/src/main/less/components/page.less index 2b5c58b37b1..3cbcfe577ae 100644 --- a/server/sonar-web/src/main/less/components/page.less +++ b/server/sonar-web/src/main/less/components/page.less @@ -124,7 +124,7 @@ } .page-footer-with-sidebar { - padding-left: ~"calc(50vw - 370px + 10px)" !important; + padding-left: ~'calc(50vw - 370px + 10px)' !important; div { max-width: 980px; @@ -172,7 +172,7 @@ bottom: 0; left: 0; overflow: auto; - width: ~"calc(50vw - 640px + 280px + 3px)"; + width: ~'calc(50vw - 640px + 280px + 3px)'; border-right: 1px solid #e6e6e6; box-sizing: border-box; background: #f3f3f3; @@ -185,7 +185,7 @@ .search-navigator-facets-list { width: 260px; - margin-left: ~"calc(50vw - 640px + 290px - 260px - 37px)"; + margin-left: ~'calc(50vw - 640px + 290px - 260px - 37px)'; @media (max-width: 1335px) { & { @@ -220,7 +220,7 @@ } .layout-page-side-outer { - width: ~"calc(50vw - 370px)"; + width: ~'calc(50vw - 370px)'; flex-grow: 0; flex-shrink: 0; background-color: #f3f3f3; @@ -232,7 +232,7 @@ top: 30px; bottom: 0; left: 0; - width: ~"calc(50vw - 370px)"; + width: ~'calc(50vw - 370px)'; border-right: 1px solid #e6e6e6; overflow-y: auto; overflow-x: hidden; @@ -241,7 +241,7 @@ .layout-page-side-inner { width: 300px; - margin-left: ~"calc(50vw - 670px)"; + margin-left: ~'calc(50vw - 670px)'; background-color: #f3f3f3; } @@ -274,7 +274,7 @@ } .layout-page-main-header-inner { - left: ~"calc(50vw - 370px + 1px)"; + left: ~'calc(50vw - 370px + 1px)'; right: 0; padding-left: 20px; padding-right: 20px; diff --git a/server/sonar-web/src/main/less/components/react-select.less b/server/sonar-web/src/main/less/components/react-select.less index f03a781f4ea..33649781706 100644 --- a/server/sonar-web/src/main/less/components/react-select.less +++ b/server/sonar-web/src/main/less/components/react-select.less @@ -102,7 +102,7 @@ } .Select-value svg, -.Select-value [class^="icon-"] { +.Select-value [class^='icon-'] { padding-top: 5px; } @@ -112,21 +112,23 @@ .Select-option svg, .Select-option img, -.Select-option [class^="icon-"] { +.Select-option [class^='icon-'] { padding-top: 2px; } .has-value:not(.Select--multi) > .Select-control > .Select-value .Select-value-label, .has-value.is-pseudo-focused:not(.Select--multi) > .Select-control - > .Select-value .Select-value-label { + > .Select-value + .Select-value-label { color: @baseFontColor; } .has-value:not(.Select--multi) > .Select-control > .Select-value a.Select-value-label, .has-value.is-pseudo-focused:not(.Select--multi) > .Select-control - > .Select-value a.Select-value-label { + > .Select-value + a.Select-value-label { cursor: pointer; text-decoration: none; } @@ -134,11 +136,13 @@ .has-value:not(.Select--multi) > .Select-control > .Select-value a.Select-value-label:hover, .has-value.is-pseudo-focused:not(.Select--multi) > .Select-control - > .Select-value a.Select-value-label:hover, + > .Select-value + a.Select-value-label:hover, .has-value:not(.Select--multi) > .Select-control > .Select-value a.Select-value-label:focus, .has-value.is-pseudo-focused:not(.Select--multi) > .Select-control - > .Select-value a.Select-value-label:focus { + > .Select-value + a.Select-value-label:focus { color: #007eff; outline: none; text-decoration: underline; diff --git a/server/sonar-web/src/main/less/components/rules.less b/server/sonar-web/src/main/less/components/rules.less index eb2ec7037e9..4df3b6c2f48 100644 --- a/server/sonar-web/src/main/less/components/rules.less +++ b/server/sonar-web/src/main/less/components/rules.less @@ -78,11 +78,11 @@ } .js-tag:after { - content: ","; + content: ','; } .js-tag:last-child:after { - content: ""; + content: ''; } } diff --git a/server/sonar-web/src/main/less/components/search-navigator.less b/server/sonar-web/src/main/less/components/search-navigator.less index 84f686f4ad2..e3a5bbd9d06 100644 --- a/server/sonar-web/src/main/less/components/search-navigator.less +++ b/server/sonar-web/src/main/less/components/search-navigator.less @@ -174,7 +174,7 @@ font-size: @smallFontSize; &:before { - content: " "; + content: ' '; position: absolute; top: 0; bottom: 0; @@ -276,7 +276,7 @@ } .search-navigator-facet-indent { - width: ~"calc(100% - 30px)"; + width: ~'calc(100% - 30px)'; margin-left: 30px; } @@ -407,7 +407,7 @@ float: right; &:before { - content: " "; + content: ' '; position: absolute; top: 0; bottom: 0; @@ -650,7 +650,7 @@ white-space: nowrap; &:before { - content: " "; + content: ' '; position: absolute; top: 0; bottom: 0; diff --git a/server/sonar-web/src/main/less/components/source.less b/server/sonar-web/src/main/less/components/source.less index 470faab9805..c9a952d2a16 100644 --- a/server/sonar-web/src/main/less/components/source.less +++ b/server/sonar-web/src/main/less/components/source.less @@ -142,7 +142,7 @@ outline: none; } -.source-meta[role="button"] { +.source-meta[role='button'] { cursor: pointer; } @@ -236,15 +236,15 @@ background-color: @orange !important; background-image: repeating-linear-gradient( 45deg, - rgba(255, 255, 255, .5) 4px, + rgba(255, 255, 255, 0.5) 4px, transparent 4px, transparent 8px, - rgba(255, 255, 255, .5) 8px, - rgba(255, 255, 255, .5) 12px, + rgba(255, 255, 255, 0.5) 8px, + rgba(255, 255, 255, 0.5) 12px, transparent 12px, transparent 16px, - rgba(255, 255, 255, .5) 16px, - rgba(255, 255, 255, .5) 20px + rgba(255, 255, 255, 0.5) 16px, + rgba(255, 255, 255, 0.5) 20px ) !important; } diff --git a/server/sonar-web/src/main/less/components/workspace.less b/server/sonar-web/src/main/less/components/workspace.less index 33e1c807400..f947fafc8a8 100644 --- a/server/sonar-web/src/main/less/components/workspace.less +++ b/server/sonar-web/src/main/less/components/workspace.less @@ -61,7 +61,7 @@ right: 0; box-sizing: border-box; background-color: #fff; - box-shadow: 0 -6px 12px rgba(0, 0, 0, .175); + box-shadow: 0 -6px 12px rgba(0, 0, 0, 0.175); } .workspace-viewer-header { @@ -107,9 +107,9 @@ } .workspace-viewer-container { - height: ~"calc(40vh - 30px)"; + height: ~'calc(40vh - 30px)'; min-height: 100px; - max-height: ~"calc(95vh - 30px)"; + max-height: ~'calc(95vh - 30px)'; padding: 5px 10px; overflow-y: scroll; overflow-x: auto; diff --git a/server/sonar-web/src/main/less/init/forms.less b/server/sonar-web/src/main/less/init/forms.less index a5ed2ce62d1..99faeac27f1 100644 --- a/server/sonar-web/src/main/less/init/forms.less +++ b/server/sonar-web/src/main/less/init/forms.less @@ -25,12 +25,12 @@ * Inputs */ -input[type=text], -input[type=password], -input[type=email], -input[type=search], -input[type=date], -input[type=number], +input[type='text'], +input[type='password'], +input[type='email'], +input[type='search'], +input[type='date'], +input[type='number'], textarea, select { border: 1px solid @darkGrey; @@ -57,21 +57,21 @@ select { } } -input[type=text], -input[type=password], -input[type=email], -input[type=search], -input[type=date], -input[type=number] { +input[type='text'], +input[type='password'], +input[type='email'], +input[type='search'], +input[type='date'], +input[type='number'] { height: @formControlHeight; padding: 0 6px; } -input[type="search"] { +input[type='search'] { -webkit-appearance: textfield; } -input[type="search"]::-webkit-search-decoration { +input[type='search']::-webkit-search-decoration { -webkit-appearance: none; } @@ -90,8 +90,8 @@ select { button, .button, -input[type=submit], -input[type=button] { +input[type='submit'], +input[type='button'] { display: inline-block; vertical-align: baseline; height: @formControlHeight; @@ -139,7 +139,7 @@ input[type=button] { } .button-red, -input[type="submit"].button-red { +input[type='submit'].button-red { border-color: @red; color: @red; @@ -152,7 +152,7 @@ input[type="submit"].button-red { } .button-success, -input[type="submit"].button-success { +input[type='submit'].button-success { border-color: @green; color: @green; @@ -165,7 +165,7 @@ input[type="submit"].button-success { } .button-grey, -input[type="submit"].button-grey { +input[type='submit'].button-grey { border-color: @middleGrey; color: @secondFontColor; @@ -255,7 +255,7 @@ input[type="submit"].button-grey { } .button-promote, -input[type="submit"].button-promote { +input[type='submit'].button-promote { border-color: #5041d2; background-color: #5041d2; color: #fff; @@ -401,17 +401,17 @@ label[for] { color: @darkBlue; } - input[type="radio"] { + input[type='radio'] { display: none; } - input[type="radio"]:checked + label { + input[type='radio']:checked + label { background-color: @darkBlue; color: #fff; font-weight: 600; } - input[type="radio"]:disabled + label { + input[type='radio']:disabled + label { color: #bbb; border-color: #ddd; background: #ebebeb; diff --git a/server/sonar-web/src/main/less/init/icons.less b/server/sonar-web/src/main/less/init/icons.less index 58171db82c6..2c7b0e75f88 100644 --- a/server/sonar-web/src/main/less/init/icons.less +++ b/server/sonar-web/src/main/less/init/icons.less @@ -32,8 +32,8 @@ font-style: normal; } -[class^="icon-"], -[class*=" icon-"] { +[class^='icon-'], +[class*=' icon-'] { font-family: 'sonar'; speak: none; font-style: normal; @@ -48,8 +48,8 @@ -moz-osx-font-smoothing: grayscale; } -a[class^="icon-"], -a[class*=" icon-"] { +a[class^='icon-'], +a[class*=' icon-'] { .link-no-underline; } @@ -84,8 +84,8 @@ a[class*=" icon-"] { * Severity */ -[class^="icon-severity-"], -[class*=" icon-severity"] { +[class^='icon-severity-'], +[class*=' icon-severity'] { display: inline-block; vertical-align: top; width: 16px; @@ -118,8 +118,8 @@ a[class*=" icon-"] { * Status */ -[class^="icon-status-"], -[class*=" icon-status"] { +[class^='icon-status-'], +[class*=' icon-status'] { display: inline-block; vertical-align: top; width: 16px; @@ -148,22 +148,22 @@ a[class*=" icon-"] { */ .icon-test-status-ok:before { - content: "\f013"; + content: '\f013'; color: @green; font-size: @iconFontSize; } .icon-test-status-failure:before { - content: "\f000"; + content: '\f000'; color: @orange; font-size: @iconFontSize; } .icon-test-status-error:before { - content: "\f057"; + content: '\f057'; color: @red; font-size: @iconFontSize; } .icon-test-status-skipped:before { - content: "\f056"; + content: '\f056'; color: @middleGrey; font-size: @iconFontSize; } @@ -176,7 +176,7 @@ a[class*=" icon-"] { font-size: @iconFontSize; } .icon-alert-ok:before { - content: "\f013"; + content: '\f013'; color: @green; font-size: @iconFontSize; } @@ -184,7 +184,7 @@ a[class*=" icon-"] { font-size: @iconFontSize; } .icon-alert-warn:before { - content: "\f000"; + content: '\f000'; color: @orange; font-size: @iconFontSize; } @@ -192,7 +192,7 @@ a[class*=" icon-"] { font-size: @iconFontSize; } .icon-alert-error:before { - content: "\f057"; + content: '\f057'; color: @red; font-size: @iconFontSize; } @@ -200,7 +200,7 @@ a[class*=" icon-"] { font-size: @iconFontSize; } .icon-alert-none:before { - content: "\f056"; + content: '\f056'; color: @middleGrey; font-size: @iconFontSize; } @@ -209,8 +209,8 @@ a[class*=" icon-"] { * Qualifier */ -[class^="icon-qualifier-"], -[class*=" icon-qualifier-"] { +[class^='icon-qualifier-'], +[class*=' icon-qualifier-'] { display: inline-block; vertical-align: top; width: 16px; @@ -263,7 +263,7 @@ a[class*=" icon-"] { box-sizing: border-box; &:before { - content: " "; + content: ' '; display: inline-block; width: 10px; height: 10px; @@ -317,7 +317,7 @@ a[class*=" icon-"] { height: 8px; border-radius: 8px; background-color: @darkBlue; - content: ""; + content: ''; opacity: 0; transition: opacity 0.3s ease; } @@ -336,87 +336,87 @@ a:hover > .icon-radio { */ .icon-list:before { - content: "\f039"; + content: '\f039'; font-size: @iconSmallFontSize; } .icon-bullet-list:before { - content: "\f03a"; + content: '\f03a'; font-size: @iconSmallFontSize; } .icon-settings:before { - content: "\f015"; + content: '\f015'; } .icon-bulk-change:before { - content: "\f085"; + content: '\f085'; font-size: @iconSmallFontSize; } .icon-arrow-down:before { - content: "\f0d7"; + content: '\f0d7'; position: relative; top: -2px; } .icon-arrow-up:before { - content: "\f0d8"; + content: '\f0d8'; position: relative; top: -2px; } .icon-arrow-left:before { - content: "\f0d9"; + content: '\f0d9'; } .icon-arrow-right:before { - content: "\f0da"; + content: '\f0da'; } .icon-dropdown:before { - content: "\f0d7"; + content: '\f0d7'; position: relative; top: -1px; } .icon-sort-desc:before { - content: "\f0d7"; + content: '\f0d7'; position: relative; top: -1px; } .icon-sort-asc:before { - content: "\f0d8"; + content: '\f0d8'; position: relative; top: -1px; } .icon-emoticon-smiley:before { - content: "\f118"; + content: '\f118'; } .icon-emoticon-sad:before { - content: "\f119"; + content: '\f119'; } .icon-emoticon-speechless:before { - content: "\f11a"; + content: '\f11a'; } .icon-rect-check:before { - content: "\f046"; + content: '\f046'; } .icon-check:before { - content: "\f00c"; + content: '\f00c'; color: @green; font-size: @iconFontSize; } .icon-default:before { position: relative; top: -0.1em; - content: "\f00c"; + content: '\f00c'; } .icon-lang:before { - content: "\f024"; + content: '\f024'; font-size: @iconSmallFontSize; } .icon-quality-profile:before { - content: "\f022"; + content: '\f022'; font-size: @iconSmallFontSize; } .icon-tags:before { - content: "\f02c"; + content: '\f02c'; font-size: @iconSmallFontSize; } .icon-calendar:before { - content: "\f073"; + content: '\f073'; font-size: @iconFontSize; } @@ -469,76 +469,76 @@ a:hover > .icon-radio { } .icon-help:before { - content: "\f059"; + content: '\f059'; color: @blue; font-size: @iconFontSize; } .icon-info:before { - content: "\f05a"; + content: '\f05a'; color: @blue; font-size: @iconFontSize; } .icon-uniF060:before { - content: "\f060"; + content: '\f060'; } .icon-uniF061:before { - content: "\f061"; + content: '\f061'; } .icon-uniF062:before { - content: "\f062"; + content: '\f062'; } .icon-uniF063:before { - content: "\f063"; + content: '\f063'; } .icon-comment:before { - content: "\f075"; + content: '\f075'; font-size: @iconSmallFontSize; } .icon-delete:before { - content: "\f00d"; + content: '\f00d'; color: @red; font-size: @iconFontSize; } .icon-close:before { - content: "\f00d"; + content: '\f00d'; font-size: @iconFontSize; } .icon-compare:before { - content: "\f0c5"; + content: '\f0c5'; font-size: @iconSmallFontSize; } .icon-restore:before { - content: "\f122"; + content: '\f122'; font-size: @iconSmallFontSize; } .icon-inheritance:before { - content: "\f126"; + content: '\f126'; font-size: @iconSmallFontSize; } .icon-inheritance-overridden:before { color: @red !important; } .icon-plus:before { - content: "\f067"; + content: '\f067'; font-size: @iconSmallFontSize; } .icon-move-down:before { - content: "\f063"; + content: '\f063'; color: @darkBlue; font-size: @iconFontSize; } .icon-move-up:before { - content: "\f062"; + content: '\f062'; color: @darkBlue; font-size: @iconFontSize; } .icon-move-left:before { - content: "\f060"; + content: '\f060'; color: @darkBlue; font-size: @iconFontSize; } .icon-move-right:before { - content: "\f061"; + content: '\f061'; color: @darkBlue; font-size: @iconFontSize; } @@ -554,90 +554,90 @@ a:hover > .icon-radio { text-align: center; } .icon-scm:before { - content: "\f017"; + content: '\f017'; font-size: @iconSmallFontSize; } .icon-scm_dev:before { - content: "\f015"; + content: '\f015'; font-size: @iconSmallFontSize; } .icon-ci:before { - content: "\f021"; + content: '\f021'; font-size: @iconSmallFontSize; } .icon-issue:before { - content: "\f188"; + content: '\f188'; font-size: @iconSmallFontSize; } .icon-homepage:before { - content: "\f016"; + content: '\f016'; font-size: @iconSmallFontSize; } .icon-resizer:before { - content: "\f142"; + content: '\f142'; color: @darkGrey; font-size: @iconFontSize; } .icon-expand:before { - content: "\e60b"; + content: '\e60b'; font-size: @iconFontSize; } .icon-period:before { - content: "\f018"; + content: '\f018'; font-size: @iconFontSize; } .icon-filter:before { - content: "\f03a"; + content: '\f03a'; font-size: @iconFontSize; } .icon-detach:before { - content: "\f08e"; + content: '\f08e'; font-size: @iconSmallFontSize; } .icon-chevron-left:before { - content: "\f104"; + content: '\f104'; font-size: @iconSmallFontSize; } .icon-chevron-right:before { - content: "\f105"; + content: '\f105'; font-size: @iconSmallFontSize; } .icon-double-chevron-left:before { - content: "\f100"; + content: '\f100'; font-size: @iconSmallFontSize; } .icon-double-chevron-right:before { - content: "\f101"; + content: '\f101'; font-size: @iconSmallFontSize; } .icon-extension:before { - content: "\f069"; + content: '\f069'; font-size: @iconFontSize; } .icon-home:before { - content: "\f016"; + content: '\f016'; font-size: @iconFontSize; } .icon-component-viewer-filter:before { - content: "\e60e"; + content: '\e60e'; color: #999; font-size: @iconSmallFontSize; } .icon-filters:before { - content: "\f039"; + content: '\f039'; font-size: @iconSmallFontSize; } .icon-next:before { - content: "\f0d7"; + content: '\f0d7'; font-size: @iconFontSize; } .icon-prev:before { - content: "\f0d8"; + content: '\f0d8'; font-size: @iconFontSize; } .icon-search:before { - content: "\f002"; + content: '\f002'; font-size: @iconFontSize; } .icon-search-new { @@ -650,33 +650,33 @@ a:hover > .icon-radio { background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%2214%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20stroke-linejoin%3D%22round%22%20stroke-miterlimit%3D%221.414%22%3E%3Cpath%20d%3D%22M9%206.5c0-.964-.342-1.788-1.027-2.473C7.288%203.342%206.463%203%205.5%203c-.964%200-1.788.342-2.473%201.027C2.342%204.712%202%205.537%202%206.5c0%20.964.342%201.788%201.027%202.473C3.712%209.658%204.537%2010%205.5%2010c.964%200%201.788-.342%202.473-1.027C8.658%208.288%209%207.463%209%206.5zm4%206.5c0%20.27-.1.505-.297.703-.198.198-.432.297-.703.297-.28%200-.516-.1-.703-.297l-2.68-2.672c-.932.647-1.97.97-3.117.97-.745%200-1.457-.145-2.137-.434-.68-.29-1.265-.68-1.758-1.171-.492-.493-.882-1.08-1.17-1.758C.144%207.957%200%207.245%200%206.5c0-.745.145-1.457.434-2.137.29-.68.68-1.265%201.17-1.758.494-.492%201.08-.882%201.76-1.17C4.043%201.144%204.753%201%205.5%201c.745%200%201.457.145%202.137.434.68.29%201.265.68%201.758%201.17.492.494.882%201.08%201.17%201.76.29.68.435%201.39.435%202.136%200%201.146-.323%202.185-.97%203.117l2.68%202.68c.194.193.29.427.29.703z%22%20fill%3D%22%23777%22%20fill-rule%3D%22nonzero%22%2F%3E%3C%2Fsvg%3E'); } .icon-edit:before { - content: "\f040"; + content: '\f040'; font-size: @iconSmallFontSize; } .icon-ellipsis-h:before { position: relative; top: 1px; - content: "\f141"; + content: '\f141'; font-size: @iconSmallFontSize; } .icon-bigger-size:before { - content: "\f065"; + content: '\f065'; font-size: @iconSmallFontSize; } .icon-smaller-size:before { - content: "\f066"; + content: '\f066'; font-size: @iconSmallFontSize; } .icon-minimize:before { - content: "\f068"; + content: '\f068'; font-size: @iconSmallFontSize; } .icon-filter:before { - content: "\f0b0"; + content: '\f0b0'; font-size: @iconFontSize; } .icon-lock:before { - content: "\f023"; + content: '\f023'; font-size: @iconFontSize; } .icon-issues { diff --git a/server/sonar-web/src/main/less/init/links.less b/server/sonar-web/src/main/less/init/links.less index e84469eba16..d2eb30dfcb5 100644 --- a/server/sonar-web/src/main/less/init/links.less +++ b/server/sonar-web/src/main/less/init/links.less @@ -98,8 +98,7 @@ a.active-link, // Color .link-red, -/* deprecated */ -a.text-danger { +/* deprecated */ a.text-danger { .link-variant(@red, darken(@red, 10%), lighten(@red, 40%)); } a.text-muted { diff --git a/server/sonar-web/src/main/less/init/misc.less b/server/sonar-web/src/main/less/init/misc.less index e174fe08e23..ddca44d3771 100644 --- a/server/sonar-web/src/main/less/init/misc.less +++ b/server/sonar-web/src/main/less/init/misc.less @@ -214,7 +214,7 @@ td.big-spacer-top { &:after { display: inline-block; width: 100%; - content: " "; + content: ' '; } } @@ -252,7 +252,7 @@ td.big-spacer-top { margin-right: 5px; &:after { - content: "/"; + content: '/'; color: rgba(68, 68, 68, 0.3); } } diff --git a/server/sonar-web/src/main/less/init/tables.less b/server/sonar-web/src/main/less/init/tables.less index 60aad77fe5a..39208052fb5 100644 --- a/server/sonar-web/src/main/less/init/tables.less +++ b/server/sonar-web/src/main/less/init/tables.less @@ -76,7 +76,7 @@ table.spaced { table.data > thead:after { display: block; line-height: 5px; - content: "\200C"; + content: '\200C'; } table.data > thead > tr > th { diff --git a/server/sonar-web/src/main/less/init/type.less b/server/sonar-web/src/main/less/init/type.less index dc8dbabffd7..8aaa5c2fa77 100644 --- a/server/sonar-web/src/main/less/init/type.less +++ b/server/sonar-web/src/main/less/init/type.less @@ -38,9 +38,9 @@ body { .header(@h) { line-height: @formControlHeight; - color: ~"@{@{h}-font-color}"; - font-size: ~"@{@{h}-font-size}"; - font-weight: ~"@{@{h}-font-weight}"; + color: ~'@{@{h}-font-color}'; + font-size: ~'@{@{h}-font-size}'; + font-weight: ~'@{@{h}-font-weight}'; img, svg { diff --git a/server/sonar-web/src/main/less/pages/login.less b/server/sonar-web/src/main/less/pages/login.less index 6b1224bf4ad..9d7e4a6f0b3 100644 --- a/server/sonar-web/src/main/less/pages/login.less +++ b/server/sonar-web/src/main/less/pages/login.less @@ -48,7 +48,7 @@ box-sizing: border-box; &:before { - content: " "; + content: ' '; display: block; width: 10px; height: 10px; |