diff options
Diffstat (limited to 'server/sonar-web/src/main/js')
226 files changed, 1707 insertions, 1037 deletions
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 b1b2ac07fad..f790ab376fe 100644 --- a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx @@ -144,14 +144,14 @@ export class ComponentContainer extends React.PureComponent<Props, State> { return ( <div> {component && - !['FIL', 'UTS'].includes(component.qualifier) && ( - <ComponentNav - branches={branches} - currentBranch={branch} - component={component} - location={this.props.location} - /> - )} + !['FIL', 'UTS'].includes(component.qualifier) && ( + <ComponentNav + branches={branches} + currentBranch={branch} + component={component} + location={this.props.location} + /> + )} {loading ? ( <div className="page page-limited"> <i className="spinner" /> diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.js b/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx index 8d68f322369..e9b31253cdd 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.js +++ b/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx @@ -17,12 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -// @flow import { connect } from 'react-redux'; import { getAppState, getGlobalSettingValue } from '../../store/rootReducer'; import GlobalFooter from './GlobalFooter'; -const mapStateToProps = state => ({ +const mapStateToProps = (state: any) => ({ sonarqubeVersion: getAppState(state).version, productionDatabase: getAppState(state).productionDatabase, onSonarCloud: getGlobalSettingValue(state, 'sonar.sonarcloud.enabled') diff --git a/server/sonar-web/src/main/js/app/components/extensions/Extension.js b/server/sonar-web/src/main/js/app/components/extensions/Extension.js index d7657b83365..f1bfbf9756a 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/Extension.js +++ b/server/sonar-web/src/main/js/app/components/extensions/Extension.js @@ -93,8 +93,10 @@ class Extension extends React.PureComponent { } stopExtension() { - this.stop && this.stop(); - this.stop = null; + if (this.stop) { + this.stop(); + this.stop = null; + } } render() { @@ -107,10 +109,4 @@ class Extension extends React.PureComponent { } } -const mapStateToProps = state => ({ - currentUser: getCurrentUser(state) -}); - -const mapDispatchToProps = { onFail: addGlobalErrorMessage }; - -export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(withRouter(Extension))); +export default injectIntl(withRouter(Extension)); diff --git a/server/sonar-web/src/main/js/app/components/extensions/ExtensionContainer.tsx b/server/sonar-web/src/main/js/app/components/extensions/ExtensionContainer.tsx new file mode 100644 index 00000000000..6e72ebb376d --- /dev/null +++ b/server/sonar-web/src/main/js/app/components/extensions/ExtensionContainer.tsx @@ -0,0 +1,31 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { connect } from 'react-redux'; +import { getCurrentUser } from '../../../store/rootReducer'; +import { addGlobalErrorMessage } from '../../../store/globalMessages/duck'; +import Extension from './Extension'; + +const mapStateToProps = (state: any) => ({ + currentUser: getCurrentUser(state) +}); + +const mapDispatchToProps = { onFail: addGlobalErrorMessage }; + +export default connect<any, any, any>(mapStateToProps, mapDispatchToProps)(Extension); diff --git a/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.js b/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.js index eff718d6168..ea9b2191b02 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.js +++ b/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.js @@ -20,7 +20,7 @@ // @flow import React from 'react'; import { connect } from 'react-redux'; -import Extension from './Extension'; +import ExtensionContainer from './ExtensionContainer'; import ExtensionNotFound from './ExtensionNotFound'; import { getAppState } from '../../../store/rootReducer'; @@ -37,7 +37,7 @@ type Props = { function GlobalAdminPageExtension(props /*: Props */) { const { extensionKey, pluginKey } = props.params; const extension = props.adminPages.find(p => p.key === `${pluginKey}/${extensionKey}`); - return extension ? <Extension extension={extension} /> : <ExtensionNotFound />; + return extension ? <ExtensionContainer extension={extension} /> : <ExtensionNotFound />; } const mapStateToProps = state => ({ diff --git a/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.js b/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.js index 5d82eae4917..acc4d25948c 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.js +++ b/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.js @@ -20,7 +20,7 @@ // @flow import React from 'react'; import { connect } from 'react-redux'; -import Extension from './Extension'; +import ExtensionContainer from './ExtensionContainer'; import ExtensionNotFound from './ExtensionNotFound'; import { getAppState } from '../../../store/rootReducer'; @@ -37,7 +37,7 @@ type Props = { function GlobalPageExtension(props /*: Props */) { const { extensionKey, pluginKey } = props.params; const extension = props.globalPages.find(p => p.key === `${pluginKey}/${extensionKey}`); - return extension ? <Extension extension={extension} /> : <ExtensionNotFound />; + return extension ? <ExtensionContainer extension={extension} /> : <ExtensionNotFound />; } const mapStateToProps = state => ({ 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 e5d38f46800..9236726d428 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 @@ -20,7 +20,7 @@ // @flow import React from 'react'; import { connect } from 'react-redux'; -import Extension from './Extension'; +import ExtensionContainer from './ExtensionContainer'; import ExtensionNotFound from './ExtensionNotFound'; import { getOrganizationByKey } from '../../../store/rootReducer'; import { fetchOrganization } from '../../../apps/organizations/actions'; @@ -55,7 +55,7 @@ class OrganizationPageExtension extends React.PureComponent { const extension = pages.find(p => p.key === `${pluginKey}/${extensionKey}`); return extension ? ( - <Extension + <ExtensionContainer extension={extension} location={this.props.location} options={{ organization, refreshOrganization: this.refreshOrganization }} 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 3881206d667..e2ce3c79d06 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 @@ -20,7 +20,7 @@ // @flow import React from 'react'; import { connect } from 'react-redux'; -import Extension from './Extension'; +import ExtensionContainer from './ExtensionContainer'; import ExtensionNotFound from './ExtensionNotFound'; import { addGlobalErrorMessage } from '../../../store/globalMessages/duck'; @@ -46,7 +46,7 @@ function ProjectAdminPageExtension(props /*: Props */) { component.configuration && component.configuration.extensions.find(p => p.key === `${pluginKey}/${extensionKey}`); return extension ? ( - <Extension extension={extension} options={{ component }} /> + <ExtensionContainer extension={extension} options={{ component }} /> ) : ( <ExtensionNotFound /> ); 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 dc23ec8df22..4c76b21a7e7 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Extension from './Extension'; +import ExtensionContainer from './ExtensionContainer'; import ExtensionNotFound from './ExtensionNotFound'; import { Component } from '../../types'; @@ -38,7 +38,7 @@ export default function ProjectPageExtension(props: Props) { component.extensions && component.extensions.find(p => p.key === `${pluginKey}/${extensionKey}`); return extension ? ( - <Extension extension={extension} options={{ component }} /> + <ExtensionContainer 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 9df12c7801c..43f4616f8b8 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 @@ -90,7 +90,8 @@ export default class GlobalHelp extends React.PureComponent { <ul className="side-tabs-menu"> {(this.props.currentUser.isLoggedIn ? ['shortcuts', 'tutorials', 'links'] - : ['shortcuts', 'links']).map(this.renderMenuItem)} + : ['shortcuts', 'links'] + ).map(this.renderMenuItem)} </ul> ); diff --git a/server/sonar-web/src/main/js/app/components/help/__tests__/__snapshots__/GlobalHelp-test.js.snap b/server/sonar-web/src/main/js/app/components/help/__tests__/__snapshots__/GlobalHelp-test.js.snap index e9a2ed0ec03..5aaa41aa5f8 100644 --- a/server/sonar-web/src/main/js/app/components/help/__tests__/__snapshots__/GlobalHelp-test.js.snap +++ b/server/sonar-web/src/main/js/app/components/help/__tests__/__snapshots__/GlobalHelp-test.js.snap @@ -12,7 +12,9 @@ exports[`does not show tutorials for anonymous 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <div className="modal-head" @@ -30,7 +32,9 @@ exports[`does not show tutorials for anonymous 1`] = ` <ul className="side-tabs-menu" > - <li> + <li + key="shortcuts" + > <a className="active" data-section="shortcuts" @@ -40,7 +44,9 @@ exports[`does not show tutorials for anonymous 1`] = ` help.section.shortcuts </a> </li> - <li> + <li + key="links" + > <a className="" data-section="links" 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 8bbd0a0c5ce..8129eeb98fd 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,11 +53,11 @@ class ComponentNavBreadcrumbs extends React.PureComponent { return ( <span key={item.key}> {!displayOrganization && - index === 0 && ( - <span className="navbar-context-title-qualifier little-spacer-right"> - <QualifierIcon qualifier={lastItem.qualifier} /> - </span> - )} + index === 0 && ( + <span className="navbar-context-title-qualifier little-spacer-right"> + <QualifierIcon qualifier={lastItem.qualifier} /> + </span> + )} <Link title={item.name} to={{ pathname: '/dashboard', query: { id: item.key } }} 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 ef2234c896d..4f64dbba6ff 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 @@ -116,11 +116,9 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { } }} activeClassName="active"> - {this.isPortfolio() || this.isApplication() ? ( - translate('view_projects.page') - ) : ( - translate('code.page') - )} + {this.isPortfolio() || this.isApplication() + ? translate('view_projects.page') + : translate('code.page')} </Link> </li> ); diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap index d7e28b0846b..7a01722ba4c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap @@ -39,14 +39,17 @@ exports[`renders list 1`] = ` "key": "component", } } + key="master" onSelect={[Function]} selected={true} /> <li className="divider" + key="divider-baz" /> <li className="dropdown-header" + key="orphans" > branches.orphan_branches <Tooltip @@ -78,6 +81,7 @@ exports[`renders list 1`] = ` "key": "component", } } + key="baz" onSelect={[Function]} selected={false} /> @@ -101,11 +105,13 @@ exports[`renders list 1`] = ` "key": "component", } } + key="foo" onSelect={[Function]} selected={false} /> <li className="divider" + key="divider-bar" /> <ComponentNavBranchesMenuItem branch={ @@ -120,14 +126,17 @@ exports[`renders list 1`] = ` "key": "component", } } + key="bar" onSelect={[Function]} selected={false} /> <li className="divider" + key="divider-baz" /> <li className="dropdown-header" + key="orphans" > branches.orphan_branches <Tooltip @@ -159,6 +168,7 @@ exports[`renders list 1`] = ` "key": "component", } } + key="baz" onSelect={[Function]} selected={false} /> @@ -213,11 +223,13 @@ exports[`searches 1`] = ` "key": "component", } } + key="foobar" onSelect={[Function]} selected={true} /> <li className="divider" + key="divider-bar" /> <ComponentNavBranchesMenuItem branch={ @@ -232,6 +244,7 @@ exports[`searches 1`] = ` "key": "component", } } + key="bar" onSelect={[Function]} selected={false} /> diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenuItem-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenuItem-test.tsx.snap index 1f6d81e9883..ceba812e99c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenuItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenuItem-test.tsx.snap @@ -2,6 +2,7 @@ exports[`renders main branch 1`] = ` <li + key="master" onMouseEnter={[Function]} > <Tooltip @@ -61,6 +62,7 @@ exports[`renders main branch 1`] = ` exports[`renders short-living branch 1`] = ` <li + key="foo" onMouseEnter={[Function]} > <Tooltip @@ -131,6 +133,7 @@ exports[`renders short-living branch 1`] = ` exports[`renders short-living orhpan branch 1`] = ` <li + key="foo" onMouseEnter={[Function]} > <Tooltip diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBreadcrumbs-test.js.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBreadcrumbs-test.js.snap index 1588ae83e8a..259c976fd11 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBreadcrumbs-test.js.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBreadcrumbs-test.js.snap @@ -8,7 +8,9 @@ exports[`should not render breadcrumbs with one element 1`] = ` organization={null} title="My Project" /> - <span> + <span + key="my-project" + > <span className="navbar-context-title-qualifier little-spacer-right" > @@ -74,7 +76,9 @@ exports[`should render organization 1`] = ` className="slash-separator" /> </span> - <span> + <span + key="my-project" + > <Link className="link-base-color link-no-underline" onlyActiveOnIndex={false} diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap index 80521551658..56558732e74 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap @@ -111,7 +111,9 @@ exports[`should work for all qualifiers 1`] = ` <ul className="dropdown-menu" > - <li> + <li + key="settings" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -129,7 +131,9 @@ exports[`should work for all qualifiers 1`] = ` project_settings.page </Link> </li> - <li> + <li + key="branches" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -146,7 +150,9 @@ exports[`should work for all qualifiers 1`] = ` project_branches.page </Link> </li> - <li> + <li + key="project_delete" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -279,7 +285,9 @@ exports[`should work for all qualifiers 2`] = ` <ul className="dropdown-menu" > - <li> + <li + key="settings" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -413,7 +421,9 @@ exports[`should work for all qualifiers 3`] = ` <ul className="dropdown-menu" > - <li> + <li + key="project_delete" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -642,7 +652,9 @@ exports[`should work for all qualifiers 5`] = ` <ul className="dropdown-menu" > - <li> + <li + key="project_delete" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1009,7 +1021,9 @@ exports[`should work with extensions 1`] = ` <ul className="dropdown-menu" > - <li> + <li + key="settings" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1027,7 +1041,9 @@ exports[`should work with extensions 1`] = ` project_settings.page </Link> </li> - <li> + <li + key="branches" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1044,7 +1060,9 @@ exports[`should work with extensions 1`] = ` project_branches.page </Link> </li> - <li> + <li + key="foo" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1061,7 +1079,9 @@ exports[`should work with extensions 1`] = ` Foo </Link> </li> - <li> + <li + key="project_delete" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1098,7 +1118,9 @@ exports[`should work with extensions 1`] = ` <ul className="dropdown-menu" > - <li> + <li + key="component-foo" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1231,7 +1253,9 @@ exports[`should work with multiple extensions 1`] = ` <ul className="dropdown-menu" > - <li> + <li + key="settings" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1249,7 +1273,9 @@ exports[`should work with multiple extensions 1`] = ` project_settings.page </Link> </li> - <li> + <li + key="branches" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1266,7 +1292,9 @@ exports[`should work with multiple extensions 1`] = ` project_branches.page </Link> </li> - <li> + <li + key="foo" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1283,7 +1311,9 @@ exports[`should work with multiple extensions 1`] = ` Foo </Link> </li> - <li> + <li + key="bar" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1300,7 +1330,9 @@ exports[`should work with multiple extensions 1`] = ` Bar </Link> </li> - <li> + <li + key="project_delete" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1337,7 +1369,9 @@ exports[`should work with multiple extensions 1`] = ` <ul className="dropdown-menu" > - <li> + <li + key="component-foo" + > <Link activeClassName="active" onlyActiveOnIndex={false} @@ -1354,7 +1388,9 @@ exports[`should work with multiple extensions 1`] = ` ComponentFoo </Link> </li> - <li> + <li + key="component-bar" + > <Link activeClassName="active" onlyActiveOnIndex={false} diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMeta-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMeta-test.tsx.snap index a1dd339dfce..dea4abcd294 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMeta-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMeta-test.tsx.snap @@ -7,12 +7,16 @@ exports[`renders meta for long-living branch 1`] = ` <ul className="list-inline" > - <li> + <li + key="analysisDate" + > <DateTimeFormatter date="2017-01-02T00:00:00.000Z" /> </li> - <li> + <li + key="version" + > <Tooltip mouseEnterDelay={0.5} overlay="version 0.0.1" @@ -38,7 +42,9 @@ exports[`renders status of short-living branch 1`] = ` <ul className="list-inline" > - <li> + <li + key="analysisDate" + > <DateTimeFormatter date="2017-01-02T00:00:00.000Z" /> diff --git a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavMenu-test.js.snap b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavMenu-test.js.snap index c72f7259205..673cc003e3c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavMenu-test.js.snap +++ b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavMenu-test.js.snap @@ -159,7 +159,9 @@ exports[`should work with extensions 1`] = ` <ul className="dropdown-menu" > - <li> + <li + key="foo" + > <Link onlyActiveOnIndex={false} style={Object {}} diff --git a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavUser-test.js.snap b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavUser-test.js.snap index 034d6700b8a..e77bc5d2d8d 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavUser-test.js.snap +++ b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavUser-test.js.snap @@ -197,7 +197,9 @@ exports[`should render the users organizations 1`] = ` my_organizations </Link> </li> - <li> + <li + key="bar" + > <OrganizationLink onClick={[Function]} organization={ @@ -215,7 +217,9 @@ exports[`should render the users organizations 1`] = ` </span> </OrganizationLink> </li> - <li> + <li + key="foo" + > <OrganizationLink onClick={[Function]} organization={ @@ -233,7 +237,9 @@ exports[`should render the users organizations 1`] = ` </span> </OrganizationLink> </li> - <li> + <li + key="myorg" + > <OrganizationLink onClick={[Function]} organization={ diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx index 527b8479ada..b0340d6730a 100644 --- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx @@ -51,14 +51,12 @@ export default class SettingsEditionsNotif extends React.PureComponent<Props, St return ( <NavBarNotif className="alert alert-success"> <span> - {edition ? ( - translateWithParameters( - 'marketplace.status_x.' + editionStatus.installationStatus, - edition.name - ) - ) : ( - translate('marketplace.status', editionStatus.installationStatus) - )} + {edition + ? translateWithParameters( + 'marketplace.status_x.' + editionStatus.installationStatus, + edition.name + ) + : translate('marketplace.status', editionStatus.installationStatus)} </span> {!preventRestart && ( <button className="js-restart spacer-left" onClick={this.handleOpenRestart}> diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap index bded1f0a092..e33f8690286 100644 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap @@ -55,7 +55,9 @@ exports[`should work with extensions 1`] = ` custom_metrics.page </IndexLink> </li> - <li> + <li + key="foo" + > <Link activeClassName="active" onlyActiveOnIndex={false} 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 7f0e355d0ce..5ea8a0f915d 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 @@ -355,37 +355,37 @@ export default class Search extends React.PureComponent { )} {this.state.open && - Object.keys(this.state.results).length > 0 && ( - <div - className="dropdown-menu dropdown-menu-right global-navbar-search-dropdown" - ref={node => (this.node = node)}> - <SearchResults - allowMore={this.state.query.length !== 1} - loadingMore={this.state.loadingMore} - more={this.state.more} - onMoreClick={this.searchMore} - onSelect={this.handleSelect} - renderNoResults={this.renderNoResults} - renderResult={this.renderResult} - results={this.state.results} - selected={this.state.selected} - /> - <div className="dropdown-bottom-hint"> - <div className="pull-right"> - <ClockIcon className="little-spacer-right" size={12} /> - {translate('recently_browsed')} - </div> - <div - dangerouslySetInnerHTML={{ - __html: translateWithParameters( - 'search.shortcut_hint', - '<span class="shortcut-button shortcut-button-small">s</span>' - ) - }} + Object.keys(this.state.results).length > 0 && ( + <div + className="dropdown-menu dropdown-menu-right global-navbar-search-dropdown" + ref={node => (this.node = node)}> + <SearchResults + allowMore={this.state.query.length !== 1} + loadingMore={this.state.loadingMore} + more={this.state.more} + onMoreClick={this.searchMore} + onSelect={this.handleSelect} + renderNoResults={this.renderNoResults} + renderResult={this.renderResult} + results={this.state.results} + selected={this.state.selected} /> + <div className="dropdown-bottom-hint"> + <div className="pull-right"> + <ClockIcon className="little-spacer-right" size={12} /> + {translate('recently_browsed')} + </div> + <div + dangerouslySetInnerHTML={{ + __html: translateWithParameters( + 'search.shortcut_hint', + '<span class="shortcut-button shortcut-button-small">s</span>' + ) + }} + /> + </div> </div> - </div> - )} + )} </li> ); } diff --git a/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResult-test.js.snap b/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResult-test.js.snap index a99f95bc210..57349cfbdf5 100644 --- a/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResult-test.js.snap +++ b/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResult-test.js.snap @@ -1,7 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders favorite 1`] = ` -<li> +<li + key="foo" +> <Tooltip mouseEnterDelay={1} overlay="foo" @@ -48,7 +50,9 @@ exports[`renders favorite 1`] = ` `; exports[`renders match 1`] = ` -<li> +<li + key="foo" +> <Tooltip mouseEnterDelay={1} overlay="foo" @@ -94,7 +98,9 @@ exports[`renders match 1`] = ` `; exports[`renders organizations 1`] = ` -<li> +<li + key="foo" +> <Tooltip mouseEnterDelay={1} overlay="foo" @@ -145,7 +151,9 @@ exports[`renders organizations 1`] = ` `; exports[`renders organizations 2`] = ` -<li> +<li + key="foo" +> <Tooltip mouseEnterDelay={1} overlay="foo" @@ -191,7 +199,9 @@ exports[`renders organizations 2`] = ` `; exports[`renders projects 1`] = ` -<li> +<li + key="qwe" +> <Tooltip mouseEnterDelay={1} overlay="qwe" @@ -242,7 +252,9 @@ exports[`renders projects 1`] = ` `; exports[`renders recently browsed 1`] = ` -<li> +<li + key="foo" +> <Tooltip mouseEnterDelay={1} overlay="foo" @@ -288,7 +300,9 @@ exports[`renders recently browsed 1`] = ` `; exports[`renders selected 1`] = ` -<li> +<li + key="foo" +> <Tooltip mouseEnterDelay={1} overlay="foo" @@ -333,6 +347,7 @@ exports[`renders selected 1`] = ` exports[`renders selected 2`] = ` <li className="active" + key="foo" > <Tooltip mouseEnterDelay={1} diff --git a/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResults-test.js.snap b/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResults-test.js.snap index b93d9ef64b5..aa88bea94d8 100644 --- a/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResults-test.js.snap +++ b/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResults-test.js.snap @@ -6,17 +6,23 @@ exports[`renders "Show More" link 1`] = ` > <li className="dropdown-header" + key="header-TRK" > qualifiers.TRK </li> - <span> + <span + key="foo" + > foo </span> - <span> + <span + key="bar" + > bar </span> <SearchShowMore allowMore={true} + key="more-TRK" loadingMore={null} onMoreClick={[Function]} onSelect={[Function]} @@ -25,16 +31,22 @@ exports[`renders "Show More" link 1`] = ` /> <li className="divider" + key="divider-BRC" /> <li className="dropdown-header" + key="header-BRC" > qualifiers.BRC </li> - <span> + <span + key="qwe" + > qwe </span> - <span> + <span + key="qux" + > qux </span> </ul> @@ -46,38 +58,53 @@ exports[`renders different components and dividers between them 1`] = ` > <li className="dropdown-header" + key="header-TRK" > qualifiers.TRK </li> - <span> + <span + key="foo" + > foo </span> - <span> + <span + key="bar" + > bar </span> <li className="divider" + key="divider-BRC" /> <li className="dropdown-header" + key="header-BRC" > qualifiers.BRC </li> - <span> + <span + key="qwe" + > qwe </span> - <span> + <span + key="qux" + > qux </span> <li className="divider" + key="divider-FIL" /> <li className="dropdown-header" + key="header-FIL" > qualifiers.FIL </li> - <span> + <span + key="zux" + > zux </span> </ul> diff --git a/server/sonar-web/src/main/js/app/styles/components/search-navigator.css b/server/sonar-web/src/main/js/app/styles/components/search-navigator.css index b89d2bab0ce..8f9294c9b77 100644 --- a/server/sonar-web/src/main/js/app/styles/components/search-navigator.css +++ b/server/sonar-web/src/main/js/app/styles/components/search-navigator.css @@ -188,7 +188,11 @@ a.search-navigator-facet:focus .facet-stat { bottom: 0; right: 100%; width: 10px; - background-image: linear-gradient(to right, rgba(243, 243, 243, 0), var(--barBackgroundColor) 75%); + background-image: linear-gradient( + to right, + rgba(243, 243, 243, 0), + var(--barBackgroundColor) 75% + ); } .search-navigator-facet .facet-toggle { @@ -766,7 +770,11 @@ a.search-navigator-facet:focus .facet-stat { bottom: 0; right: 100%; width: 10px; - background-image: linear-gradient(to right, rgba(243, 243, 243, 0), var(--barBackgroundColor) 75%); + background-image: linear-gradient( + to right, + rgba(243, 243, 243, 0), + var(--barBackgroundColor) 75% + ); } .search-navigator-header-pagination { 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 cc3556ca910..267d0fc7cf1 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 @@ -156,12 +156,12 @@ class AboutApp extends React.PureComponent { </div> {customText != null && - customText.value && ( - <div - className="about-page-section" - dangerouslySetInnerHTML={{ __html: customText.value }} - /> - )} + customText.value && ( + <div + className="about-page-section" + dangerouslySetInnerHTML={{ __html: customText.value }} + /> + )} <AboutLanguages /> diff --git a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/GlobalNotifications-test.js.snap b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/GlobalNotifications-test.js.snap index 2135246ecb6..4a7d7d10c5a 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/GlobalNotifications-test.js.snap +++ b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/GlobalNotifications-test.js.snap @@ -15,6 +15,7 @@ exports[`should match snapshot 1`] = ` <th /> <th className="text-center" + key="channel1" > <h4> notification.channel.channel1 @@ -22,6 +23,7 @@ exports[`should match snapshot 1`] = ` </th> <th className="text-center" + key="channel2" > <h4> notification.channel.channel2 diff --git a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/Notifications-test.js.snap b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/Notifications-test.js.snap index 978e4038e91..8541cc01be7 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/Notifications-test.js.snap +++ b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/Notifications-test.js.snap @@ -5,6 +5,7 @@ exports[`should match snapshot 1`] = ` className="account-body account-container" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="my_account.notifications" /> diff --git a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/NotificationsList-test.js.snap b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/NotificationsList-test.js.snap index 3ca417ef0a0..13a18bff3c7 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/NotificationsList-test.js.snap +++ b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/NotificationsList-test.js.snap @@ -2,12 +2,15 @@ exports[`renders project-specific labels 1`] = ` <tbody> - <tr> + <tr + key="type1" + > <td> notification.dispatcher.type1.project </td> <td className="text-center" + key="channel1" > <Checkbox checked={true} @@ -18,6 +21,7 @@ exports[`renders project-specific labels 1`] = ` </td> <td className="text-center" + key="channel2" > <Checkbox checked={false} @@ -27,12 +31,15 @@ exports[`renders project-specific labels 1`] = ` /> </td> </tr> - <tr> + <tr + key="type2" + > <td> notification.dispatcher.type2.project </td> <td className="text-center" + key="channel1" > <Checkbox checked={true} @@ -43,6 +50,7 @@ exports[`renders project-specific labels 1`] = ` </td> <td className="text-center" + key="channel2" > <Checkbox checked={true} @@ -57,12 +65,15 @@ exports[`renders project-specific labels 1`] = ` exports[`should match snapshot 1`] = ` <tbody> - <tr> + <tr + key="type1" + > <td> notification.dispatcher.type1 </td> <td className="text-center" + key="channel1" > <Checkbox checked={true} @@ -73,6 +84,7 @@ exports[`should match snapshot 1`] = ` </td> <td className="text-center" + key="channel2" > <Checkbox checked={false} @@ -82,12 +94,15 @@ exports[`should match snapshot 1`] = ` /> </td> </tr> - <tr> + <tr + key="type2" + > <td> notification.dispatcher.type2 </td> <td className="text-center" + key="channel1" > <Checkbox checked={true} @@ -98,6 +113,7 @@ exports[`should match snapshot 1`] = ` </td> <td className="text-center" + key="channel2" > <Checkbox checked={true} diff --git a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/ProjectNotifications-test.js.snap b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/ProjectNotifications-test.js.snap index 3a5f1bb6f42..2fb0f7c15d1 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/ProjectNotifications-test.js.snap +++ b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/ProjectNotifications-test.js.snap @@ -3,6 +3,7 @@ exports[`should match snapshot 1`] = ` <table className="form big-spacer-bottom" + key="foo" > <thead> <tr> @@ -34,6 +35,7 @@ exports[`should match snapshot 1`] = ` </th> <th className="text-center" + key="channel1" > <h4> notification.channel.channel1 @@ -41,6 +43,7 @@ exports[`should match snapshot 1`] = ` </th> <th className="text-center" + key="channel2" > <h4> notification.channel.channel2 diff --git a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/Projects-test.js.snap b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/Projects-test.js.snap index 0a6bbf5f267..ed54ae19c4d 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/Projects-test.js.snap +++ b/server/sonar-web/src/main/js/apps/account/notifications/__tests__/__snapshots__/Projects-test.js.snap @@ -8,6 +8,7 @@ exports[`should render projects 1`] = ` my_profile.per_project_notifications.title </h2> <Connect(ProjectNotifications) + key="foo" project={ Object { "key": "foo", @@ -16,6 +17,7 @@ exports[`should render projects 1`] = ` } /> <Connect(ProjectNotifications) + key="bar" project={ Object { "key": "bar", @@ -64,6 +66,7 @@ exports[`should render projects 2`] = ` my_profile.per_project_notifications.title </h2> <Connect(ProjectNotifications) + key="foo" project={ Object { "key": "foo", @@ -72,6 +75,7 @@ exports[`should render projects 2`] = ` } /> <Connect(ProjectNotifications) + key="bar" project={ Object { "key": "bar", @@ -80,6 +84,7 @@ exports[`should render projects 2`] = ` } /> <Connect(ProjectNotifications) + key="qux" project={ Object { "key": "qux", @@ -128,6 +133,7 @@ exports[`should render projects 3`] = ` my_profile.per_project_notifications.title </h2> <Connect(ProjectNotifications) + key="foo" project={ Object { "key": "foo", @@ -136,6 +142,7 @@ exports[`should render projects 3`] = ` } /> <Connect(ProjectNotifications) + key="bar" project={ Object { "key": "bar", @@ -144,6 +151,7 @@ exports[`should render projects 3`] = ` } /> <Connect(ProjectNotifications) + key="qux" project={ Object { "key": "qux", 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 1022a377f33..4996bfcd124 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 @@ -50,11 +50,11 @@ function Profile(props /*: Props */) { </div> {!user.local && - user.externalProvider !== 'sonarqube' && ( - <div id="identity-provider" className="spacer-bottom"> - <UserExternalIdentity user={user} /> - </div> - )} + user.externalProvider !== 'sonarqube' && ( + <div id="identity-provider" className="spacer-bottom"> + <UserExternalIdentity user={user} /> + </div> + )} {!!user.email && ( <div className="spacer-bottom"> 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 c5fa551f142..1e01f0ce5a2 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { getTask } from '../../../api/ce'; import { translate } from '../../../helpers/l10n'; import { Task } from '../types'; 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 7156099b54c..56c5a82e0da 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { getTask } from '../../../api/ce'; import { translate } from '../../../helpers/l10n'; import { Task } from '../types'; 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 285e7a4d50f..d6510541fc2 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,17 +86,17 @@ export default class TaskActions extends React.PureComponent<Props, State> { </button> <ul className="dropdown-menu dropdown-menu-right"> {canFilter && - task.componentName && ( - <li> - <a className="js-task-filter" href="#" onClick={this.handleFilterClick}> - <i className="spacer-right icon-filter icon-gray" /> - {translateWithParameters( - 'background_tasks.filter_by_component_x', - task.componentName - )} - </a> - </li> - )} + task.componentName && ( + <li> + <a className="js-task-filter" href="#" onClick={this.handleFilterClick}> + <i className="spacer-right icon-filter icon-gray" /> + {translateWithParameters( + 'background_tasks.filter_by_component_x', + task.componentName + )} + </a> + </li> + )} {canCancel && ( <li> <a className="js-task-cancel" href="#" onClick={this.handleCancelClick}> 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 d94228bde20..8d297463b7e 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 @@ -47,11 +47,11 @@ export default function TaskComponent({ task }: Props) { {task.branchType === 'LONG' && <LongLivingBranchIcon className="little-spacer-right" />} {!task.branchType && - task.componentQualifier && ( - <span className="little-spacer-right"> - <QualifierIcon qualifier={task.componentQualifier} /> - </span> - )} + task.componentQualifier && ( + <span className="little-spacer-right"> + <QualifierIcon qualifier={task.componentQualifier} /> + </span> + )} {task.organization && <Organization organizationKey={task.organization} />} diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx index a3da79ab51f..60312ec8927 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx @@ -97,11 +97,11 @@ export default class Workers extends React.PureComponent<{}, State> { return ( <div> {!loading && - workerCount > 1 && ( - <Tooltip overlay={translate('background_tasks.number_of_workers.warning')}> - <i className="icon-alert-warn little-spacer-right bt-workers-warning-icon" /> - </Tooltip> - )} + workerCount > 1 && ( + <Tooltip overlay={translate('background_tasks.number_of_workers.warning')}> + <i className="icon-alert-warn little-spacer-right bt-workers-warning-icon" /> + </Tooltip> + )} {translate('background_tasks.number_of_workers')} @@ -112,26 +112,26 @@ export default class Workers extends React.PureComponent<{}, State> { )} {!loading && - canSetWorkerCount && ( - <Tooltip overlay={translate('background_tasks.change_number_of_workers')}> - <a className="icon-edit spacer-left" href="#" onClick={this.handleChangeClick} /> - </Tooltip> - )} + canSetWorkerCount && ( + <Tooltip overlay={translate('background_tasks.change_number_of_workers')}> + <a className="icon-edit spacer-left" href="#" onClick={this.handleChangeClick} /> + </Tooltip> + )} {!loading && - !canSetWorkerCount && ( - <span className="spacer-left"> - <a className="link-no-underline" href="#" onClick={this.handleHelpClick}> - <HelpIcon className="text-text-bottom" fill={theme.gray80} /> - </a> - <BubblePopupHelper - isOpen={this.state.noSupportPopup} - position="bottomright" - popup={<NoWorkersSupportPopup />} - togglePopup={this.toggleNoSupportPopup} - /> - </span> - )} + !canSetWorkerCount && ( + <span className="spacer-left"> + <a className="link-no-underline" href="#" onClick={this.handleHelpClick}> + <HelpIcon className="text-text-bottom" fill={theme.gray80} /> + </a> + <BubblePopupHelper + isOpen={this.state.noSupportPopup} + position="bottomright" + popup={<NoWorkersSupportPopup />} + togglePopup={this.toggleNoSupportPopup} + /> + </span> + )} {formOpen && <WorkersForm onClose={this.closeForm} workerCount={this.state.workerCount} />} </div> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.tsx index 1d4854b74d2..b0849315a4e 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; -import * as Select from 'react-select'; +import * as Modal from 'react-modal'; +import Select from 'react-select'; import { times } from 'lodash'; import { setWorkerCount } from '../../../api/ce'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx index 940fe3341da..4c86aa33142 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx @@ -35,7 +35,7 @@ it('shows stack trace', () => { click(wrapper.find('.js-task-show-stacktrace')); expect(wrapper.find('Stacktrace')).toMatchSnapshot(); wrapper.find('Stacktrace').prop<Function>('onClose')(); - expect(wrapper.find('Stacktrace')).toMatchSnapshot(); + expect(wrapper.find('Stacktrace').exists()).toBeFalsy(); }); it('shows scanner context', () => { @@ -43,7 +43,7 @@ it('shows scanner context', () => { click(wrapper.find('.js-task-show-scanner-context')); expect(wrapper.find('ScannerContext')).toMatchSnapshot(); wrapper.find('ScannerContext').prop<Function>('onClose')(); - expect(wrapper.find('ScannerContext')).toMatchSnapshot(); + expect(wrapper.find('ScannerContext').exists()).toBeFalsy(); }); function shallowRender(fields?: any, props?: any) { diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/ScannerContext-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/ScannerContext-test.tsx.snap index 791da5f3492..d456c84d89e 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/ScannerContext-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/ScannerContext-test.tsx.snap @@ -12,7 +12,9 @@ exports[`renders 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <div className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Stacktrace-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Stacktrace-test.tsx.snap index 983e455792a..77022e03f21 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Stacktrace-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Stacktrace-test.tsx.snap @@ -12,7 +12,9 @@ exports[`renders 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <div className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskActions-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskActions-test.tsx.snap index 9de3ec891a0..aabe0783b3d 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskActions-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskActions-test.tsx.snap @@ -251,8 +251,6 @@ exports[`shows scanner context 1`] = ` /> `; -exports[`shows scanner context 2`] = `undefined`; - exports[`shows stack trace 1`] = ` <Stacktrace onClose={[Function]} @@ -268,5 +266,3 @@ exports[`shows stack trace 1`] = ` } /> `; - -exports[`shows stack trace 2`] = `undefined`; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/WorkersForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/WorkersForm-test.tsx.snap index 8ff615ea5e0..379c4e1d9b1 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/WorkersForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/WorkersForm-test.tsx.snap @@ -12,7 +12,9 @@ exports[`changes select 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -38,6 +40,7 @@ exports[`changes select 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -58,6 +61,8 @@ exports[`changes select 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ @@ -155,7 +160,9 @@ exports[`changes select 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -181,6 +188,7 @@ exports[`changes select 2`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -201,6 +209,8 @@ exports[`changes select 2`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ 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 2fd66d70ad7..13718a6f520 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 @@ -223,21 +223,21 @@ export default class App extends React.PureComponent<Props, State> { )} {sourceViewer === undefined && - components !== undefined && ( - <div className={componentsClassName}> - <Components - baseComponent={baseComponent} - branch={branchName} - components={components} - rootComponent={component} - /> - </div> - )} + components !== undefined && ( + <div className={componentsClassName}> + <Components + baseComponent={baseComponent} + branch={branchName} + components={components} + rootComponent={component} + /> + </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 && ( <div className="spacer-top"> 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 a33340530ea..e5a483dcac8 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 @@ -182,20 +182,20 @@ export default class App extends React.PureComponent { /> )} {metric == null && - hasBubbleChart(query.metric) && ( - <MeasureOverviewContainer - branch={branch && getBranchName(branch)} - className="layout-page-main" - rootComponent={component} - currentUser={this.props.currentUser} - domain={query.metric} - leakPeriod={leakPeriod} - metrics={metrics} - router={this.props.router} - selected={query.selected} - updateQuery={this.updateQuery} - /> - )} + hasBubbleChart(query.metric) && ( + <MeasureOverviewContainer + branch={branch && getBranchName(branch)} + className="layout-page-main" + rootComponent={component} + currentUser={this.props.currentUser} + domain={query.metric} + leakPeriod={leakPeriod} + metrics={metrics} + router={this.props.router} + selected={query.selected} + updateQuery={this.updateQuery} + /> + )} </div> ); } 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 12f3616697d..b27e5ad74c6 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 @@ -295,12 +295,12 @@ export default class MeasureContent extends React.PureComponent { rootComponent={rootComponent} /> {component.key !== rootComponent.key && - isLoggedIn && ( - <MeasureFavoriteContainer - component={component.key} - className="measure-favorite spacer-right" - /> - )} + isLoggedIn && ( + <MeasureFavoriteContainer + component={component.key} + className="measure-favorite spacer-right" + /> + )} {!isFile && ( <MeasureViewSelect className="measure-view-select" @@ -324,19 +324,19 @@ export default class MeasureContent extends React.PureComponent { <MetricNotFound className="layout-page-main-inner measure-details-content" /> )} {metric != null && - measure != null && ( - <div className="layout-page-main-inner measure-details-content"> - <MeasureHeader - branch={branch} - component={component} - components={this.state.components} - leakPeriod={this.props.leakPeriod} - measure={measure} - secondaryMeasure={this.props.secondaryMeasure} - /> - {isFileType(component) ? this.renderCode() : this.renderMeasure()} - </div> - )} + measure != null && ( + <div className="layout-page-main-inner measure-details-content"> + <MeasureHeader + branch={branch} + component={component} + components={this.state.components} + leakPeriod={this.props.leakPeriod} + measure={measure} + secondaryMeasure={this.props.secondaryMeasure} + /> + {isFileType(component) ? this.renderCode() : this.renderMeasure()} + </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 695c68ea26b..bbbded8e6c1 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 @@ -80,27 +80,27 @@ export default function MeasureHeader(props /*: Props*/) { </div> </div> {secondaryMeasure && - secondaryMeasure.metric.key === 'ncloc_language_distribution' && ( - <div className="measure-details-secondary"> - <LanguageDistributionContainer - alignTicks={true} - distribution={secondaryMeasure.value} - width={260} - /> - </div> - )} + secondaryMeasure.metric.key === 'ncloc_language_distribution' && ( + <div className="measure-details-secondary"> + <LanguageDistributionContainer + alignTicks={true} + distribution={secondaryMeasure.value} + width={260} + /> + </div> + )} {secondaryMeasure && - secondaryMeasure.metric.key === 'function_complexity_distribution' && ( - <div className="measure-details-secondary"> - <ComplexityDistribution distribution={secondaryMeasure.value} of="function" /> - </div> - )} + secondaryMeasure.metric.key === 'function_complexity_distribution' && ( + <div className="measure-details-secondary"> + <ComplexityDistribution distribution={secondaryMeasure.value} of="function" /> + </div> + )} {secondaryMeasure && - secondaryMeasure.metric.key === 'file_complexity_distribution' && ( - <div className="measure-details-secondary"> - <ComplexityDistribution distribution={secondaryMeasure.value} of="file" /> - </div> - )} + secondaryMeasure.metric.key === 'file_complexity_distribution' && ( + <div className="measure-details-secondary"> + <ComplexityDistribution distribution={secondaryMeasure.value} of="file" /> + </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 91d5cf8d669..8dd310c8a10 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,12 +152,12 @@ export default class MeasureOverview extends React.PureComponent { rootComponent={rootComponent} /> {component.key !== rootComponent.key && - isLoggedIn && ( - <MeasureFavoriteContainer - component={component.key} - className="measure-favorite spacer-right" - /> - )} + isLoggedIn && ( + <MeasureFavoriteContainer + component={component.key} + className="measure-favorite spacer-right" + /> + )} <PageActions current={this.state.components.length} loading={this.props.loading} diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/App-test.js.snap b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/App-test.js.snap index 24354987bd6..0477a149877 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/App-test.js.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/App-test.js.snap @@ -6,6 +6,7 @@ exports[`should render correctly 1`] = ` id="component-measures" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="layout.measures" /> diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureViewSelect-test.js.snap b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureViewSelect-test.js.snap index 7ab0276dde2..c007678dbab 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureViewSelect-test.js.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureViewSelect-test.js.snap @@ -12,6 +12,7 @@ exports[`should display correctly with treemap option 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -32,6 +33,8 @@ exports[`should display correctly with treemap option 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ @@ -39,30 +42,30 @@ exports[`should display correctly with treemap option 1`] = ` "icon": <ListIcon />, "label": <div> <ListIcon - className="little-spacer-right" + className="little-spacer-right" /> component_measures.tab.list - </div>, + </div>, "value": "list", }, Object { "icon": <TreeIcon />, "label": <div> <TreeIcon - className="little-spacer-right" + className="little-spacer-right" /> component_measures.tab.tree - </div>, + </div>, "value": "tree", }, Object { "icon": <TreemapIcon />, "label": <div> <TreemapIcon - className="little-spacer-right" + className="little-spacer-right" /> component_measures.tab.treemap - </div>, + </div>, "value": "treemap", }, ] 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 1d7be5e5b3b..702dd80038e 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 @@ -131,13 +131,13 @@ export default class ListView extends React.PureComponent { selectedComponent={this.props.selectedKey} /> {this.props.paging && - this.props.components.length > 0 && ( - <ListFooter - count={this.props.components.length} - total={this.props.paging.total} - loadMore={this.props.fetchMore} - /> - )} + 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 b836d061c7d..875f750d7db 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 @@ -202,7 +202,7 @@ export default class TreeMapView extends React.PureComponent { </li> <li className="pull-right">{this.renderLegend()}</li> </ul> - <AutoSizer> + <AutoSizer disableHeight={true}> {({ width }) => ( <TreeMap items={treemapItems} diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/DomainFacet-test.js.snap b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/DomainFacet-test.js.snap index fd5ddec46a2..9c88f409c2d 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/DomainFacet-test.js.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/DomainFacet-test.js.snap @@ -13,6 +13,7 @@ exports[`should display facet item list 1`] = ` active={false} disabled={false} halfWidth={false} + key="Reliability" name={ <span id="measure-overview-Reliability-name" @@ -30,6 +31,7 @@ exports[`should display facet item list 1`] = ` /> <span className="facet search-navigator-facet facet-category" + key="new_code_category" > <span className="facet-name" @@ -41,6 +43,7 @@ exports[`should display facet item list 1`] = ` active={false} disabled={false} halfWidth={false} + key="new_bugs" name={ <span className="big-spacer-left" @@ -75,6 +78,7 @@ exports[`should display facet item list 1`] = ` /> <span className="facet search-navigator-facet facet-category" + key="overall_category" > <span className="facet-name" @@ -86,6 +90,7 @@ exports[`should display facet item list 1`] = ` active={false} disabled={false} halfWidth={false} + key="bugs" name={ <span className="big-spacer-left" @@ -140,6 +145,7 @@ exports[`should display facet item list with bugs selected 1`] = ` active={false} disabled={false} halfWidth={false} + key="Reliability" name={ <span id="measure-overview-Reliability-name" @@ -157,6 +163,7 @@ exports[`should display facet item list with bugs selected 1`] = ` /> <span className="facet search-navigator-facet facet-category" + key="new_code_category" > <span className="facet-name" @@ -168,6 +175,7 @@ exports[`should display facet item list with bugs selected 1`] = ` active={false} disabled={false} halfWidth={false} + key="new_bugs" name={ <span className="big-spacer-left" @@ -202,6 +210,7 @@ exports[`should display facet item list with bugs selected 1`] = ` /> <span className="facet search-navigator-facet facet-category" + key="overall_category" > <span className="facet-name" @@ -213,6 +222,7 @@ exports[`should display facet item list with bugs selected 1`] = ` active={true} disabled={false} halfWidth={false} + key="bugs" name={ <span className="big-spacer-left" diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/Sidebar-test.js.snap b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/Sidebar-test.js.snap index 2472444bb70..2a3aab950cb 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/Sidebar-test.js.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/Sidebar-test.js.snap @@ -49,6 +49,7 @@ exports[`should display two facets 1`] = ` "name": "Coverage", } } + key="Coverage" onChange={[Function]} onToggle={[Function]} open={false} @@ -78,6 +79,7 @@ exports[`should display two facets 1`] = ` "name": "Duplications", } } + key="Duplications" onChange={[Function]} onToggle={[Function]} open={true} 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 864ca2b5d09..94b226cb89d 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 @@ -806,9 +806,13 @@ 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> ); } 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 b086fb5a125..22332785306 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 @@ -61,15 +61,15 @@ export default function ComponentBreadcrumbs({ branch, component, issue, organiz )} {displaySubProject && - 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> - )} + 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> + )} <Link to={getProjectUrl(issue.component, branch)} className="link-no-underline"> <span title={issue.componentLongName}>{collapsePath(issue.componentLongName)}</span> diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssueLocations-test.js.snap b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssueLocations-test.js.snap index b66e4a8d097..f9973b06e0c 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssueLocations-test.js.snap +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssueLocations-test.js.snap @@ -6,6 +6,7 @@ exports[`should render one flow 1`] = ` > <ConciseIssueLocationBadge count={3} + key="0" onClick={[Function]} selected={false} /> @@ -18,6 +19,7 @@ exports[`should render secondary locations 1`] = ` > <ConciseIssueLocationBadge count={3} + key="-1" selected={true} /> </div> @@ -29,16 +31,19 @@ exports[`should render several flows 1`] = ` > <ConciseIssueLocationBadge count={3} + key="0" onClick={[Function]} selected={false} /> <ConciseIssueLocationBadge count={2} + key="1" onClick={[Function]} selected={false} /> <ConciseIssueLocationBadge count={3} + key="2" onClick={[Function]} selected={false} /> diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssuesList-test.js.snap b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssuesList-test.js.snap index 1c8a20f3792..b6bc2b99242 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssuesList-test.js.snap +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssuesList-test.js.snap @@ -8,6 +8,7 @@ exports[`should render 1`] = ` "key": "foo", } } + key="foo" previousIssue={null} scroll={[Function]} selected={false} @@ -18,6 +19,7 @@ exports[`should render 1`] = ` "key": "bar", } } + key="bar" previousIssue={ Object { "key": "foo", diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/AssigneeFacet-test.js.snap b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/AssigneeFacet-test.js.snap index d6d4ef6ac7b..d384037257b 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/AssigneeFacet-test.js.snap +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/AssigneeFacet-test.js.snap @@ -23,6 +23,7 @@ exports[`should render 1`] = ` active={false} disabled={false} halfWidth={false} + key="foo" name={ <span> <Connect(Avatar) @@ -42,6 +43,7 @@ exports[`should render 1`] = ` active={false} disabled={false} halfWidth={false} + key="bar" name="bar" onClick={[Function]} stat="7" @@ -107,6 +109,7 @@ exports[`should select unassigned 1`] = ` active={false} disabled={false} halfWidth={false} + key="foo" name={ <span> <Connect(Avatar) @@ -126,6 +129,7 @@ exports[`should select unassigned 1`] = ` active={false} disabled={false} halfWidth={false} + key="bar" name="bar" onClick={[Function]} stat="7" @@ -167,6 +171,7 @@ exports[`should select user 1`] = ` active={true} disabled={false} halfWidth={false} + key="foo" name={ <span> <Connect(Avatar) @@ -186,6 +191,7 @@ exports[`should select user 1`] = ` active={false} disabled={false} halfWidth={false} + key="bar" name="bar" onClick={[Function]} stat="7" diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap index 952e8dc78c1..bd62c3de370 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/EditionBoxes-test.tsx.snap @@ -15,9 +15,9 @@ exports[`should display an error message 1`] = ` "url": <a href="https://redirect.sonarsource.com/editions/editions.html" target="_blank" - > + > SonarSource.com - </a>, + </a>, } } /> @@ -56,6 +56,7 @@ exports[`should display the edition boxes correctly 2`] = ` } } isDowngrade={true} + key="comunity" onInstall={[Function]} onUninstall={[Function]} /> @@ -80,6 +81,7 @@ exports[`should display the edition boxes correctly 2`] = ` } } isDowngrade={false} + key="developer" onInstall={[Function]} onUninstall={[Function]} /> diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/PendingActions-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/PendingActions-test.tsx.snap index b30e1e22d36..7e8801a1e0c 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/PendingActions-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/PendingActions-test.tsx.snap @@ -21,7 +21,7 @@ exports[`should display pending actions 1`] = ` Object { "nb": <strong> 2 - </strong>, + </strong>, } } /> @@ -34,7 +34,7 @@ exports[`should display pending actions 1`] = ` Object { "nb": <strong> 1 - </strong>, + </strong>, } } /> diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionForm.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionForm.tsx index abab7c84ed4..ee86ac11596 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionForm.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import LicenseEditionSet from './LicenseEditionSet'; import { Edition, EditionStatus, applyLicense } from '../../../api/marketplace'; import { translate, translateWithParameters } from '../../../helpers/l10n'; @@ -108,11 +108,9 @@ export default class LicenseEditionForm extends React.PureComponent<Props, State {submitting && <i className="spinner spacer-right" />} {status && ( <button className="js-confirm" onClick={this.handleConfirmClick} disabled={submitting}> - {status === 'AUTOMATIC_INSTALL' ? ( - translate('marketplace.install') - ) : ( - translate('save') - )} + {status === 'AUTOMATIC_INSTALL' + ? translate('marketplace.install') + : translate('save')} </button> )} <a className="js-modal-close" href="#" onClick={this.handleCancelClick}> diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx index 501631edadc..df898dbdbeb 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx @@ -91,19 +91,19 @@ export default class PluginActions extends React.PureComponent<Props, State> { </p> )} {isPluginInstalled(plugin) && - plugin.updates && - plugin.updates.length > 0 && ( - <div className="spacer-top button-group"> - {plugin.updates.map((update, idx) => ( - <PluginUpdateButton - key={idx} - onClick={this.handleUpdate} - update={update} - disabled={this.state.loading} - /> - ))} - </div> - )} + plugin.updates && + plugin.updates.length > 0 && ( + <div className="spacer-top button-group"> + {plugin.updates.map((update, idx) => ( + <PluginUpdateButton + key={idx} + onClick={this.handleUpdate} + update={update} + disabled={this.state.loading} + /> + ))} + </div> + )} </div> ); } @@ -119,25 +119,25 @@ export default class PluginActions extends React.PureComponent<Props, State> { return ( <div className="js-actions"> {isPluginAvailable(plugin) && - plugin.termsAndConditionsUrl && ( - <p className="little-spacer-bottom"> - <Checkbox - checked={this.state.acceptTerms} - className="js-terms" - id={'plugin-terms-' + plugin.key} - onCheck={this.handleTermsCheck}> - <label className="little-spacer-left" htmlFor={'plugin-terms-' + plugin.key}> - {translate('marketplace.i_accept_the')} - </label> - </Checkbox> - <a - className="js-plugin-terms nowrap little-spacer-left" - href={plugin.termsAndConditionsUrl} - target="_blank"> - {translate('marketplace.terms_and_conditions')} - </a> - </p> - )} + plugin.termsAndConditionsUrl && ( + <p className="little-spacer-bottom"> + <Checkbox + checked={this.state.acceptTerms} + className="js-terms" + id={'plugin-terms-' + plugin.key} + onCheck={this.handleTermsCheck}> + <label className="little-spacer-left" htmlFor={'plugin-terms-' + plugin.key}> + {translate('marketplace.i_accept_the')} + </label> + </Checkbox> + <a + className="js-plugin-terms nowrap little-spacer-left" + href={plugin.termsAndConditionsUrl} + target="_blank"> + {translate('marketplace.terms_and_conditions')} + </a> + </p> + )} {loading && <i className="spinner spacer-right" />} {isPluginInstalled(plugin) && ( <div className="display-inlin-block"> diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx index 37b76edc83e..1af1ee86295 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/UninstallEditionForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { Edition, EditionStatus, uninstallEdition } from '../../../api/marketplace'; import { translate, translateWithParameters } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap index 9e07155c292..bd4aa78eb6a 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/LicenseEditionForm-test.tsx.snap @@ -42,7 +42,9 @@ exports[`should display correctly 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginLicense-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginLicense-test.tsx.snap index 5c6e0ab7138..5a77d6923b2 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginLicense-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginLicense-test.tsx.snap @@ -15,9 +15,9 @@ exports[`should display the license field 1`] = ` Object { "license": <span className="js-plugin-license" - > + > SonarSource license - </span>, + </span>, } } /> diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap index 507f7e4fe73..05cefbe37c2 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/UninstallEditionForm-test.tsx.snap @@ -12,7 +12,9 @@ exports[`should display correctly 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/MembersList-test.js.snap b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/MembersList-test.js.snap index a472b00b798..4bc29637672 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/MembersList-test.js.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/MembersList-test.js.snap @@ -6,6 +6,7 @@ exports[`should render a list of members of an organization 1`] = ` > <tbody> <MembersListItem + key="admin" member={ Object { "avatar": "", @@ -22,6 +23,7 @@ exports[`should render a list of members of an organization 1`] = ` } /> <MembersListItem + key="john" member={ Object { "avatar": "7daf6c79d4802916d83f6266e24850af", diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationDelete-test.js.snap b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationDelete-test.js.snap index 508cdecb71b..b34a9e508da 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationDelete-test.js.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationDelete-test.js.snap @@ -5,6 +5,7 @@ exports[`smoke test 1`] = ` className="page page-limited" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="organization.delete" /> @@ -39,6 +40,7 @@ exports[`smoke test 2`] = ` className="page page-limited" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="organization.delete" /> @@ -75,7 +77,9 @@ exports[`smoke test 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -122,6 +126,7 @@ exports[`smoke test 3`] = ` className="page page-limited" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="organization.delete" /> @@ -158,7 +163,9 @@ exports[`smoke test 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.js.snap b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.js.snap index 6c13ca615a2..9dc712473f2 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.js.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.js.snap @@ -5,6 +5,7 @@ exports[`smoke test 1`] = ` className="page page-limited" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="organization.edit" /> @@ -137,6 +138,7 @@ exports[`smoke test 2`] = ` className="page page-limited" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="organization.edit" /> @@ -284,6 +286,7 @@ exports[`smoke test 3`] = ` className="page page-limited" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="organization.edit" /> diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationMembers-test.js.snap b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationMembers-test.js.snap index 17ab36b7540..9a13da1aa21 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationMembers-test.js.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationMembers-test.js.snap @@ -5,6 +5,7 @@ exports[`should not render actions for non admin 1`] = ` className="page page-limited" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="organization.members.page" /> @@ -55,6 +56,7 @@ exports[`should render actions for admin 1`] = ` className="page page-limited" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="organization.members.page" /> diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationPage-test.js.snap b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationPage-test.js.snap index f63164ef1e0..350cc9b5d80 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationPage-test.js.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationPage-test.js.snap @@ -16,6 +16,7 @@ exports[`smoke test 2`] = ` <div> <HelmetWrapper defaultTitle="Foo" + defer={true} encodeSpecialCharacters={true} titleTemplate="%s - Foo" /> diff --git a/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/AddMemberForm-test.js.snap b/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/AddMemberForm-test.js.snap index b00ff229314..96d42f26097 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/AddMemberForm-test.js.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/AddMemberForm-test.js.snap @@ -24,7 +24,9 @@ exports[`should render and open the modal 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/ManageMemberGroupsForm-test.js.snap b/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/ManageMemberGroupsForm-test.js.snap index 3f450483d13..751d905c910 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/ManageMemberGroupsForm-test.js.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/ManageMemberGroupsForm-test.js.snap @@ -94,7 +94,9 @@ exports[`should render and open the modal 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -126,6 +128,7 @@ exports[`should render and open the modal 2`] = ` "name": "professionals", } } + key="7" onCheck={[Function]} /> <OrganizationGroupCheckbox @@ -138,6 +141,7 @@ exports[`should render and open the modal 2`] = ` "name": "pull-request-analysers", } } + key="11" onCheck={[Function]} /> <OrganizationGroupCheckbox @@ -150,6 +154,7 @@ exports[`should render and open the modal 2`] = ` "name": "sonar-administrators", } } + key="1" onCheck={[Function]} /> </ul> diff --git a/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/RemoveMemberForm-test.js.snap b/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/RemoveMemberForm-test.js.snap index 5b298e526ba..b1b8bdb072d 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/RemoveMemberForm-test.js.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/forms/__tests__/__snapshots__/RemoveMemberForm-test.js.snap @@ -39,7 +39,9 @@ exports[`should render and open the modal 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/ApplicationLeakPeriodLegend-test.js.snap b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/ApplicationLeakPeriodLegend-test.js.snap index cb842597822..f7c73f3b9fb 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/ApplicationLeakPeriodLegend-test.js.snap +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/ApplicationLeakPeriodLegend-test.js.snap @@ -25,14 +25,18 @@ exports[`renders 2`] = ` <ul className="text-left" > - <li> + <li + key="foo" + > Foo : <DateTooltipFormatter date="2017-01-01T11:39:03+0100" /> </li> - <li> + <li + key="bar" + > Bar : <DateTooltipFormatter diff --git a/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Analysis-test.js.snap b/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Analysis-test.js.snap index 33bc4e28c18..a9296187266 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Analysis-test.js.snap +++ b/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Analysis-test.js.snap @@ -25,6 +25,7 @@ exports[`should sort the events with version first 1`] = ` "name": "6.5-SNAPSHOT", } } + key="2" /> <Event event={ @@ -34,6 +35,7 @@ exports[`should sort the events with version first 1`] = ` "name": "test", } } + key="1" /> </div> </li> diff --git a/server/sonar-web/src/main/js/apps/overview/meta/__tests__/MetaTagsSelector-test.js b/server/sonar-web/src/main/js/apps/overview/meta/__tests__/MetaTagsSelector-test.js index bc22697f5f3..fc0fe817dc1 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/__tests__/MetaTagsSelector-test.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/__tests__/MetaTagsSelector-test.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* eslint-disable import/order, import/first */ -import * as React from 'react'; +import React from 'react'; import { mount, shallow } from 'enzyme'; import MetaTagsSelector from '../MetaTagsSelector'; 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 d88d0e76e97..bc49256f055 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 @@ -155,11 +155,11 @@ export default class QualityGateCondition extends React.PureComponent { {metric.name} </div> {!isDiff && - condition.period != null && ( - <div className="overview-quality-gate-condition-period"> - {translate('quality_gates.conditions.leak')} - </div> - )} + condition.period != null && ( + <div className="overview-quality-gate-condition-period"> + {translate('quality_gates.conditions.leak')} + </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/__tests__/__snapshots__/ApplicationQualityGate-test.js.snap b/server/sonar-web/src/main/js/apps/overview/qualityGate/__tests__/__snapshots__/ApplicationQualityGate-test.js.snap index 326b9ecefb1..5a7f39cf4d9 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/__tests__/__snapshots__/ApplicationQualityGate-test.js.snap +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/__tests__/__snapshots__/ApplicationQualityGate-test.js.snap @@ -34,6 +34,7 @@ exports[`renders 2`] = ` id="overview-quality-gate-conditions-list" > <ApplicationQualityGateProject + key="project1" metrics={Object {}} project={ Object { @@ -45,6 +46,7 @@ exports[`renders 2`] = ` } /> <ApplicationQualityGateProject + key="project3" metrics={Object {}} project={ Object { diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/__tests__/__snapshots__/ApplicationQualityGateProject-test.js.snap b/server/sonar-web/src/main/js/apps/overview/qualityGate/__tests__/__snapshots__/ApplicationQualityGateProject-test.js.snap index 7538c3934a6..64d2bf86cfb 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/__tests__/__snapshots__/ApplicationQualityGateProject-test.js.snap +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/__tests__/__snapshots__/ApplicationQualityGateProject-test.js.snap @@ -26,6 +26,7 @@ exports[`renders 1`] = ` > <li className="is-on-leak" + key="new_coverage" > <span className="text-limited" @@ -46,6 +47,7 @@ exports[`renders 1`] = ` </li> <li className="" + key="bugs" > <span className="text-limited" @@ -66,6 +68,7 @@ exports[`renders 1`] = ` </li> <li className="" + key="bugs" > <span className="text-limited" 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 5802a33d217..4ab52668b98 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 @@ -360,9 +360,9 @@ export default class App extends React.PureComponent { visibility={this.props.component.visibility} /> {this.props.component.qualifier === 'TRK' && - !canTurnToPrivate && ( - <UpgradeOrganizationBox organization={this.props.component.organization} /> - )} + !canTurnToPrivate && ( + <UpgradeOrganizationBox organization={this.props.component.organization} /> + )} {this.state.disclaimer && ( <PublicProjectDisclaimer component={this.props.component} 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 14c6018180f..0fdb5568931 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,12 +83,14 @@ export default class SearchForm extends React.PureComponent { onChange={this.handleSearch.bind(this)} /> {query.length > 0 && - 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-arrow" style={{ left: 23 }} /> - </div> - )} + 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-arrow" style={{ left: 23 }} /> + </div> + )} </form> </div> ); diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx index 7d3efb507bf..993345e2319 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx @@ -152,13 +152,13 @@ export default class App extends React.PureComponent<Props, State> { </div> {subComponents !== undefined && - totalSubComponents !== undefined && ( - <WorstProjects - component={component.key} - subComponents={subComponents} - total={totalSubComponents} - /> - )} + totalSubComponents !== undefined && ( + <WorstProjects + component={component.key} + subComponents={subComponents} + total={totalSubComponents} + /> + )} </div> ); } @@ -178,7 +178,7 @@ export default class App extends React.PureComponent<Props, State> { <aside className="page-sidebar-fixed"> {!this.isEmpty() && - !this.isNotComputed() && <Summary component={component} measures={measures!} />} + !this.isNotComputed() && <Summary component={component} measures={measures!} />} <Activity component={component.key} /> <Report component={component} /> </aside> diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/ReleasabilityBox.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/ReleasabilityBox.tsx index e71c0aed894..798e7b16dd2 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/ReleasabilityBox.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/ReleasabilityBox.tsx @@ -50,19 +50,19 @@ export default function ReleasabilityBox({ component, measures }: Props) { <RatingFreshness lastChange={lastReleasabilityChange} /> {effort && - Number(effort) > 0 && ( - <div className="portfolio-effort"> - <Link to={getComponentDrilldownUrl(component, 'alert_status')}> - <span> - <Measure - measure={{ metric: { key: 'projects', type: 'SHORT_INT' }, value: effort }} - />{' '} - {Number(effort) === 1 ? 'project' : 'projects'} - </span> - </Link>{' '} - <span className="level level-ERROR level-small">{translate('metric.level.ERROR')}</span> - </div> - )} + Number(effort) > 0 && ( + <div className="portfolio-effort"> + <Link to={getComponentDrilldownUrl(component, 'alert_status')}> + <span> + <Measure + measure={{ metric: { key: 'projects', type: 'SHORT_INT' }, value: effort }} + />{' '} + {Number(effort) === 1 ? 'project' : 'projects'} + </span> + </Link>{' '} + <span className="level level-ERROR level-small">{translate('metric.level.ERROR')}</span> + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/WorstProjects.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/WorstProjects.tsx index 421eea14c96..ae676759a5a 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/WorstProjects.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/WorstProjects.tsx @@ -79,11 +79,9 @@ export default function WorstProjects({ component, subComponents, total }: Props <QualifierIcon qualifier={component.qualifier} /> {component.name} </Link> </td> - {component.qualifier === 'TRK' ? ( - renderCell(component.measures, 'alert_status', 'LEVEL') - ) : ( - renderCell(component.measures, 'releasability_rating', 'RATING') - )} + {component.qualifier === 'TRK' + ? renderCell(component.measures, 'alert_status', 'LEVEL') + : renderCell(component.measures, 'releasability_rating', 'RATING')} {renderCell(component.measures, 'reliability_rating', 'RATING')} {renderCell(component.measures, 'security_rating', 'RATING')} {renderCell(component.measures, 'sqale_rating', 'RATING')} diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Effort-test.tsx.snap b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Effort-test.tsx.snap index 79fce89982d..989531cad1e 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Effort-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Effort-test.tsx.snap @@ -13,36 +13,36 @@ exports[`renders 1`] = ` onlyActiveOnIndex={false} style={Object {}} to={ - Object { - "pathname": "/component_measures", - "query": Object { - "branch": undefined, - "id": "foo", - "metric": "security_rating", - }, - } + Object { + "pathname": "/component_measures", + "query": Object { + "branch": undefined, + "id": "foo", + "metric": "security_rating", + }, + } } - > + > <span> - <Measure - measure={ - Object { - "metric": Object { - "key": "projects", - "type": "SHORT_INT", - }, - "value": "3", - } - } - /> - - projects_ + <Measure + measure={ + Object { + "metric": Object { + "key": "projects", + "type": "SHORT_INT", + }, + "value": "3", + } + } + /> + + projects_ </span> - </Link>, + </Link>, "rating": <Rating small={true} value={2} - />, + />, } } /> diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/RatingFreshness-test.tsx.snap b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/RatingFreshness-test.tsx.snap index ca9124758dc..7e0c44f1ca4 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/RatingFreshness-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/RatingFreshness-test.tsx.snap @@ -11,11 +11,11 @@ exports[`renders 1`] = ` Object { "date": <DateFromNow date="2017-01-02T00:00:00.000Z" - />, + />, "rating": <Rating small={true} value={2} - />, + />, } } /> diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/WorstProjects-test.tsx.snap b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/WorstProjects-test.tsx.snap index 1eaa2c0bdb9..c36279d6709 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/WorstProjects-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/WorstProjects-test.tsx.snap @@ -41,7 +41,9 @@ exports[`renders 1`] = ` </tr> </thead> <tbody> - <tr> + <tr + key="foo" + > <td> <Link className="link-with-icon" @@ -157,7 +159,9 @@ exports[`renders 1`] = ` </svg> </td> </tr> - <tr> + <tr + key="bar" + > <td> <Link className="link-with-icon" @@ -273,7 +277,9 @@ exports[`renders 1`] = ` </svg> </td> </tr> - <tr> + <tr + key="baz" + > <td> <Link className="link-with-icon" 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 29fe837acfa..3bc95c78ff9 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 @@ -107,19 +107,19 @@ export default class GraphHistory extends React.PureComponent { updateZoom={this.props.updateGraphZoom} /> {selectedDate != null && - tooltipXPos != null && ( - <GraphsTooltips - events={this.props.events} - formatValue={this.formatTooltipValue} - graph={graph} - graphWidth={width} - measuresHistory={this.props.measuresHistory} - selectedDate={selectedDate} - series={series} - tooltipIdx={tooltipIdx} - tooltipPos={tooltipXPos} - /> - )} + tooltipXPos != null && ( + <GraphsTooltips + events={this.props.events} + formatValue={this.formatTooltipValue} + graph={graph} + graphWidth={width} + measuresHistory={this.props.measuresHistory} + selectedDate={selectedDate} + series={series} + tooltipIdx={tooltipIdx} + tooltipPos={tooltipXPos} + /> + )} </div> )} </AutoSizer> 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 69065f1b708..2aa4137cc1d 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 @@ -117,9 +117,9 @@ export default class GraphsTooltips extends React.PureComponent { /> )} {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/ProjectActivityAnalysis.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.js index 88bf5483c11..517e60cc26f 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 @@ -105,7 +105,7 @@ export default class ProjectActivityAnalysis extends React.PureComponent { </li> )} {(canAddVersion || canAddEvent) && - canDeleteAnalyses && <li role="separator" className="divider" />} + canDeleteAnalyses && <li role="separator" className="divider" />} {canDeleteAnalyses && ( <li> <RemoveAnalysisForm diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphHistory-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphHistory-test.js.snap index 2b9e964ae1d..b83cc033e28 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphHistory-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphHistory-test.js.snap @@ -32,6 +32,8 @@ exports[`should correctly render a graph 1`] = ` className="project-activity-graph" > <AutoSizer + disableHeight={false} + disableWidth={false} onResize={[Function]} /> </div> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsHistory-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsHistory-test.js.snap index fb809d1f599..b7de2ea3cfe 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsHistory-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsHistory-test.js.snap @@ -35,6 +35,7 @@ exports[`should correctly render a graph 1`] = ` graphEndDate={null} graphStartDate={null} isCustom={false} + key="0" leakPeriodDate="2017-05-16T13:50:02+0200" measuresHistory={Array []} removeCustomMetric={[Function]} @@ -79,6 +80,7 @@ exports[`should correctly render multiple graphs 1`] = ` graphEndDate={null} graphStartDate={null} isCustom={false} + key="0" leakPeriodDate="2017-05-16T13:50:02+0200" measuresHistory={Array []} removeCustomMetric={[Function]} @@ -116,6 +118,7 @@ exports[`should correctly render multiple graphs 1`] = ` graphEndDate={null} graphStartDate={null} isCustom={false} + key="1" leakPeriodDate="2017-05-16T13:50:02+0200" measuresHistory={Array []} removeCustomMetric={[Function]} diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendCustom-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendCustom-test.js.snap index cd8ec0cc2f4..b50a253ae4c 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendCustom-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendCustom-test.js.snap @@ -6,6 +6,7 @@ exports[`should render correctly the list of series 1`] = ` > <span className="spacer-left spacer-right" + key="bugs" > <GraphsLegendItem metric="bugs" @@ -17,6 +18,7 @@ exports[`should render correctly the list of series 1`] = ` </span> <span className="spacer-left spacer-right" + key="my_metric" > <GraphsLegendItem metric="my_metric" @@ -27,6 +29,7 @@ exports[`should render correctly the list of series 1`] = ` /> </span> <Tooltip + key="foo" overlay="project_activity.graphs.custom.metric_no_history" placement="bottom" > diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendStatic-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendStatic-test.js.snap index 47cc682d03f..c8d7df8f28a 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendStatic-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendStatic-test.js.snap @@ -6,12 +6,14 @@ exports[`should render correctly the list of series 1`] = ` > <GraphsLegendItem className="big-spacer-left big-spacer-right" + key="bugs" metric="bugs" name="Bugs" style="0" /> <GraphsLegendItem className="big-spacer-left big-spacer-right" + key="code_smells" metric="code_smells" name="Code Smells" style="1" diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltips-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltips-test.js.snap index e2ab4b039a8..96758777f80 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltips-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltips-test.js.snap @@ -61,6 +61,7 @@ exports[`should render correctly for issues graphs 1`] = ` > <tbody> <GraphsTooltipsContentIssues + key="bugs" measuresHistory={Array []} name="bugs" style="0" @@ -69,6 +70,7 @@ exports[`should render correctly for issues graphs 1`] = ` value="Formated.3" /> <GraphsTooltipsContentIssues + key="code_smells" measuresHistory={Array []} name="code_smells" style="1" @@ -77,6 +79,7 @@ exports[`should render correctly for issues graphs 1`] = ` value="Formated.18" /> <GraphsTooltipsContentIssues + key="vulnerabilities" measuresHistory={Array []} name="vulnerabilities" style="2" @@ -116,18 +119,21 @@ exports[`should render correctly for random graphs 1`] = ` > <tbody> <GraphsTooltipsContent + key="bugs" name="bugs" style="0" translatedName="Bugs" value="Formated.0" /> <GraphsTooltipsContent + key="code_smells" name="code_smells" style="1" translatedName="Code Smells" value="Formated.15" /> <GraphsTooltipsContent + key="vulnerabilities" name="vulnerabilities" style="2" translatedName="Vulnerabilities" diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContent-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContent-test.js.snap index 353f07cdac3..7f818adb4c6 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContent-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContent-test.js.snap @@ -3,6 +3,7 @@ exports[`should render correctly 1`] = ` <tr className="project-activity-graph-tooltip-line" + key="code_smells" > <td className="thin" diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentEvents-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentEvents-test.js.snap index 95e4c4b18a1..29401d4397d 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentEvents-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentEvents-test.js.snap @@ -22,6 +22,7 @@ exports[`should render correctly 1`] = ` </span> <span className="spacer-left" + key="1" > <ProjectEventIcon className="project-activity-event-icon VERSION" @@ -29,6 +30,7 @@ exports[`should render correctly 1`] = ` </span> <span className="spacer-left" + key="2" > <ProjectEventIcon className="project-activity-event-icon OTHER" diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentIssues-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentIssues-test.js.snap index 91f9b47f6f5..f5712ca5b76 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentIssues-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentIssues-test.js.snap @@ -3,6 +3,7 @@ exports[`should render correctly 1`] = ` <tr className="project-activity-graph-tooltip-issues-line" + key="bugs" > <td className="thin" @@ -34,6 +35,7 @@ exports[`should render correctly 1`] = ` exports[`should render correctly when rating data is missing 1`] = ` <tr className="project-activity-graph-tooltip-issues-line" + key="bugs" > <td className="thin" diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAnalysesList-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAnalysesList-test.js.snap index f2a64234ead..468f7b7ddec 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAnalysesList-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAnalysesList-test.js.snap @@ -10,7 +10,9 @@ exports[`should correctly filter analyses by category 1`] = ` } } > - <li> + <li + key="E2" + > <div className="project-activity-version-badge first" > @@ -32,6 +34,7 @@ exports[`should correctly filter analyses by category 1`] = ` <li className="project-activity-day" data-day="ISO.1477267200000" + key="1477267200000" > <div className="project-activity-date" @@ -66,6 +69,7 @@ exports[`should correctly filter analyses by category 1`] = ` deleteAnalysis={[Function]} deleteEvent={[Function]} isFirst={false} + key="A4" selected={false} updateSelectedDate={[Function]} /> @@ -86,7 +90,9 @@ exports[`should correctly filter analyses by date range 1`] = ` } } > - <li> + <li + key="E1" + > <div className="project-activity-version-badge first" > @@ -108,6 +114,7 @@ exports[`should correctly filter analyses by date range 1`] = ` <li className="project-activity-day" data-day="ISO.1477526400000" + key="1477526400000" > <div className="project-activity-date" @@ -142,6 +149,7 @@ exports[`should correctly filter analyses by date range 1`] = ` deleteAnalysis={[Function]} deleteEvent={[Function]} isFirst={true} + key="A1" selected={false} updateSelectedDate={[Function]} /> @@ -162,7 +170,9 @@ exports[`should render correctly 1`] = ` } } > - <li> + <li + key="E1" + > <div className="project-activity-version-badge first" > @@ -184,6 +194,7 @@ exports[`should render correctly 1`] = ` <li className="project-activity-day" data-day="ISO.1477526400000" + key="1477526400000" > <div className="project-activity-date" @@ -218,6 +229,7 @@ exports[`should render correctly 1`] = ` deleteAnalysis={[Function]} deleteEvent={[Function]} isFirst={true} + key="A1" selected={false} updateSelectedDate={[Function]} /> @@ -237,6 +249,7 @@ exports[`should render correctly 1`] = ` deleteAnalysis={[Function]} deleteEvent={[Function]} isFirst={false} + key="A2" selected={false} updateSelectedDate={[Function]} /> @@ -244,7 +257,9 @@ exports[`should render correctly 1`] = ` </li> </ul> </li> - <li> + <li + key="E2" + > <div className="project-activity-version-badge" > @@ -266,6 +281,7 @@ exports[`should render correctly 1`] = ` <li className="project-activity-day" data-day="ISO.1477440000000" + key="1477440000000" > <div className="project-activity-date" @@ -305,6 +321,7 @@ exports[`should render correctly 1`] = ` deleteAnalysis={[Function]} deleteEvent={[Function]} isFirst={false} + key="A3" selected={false} updateSelectedDate={[Function]} /> @@ -313,6 +330,7 @@ exports[`should render correctly 1`] = ` <li className="project-activity-day" data-day="ISO.1477267200000" + key="1477267200000" > <div className="project-activity-date" @@ -347,6 +365,7 @@ exports[`should render correctly 1`] = ` deleteAnalysis={[Function]} deleteEvent={[Function]} isFirst={false} + key="A4" selected={false} updateSelectedDate={[Function]} /> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityApp-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityApp-test.js.snap index 0e51a64862b..71e18479081 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityApp-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityApp-test.js.snap @@ -6,6 +6,7 @@ exports[`should render correctly 1`] = ` id="project-activity" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="project_activity.page" /> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityPageHeader-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityPageHeader-test.js.snap index 1112cfa4ea8..12ff75c5342 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityPageHeader-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityPageHeader-test.js.snap @@ -15,6 +15,7 @@ exports[`should render correctly the list of series 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={true} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -35,6 +36,8 @@ exports[`should render correctly the list of series 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ 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 ece4bdad6d7..bf9c646b599 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 @@ -128,17 +128,15 @@ 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/projectBranches/components/DeleteBranchModal.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx index 66d14ed260f..5b8e9cb8c7f 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { deleteBranch } from '../../../api/branches'; import { Branch } from '../../../app/types'; import { translate, translateWithParameters } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LeakPeriodForm.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LeakPeriodForm.tsx index 26d0c82f668..ac05eabcc07 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/LeakPeriodForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LeakPeriodForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import SettingForm from './SettingForm'; import { translate } from '../../../helpers/l10n'; import { getValues, SettingValue } from '../../../api/settings'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPatternForm.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPatternForm.tsx index c773b3c737f..8a683b25529 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPatternForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPatternForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import SettingForm from './SettingForm'; import { translate } from '../../../helpers/l10n'; import { SettingValue } from '../../../api/settings'; 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 02bd8572c9c..52a381eb90c 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { renameBranch } from '../../../api/branches'; import { Branch } from '../../../app/types'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/SettingForm.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/SettingForm.tsx index 41e8c9d439e..ba43512af0a 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/SettingForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/SettingForm.tsx @@ -118,24 +118,24 @@ export default class SettingForm extends React.PureComponent<Props, State> { <div className="note spacer-top">{translate('settings._default')}</div> )} {!setting.inherited && - setting.parentValue && ( - <div className="note spacer-top"> - {translateWithParameters('settings.default_x', setting.parentValue)} - </div> - )} + setting.parentValue && ( + <div className="note spacer-top"> + {translateWithParameters('settings.default_x', setting.parentValue)} + </div> + )} </div> </div> <footer className="modal-foot"> {!setting.inherited && - setting.parentValue && ( - <button - className="pull-left" - disabled={this.state.submitting} - onClick={this.handleResetClick} - type="reset"> - {translate('reset_to_default')} - </button> - )} + setting.parentValue && ( + <button + className="pull-left" + disabled={this.state.submitting} + onClick={this.handleResetClick} + type="reset"> + {translate('reset_to_default')} + </button> + )} {this.state.submitting && <i className="spinner spacer-right" />} <button disabled={submitDisabled} type="submit"> {translate('save')} diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap index a3281058f51..4914db6ffce 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap @@ -33,9 +33,9 @@ exports[`renders sorted list of branches 1`] = ` onlyActiveOnIndex={false} style={Object {}} to="/admin/settings" - > + > settings.page - </Link>, + </Link>, } } /> @@ -75,6 +75,7 @@ exports[`renders sorted list of branches 1`] = ` } } component="foo" + key="master" onChange={[Function]} /> <BranchRow @@ -87,6 +88,7 @@ exports[`renders sorted list of branches 1`] = ` } } component="foo" + key="branch-1.0" onChange={[Function]} /> <BranchRow @@ -98,6 +100,7 @@ exports[`renders sorted list of branches 1`] = ` } } component="foo" + key="branch-1.0" onChange={[Function]} /> </tbody> diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/DeleteBranchModal-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/DeleteBranchModal-test.tsx.snap index 934f8ed2d7d..fe8762c945f 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/DeleteBranchModal-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/DeleteBranchModal-test.tsx.snap @@ -12,7 +12,9 @@ exports[`renders 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -62,7 +64,9 @@ exports[`renders 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/LongBranchesPatternForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/LongBranchesPatternForm-test.tsx.snap index d1c5ef0c609..8e0e2e2d8ca 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/LongBranchesPatternForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/LongBranchesPatternForm-test.tsx.snap @@ -12,7 +12,9 @@ exports[`renders 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/RenameBranchModal-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/RenameBranchModal-test.tsx.snap index 7867fa4785a..1f190cd94c5 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/RenameBranchModal-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/RenameBranchModal-test.tsx.snap @@ -12,7 +12,9 @@ exports[`renders 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -85,7 +87,9 @@ exports[`renders 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -158,7 +162,9 @@ exports[`renders 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" 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 b5a034ccd68..aa0b8bea116 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import * as Select from 'react-select'; +import Select from 'react-select'; import { some } from 'lodash'; import { QualityGate } from '../../api/quality-gates'; import { translate } from '../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/__snapshots__/Form-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/__snapshots__/Form-test.tsx.snap index afa45f5e3ba..4d448e7a8cb 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/__snapshots__/Form-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/__snapshots__/Form-test.tsx.snap @@ -12,6 +12,7 @@ exports[`renders 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -32,6 +33,8 @@ exports[`renders 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} optionRenderer={[Function]} options={ 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 ad8340c2c20..9a3febf80ad 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import * as Select from 'react-select'; +import Select from 'react-select'; import { Profile } from '../../api/quality-profiles'; import { translate } from '../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/ProfileRow-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/ProfileRow-test.tsx.snap index 541a117c889..12542749c1f 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/ProfileRow-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/ProfileRow-test.tsx.snap @@ -22,6 +22,7 @@ exports[`renders 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -42,6 +43,8 @@ exports[`renders 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} optionRenderer={[Function]} options={ diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/Table-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/Table-test.tsx.snap index b4b991157eb..5ac9cea89da 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/Table-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/Table-test.tsx.snap @@ -23,6 +23,7 @@ exports[`renders 1`] = ` </thead> <tbody> <ProfileRow + key="java" onChangeProfile={[Function]} possibleProfiles={ Array [ @@ -68,6 +69,7 @@ exports[`renders 1`] = ` } /> <ProfileRow + key="js" onChangeProfile={[Function]} possibleProfiles={ Array [ diff --git a/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx b/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx index c27d1fce861..5b2e8af4056 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import * as Select from 'react-select'; +import Select from 'react-select'; import PerspectiveSelectOption, { Option } from './PerspectiveSelectOption'; import { translate } from '../../../helpers/l10n'; import { VIEWS, VISUALIZATIONS } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx index 1505bef784b..d8ce816507c 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx @@ -63,22 +63,24 @@ export default function ProjectCardLeak({ organization, project }: Props) { {hasTags && <TagsList tags={project.tags} customClass="spacer-left" />} </div> {project.analysisDate && - project.leakPeriodDate && ( - <div className="project-card-dates note text-right pull-right"> - <DateFromNow date={project.leakPeriodDate!}> - {fromNow => ( - <span className="project-card-leak-date pull-right"> - {translateWithParameters('projects.leak_period_x', fromNow)} - </span> - )} - </DateFromNow> - <DateTimeFormatter date={project.analysisDate!}> - {formattedDate => ( - <span>{translateWithParameters('projects.last_analysis_on_x', formattedDate)}</span> - )} - </DateTimeFormatter> - </div> - )} + project.leakPeriodDate && ( + <div className="project-card-dates note text-right pull-right"> + <DateFromNow date={project.leakPeriodDate!}> + {fromNow => ( + <span className="project-card-leak-date pull-right"> + {translateWithParameters('projects.leak_period_x', fromNow)} + </span> + )} + </DateFromNow> + <DateTimeFormatter date={project.analysisDate!}> + {formattedDate => ( + <span> + {translateWithParameters('projects.last_analysis_on_x', formattedDate)} + </span> + )} + </DateTimeFormatter> + </div> + )} </div> {project.analysisDate && project.leakPeriodDate ? ( @@ -88,11 +90,9 @@ export default function ProjectCardLeak({ organization, project }: Props) { ) : ( <div className="boxed-group-inner"> <div className="note project-card-not-analyzed"> - {project.analysisDate ? ( - translate('projects.no_leak_period') - ) : ( - translate('projects.not_analyzed') - )} + {project.analysisDate + ? translate('projects.no_leak_period') + : translate('projects.not_analyzed')} </div> </div> )} diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx index 423da0dcd26..21101667187 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx @@ -49,18 +49,16 @@ export default class ProjectsList extends React.PureComponent<Props> { return ( <div className="projects-list"> - {projects.length > 0 ? ( - projects.map(project => ( - <ProjectCard - key={project.key} - project={project} - organization={this.props.organization} - type={this.props.cardType} - /> - )) - ) : ( - this.renderNoProjects() - )} + {projects.length > 0 + ? projects.map(project => ( + <ProjectCard + key={project.key} + project={project} + organization={this.props.organization} + type={this.props.cardType} + /> + )) + : this.renderNoProjects()} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.tsx index eb84d21caed..434c1818eeb 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { sortBy } from 'lodash'; -import * as Select from 'react-select'; +import Select from 'react-select'; import ProjectsSortingSelectOption, { Option } from './ProjectsSortingSelectOption'; import SortAscIcon from '../../../components/icons-components/SortAscIcon'; import SortDescIcon from '../../../components/icons-components/SortDescIcon'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageSidebar-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageSidebar-test.tsx index 6d071b47da5..b6ba776c0da 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageSidebar-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageSidebar-test.tsx @@ -44,7 +44,7 @@ it('reset function should work correctly with view and visualizations', () => { isFavorite={false} /> ); - expect(sidebar.find('.projects-facets-reset')).toMatchSnapshot(); + expect(sidebar.find('.projects-facets-reset').exists()).toBeFalsy(); sidebar.setProps({ query: { size: '3' } }); expect(sidebar.find('.projects-facets-reset')).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap index fc7e90eddd2..5ac9039df25 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap @@ -5,6 +5,7 @@ exports[`renders 1`] = ` className="layout-page projects-page" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="projects.page" /> @@ -109,6 +110,7 @@ exports[`renders 2`] = ` className="layout-page projects-page" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="projects.page" /> diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PageSidebar-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PageSidebar-test.tsx.snap index 5cd3d236fb0..78961fde19f 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PageSidebar-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PageSidebar-test.tsx.snap @@ -1,8 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`reset function should work correctly with view and visualizations 1`] = `undefined`; - -exports[`reset function should work correctly with view and visualizations 2`] = ` +exports[`reset function should work correctly with view and visualizations 1`] = ` <div className="projects-facets-reset" > @@ -51,6 +49,7 @@ exports[`should render \`leak\` view correctly 1`] = ` /> <NewReliabilityFilter isFavorite={false} + key="new_reliability" query={ Object { "view": "leak", @@ -59,6 +58,7 @@ exports[`should render \`leak\` view correctly 1`] = ` /> <NewSecurityFilter isFavorite={false} + key="new_security" query={ Object { "view": "leak", @@ -67,6 +67,7 @@ exports[`should render \`leak\` view correctly 1`] = ` /> <NewMaintainabilityFilter isFavorite={false} + key="new_maintainability" query={ Object { "view": "leak", @@ -75,6 +76,7 @@ exports[`should render \`leak\` view correctly 1`] = ` /> <NewCoverageFilter isFavorite={false} + key="new_coverage" query={ Object { "view": "leak", @@ -83,6 +85,7 @@ exports[`should render \`leak\` view correctly 1`] = ` /> <NewDuplicationsFilter isFavorite={false} + key="new_duplications" query={ Object { "view": "leak", @@ -91,6 +94,7 @@ exports[`should render \`leak\` view correctly 1`] = ` /> <NewLinesFilter isFavorite={false} + key="new_lines" query={ Object { "view": "leak", @@ -153,6 +157,7 @@ exports[`should render correctly 1`] = ` /> <ReliabilityFilter isFavorite={true} + key="reliability" query={ Object { "size": "3", @@ -161,6 +166,7 @@ exports[`should render correctly 1`] = ` /> <SecurityFilter isFavorite={true} + key="security" query={ Object { "size": "3", @@ -169,6 +175,7 @@ exports[`should render correctly 1`] = ` /> <MaintainabilityFilter isFavorite={true} + key="maintainability" query={ Object { "size": "3", @@ -177,6 +184,7 @@ exports[`should render correctly 1`] = ` /> <CoverageFilter isFavorite={true} + key="coverage" query={ Object { "size": "3", @@ -185,6 +193,7 @@ exports[`should render correctly 1`] = ` /> <DuplicationsFilter isFavorite={true} + key="duplications" query={ Object { "size": "3", @@ -193,6 +202,7 @@ exports[`should render correctly 1`] = ` /> <SizeFilter isFavorite={true} + key="size" query={ Object { "size": "3", diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PerspectiveSelect-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PerspectiveSelect-test.tsx.snap index 7671abced29..1c5a0c3e47a 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PerspectiveSelect-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PerspectiveSelect-test.tsx.snap @@ -38,6 +38,7 @@ exports[`should render correctly 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -58,6 +59,8 @@ exports[`should render correctly 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ @@ -134,6 +137,7 @@ exports[`should render with coverage selected 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -154,6 +158,8 @@ exports[`should render with coverage selected 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLanguages-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLanguages-test.tsx.snap index bf50df65a84..5b18aee0615 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLanguages-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLanguages-test.tsx.snap @@ -9,11 +9,15 @@ exports[`handles unknown languages 1`] = ` <Tooltip overlay={ <span> - <span> + <span + key="cpp" + > cpp <br /> </span> - <span> + <span + key="Java" + > Java <br /> </span> @@ -35,11 +39,15 @@ exports[`handles unknown languages 2`] = ` <Tooltip overlay={ <span> - <span> + <span + key="unknown" + > unknown <br /> </span> - <span> + <span + key="Java" + > Java <br /> </span> @@ -61,11 +69,15 @@ exports[`renders 1`] = ` <Tooltip overlay={ <span> - <span> + <span + key="Java" + > Java <br /> </span> - <span> + <span + key="JavaScript" + > JavaScript <br /> </span> @@ -87,11 +99,15 @@ exports[`sorts languages 1`] = ` <Tooltip overlay={ <span> - <span> + <span + key="JavaScript" + > JavaScript <br /> </span> - <span> + <span + key="Java" + > Java <br /> </span> diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsList-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsList-test.tsx.snap index b5a2c7729c5..93fb447b814 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsList-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsList-test.tsx.snap @@ -5,6 +5,7 @@ exports[`renders 1`] = ` className="projects-list" > <ProjectCard + key="foo" project={ Object { "key": "foo", @@ -14,6 +15,7 @@ exports[`renders 1`] = ` type="overall" /> <ProjectCard + key="bar" project={ Object { "key": "bar", diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap index dfa78f606fc..d1c569d9601 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap @@ -17,6 +17,7 @@ exports[`should handle the descending sort direction 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -37,6 +38,8 @@ exports[`should handle the descending sort direction 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ @@ -127,6 +130,7 @@ exports[`should render correctly for leak view 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -147,6 +151,8 @@ exports[`should render correctly for leak view 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ @@ -237,6 +243,7 @@ exports[`should render correctly for overall view 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -257,6 +264,8 @@ exports[`should render correctly for overall view 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ diff --git a/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.tsx index 5e14ac24774..65539aae09c 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.tsx @@ -70,7 +70,7 @@ function renderOption(option: number, selected: boolean) { <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/SearchableFilterFooter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/SearchableFilterFooter.tsx index b81830abbb7..5b45e79a6f5 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/SearchableFilterFooter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/SearchableFilterFooter.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import * as Select from 'react-select'; +import Select from 'react-select'; import * as PropTypes from 'prop-types'; import { getFilterUrl } from './utils'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/Filter-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/Filter-test.tsx.snap index 684a65f0ce8..3c6f588c192 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/Filter-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/Filter-test.tsx.snap @@ -11,6 +11,7 @@ exports[`highlights under 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={1} + key="1" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -35,6 +36,7 @@ exports[`highlights under 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={2} + key="2" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -56,6 +58,7 @@ exports[`highlights under 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={3} + key="3" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -90,6 +93,7 @@ exports[`hightlights under selected 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={1} + key="1" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -114,6 +118,7 @@ exports[`hightlights under selected 1`] = ` <Link className="facet search-navigator-facet projects-facet active" data-key={2} + key="2" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -133,6 +138,7 @@ exports[`hightlights under selected 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={3} + key="3" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -167,6 +173,7 @@ exports[`renders 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={1} + key="1" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -188,6 +195,7 @@ exports[`renders 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={2} + key="2" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -209,6 +217,7 @@ exports[`renders 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={3} + key="3" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -242,6 +251,7 @@ exports[`renders facet bar chart 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key="a" + key="a" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -280,6 +290,7 @@ exports[`renders facet bar chart 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key="b" + key="b" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -318,6 +329,7 @@ exports[`renders facet bar chart 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key="c" + key="c" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -369,6 +381,7 @@ exports[`renders header and footer 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={1} + key="1" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -390,6 +403,7 @@ exports[`renders header and footer 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={2} + key="2" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -411,6 +425,7 @@ exports[`renders header and footer 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={3} + key="3" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -445,6 +460,7 @@ exports[`renders multiple selected 1`] = ` <Link className="facet search-navigator-facet projects-facet active" data-key={1} + key="1" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -466,6 +482,7 @@ exports[`renders multiple selected 1`] = ` <Link className="facet search-navigator-facet projects-facet active" data-key={2} + key="2" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -487,6 +504,7 @@ exports[`renders multiple selected 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={3} + key="3" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -533,6 +551,7 @@ exports[`renders selected 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={1} + key="1" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -554,6 +573,7 @@ exports[`renders selected 1`] = ` <Link className="facet search-navigator-facet projects-facet active" data-key={2} + key="2" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -573,6 +593,7 @@ exports[`renders selected 1`] = ` <Link className="facet search-navigator-facet projects-facet" data-key={3} + key="3" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.tsx.snap index 38b72391839..3de7fafe747 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.tsx.snap @@ -188,6 +188,7 @@ exports[`should render the languages facet with the selected languages 2`] = ` <Link className="facet search-navigator-facet projects-facet active" data-key="java" + key="java" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -222,6 +223,7 @@ exports[`should render the languages facet with the selected languages 2`] = ` <Link className="facet search-navigator-facet projects-facet active" data-key="cs" + key="cs" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -256,6 +258,7 @@ exports[`should render the languages facet with the selected languages 2`] = ` <Link className="facet search-navigator-facet projects-facet" data-key="js" + key="js" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/TagsFilter-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/TagsFilter-test.tsx.snap index 22f13a9b832..66d789e0a75 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/TagsFilter-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/TagsFilter-test.tsx.snap @@ -179,6 +179,7 @@ exports[`should render the tags facet with the selected tags 2`] = ` <Link className="facet search-navigator-facet projects-facet active" data-key="lang" + key="lang" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -207,6 +208,7 @@ exports[`should render the tags facet with the selected tags 2`] = ` <Link className="facet search-navigator-facet projects-facet active" data-key="sonar" + key="sonar" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} @@ -235,6 +237,7 @@ exports[`should render the tags facet with the selected tags 2`] = ` <Link className="facet search-navigator-facet projects-facet" data-key="csharp" + key="csharp" onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} 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 3e81e28cb5c..f446bc626ef 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; -import * as Select from 'react-select'; +import * as Modal from 'react-modal'; +import Select from 'react-select'; import { getPermissionTemplates, bulkApplyTemplate, @@ -126,17 +126,15 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S 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 - ) - )} + {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> ); @@ -188,12 +186,12 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S <footer className="modal-foot"> {submitting && <i className="spinner spacer-right" />} {!loading && - !done && - permissionTemplates && ( - <button disabled={submitting} onClick={this.handleConfirmClick}> - {translate('apply')} - </button> - )} + !done && + permissionTemplates && ( + <button disabled={submitting} onClick={this.handleConfirmClick}> + {translate('apply')} + </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 148172bb3c4..b464112c980 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import * as classNames from 'classnames'; import { Organization, Visibility } from '../../app/types'; import UpgradeOrganizationBox from '../../components/common/UpgradeOrganizationBox'; 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 26c90c857b2..07352fda839 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { Link } from 'react-router'; import { FormattedMessage } from 'react-intl'; import { Organization } from '../../app/types'; 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 ae0640d1c1e..04ae04af7bc 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { bulkDeleteProjects } from '../../api/components'; import { translate, translateWithParameters } from '../../helpers/l10n'; import AlertWarnIcon from '../../components/icons-components/AlertWarnIcon'; @@ -87,14 +87,12 @@ export default class DeleteModal extends React.PureComponent<Props, State> { 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) - )} + {this.props.selection.length + ? translateWithParameters( + 'projects_management.delete_selected_warning', + this.props.selection.length + ) + : translateWithParameters('projects_management.delete_all_warning', this.props.total)} </div> ); 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 94318dbae7c..2c9b0684090 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import * as Select from 'react-select'; +import Select from 'react-select'; import { sortBy } from 'lodash'; import BulkApplyTemplateModal from './BulkApplyTemplateModal'; import DeleteModal from './DeleteModal'; diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/BulkApplyTemplateModal-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/BulkApplyTemplateModal-test.tsx.snap index 4cadeebb4a0..02eab945bf9 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/BulkApplyTemplateModal-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/BulkApplyTemplateModal-test.tsx.snap @@ -12,7 +12,9 @@ exports[`bulk applies template to all results 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -54,7 +56,9 @@ exports[`bulk applies template to all results 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -95,6 +99,7 @@ exports[`bulk applies template to all results 2`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -115,6 +120,8 @@ exports[`bulk applies template to all results 2`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ @@ -173,7 +180,9 @@ exports[`bulk applies template to all results 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -214,6 +223,7 @@ exports[`bulk applies template to all results 3`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={true} @@ -234,6 +244,8 @@ exports[`bulk applies template to all results 3`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ @@ -295,7 +307,9 @@ exports[`bulk applies template to all results 4`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -339,7 +353,9 @@ exports[`bulk applies template to selected results 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -381,7 +397,9 @@ exports[`bulk applies template to selected results 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -422,6 +440,7 @@ exports[`bulk applies template to selected results 2`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -442,6 +461,8 @@ exports[`bulk applies template to selected results 2`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ @@ -500,7 +521,9 @@ exports[`bulk applies template to selected results 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -541,6 +564,7 @@ exports[`bulk applies template to selected results 3`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={true} @@ -561,6 +585,8 @@ exports[`bulk applies template to selected results 3`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ @@ -622,7 +648,9 @@ exports[`bulk applies template to selected results 4`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ChangeVisibilityForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ChangeVisibilityForm-test.tsx.snap index d46e88f161f..2eaf4fb187d 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ChangeVisibilityForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ChangeVisibilityForm-test.tsx.snap @@ -12,7 +12,9 @@ exports[`changes visibility 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -26,6 +28,7 @@ exports[`changes visibility 1`] = ` > <div className="big-spacer-bottom" + key="public" > <p> <a @@ -53,6 +56,7 @@ exports[`changes visibility 1`] = ` </div> <div className="big-spacer-bottom" + key="private" > <p> <a @@ -116,7 +120,9 @@ exports[`changes visibility 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -130,6 +136,7 @@ exports[`changes visibility 2`] = ` > <div className="big-spacer-bottom" + key="public" > <p> <a @@ -157,6 +164,7 @@ exports[`changes visibility 2`] = ` </div> <div className="big-spacer-bottom" + key="private" > <p> <a @@ -220,7 +228,9 @@ exports[`renders disabled 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -234,6 +244,7 @@ exports[`renders disabled 1`] = ` > <div className="big-spacer-bottom" + key="public" > <p> <a @@ -261,6 +272,7 @@ exports[`renders disabled 1`] = ` </div> <div className="big-spacer-bottom" + key="private" > <p> <span diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/CreateProjectForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/CreateProjectForm-test.tsx.snap index 7a9c5c62141..322cdd80dda 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/CreateProjectForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/CreateProjectForm-test.tsx.snap @@ -12,7 +12,9 @@ exports[`creates project 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <form id="create-project-form" @@ -140,7 +142,9 @@ exports[`creates project 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <form id="create-project-form" @@ -268,7 +272,9 @@ exports[`creates project 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <form id="create-project-form" @@ -399,7 +405,9 @@ exports[`creates project 4`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <div> <header @@ -424,17 +432,17 @@ exports[`creates project 4`] = ` onlyActiveOnIndex={false} style={Object {}} to={ - Object { - "pathname": "/dashboard", - "query": Object { - "branch": undefined, - "id": "name", - }, - } + Object { + "pathname": "/dashboard", + "query": Object { + "branch": undefined, + "id": "name", + }, + } } - > + > name - </Link>, + </Link>, } } /> @@ -467,7 +475,9 @@ exports[`shows more 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <form id="create-project-form" @@ -595,7 +605,9 @@ exports[`shows more 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <form id="create-project-form" diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/DeleteModal-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/DeleteModal-test.tsx.snap index 12d6e222a77..9e568644af0 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/DeleteModal-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/DeleteModal-test.tsx.snap @@ -12,7 +12,9 @@ exports[`deletes all projects 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -67,7 +69,9 @@ exports[`deletes all projects 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -125,7 +129,9 @@ exports[`deletes selected projects 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -180,7 +186,9 @@ exports[`deletes selected projects 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/Projects-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/Projects-test.tsx.snap index 2c60880eb28..6705b982c5a 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/Projects-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/Projects-test.tsx.snap @@ -25,6 +25,7 @@ exports[`renders list of projects 1`] = ` </thead> <tbody> <ProjectRow + key="a" onApplyTemplateClick={[Function]} onProjectCheck={[Function]} project={ @@ -38,6 +39,7 @@ exports[`renders list of projects 1`] = ` selected={true} /> <ProjectRow + key="b" onApplyTemplateClick={[Function]} onProjectCheck={[Function]} project={ diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/Search-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/Search-test.tsx.snap index cebeb62f2c9..5e8bdfddf0d 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/Search-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/Search-test.tsx.snap @@ -63,6 +63,7 @@ exports[`render qualifiers filter 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -84,6 +85,8 @@ exports[`render qualifiers filter 1`] = ` onBlurResetsInput={true} onChange={[Function]} onCloseResetsInput={true} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} optionRenderer={[Function]} options={ 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 6acb20708d8..073ce138746 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 @@ -59,11 +59,9 @@ 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" 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 9d05395586e..77329207900 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,9 +185,9 @@ 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 && ( <footer className="text-center spacer-top small"> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ParameterChange.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ParameterChange.tsx index e8d2ec75551..40e0fa89018 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ParameterChange.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ParameterChange.tsx @@ -28,11 +28,12 @@ interface Props { export default function ParameterChange({ name, value }: Props) { return ( <div className="quality-profile-changelog-parameter"> - {value == null ? ( - translateWithParameters('quality_profiles.changelog.parameter_reset_to_default_value', name) - ) : ( - translateWithParameters('quality_profiles.parameter_set_to', name, value) - )} + {value == null + ? translateWithParameters( + 'quality_profiles.changelog.parameter_reset_to_default_value', + name + ) + : translateWithParameters('quality_profiles.parameter_set_to', name, value)} </div> ); } 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 a71123b1927..173d1d0dbb3 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,21 +126,21 @@ export default class ComparisonContainer extends React.PureComponent<Props, Stat </header> {left != null && - inLeft != null && - right != null && - inRight != null && - modified != null && ( - <div className="spacer-top"> - <ComparisonResults - left={left} - right={right} - inLeft={inLeft} - inRight={inRight} - modified={modified} - organization={this.props.organization} - /> - </div> - )} + inLeft != null && + right != null && + inRight != null && + modified != null && ( + <div className="spacer-top"> + <ComparisonResults + left={left} + right={right} + inLeft={inLeft} + inRight={inRight} + modified={modified} + organization={this.props.organization} + /> + </div> + )} </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 bee2e948e07..384c0cf3525 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import * as Select from 'react-select'; +import Select from 'react-select'; import { translate } from '../../../helpers/l10n'; import { Profile } from '../types'; 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 70f58f01ea6..963b09cd24e 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { copyProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Profile } from '../types'; 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 9a25f9c3007..99b85e7aad9 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { deleteProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Profile } from '../types'; 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 164943c43c4..8906db09a3b 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 @@ -134,11 +134,11 @@ export default class ProfileActions extends React.PureComponent<Props, State> { return ( <ul className="dropdown-menu dropdown-menu-right"> {actions.edit && - !profile.isBuiltIn && ( - <li> - <Link to={activateMoreUrl}>{translate('quality_profiles.activate_more_rules')}</Link> - </li> - )} + !profile.isBuiltIn && ( + <li> + <Link to={activateMoreUrl}>{translate('quality_profiles.activate_more_rules')}</Link> + </li> + )} {!profile.isBuiltIn && ( <li> <a id="quality-profile-backup" href={backupUrl}> @@ -161,30 +161,30 @@ export default class ProfileActions extends React.PureComponent<Props, State> { </li> )} {actions.edit && - !profile.isBuiltIn && ( - <li> - <a id="quality-profile-rename" href="#" onClick={this.handleRenameClick}> - {translate('rename')} - </a> - </li> - )} + !profile.isBuiltIn && ( + <li> + <a id="quality-profile-rename" href="#" onClick={this.handleRenameClick}> + {translate('rename')} + </a> + </li> + )} {actions.setAsDefault && - !profile.isDefault && ( - <li> - <a id="quality-profile-set-as-default" href="#" onClick={this.handleSetDefaultClick}> - {translate('set_as_default')} - </a> - </li> - )} + !profile.isDefault && ( + <li> + <a id="quality-profile-set-as-default" href="#" onClick={this.handleSetDefaultClick}> + {translate('set_as_default')} + </a> + </li> + )} {actions.edit && - !profile.isDefault && - !profile.isBuiltIn && ( - <li> - <a id="quality-profile-delete" href="#" onClick={this.handleDeleteClick}> - {translate('delete')} - </a> - </li> - )} + !profile.isDefault && + !profile.isBuiltIn && ( + <li> + <a id="quality-profile-delete" href="#" onClick={this.handleDeleteClick}> + {translate('delete')} + </a> + </li> + )} {this.state.copyFormOpen && ( <CopyProfileForm 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 d8c4951f02c..33cc3e4c9f8 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { renameProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Profile } from '../types'; 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 2327cd7acc0..204d6ff0348 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 @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; -import * as Select from 'react-select'; +import * as Modal from 'react-modal'; +import Select from 'react-select'; import { sortBy } from 'lodash'; import { changeProfileParent } from '../../../api/quality-profiles'; import { translate } from '../../../helpers/l10n'; @@ -120,11 +120,9 @@ 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 3467fb01b19..6e1095c4eac 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import * as escapeHtml from 'escape-html'; import SelectList from '../../../components/SelectList'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx index 524a148dadd..4ffed5d56cc 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx @@ -43,10 +43,13 @@ export default function ProfileDetails(props: Props) { <ProfileRules {...props} /> <ProfileExporters {...props} /> {profile.actions && - profile.actions.edit && - !profile.isBuiltIn && ( - <ProfilePermissions organization={props.organization || undefined} profile={profile} /> - )} + profile.actions.edit && + !profile.isBuiltIn && ( + <ProfilePermissions + organization={props.organization || undefined} + profile={profile} + /> + )} </div> <div className="quality-profile-grid-right"> <ProfileInheritance {...props} /> 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 77f8a92a7f1..290ea8f3bb0 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 @@ -120,14 +120,16 @@ export default class ProfileInheritance extends React.PureComponent<Props, State return ( <div className="boxed-group quality-profile-inheritance"> {profile.actions && - profile.actions.edit && - !profile.isBuiltIn && ( - <div className="boxed-group-actions"> - <button className="pull-right js-change-parent" onClick={this.handleChangeParentClick}> - {translate('quality_profiles.change_parent')} - </button> - </div> - )} + profile.actions.edit && + !profile.isBuiltIn && ( + <div className="boxed-group-actions"> + <button + className="pull-right js-change-parent" + onClick={this.handleChangeParentClick}> + {translate('quality_profiles.change_parent')} + </button> + </div> + )} <header className="boxed-group-header"> <h2>{translate('quality_profiles.profile_inheritance')}</h2> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx index 8d892127fc7..2431856c53c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import ProfilePermissionsFormSelect from './ProfilePermissionsFormSelect'; import { searchUsers, diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx index 911bf55cca4..fcf87c6cbe7 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import * as Select from 'react-select'; +import Select from 'react-select'; import { debounce, identity } from 'lodash'; import { User, Group } from './ProfilePermissions'; import Avatar from '../../../components/ui/Avatar'; 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 b809abd6a6f..9b1acd46c8e 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 @@ -130,14 +130,14 @@ export default class ProfileProjects extends React.PureComponent<Props, State> { return ( <div className="boxed-group quality-profile-projects"> {profile.actions && - profile.actions.edit && - !profile.isDefault && ( - <div className="boxed-group-actions"> - <button className="js-change-projects" onClick={this.handleChangeClick}> - {translate('quality_profiles.change_projects')} - </button> - </div> - )} + profile.actions.edit && + !profile.isDefault && ( + <div className="boxed-group-actions"> + <button className="js-change-projects" onClick={this.handleChangeClick}> + {translate('quality_profiles.change_projects')} + </button> + </div> + )} <header className="boxed-group-header"> <h2>{translate('projects')}</h2> 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 b2ab6732921..facde0a4a34 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 @@ -184,14 +184,14 @@ export default class ProfileRules extends React.PureComponent<Props, State> { </table> {profile.actions && - profile.actions.edit && - !profile.isBuiltIn && ( - <div className="text-right big-spacer-top"> - <Link to={activateMoreUrl} className="button js-activate-rules"> - {translate('quality_profiles.activate_more')} - </Link> - </div> - )} + profile.actions.edit && + !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> {profile.activeDeprecatedRuleCount > 0 && ( <ProfileRulesDeprecatedWarning @@ -201,15 +201,15 @@ export default class ProfileRules extends React.PureComponent<Props, State> { /> )} {compareToSonarWay != null && - compareToSonarWay.missingRuleCount > 0 && ( - <ProfileRulesSonarWayComparison - language={profile.language} - organization={organization} - profile={profile.key} - sonarway={compareToSonarWay.profile} - sonarWayMissingRules={compareToSonarWay.missingRuleCount} - /> - )} + 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/__tests__/__snapshots__/ProfilePermissions-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissions-test.tsx.snap index 806ca57c73c..9dd2c1d6c47 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissions-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissions-test.tsx.snap @@ -45,6 +45,7 @@ exports[`renders 2`] = ` className="big-spacer-top" > <ProfilePermissionsUser + key="luke" onDelete={[Function]} profile={ Object { @@ -65,6 +66,7 @@ exports[`renders 2`] = ` "name": "Lambda", } } + key="Lambda" onDelete={[Function]} profile={ Object { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsForm-test.tsx.snap index d8b0f2354d0..7acbdb7e005 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsForm-test.tsx.snap @@ -12,7 +12,9 @@ exports[`adds group 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -72,7 +74,9 @@ exports[`adds group 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -137,7 +141,9 @@ exports[`adds group 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -205,7 +211,9 @@ exports[`adds user 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -265,7 +273,9 @@ exports[`adds user 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -330,7 +340,9 @@ exports[`adds user 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsFormSelect-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsFormSelect-test.tsx.snap index 10e1ea582f7..818fc5af342 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsFormSelect-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsFormSelect-test.tsx.snap @@ -13,6 +13,7 @@ exports[`renders 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -34,6 +35,8 @@ exports[`renders 1`] = ` onChange={[Function]} onCloseResetsInput={true} onInputChange={[Function]} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} optionRenderer={[Function]} options={Array []} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap index 315e117ffba..6d92fb9ab26 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap @@ -28,12 +28,14 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] = <tbody> <ProfileRulesRowTotal count={68} + key="all" organization="foo" qprofile="foo" total={243} /> <ProfileRulesRowOfType count={68} + key="BUG" organization="foo" qprofile="foo" total={68} @@ -41,6 +43,7 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] = /> <ProfileRulesRowOfType count={0} + key="VULNERABILITY" organization="foo" qprofile="foo" total={7} @@ -48,6 +51,7 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] = /> <ProfileRulesRowOfType count={0} + key="CODE_SMELL" organization="foo" qprofile="foo" total={168} 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 ed4dbb325ac..a58a721f00e 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 @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; -import * as Select from 'react-select'; +import * as Modal from 'react-modal'; +import Select from 'react-select'; import { sortBy } from 'lodash'; import { getImporters, createQualityProfile } from '../../../api/quality-profiles'; import { translate } from '../../../helpers/l10n'; 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 9ff9410a37c..bc4c085d89e 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 @@ -121,18 +121,16 @@ export default class EvolutionRules extends React.PureComponent<Props, State> { {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> 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 49674ef4d46..da5b8b61732 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 @@ -71,6 +71,17 @@ export default class ProfilesList extends React.PureComponent<Props> { ); } + renderLanguage = (languageKey: string, profiles: Profile[] | undefined) => { + return ( + <div key={languageKey} className="boxed-group boxed-group-inner quality-profiles-table"> + <table data-language={languageKey} className="data zebra zebra-hover"> + {profiles !== undefined && this.renderHeader(languageKey, profiles.length)} + <tbody>{profiles !== undefined && this.renderProfiles(profiles)}</tbody> + </table> + </div> + ); + }; + render() { const { profiles, languages } = this.props; const { language } = this.props.location.query; @@ -80,9 +91,7 @@ export default class ProfilesList extends React.PureComponent<Props> { profile => profile.language ); - const profilesToShow: { [language: string]: Profile[] } = language - ? pick(profilesIndex, language) - : profilesIndex; + const profilesToShow = language ? pick(profilesIndex, language) : profilesIndex; const languagesToShow = sortBy(Object.keys(profilesToShow)); @@ -98,19 +107,9 @@ export default class ProfilesList extends React.PureComponent<Props> { <div className="alert alert-warning spacer-top">{translate('no_results')}</div> )} - {languagesToShow.map(languageKey => ( - <div key={languageKey} className="boxed-group boxed-group-inner quality-profiles-table"> - <table data-language={languageKey} className="data zebra zebra-hover"> - {profilesToShow[languageKey] != null && - this.renderHeader(languageKey, profilesToShow[languageKey].length)} - - <tbody> - {profilesToShow[languageKey] != null && - this.renderProfiles(profilesToShow[languageKey])} - </tbody> - </table> - </div> - ))} + {languagesToShow.map(languageKey => + this.renderLanguage(languageKey, profilesToShow[languageKey]) + )} </div> ); } 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 021f5951af8..b63924e5a28 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 @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { restoreQualityProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; @@ -102,23 +102,25 @@ export default class RestoreProfileForm extends React.PureComponent<Props, State </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> + {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"> diff --git a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/LoginForm-test.tsx b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/LoginForm-test.tsx index 29a5edfb341..2bebbea19e1 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/LoginForm-test.tsx +++ b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/LoginForm-test.tsx @@ -45,14 +45,24 @@ it('logs in with simple credentials', () => { it('logs in with identity provider', () => { const wrapper = shallow( - <LoginForm onSonarCloud={false} identityProviders={[identityProvider]} onSubmit={jest.fn()} returnTo="" /> + <LoginForm + onSonarCloud={false} + identityProviders={[identityProvider]} + onSubmit={jest.fn()} + returnTo="" + /> ); expect(wrapper).toMatchSnapshot(); }); it('expands more options', () => { const wrapper = shallow( - <LoginForm onSonarCloud={false} identityProviders={[identityProvider]} onSubmit={jest.fn()} returnTo="" /> + <LoginForm + onSonarCloud={false} + identityProviders={[identityProvider]} + onSubmit={jest.fn()} + returnTo="" + /> ); expect(wrapper).toMatchSnapshot(); 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 5c1f7f0b45f..29250dd1a4f 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 @@ -164,25 +164,25 @@ class Definition extends React.PureComponent { )} {!loading && - this.props.validationMessage != null && ( - <span className="text-danger"> - <i className="icon-alert-error spacer-right" /> - <span> - {translateWithParameters( - 'settings.state.validation_failed', - this.props.validationMessage - )} + this.props.validationMessage != null && ( + <span className="text-danger"> + <i className="icon-alert-error spacer-right" /> + <span> + {translateWithParameters( + 'settings.state.validation_failed', + this.props.validationMessage + )} + </span> </span> - </span> - )} + )} {!loading && - this.state.success && ( - <span className="text-success"> - <i className="icon-check spacer-right" /> - {translate('settings.state.saved')} - </span> - )} + this.state.success && ( + <span className="text-success"> + <i className="icon-check spacer-right" /> + {translate('settings.state.saved')} + </span> + )} </div> <Input 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 7c9727e99f4..73557269222 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 @@ -51,12 +51,12 @@ export default class EncryptionApp extends React.PureComponent { </header> {!this.props.loading && - !this.props.secretKeyAvailable && ( - <GenerateSecretKeyForm - secretKey={this.props.secretKey} - generateSecretKey={this.props.generateSecretKey} - /> - )} + !this.props.secretKeyAvailable && ( + <GenerateSecretKeyForm + secretKey={this.props.secretKey} + generateSecretKey={this.props.generateSecretKey} + /> + )} {this.props.secretKeyAvailable && ( <EncryptionForm diff --git a/server/sonar-web/src/main/js/apps/system/components/ChangeLogLevelForm.tsx b/server/sonar-web/src/main/js/apps/system/components/ChangeLogLevelForm.tsx index 045142edbf9..932f008b324 100644 --- a/server/sonar-web/src/main/js/apps/system/components/ChangeLogLevelForm.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/ChangeLogLevelForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { setLogLevel } from '../../../api/system'; import { translate } from '../../../helpers/l10n'; import { LOGS_LEVELS } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/ChangeLogLevelForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/ChangeLogLevelForm-test.tsx.snap index 26e85fbe63e..a3cd26a208b 100644 --- a/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/ChangeLogLevelForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/ChangeLogLevelForm-test.tsx.snap @@ -12,7 +12,9 @@ exports[`should display some warning messages for non INFO levels 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <form id="set-log-level-form" @@ -30,6 +32,7 @@ exports[`should display some warning messages for non INFO levels 1`] = ` > <p className="spacer-bottom" + key="INFO" > <input checked={false} @@ -49,6 +52,7 @@ exports[`should display some warning messages for non INFO levels 1`] = ` </p> <p className="spacer-bottom" + key="DEBUG" > <input checked={true} @@ -68,6 +72,7 @@ exports[`should display some warning messages for non INFO levels 1`] = ` </p> <p className="spacer-bottom" + key="TRACE" > <input checked={false} @@ -129,7 +134,9 @@ exports[`should render correctly 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <form id="set-log-level-form" @@ -147,6 +154,7 @@ exports[`should render correctly 1`] = ` > <p className="spacer-bottom" + key="INFO" > <input checked={true} @@ -166,6 +174,7 @@ exports[`should render correctly 1`] = ` </p> <p className="spacer-bottom" + key="DEBUG" > <input checked={false} @@ -185,6 +194,7 @@ exports[`should render correctly 1`] = ` </p> <p className="spacer-bottom" + key="TRACE" > <input checked={false} diff --git a/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/ClusterSysInfos-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/ClusterSysInfos-test.tsx.snap index 6db92bdf46b..4cee8e00890 100644 --- a/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/ClusterSysInfos-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/ClusterSysInfos-test.tsx.snap @@ -28,6 +28,7 @@ exports[`should support more than two nodes 1`] = ` <HealthCard health="GREEN" healthCauses={Array []} + key="Bar" name="Bar" onClick={[Function]} open={false} @@ -50,6 +51,7 @@ exports[`should support more than two nodes 1`] = ` <HealthCard health="YELLOW" healthCauses={Array []} + key="Baz" name="Baz" onClick={[Function]} open={false} diff --git a/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/StandaloneSysInfos-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/StandaloneSysInfos-test.tsx.snap index ba562c42b3b..13877f72b86 100644 --- a/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/StandaloneSysInfos-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/__tests__/__snapshots__/StandaloneSysInfos-test.tsx.snap @@ -21,6 +21,7 @@ exports[`should render correctly 1`] = ` } /> <HealthCard + key="Web" name="Web" onClick={[Function]} open={false} @@ -33,6 +34,7 @@ exports[`should render correctly 1`] = ` } /> <HealthCard + key="Compute Engine" name="Compute Engine" onClick={[Function]} open={true} @@ -45,6 +47,7 @@ exports[`should render correctly 1`] = ` } /> <HealthCard + key="Search Engine" name="Search Engine" onClick={[Function]} open={false} diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/HealthCard-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/HealthCard-test.tsx.snap index 77afaf39ea2..fe7c59a4286 100644 --- a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/HealthCard-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/HealthCard-test.tsx.snap @@ -125,6 +125,7 @@ exports[`should show a main section and multiple sub sections 1`] = ` "db": "test", } } + key="Database" name="Database" /> <Section @@ -133,6 +134,7 @@ exports[`should show a main section and multiple sub sections 1`] = ` "Elastic": "search", } } + key="Elasticseach" name="Elasticseach" /> </div> diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/HealthItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/HealthItem-test.tsx.snap index 81f4aa9ba6a..6b224445797 100644 --- a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/HealthItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/HealthItem-test.tsx.snap @@ -28,6 +28,7 @@ exports[`should render correctly 1`] = ` className="spacer-right" health="RED" healthCause="foo" + key="0" /> <Tooltip overlay="system.current_health_of_x.Foo" @@ -51,11 +52,13 @@ exports[`should render multiple health causes 1`] = ` className="spacer-right" health="YELLOW" healthCause="foo" + key="0" /> <HealthCauseItem className="spacer-right" health="YELLOW" healthCause="bar" + key="1" /> <StatusIndicator color="yellow" diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/Section-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/Section-test.tsx.snap index 20fce92a9b7..ecbb9a4b5b3 100644 --- a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/Section-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/Section-test.tsx.snap @@ -8,7 +8,9 @@ exports[`should not render a title 1`] = ` className="data zebra" > <tbody> - <tr> + <tr + key="foo" + > <td className="thin" > @@ -50,7 +52,9 @@ exports[`should render correctly 1`] = ` id="foo" > <tbody> - <tr> + <tr + key="foo" + > <td className="thin" > @@ -73,7 +77,9 @@ exports[`should render correctly 1`] = ` /> </td> </tr> - <tr> + <tr + key="bar" + > <td className="thin" > @@ -96,7 +102,9 @@ exports[`should render correctly 1`] = ` /> </td> </tr> - <tr> + <tr + key="baz" + > <td className="thin" > diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/SysInfoItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/SysInfoItem-test.tsx.snap index b02b9854bdf..86c9310e1d7 100644 --- a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/SysInfoItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/SysInfoItem-test.tsx.snap @@ -4,192 +4,206 @@ exports[`should render object correctly 1`] = ` Array [ <ObjectItem value={ - Object { - "bar": Object { - "a": 1, - "b": "b", - }, - "baz": true, - "foo": "Far", - } + Object { + "bar": Object { + "a": 1, + "b": "b", + }, + "baz": true, + "foo": "Far", + } } -> + > <table - className="data" + className="data" > - <tbody> - <tr> - <td - className="thin nowrap" + <tbody> + <tr + key="foo" + > + <td + className="thin nowrap" + > + foo + </td> + <td> + <SysInfoItem + name="foo" + value="Far" + > + <code> + Far + </code> + </SysInfoItem> + </td> + </tr> + <tr + key="bar" + > + <td + className="thin nowrap" + > + bar + </td> + <td> + <SysInfoItem + name="bar" + value={ + Object { + "a": 1, + "b": "b", + } + } + > + <ObjectItem + value={ + Object { + "a": 1, + "b": "b", + } + } + > + <table + className="data" > - foo - </td> - <td> - <SysInfoItem - name="foo" - value="Far" + <tbody> + <tr + key="a" > - <code> - Far - </code> - </SysInfoItem> - </td> - </tr> - <tr> - <td - className="thin nowrap" - > - bar - </td> - <td> - <SysInfoItem - name="bar" - value={ - Object { - "a": 1, - "b": "b", - } - } - > - <ObjectItem - value={ - Object { - "a": 1, - "b": "b", - } - } + <td + className="thin nowrap" + > + a + </td> + <td> + <SysInfoItem + name="a" + value={1} > - <table - className="data" - > - <tbody> - <tr> - <td - className="thin nowrap" - > - a - </td> - <td> - <SysInfoItem - name="a" - value={1} - > - <code> - 1 - </code> - </SysInfoItem> - </td> - </tr> - <tr> - <td - className="thin nowrap" - > - b - </td> - <td> - <SysInfoItem - name="b" - value="b" - > - <code> - b - </code> - </SysInfoItem> - </td> - </tr> - </tbody> - </table> - </ObjectItem> - </SysInfoItem> - </td> - </tr> - <tr> - <td - className="thin nowrap" - > - baz - </td> - <td> - <SysInfoItem - name="baz" - value={true} + <code> + 1 + </code> + </SysInfoItem> + </td> + </tr> + <tr + key="b" > - <BooleanItem - value={true} + <td + className="thin nowrap" + > + b + </td> + <td> + <SysInfoItem + name="b" + value="b" > - <CheckIcon> - <svg - height={16} - viewBox="0 0 16 16" - width={16} - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M14.92 4.804q0 0.357-0.25 0.607l-7.679 7.679q-0.25 0.25-0.607 0.25t-0.607-0.25l-4.446-4.446q-0.25-0.25-0.25-0.607t0.25-0.607l1.214-1.214q0.25-0.25 0.607-0.25t0.607 0.25l2.625 2.634 5.857-5.866q0.25-0.25 0.607-0.25t0.607 0.25l1.214 1.214q0.25 0.25 0.25 0.607z" - style={ - Object { - "fill": "currentColor", - } - } - /> - ; - </svg> - </CheckIcon> - </BooleanItem> - </SysInfoItem> - </td> - </tr> - </tbody> + <code> + b + </code> + </SysInfoItem> + </td> + </tr> + </tbody> + </table> + </ObjectItem> + </SysInfoItem> + </td> + </tr> + <tr + key="baz" + > + <td + className="thin nowrap" + > + baz + </td> + <td> + <SysInfoItem + name="baz" + value={true} + > + <BooleanItem + value={true} + > + <CheckIcon> + <svg + height={16} + viewBox="0 0 16 16" + width={16} + xmlns="http://www.w3.org/2000/svg" + > + <path + d="M14.92 4.804q0 0.357-0.25 0.607l-7.679 7.679q-0.25 0.25-0.607 0.25t-0.607-0.25l-4.446-4.446q-0.25-0.25-0.25-0.607t0.25-0.607l1.214-1.214q0.25-0.25 0.607-0.25t0.607 0.25l2.625 2.634 5.857-5.866q0.25-0.25 0.607-0.25t0.607 0.25l1.214 1.214q0.25 0.25 0.25 0.607z" + style={ + Object { + "fill": "currentColor", + } + } + /> + ; + </svg> + </CheckIcon> + </BooleanItem> + </SysInfoItem> + </td> + </tr> + </tbody> </table> -</ObjectItem>, + </ObjectItem>, <ObjectItem value={ - Object { - "a": 1, - "b": "b", - } + Object { + "a": 1, + "b": "b", + } } -> + > <table - className="data" + className="data" > - <tbody> - <tr> - <td - className="thin nowrap" - > - a - </td> - <td> - <SysInfoItem - name="a" - value={1} - > - <code> - 1 - </code> - </SysInfoItem> - </td> - </tr> - <tr> - <td - className="thin nowrap" - > - b - </td> - <td> - <SysInfoItem - name="b" - value="b" - > - <code> - b - </code> - </SysInfoItem> - </td> - </tr> - </tbody> + <tbody> + <tr + key="a" + > + <td + className="thin nowrap" + > + a + </td> + <td> + <SysInfoItem + name="a" + value={1} + > + <code> + 1 + </code> + </SysInfoItem> + </td> + </tr> + <tr + key="b" + > + <td + className="thin nowrap" + > + b + </td> + <td> + <SysInfoItem + name="b" + value="b" + > + <code> + b + </code> + </SysInfoItem> + </td> + </tr> + </tbody> </table> -</ObjectItem>, + </ObjectItem>, ] `; diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx index 0c508a86706..d69ff53c19b 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import SystemUpgradeItem from './SystemUpgradeItem'; import { SystemUpgrade } from '../../../../api/system'; import { translate } from '../../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeIntermediate.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeIntermediate.tsx index ccafec8a1aa..01d546ecdb1 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeIntermediate.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeIntermediate.tsx @@ -54,11 +54,9 @@ export default class SystemUpgradeIntermediate extends React.PureComponent<Props className="button-link little-spacer-bottom" href="#" onClick={this.toggleIntermediatVersions}> - {showMore ? ( - translate('system.hide_intermediate_versions') - ) : ( - translate('system.show_intermediate_versions') - )} + {showMore + ? translate('system.hide_intermediate_versions') + : translate('system.show_intermediate_versions')} <i className={classNames('little-spacer-left', { 'icon-arrow-down': !showMore, diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap index 0f84689c104..86dfdda674a 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap @@ -12,7 +12,9 @@ exports[`should display correctly 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <div className="modal-head" @@ -25,6 +27,7 @@ exports[`should display correctly 1`] = ` className="modal-body" > <SystemUpgradeItem + key="6.3" systemUpgrades={ Array [ Object { @@ -48,6 +51,7 @@ exports[`should display correctly 1`] = ` type="system.latest_version" /> <SystemUpgradeItem + key="5.6.5" systemUpgrades={ Array [ Object { diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeIntermediate-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeIntermediate-test.tsx.snap index 9217e8cb640..80a70b6f48e 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeIntermediate-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeIntermediate-test.tsx.snap @@ -29,6 +29,7 @@ exports[`should display correctly 2`] = ` </a> <div className="note system-upgrade-intermediate" + key="5.6.6" > <DateFormatter date="2017-04-02" @@ -42,6 +43,7 @@ exports[`should display correctly 2`] = ` </div> <div className="note system-upgrade-intermediate" + key="5.6.5" > <DateFormatter date="2017-03-01" diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap index 15f11c439b6..e6e4afad432 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap @@ -13,7 +13,7 @@ exports[`should display correctly 1`] = ` "version": <b> SonarQube 5.6.7 - </b>, + </b>, } } /> diff --git a/server/sonar-web/src/main/js/apps/system/utils.ts b/server/sonar-web/src/main/js/apps/system/utils.ts index 7d6ccca5a0d..613dccb9a93 100644 --- a/server/sonar-web/src/main/js/apps/system/utils.ts +++ b/server/sonar-web/src/main/js/apps/system/utils.ts @@ -54,7 +54,7 @@ export function ignoreInfoFields(sysInfoObject: SysValueObject): SysValueObject 'Name', PLUGINS_FIELD, SETTINGS_FIELD - ]); + ]) as SysValueObject; } export function getHealth(sysInfoObject: SysValueObject): HealthType { @@ -130,21 +130,21 @@ function getSystemData(sysInfoData: SysInfo): SysValueObject { export function getClusterMainCardSection(sysInfoData: ClusterSysInfo): SysValueObject { return { ...getSystemData(sysInfoData), - ...omit(sysInfoData, [ + ...(omit(sysInfoData, [ 'Application Nodes', PLUGINS_FIELD, 'Search Nodes', SETTINGS_FIELD, 'Statistics', 'System' - ]) + ]) as SysValueObject) }; } export function getStandaloneMainSections(sysInfoData: SysInfo): SysValueObject { return { ...getSystemData(sysInfoData), - ...omitBy( + ...(omitBy( sysInfoData, (value, key) => value == null || @@ -152,15 +152,17 @@ export function getStandaloneMainSections(sysInfoData: SysInfo): SysValueObject key.startsWith('Compute Engine') || key.startsWith('Search') || key.startsWith('Web') - ) + ) as SysValueObject) }; } export function getStandaloneSecondarySections(sysInfoData: SysInfo): SysInfoSection { return { - Web: pickBy(sysInfoData, (_, key) => key.startsWith('Web')), - 'Compute Engine': pickBy(sysInfoData, (_, key) => key.startsWith('Compute Engine')), - 'Search Engine': pickBy(sysInfoData, (_, key) => key.startsWith('Search')) + Web: pickBy(sysInfoData, (_, key) => key.startsWith('Web')) as SysValueObject, + 'Compute Engine': pickBy(sysInfoData, (_, key) => + key.startsWith('Compute Engine') + ) as SysValueObject, + 'Search Engine': pickBy(sysInfoData, (_, key) => key.startsWith('Search')) as SysValueObject }; } 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 116b4c7d8c4..c890c3d9b38 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 @@ -229,13 +229,13 @@ export default class OrganizationStep extends React.PureComponent { )} {this.getSelectedOrganization() != null && - !this.state.loading && ( - <div className="big-spacer-top"> - <button className="js-continue" onClick={this.handleContinueClick}> - {translate('continue')} - </button> - </div> - )} + !this.state.loading && ( + <div className="big-spacer-top"> + <button className="js-continue" onClick={this.handleContinueClick}> + {translate('continue')} + </button> + </div> + )} </div> ); }; diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/__snapshots__/Onboarding-test.js.snap b/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/__snapshots__/Onboarding-test.js.snap index 55409e86250..9c24b5b42a4 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/__snapshots__/Onboarding-test.js.snap +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/__snapshots__/Onboarding-test.js.snap @@ -5,6 +5,7 @@ exports[`guides for on-premise 1`] = ` className="modal-container" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="onboarding.header" titleTemplate="%s" @@ -71,6 +72,7 @@ exports[`guides for on-premise 2`] = ` className="modal-container" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="onboarding.header" titleTemplate="%s" @@ -138,6 +140,7 @@ exports[`guides for sonarcloud 1`] = ` className="modal-container" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="onboarding.header.sonarcloud" titleTemplate="%s" @@ -217,6 +220,7 @@ exports[`guides for sonarcloud 2`] = ` className="modal-container" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="onboarding.header.sonarcloud" titleTemplate="%s" @@ -297,6 +301,7 @@ exports[`guides for sonarcloud 3`] = ` className="modal-container" > <HelmetWrapper + defer={true} encodeSpecialCharacters={true} title="onboarding.header.sonarcloud" titleTemplate="%s" diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Command-test.js.snap b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Command-test.js.snap index 9ce1c887f5f..f456088c24a 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Command-test.js.snap +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Command-test.js.snap @@ -6,11 +6,11 @@ exports[`renders correctly 1`] = ` > <pre> foo - bar +bar </pre> <button data-clipboard-text="foo - bar" +bar" > copy </button> diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaGradle-test.js.snap b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaGradle-test.js.snap index 559864e0d90..9361ccc33a3 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaGradle-test.js.snap +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaGradle-test.js.snap @@ -17,8 +17,8 @@ exports[`renders correctly 1`] = ` /> <Command command="plugins { - id \\"org.sonarqube\\" version \\"2.5\\" - }" + id \\"org.sonarqube\\" version \\"2.5\\" +}" /> <p className="spacer-top spacer-bottom markdown" @@ -71,8 +71,8 @@ exports[`renders correctly 2`] = ` /> <Command command="plugins { - id \\"org.sonarqube\\" version \\"2.5\\" - }" + id \\"org.sonarqube\\" version \\"2.5\\" +}" /> <p className="spacer-top spacer-bottom markdown" 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 a420dad822c..4354b75b1e0 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,13 +39,13 @@ export default class UsersSelectSearchValue extends React.PureComponent { return ( <div className="Select-value" title={user ? user.name : ''}> {user && - 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> - )} + 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> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UsersSelectSearch-test.js.snap b/server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UsersSelectSearch-test.js.snap index 483f49d3ea0..900354c4376 100644 --- a/server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UsersSelectSearch-test.js.snap +++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UsersSelectSearch-test.js.snap @@ -12,6 +12,7 @@ exports[`should render correctly 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -33,6 +34,8 @@ exports[`should render correctly 1`] = ` onChange={[Function]} onCloseResetsInput={true} onInputChange={[Function]} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={Array []} pageSize={5} @@ -81,6 +84,7 @@ exports[`should render correctly 3`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -102,6 +106,8 @@ exports[`should render correctly 3`] = ` onChange={[Function]} onCloseResetsInput={true} onInputChange={[Function]} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={ Array [ 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 06bce67949d..f0b5eed39e6 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 @@ -169,16 +169,16 @@ export default class Action extends React.PureComponent<Props, State> { {this.renderTabs()} {showParams && - action.params && ( - <Params - params={action.params} - showDeprecated={this.props.showDeprecated} - showInternal={this.props.showInternal} - /> - )} + 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/Params.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx index 9f32210fc63..4dbacf06bd0 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 @@ -55,19 +55,19 @@ export default function Params({ params, showDeprecated, showInternal }: Props) )} {showDeprecated && - param.deprecatedKey && ( - <div className="little-spacer-top"> - <code>{param.deprecatedKey}</code> - </div> - )} + param.deprecatedKey && ( + <div className="little-spacer-top"> + <code>{param.deprecatedKey}</code> + </div> + )} {showDeprecated && - param.deprecatedKey && - param.deprecatedKeySince && ( - <div className="little-spacer-top"> - <DeprecatedBadge since={param.deprecatedKeySince} /> - </div> - )} + param.deprecatedKey && + param.deprecatedKeySince && ( + <div className="little-spacer-top"> + <DeprecatedBadge since={param.deprecatedKeySince} /> + </div> + )} <div className="note little-spacer-top"> {param.required ? 'required' : 'optional'} diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/ActionChangelog-test.tsx.snap b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/ActionChangelog-test.tsx.snap index 8c3eb7ace6d..b86b69c795d 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/ActionChangelog-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/ActionChangelog-test.tsx.snap @@ -6,6 +6,7 @@ exports[`should render 1`] = ` > <li className="spacer-top" + key="0" > <span className="spacer-right badge" @@ -16,6 +17,7 @@ exports[`should render 1`] = ` </li> <li className="spacer-top" + key="1" > <span className="spacer-right badge" diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Domain-test.tsx.snap b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Domain-test.tsx.snap index e1c93d26f4a..2bed8feb6db 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Domain-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Domain-test.tsx.snap @@ -69,6 +69,7 @@ exports[`should also render actions with a description matching the query 1`] = "path": "api", } } + key="api/foo" showDeprecated={false} showInternal={false} /> @@ -117,6 +118,7 @@ exports[`should also render actions with a description matching the query 1`] = "path": "api", } } + key="api/baz" showDeprecated={false} showInternal={false} /> @@ -233,6 +235,7 @@ exports[`should render deprecated actions 1`] = ` "path": "api", } } + key="api/foo" showDeprecated={true} showInternal={false} /> @@ -293,6 +296,7 @@ exports[`should render internal actions 1`] = ` "path": "api", } } + key="api/foo" showDeprecated={false} showInternal={true} /> @@ -361,6 +365,7 @@ exports[`should render only actions matching the query 1`] = ` "path": "api", } } + key="api/foo" showDeprecated={false} showInternal={false} /> diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Menu-test.tsx.snap b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Menu-test.tsx.snap index 34329aa2fbf..87783ec3cf9 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Menu-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Menu-test.tsx.snap @@ -9,6 +9,7 @@ exports[`should also render domains with an actions description matching the que > <Link className="list-group-item" + key="bar" onlyActiveOnIndex={false} style={Object {}} to="/web_api/bar" @@ -29,6 +30,7 @@ exports[`should also render domains with an actions description matching the que </Link> <Link className="list-group-item" + key="baz" onlyActiveOnIndex={false} style={Object {}} to="/web_api/baz" @@ -60,6 +62,7 @@ exports[`should not render deprecated domains 1`] = ` > <Link className="list-group-item" + key="foo" onlyActiveOnIndex={false} style={Object {}} to="/web_api/foo" @@ -91,6 +94,7 @@ exports[`should not render internal domains 1`] = ` > <Link className="list-group-item" + key="foo" onlyActiveOnIndex={false} style={Object {}} to="/web_api/foo" @@ -122,6 +126,7 @@ exports[`should render deprecated domains 1`] = ` > <Link className="list-group-item" + key="foo" onlyActiveOnIndex={false} style={Object {}} to="/web_api/foo" @@ -142,6 +147,7 @@ exports[`should render deprecated domains 1`] = ` </Link> <Link className="list-group-item" + key="bar" onlyActiveOnIndex={false} style={Object {}} to="/web_api/bar" @@ -173,6 +179,7 @@ exports[`should render internal domains 1`] = ` > <Link className="list-group-item" + key="foo" onlyActiveOnIndex={false} style={Object {}} to="/web_api/foo" @@ -193,6 +200,7 @@ exports[`should render internal domains 1`] = ` </Link> <Link className="list-group-item" + key="bar" onlyActiveOnIndex={false} style={Object {}} to="/web_api/bar" @@ -225,6 +233,7 @@ exports[`should render only domains with an action matching the query 1`] = ` > <Link className="list-group-item" + key="foo" onlyActiveOnIndex={false} style={Object {}} to="/web_api/foo" diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Params-test.tsx.snap b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Params-test.tsx.snap index c6a75522309..5d33f4f9613 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Params-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Params-test.tsx.snap @@ -16,7 +16,9 @@ exports[`should render deprecated and internal parameters 1`] = ` > <table> <tbody> - <tr> + <tr + key="foo" + > <td className="markdown" style={ @@ -59,7 +61,9 @@ exports[`should render deprecated and internal parameters 1`] = ` } /> </tr> - <tr> + <tr + key="foo" + > <td className="markdown" style={ @@ -118,7 +122,9 @@ exports[`should render deprecated key 1`] = ` > <table> <tbody> - <tr> + <tr + key="foo" + > <td className="markdown" style={ 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 5da88260309..1f6aaeeef25 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 @@ -137,13 +137,13 @@ export default class Line extends React.PureComponent { ))} {this.props.displayIssues && - !this.props.displayAllIssues && ( - <LineIssuesIndicator - issues={this.props.issues} - line={line} - onClick={this.handleIssuesIndicatorClick} - /> - )} + !this.props.displayAllIssues && ( + <LineIssuesIndicator + issues={this.props.issues} + line={line} + onClick={this.handleIssuesIndicatorClick} + /> + )} <LineCode branch={this.props.branch} 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 f3aea8272c9..a71c07d8002 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 @@ -229,19 +229,19 @@ export default class LineCode extends React.PureComponent { <pre ref={node => (this.codeNode = node)}>{renderedTokens}</pre> </div> {showIssues && - issues.length > 0 && ( - <LineIssuesList - branch={this.props.branch} - displayIssueLocationsCount={this.props.displayIssueLocationsCount} - displayIssueLocationsLink={this.props.displayIssueLocationsLink} - issues={issues} - onIssueChange={this.props.onIssueChange} - onIssueClick={onIssueSelect} - onPopupToggle={this.props.onPopupToggle} - openPopup={this.props.openPopup} - selectedIssue={selectedIssue} - /> - )} + issues.length > 0 && ( + <LineIssuesList + branch={this.props.branch} + displayIssueLocationsCount={this.props.displayIssueLocationsCount} + displayIssueLocationsLink={this.props.displayIssueLocationsLink} + issues={issues} + onIssueChange={this.props.onIssueChange} + onIssueClick={onIssueSelect} + onPopupToggle={this.props.onPopupToggle} + openPopup={this.props.openPopup} + selectedIssue={selectedIssue} + /> + )} </td> ); } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCode-test.js.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCode-test.js.snap index 9f6da3b0b4b..2cfc320db91 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCode-test.js.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCode-test.js.snap @@ -11,21 +11,25 @@ exports[`render code 1`] = ` <pre> <span className="k source-line-code-issue" + key="0" > class </span> <span className="" + key="1" > </span> <span className="sym sym-1" + key="2" > Foo </span> <span className="" + key="3" > { </span> diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineDuplicationBlock-test.js.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineDuplicationBlock-test.js.snap index 96f320c4382..c8a4ee23981 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineDuplicationBlock-test.js.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineDuplicationBlock-test.js.snap @@ -9,6 +9,7 @@ exports[`render duplicated line 1`] = ` className="source-meta source-line-duplications-extra source-line-duplicated" data-index={1} data-line-number={3} + key="1" onClick={[Function]} role="button" tabIndex="0" @@ -25,6 +26,7 @@ exports[`render not duplicated line 1`] = ` className="source-meta source-line-duplications-extra" data-index={1} data-line-number={3} + key="1" > <div className="source-line-bar" diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssuesList-test.js.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssuesList-test.js.snap index 6bd44307b2f..1bae77158dd 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssuesList-test.js.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssuesList-test.js.snap @@ -12,6 +12,7 @@ exports[`render issues list 1`] = ` "key": "foo", } } + key="foo" onClick={[Function]} onPopupToggle={[Function]} openPopup={null} @@ -25,6 +26,7 @@ exports[`render issues list 1`] = ` "key": "bar", } } + key="bar" onClick={[Function]} onPopupToggle={[Function]} openPopup={null} diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/BubbleChart-test.js.snap b/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/BubbleChart-test.js.snap index 0c35f6f5ce5..e5854e7792f 100644 --- a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/BubbleChart-test.js.snap +++ b/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/BubbleChart-test.js.snap @@ -2,6 +2,7 @@ exports[`should display bubbles 1`] = ` <Bubble + key="0" r={45} x={-10} y={52.3015873015873} @@ -22,6 +23,7 @@ exports[`should display bubbles 1`] = ` exports[`should display bubbles 2`] = ` <Bubble + key="1" r={33.57142857142857} x={-75} y={33.57142857142857} @@ -42,6 +44,7 @@ exports[`should display bubbles 2`] = ` exports[`should render bubble links 1`] = ` <Bubble + key="0" link="foo" r={45} x={-10} @@ -74,6 +77,7 @@ exports[`should render bubble links 1`] = ` exports[`should render bubble links 2`] = ` <Bubble + key="1" link="bar" r={33.57142857142857} x={-75} @@ -106,6 +110,7 @@ exports[`should render bubble links 2`] = ` exports[`should render bubbles with click handlers 1`] = ` <Bubble + key="0" link="foo" onClick={[Function]} r={45} @@ -129,6 +134,7 @@ exports[`should render bubbles with click handlers 1`] = ` exports[`should render bubbles with click handlers 2`] = ` <Bubble + key="1" link="bar" onClick={[Function]} r={33.57142857142857} diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/Histogram-test.tsx.snap b/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/Histogram-test.tsx.snap index e7885c89cad..04aacd7b139 100644 --- a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/Histogram-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/Histogram-test.tsx.snap @@ -10,7 +10,9 @@ exports[`renders 1`] = ` transform="translate(10, 10)" > <g> - <g> + <g + key="0" + > <rect className="bar-chart-bar" height={10} @@ -19,7 +21,9 @@ exports[`renders 1`] = ` y={10} /> </g> - <g> + <g + key="1" + > <rect className="bar-chart-bar" height={10} @@ -28,7 +32,9 @@ exports[`renders 1`] = ` y={28} /> </g> - <g> + <g + key="2" + > <rect className="bar-chart-bar" height={10} @@ -52,7 +58,9 @@ exports[`renders with yValues 1`] = ` transform="translate(10, 10)" > <g> - <g> + <g + key="0" + > <rect className="bar-chart-bar" height={10} @@ -70,7 +78,9 @@ exports[`renders with yValues 1`] = ` 100.0 </text> </g> - <g> + <g + key="1" + > <rect className="bar-chart-bar" height={10} @@ -88,7 +98,9 @@ exports[`renders with yValues 1`] = ` 75.0 </text> </g> - <g> + <g + key="2" + > <rect className="bar-chart-bar" height={10} @@ -121,7 +133,9 @@ exports[`renders with yValues and yTicks 1`] = ` transform="translate(10, 10)" > <g> - <g> + <g + key="0" + > <rect className="bar-chart-bar" height={10} @@ -148,7 +162,9 @@ exports[`renders with yValues and yTicks 1`] = ` a </text> </g> - <g> + <g + key="1" + > <rect className="bar-chart-bar" height={10} @@ -175,7 +191,9 @@ exports[`renders with yValues and yTicks 1`] = ` b </text> </g> - <g> + <g + key="2" + > <rect className="bar-chart-bar" height={10} @@ -217,7 +235,9 @@ exports[`renders with yValues, yTicks and yTooltips 1`] = ` transform="translate(10, 10)" > <g> - <g> + <g + key="0" + > <rect className="bar-chart-bar" height={10} @@ -226,6 +246,7 @@ exports[`renders with yValues, yTicks and yTooltips 1`] = ` y={10} /> <Tooltip + key="0" overlay="a - 100" placement="top" > @@ -249,7 +270,9 @@ exports[`renders with yValues, yTicks and yTooltips 1`] = ` a </text> </g> - <g> + <g + key="1" + > <rect className="bar-chart-bar" height={10} @@ -258,6 +281,7 @@ exports[`renders with yValues, yTicks and yTooltips 1`] = ` y={28} /> <Tooltip + key="1" overlay="b - 75" placement="top" > @@ -281,7 +305,9 @@ exports[`renders with yValues, yTicks and yTooltips 1`] = ` b </text> </g> - <g> + <g + key="2" + > <rect className="bar-chart-bar" height={10} @@ -290,6 +316,7 @@ exports[`renders with yValues, yTicks and yTooltips 1`] = ` y={46} /> <Tooltip + key="2" overlay="c - 150" placement="top" > diff --git a/server/sonar-web/src/main/js/components/common/RestartForm.tsx b/server/sonar-web/src/main/js/components/common/RestartForm.tsx index 98f4301ef39..ea72ec34478 100644 --- a/server/sonar-web/src/main/js/components/common/RestartForm.tsx +++ b/server/sonar-web/src/main/js/components/common/RestartForm.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import * as classNames from 'classnames'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { restartAndWait } from '../../api/system'; import { translate } from '../../helpers/l10n'; @@ -59,8 +59,7 @@ export default class RestartForm extends React.PureComponent<Props, State> { contentLabel={header} className="modal" overlayClassName="modal-overlay" - onRequestClose={this.props.onClose} - shouldCloseOnOverlayClick={!restarting}> + onRequestClose={restarting ? undefined : this.props.onClose}> <form id="restart-form" onSubmit={this.handleFormSubmit}> <div className="modal-head"> <h2>{header}</h2> diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MultiSelect-test.js.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MultiSelect-test.js.snap index e9a5eca76b5..2fa03425675 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MultiSelect-test.js.snap +++ b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MultiSelect-test.js.snap @@ -59,6 +59,7 @@ exports[`should render multiselect with selected elements 2`] = ` active={false} custom={false} element="bar" + key="bar" onHover={[Function]} onSelectChange={[Function]} selected={true} @@ -67,6 +68,7 @@ exports[`should render multiselect with selected elements 2`] = ` active={false} custom={false} element="foo" + key="foo" onHover={[Function]} onSelectChange={[Function]} selected={false} @@ -75,6 +77,7 @@ exports[`should render multiselect with selected elements 2`] = ` active={false} custom={false} element="baz" + key="baz" onHover={[Function]} onSelectChange={[Function]} selected={false} @@ -113,6 +116,7 @@ exports[`should render multiselect with selected elements 3`] = ` active={false} custom={false} element="bar" + key="bar" onHover={[Function]} onSelectChange={[Function]} selected={true} @@ -121,6 +125,7 @@ exports[`should render multiselect with selected elements 3`] = ` active={false} custom={false} element="foo" + key="foo" onHover={[Function]} onSelectChange={[Function]} selected={false} @@ -129,6 +134,7 @@ exports[`should render multiselect with selected elements 3`] = ` active={true} custom={false} element="baz" + key="baz" onHover={[Function]} onSelectChange={[Function]} selected={false} @@ -167,6 +173,7 @@ exports[`should render multiselect with selected elements 4`] = ` active={false} custom={false} element="bar" + key="bar" onHover={[Function]} onSelectChange={[Function]} selected={true} @@ -175,6 +182,7 @@ exports[`should render multiselect with selected elements 4`] = ` active={false} custom={false} element="foo" + key="foo" onHover={[Function]} onSelectChange={[Function]} selected={false} @@ -183,6 +191,7 @@ exports[`should render multiselect with selected elements 4`] = ` active={true} custom={false} element="baz" + key="baz" onHover={[Function]} onSelectChange={[Function]} selected={false} @@ -191,6 +200,7 @@ exports[`should render multiselect with selected elements 4`] = ` active={false} custom={true} element="test" + key="test" onHover={[Function]} onSelectChange={[Function]} selected={false} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SelectList-test.js.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SelectList-test.js.snap index 29ae52e453a..c1c91a2ba8e 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SelectList-test.js.snap +++ b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SelectList-test.js.snap @@ -33,6 +33,7 @@ exports[`should render correctly with children 1`] = ` <SelectListItem active="seconditem" item="item" + key=".$item" onHover={[Function]} onSelect={[Function]} > @@ -44,6 +45,7 @@ exports[`should render correctly with children 1`] = ` <SelectListItem active="seconditem" item="seconditem" + key=".$seconditem" onHover={[Function]} onSelect={[Function]} > @@ -55,6 +57,7 @@ exports[`should render correctly with children 1`] = ` <SelectListItem active="seconditem" item="third" + key=".$third" onHover={[Function]} onSelect={[Function]} > @@ -73,18 +76,21 @@ exports[`should render correctly without children 1`] = ` <SelectListItem active="seconditem" item="item" + key="item" onHover={[Function]} onSelect={[Function]} /> <SelectListItem active="seconditem" item="seconditem" + key="seconditem" onHover={[Function]} onSelect={[Function]} /> <SelectListItem active="seconditem" item="third" + key="third" onHover={[Function]} onSelect={[Function]} /> 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 265643354e6..1bb65c64457 100644 --- a/server/sonar-web/src/main/js/components/controls/DateInput.tsx +++ b/server/sonar-web/src/main/js/components/controls/DateInput.tsx @@ -87,7 +87,10 @@ export default class DateInput extends React.PureComponent<Props> { } render() { - const inputProps = pick(this.props, ['placeholder', 'name']); + const inputProps: { name?: string; placeholder?: string } = pick(this.props, [ + 'placeholder', + 'name' + ]); return ( <span className={classNames('date-input-control', this.props.className)}> 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 39ca6539c59..496f039ca82 100644 --- a/server/sonar-web/src/main/js/components/controls/SearchSelect.js +++ b/server/sonar-web/src/main/js/components/controls/SearchSelect.js @@ -117,11 +117,9 @@ 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/SimpleModal.tsx b/server/sonar-web/src/main/js/components/controls/SimpleModal.tsx index 825ace80a34..057fdf5b323 100644 --- a/server/sonar-web/src/main/js/components/controls/SimpleModal.tsx +++ b/server/sonar-web/src/main/js/components/controls/SimpleModal.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; export interface ChildrenProps { onCloseClick: (event: React.SyntheticEvent<HTMLElement>) => void; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioToggle-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioToggle-test.tsx.snap index c0aa0d1ab89..d9c8fa8d1f9 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioToggle-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioToggle-test.tsx.snap @@ -4,7 +4,9 @@ exports[`accepts advanced options fields 1`] = ` <ul className="radio-toggle" > - <li> + <li + key="one" + > <input checked={false} id="sample__one" @@ -24,7 +26,9 @@ exports[`accepts advanced options fields 1`] = ` </label> </Tooltip> </li> - <li> + <li + key="two" + > <input checked={false} disabled={true} @@ -52,7 +56,9 @@ exports[`renders 1`] = ` <ul className="radio-toggle" > - <li> + <li + key="one" + > <input checked={false} id="sample__one" @@ -67,7 +73,9 @@ exports[`renders 1`] = ` first </label> </li> - <li> + <li + key="two" + > <input checked={false} id="sample__two" diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchSelect-test.js.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchSelect-test.js.snap index d3ea2edb7b0..7013269949a 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchSelect-test.js.snap +++ b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchSelect-test.js.snap @@ -14,6 +14,7 @@ exports[`should render Select 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -37,6 +38,8 @@ exports[`should render Select 1`] = ` onChange={[Function]} onCloseResetsInput={true} onInputChange={[Function]} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} options={Array []} pageSize={5} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap index 4778ef47dbc..ea433bf1532 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap @@ -12,7 +12,9 @@ exports[`renders 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <div /> </Modal> @@ -30,7 +32,9 @@ exports[`submits 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <button disabled={false} @@ -53,7 +57,9 @@ exports[`submits 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <button disabled={true} @@ -76,7 +82,9 @@ exports[`submits 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <button disabled={false} 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 5141e4d8032..6b8b4fd94c8 100644 --- a/server/sonar-web/src/main/js/components/issue/IssueView.js +++ b/server/sonar-web/src/main/js/components/issue/IssueView.js @@ -108,18 +108,18 @@ export default class IssueView extends React.PureComponent { onChange={this.props.onChange} /> {issue.comments && - issue.comments.length > 0 && ( - <div className="issue-comments"> - {issue.comments.map(comment => ( - <IssueCommentLine - comment={comment} - key={comment.key} - onEdit={this.editComment} - onDelete={this.deleteComment} - /> - ))} - </div> - )} + issue.comments.length > 0 && ( + <div className="issue-comments"> + {issue.comments.map(comment => ( + <IssueCommentLine + comment={comment} + key={comment.key} + onEdit={this.editComment} + onDelete={this.deleteComment} + /> + ))} + </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" /> 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 fa66812411b..bb80c21b786 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 @@ -90,11 +90,9 @@ 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"> diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/ChangelogPopup-test.js.snap b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/ChangelogPopup-test.js.snap index 1e649d62abb..65cade73cf8 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/ChangelogPopup-test.js.snap +++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/ChangelogPopup-test.js.snap @@ -25,7 +25,9 @@ exports[`should render the changelog popup correctly 1`] = ` created_by john.david.dalton@gmail.com </td> </tr> - <tr> + <tr + key="0" + > <td className="thin text-left text-top nowrap" > @@ -53,6 +55,7 @@ exports[`should render the changelog popup correctly 1`] = ` "oldValue": "CRITICAL", } } + key="severity" /> </td> </tr> diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetSeverityPopup-test.js.snap b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetSeverityPopup-test.js.snap index 8d0995dce23..bc4c8e02c7f 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetSeverityPopup-test.js.snap +++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetSeverityPopup-test.js.snap @@ -19,6 +19,7 @@ exports[`should render tags popup correctly 1`] = ` > <SelectListItem item="BLOCKER" + key="BLOCKER" > <SeverityIcon className="little-spacer-right" @@ -28,6 +29,7 @@ exports[`should render tags popup correctly 1`] = ` </SelectListItem> <SelectListItem item="CRITICAL" + key="CRITICAL" > <SeverityIcon className="little-spacer-right" @@ -37,6 +39,7 @@ exports[`should render tags popup correctly 1`] = ` </SelectListItem> <SelectListItem item="MAJOR" + key="MAJOR" > <SeverityIcon className="little-spacer-right" @@ -46,6 +49,7 @@ exports[`should render tags popup correctly 1`] = ` </SelectListItem> <SelectListItem item="MINOR" + key="MINOR" > <SeverityIcon className="little-spacer-right" @@ -55,6 +59,7 @@ exports[`should render tags popup correctly 1`] = ` </SelectListItem> <SelectListItem item="INFO" + key="INFO" > <SeverityIcon className="little-spacer-right" diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetTransitionPopup-test.js.snap b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetTransitionPopup-test.js.snap index 249ca05ae77..4c67a6da4ec 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetTransitionPopup-test.js.snap +++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetTransitionPopup-test.js.snap @@ -18,24 +18,28 @@ exports[`should render tags popup correctly 1`] = ` > <SelectListItem item="confirm" + key="confirm" title="issue.transition.confirm.description" > issue.transition.confirm </SelectListItem> <SelectListItem item="resolve" + key="resolve" title="issue.transition.resolve.description" > issue.transition.resolve </SelectListItem> <SelectListItem item="falsepositive" + key="falsepositive" title="issue.transition.falsepositive.description" > issue.transition.falsepositive </SelectListItem> <SelectListItem item="wontfix" + key="wontfix" title="issue.transition.wontfix.description" > issue.transition.wontfix diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetTypePopup-test.js.snap b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetTypePopup-test.js.snap index fb727840075..6313549adb2 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetTypePopup-test.js.snap +++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetTypePopup-test.js.snap @@ -17,6 +17,7 @@ exports[`should render tags popup correctly 1`] = ` > <SelectListItem item="BUG" + key="BUG" > <IssueTypeIcon className="little-spacer-right" @@ -26,6 +27,7 @@ exports[`should render tags popup correctly 1`] = ` </SelectListItem> <SelectListItem item="VULNERABILITY" + key="VULNERABILITY" > <IssueTypeIcon className="little-spacer-right" @@ -35,6 +37,7 @@ exports[`should render tags popup correctly 1`] = ` </SelectListItem> <SelectListItem item="CODE_SMELL" + key="CODE_SMELL" > <IssueTypeIcon className="little-spacer-right" diff --git a/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.js b/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.js index c7544325517..8597c393103 100644 --- a/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.js +++ b/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.js @@ -175,19 +175,19 @@ export default class PreviewGraph extends React.PureComponent { updateTooltip={this.updateTooltip} /> {selectedDate != null && - tooltipXPos != null && - tooltipIdx != null && ( - <PreviewGraphTooltips - formatValue={this.formatValue} - graph={graph} - graphWidth={width} - metrics={this.props.metrics} - selectedDate={selectedDate} - series={series} - tooltipIdx={tooltipIdx} - tooltipPos={tooltipXPos} - /> - )} + tooltipXPos != null && + tooltipIdx != null && ( + <PreviewGraphTooltips + formatValue={this.formatValue} + graph={graph} + graphWidth={width} + metrics={this.props.metrics} + selectedDate={selectedDate} + series={series} + tooltipIdx={tooltipIdx} + tooltipPos={tooltipXPos} + /> + )} </div> )} </AutoSizer> diff --git a/server/sonar-web/src/main/js/components/preview-graph/__tests__/__snapshots__/PreviewGraphTooltips-test.js.snap b/server/sonar-web/src/main/js/components/preview-graph/__tests__/__snapshots__/PreviewGraphTooltips-test.js.snap index 64d9d39a3e4..bd558730f26 100644 --- a/server/sonar-web/src/main/js/components/preview-graph/__tests__/__snapshots__/PreviewGraphTooltips-test.js.snap +++ b/server/sonar-web/src/main/js/components/preview-graph/__tests__/__snapshots__/PreviewGraphTooltips-test.js.snap @@ -27,16 +27,19 @@ exports[`should render correctly 1`] = ` > <tbody> <PreviewGraphTooltipsContent + key="code_smells" style="0" translatedName="Code Smells" value="Formated.15" /> <PreviewGraphTooltipsContent + key="bugs" style="1" translatedName="Bugs" value="Formated.0" /> <PreviewGraphTooltipsContent + key="vulnerabilities" style="2" translatedName="Vulnerabilities" value="Formated.1" diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts index aae5afb93bc..5de3cb928fb 100644 --- a/server/sonar-web/src/main/js/helpers/urls.ts +++ b/server/sonar-web/src/main/js/helpers/urls.ts @@ -76,7 +76,7 @@ export function getIssuesUrl(query: Query): Location { * Generate URL for a component's issues page */ export function getComponentIssuesUrl(componentKey: string, query?: Query): Location { - return { pathname: '/project/issues', query: { ...query || {}, id: componentKey } }; + return { pathname: '/project/issues', query: { ...(query || {}), id: componentKey } }; } export function getComponentIssuesUrlAsString(componentKey: string, query?: Query): string { diff --git a/server/sonar-web/src/main/js/store/utils/configureStore.js b/server/sonar-web/src/main/js/store/utils/configureStore.js index 8c5e2d8150b..e356fffe796 100644 --- a/server/sonar-web/src/main/js/store/utils/configureStore.js +++ b/server/sonar-web/src/main/js/store/utils/configureStore.js @@ -24,7 +24,7 @@ const middlewares = [thunk]; const composed = []; if (process.env.NODE_ENV !== 'production') { - const createLogger = require('redux-logger'); + const { createLogger } = require('redux-logger'); middlewares.push(createLogger()); composed.push(window.devToolsExtension ? window.devToolsExtension() : f => f); |