@@ -2,4 +2,8 @@ enableGlobalCache: true | |||
nodeLinker: node-modules | |||
plugins: | |||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs | |||
spec: "@yarnpkg/plugin-interactive-tools" | |||
yarnPath: .yarn/releases/yarn-3.2.4.cjs |
@@ -5,12 +5,12 @@ | |||
"repository": "SonarSource/sonarqube", | |||
"license": "LGPL-3.0", | |||
"dependencies": { | |||
"@emotion/react": "11.10.4", | |||
"@emotion/styled": "11.10.4", | |||
"@emotion/react": "11.10.5", | |||
"@emotion/styled": "11.10.5", | |||
"classnames": "2.3.2", | |||
"clipboard": "2.0.11", | |||
"core-js": "3.25.5", | |||
"d3-array": "3.2.0", | |||
"d3-array": "3.2.1", | |||
"d3-hierarchy": "3.1.2", | |||
"d3-scale": "4.0.2", | |||
"d3-selection": "3.0.0", | |||
@@ -18,7 +18,7 @@ | |||
"d3-zoom": "3.0.0", | |||
"date-fns": "2.29.3", | |||
"diff": "5.1.0", | |||
"dompurify": "2.4.0", | |||
"dompurify": "2.4.1", | |||
"formik": "2.2.9", | |||
"lodash": "4.17.21", | |||
"lunr": "2.3.9", | |||
@@ -32,19 +32,19 @@ | |||
"react-router-dom": "6.3.0", | |||
"react-select": "4.3.1", | |||
"react-virtualized": "9.22.3", | |||
"regenerator-runtime": "0.13.9", | |||
"regenerator-runtime": "0.13.11", | |||
"valid-url": "1.0.9" | |||
}, | |||
"devDependencies": { | |||
"@emotion/jest": "11.10.0", | |||
"@swc/core": "1.3.9", | |||
"@swc/jest": "0.2.23", | |||
"@emotion/jest": "11.10.5", | |||
"@swc/core": "1.3.23", | |||
"@swc/jest": "0.2.24", | |||
"@testing-library/dom": "8.13.0", | |||
"@testing-library/jest-dom": "5.16.3", | |||
"@testing-library/react": "12.1.4", | |||
"@testing-library/jest-dom": "5.16.5", | |||
"@testing-library/react": "12.1.5", | |||
"@testing-library/user-event": "14.0.4", | |||
"@types/cheerio": "0.22.31", | |||
"@types/classnames": "2.3.0", | |||
"@types/classnames": "2.3.1", | |||
"@types/d3-array": "3.0.3", | |||
"@types/d3-hierarchy": "3.1.0", | |||
"@types/d3-scale": "4.0.2", | |||
@@ -55,35 +55,35 @@ | |||
"@types/dompurify": "2.3.4", | |||
"@types/enzyme": "3.10.12", | |||
"@types/jest": "27.4.1", | |||
"@types/lodash": "4.14.149", | |||
"@types/react": "16.14.28", | |||
"@types/react-dom": "16.9.16", | |||
"@types/react-helmet": "5.0.15", | |||
"@types/lodash": "4.14.191", | |||
"@types/react": "16.14.34", | |||
"@types/react-dom": "16.9.17", | |||
"@types/react-helmet": "5.0.21", | |||
"@types/react-modal": "3.13.1", | |||
"@types/react-select": "4.0.16", | |||
"@types/react-select": "4.0.18", | |||
"@types/react-virtualized": "9.21.21", | |||
"@types/valid-url": "1.0.3", | |||
"@typescript-eslint/eslint-plugin": "5.40.1", | |||
"@typescript-eslint/parser": "5.40.1", | |||
"autoprefixer": "10.4.12", | |||
"autoprefixer": "10.4.13", | |||
"chalk": "4.1.2", | |||
"enzyme": "3.11.0", | |||
"enzyme-adapter-react-16": "1.15.6", | |||
"enzyme-adapter-react-16": "1.15.7", | |||
"enzyme-to-json": "3.6.2", | |||
"esbuild": "0.15.11", | |||
"esbuild": "0.15.18", | |||
"esbuild-plugin-postcss2": "0.1.1", | |||
"eslint": "8.25.0", | |||
"eslint-config-sonarqube": "2.1.0", | |||
"eslint-plugin-import": "2.26.0", | |||
"eslint-plugin-jest": "27.1.3", | |||
"eslint-plugin-jest-dom": "4.0.2", | |||
"eslint-plugin-jest": "27.1.7", | |||
"eslint-plugin-jest-dom": "4.0.3", | |||
"eslint-plugin-jsx-a11y": "6.6.1", | |||
"eslint-plugin-promise": "6.1.0", | |||
"eslint-plugin-react": "7.31.10", | |||
"eslint-plugin-promise": "6.1.1", | |||
"eslint-plugin-react": "7.31.11", | |||
"eslint-plugin-react-hooks": "4.6.0", | |||
"eslint-plugin-testing-library": "5.7.3", | |||
"fs-extra": "10.1.0", | |||
"glob": "7.2.0", | |||
"glob": "7.2.3", | |||
"glob-promise": "4.2.2", | |||
"http-proxy": "1.18.1", | |||
"jest": "27.5.1", | |||
@@ -91,7 +91,7 @@ | |||
"jest-junit": "13.0.0", | |||
"jsdom": "19.0.0", | |||
"path-browserify": "1.0.1", | |||
"postcss-calc": "7.0.2", | |||
"postcss-calc": "7.0.5", | |||
"postcss-custom-properties": "9.1.1", | |||
"prettier": "2.7.1", | |||
"react-select-event": "5.5.1", |
@@ -18,7 +18,6 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import classNames from 'classnames'; | |||
import { debounce } from 'lodash'; | |||
import * as React from 'react'; | |||
import { getSuggestions } from '../../../api/components'; | |||
import { ResetButtonLink, SubmitButton } from '../../../components/controls/buttons'; | |||
@@ -51,7 +50,6 @@ export default class ProjectModal extends React.PureComponent<Props, State> { | |||
constructor(props: Props) { | |||
super(props); | |||
this.state = {}; | |||
this.handleSearch = debounce(this.handleSearch, 250); | |||
} | |||
componentDidMount() { | |||
@@ -124,11 +122,11 @@ export default class ProjectModal extends React.PureComponent<Props, State> { | |||
if (query.length < 2) { | |||
this.setState({ open: false, query }); | |||
return Promise.resolve([]); | |||
return; | |||
} | |||
this.setState({ loading: true, query }); | |||
return getSuggestions(query).then( | |||
getSuggestions(query).then( | |||
(r) => { | |||
if (this.mounted) { | |||
let suggestions = undefined; |
@@ -57,6 +57,8 @@ interface State { | |||
submitting: boolean; | |||
} | |||
const DEBOUNCE_DELAY = 250; | |||
type ValidState = State & Required<Pick<State, 'projectKey' | 'projectName'>>; | |||
export default class ManualProjectCreate extends React.PureComponent<Props, State> { | |||
@@ -74,7 +76,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat | |||
mainBranchNameTouched: false, | |||
validatingProjectKey: false, | |||
}; | |||
this.checkFreeKey = debounce(this.checkFreeKey, 250); | |||
this.checkFreeKey = debounce(this.checkFreeKey, DEBOUNCE_DELAY); | |||
} | |||
componentDidMount() { | |||
@@ -97,7 +99,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat | |||
checkFreeKey = (key: string) => { | |||
this.setState({ validatingProjectKey: true }); | |||
return doesComponentExists({ component: key }) | |||
doesComponentExists({ component: key }) | |||
.then((alreadyExist) => { | |||
if (this.mounted && key === this.state.projectKey) { | |||
this.setState({ |
@@ -27,6 +27,7 @@ import withCurrentUserContext from '../../app/components/current-user/withCurren | |||
import ListFooter from '../../components/controls/ListFooter'; | |||
import Suggestions from '../../components/embed-docs-modal/Suggestions'; | |||
import { toShortNotSoISOString } from '../../helpers/dates'; | |||
import { throwGlobalError } from '../../helpers/error'; | |||
import { translate } from '../../helpers/l10n'; | |||
import { hasGlobalPermission } from '../../helpers/users'; | |||
import { Permissions } from '../../types/permissions'; | |||
@@ -116,15 +117,17 @@ export class ProjectManagementApp extends React.PureComponent<Props, State> { | |||
qualifiers: this.state.qualifiers, | |||
visibility: this.state.visibility, | |||
}; | |||
return getComponents(parameters).then((r) => { | |||
if (this.mounted) { | |||
let projects: Project[] = r.components; | |||
if (this.state.page > 1) { | |||
projects = [...this.state.projects, ...projects]; | |||
getComponents(parameters) | |||
.then((r) => { | |||
if (this.mounted) { | |||
let projects: Project[] = r.components; | |||
if (this.state.page > 1) { | |||
projects = [...this.state.projects, ...projects]; | |||
} | |||
this.setState({ ready: true, projects, selection: [], total: r.paging.total }); | |||
} | |||
this.setState({ ready: true, projects, selection: [], total: r.paging.total }); | |||
} | |||
}); | |||
}) | |||
.catch(throwGlobalError); | |||
}; | |||
loadMore = () => { |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import classNames from 'classnames'; | |||
import { Cancelable, debounce } from 'lodash'; | |||
import { debounce, DebouncedFunc } from 'lodash'; | |||
import * as React from 'react'; | |||
import { KeyboardKeys } from '../../helpers/keycodes'; | |||
import { translate, translateWithParameters } from '../../helpers/l10n'; | |||
@@ -48,15 +48,16 @@ interface State { | |||
} | |||
const DEFAULT_MAX_LENGTH = 100; | |||
const DEBOUNCE_DELAY = 250; | |||
export default class SearchBox extends React.PureComponent<Props, State> { | |||
debouncedOnChange: ((query: string) => void) & Cancelable; | |||
debouncedOnChange: DebouncedFunc<(query: string) => void>; | |||
input?: HTMLInputElement | null; | |||
constructor(props: Props) { | |||
super(props); | |||
this.state = { value: props.value || '' }; | |||
this.debouncedOnChange = debounce(this.props.onChange, 250); | |||
this.debouncedOnChange = debounce(this.props.onChange, DEBOUNCE_DELAY); | |||
} | |||
componentDidUpdate(prevProps: Props) { |