*/
import * as classNames from 'classnames';
import { Location } from 'history';
+import { debounce } from 'lodash';
import * as React from 'react';
import Helmet from 'react-helmet';
import { connect } from 'react-redux';
export class App extends React.PureComponent<Props, State> {
mounted = false;
- state: State = {
- breadcrumbs: [],
- loading: true,
- page: 0,
- total: 0
- };
+ state: State;
+
+ constructor(props: Props) {
+ super(props);
+ this.state = {
+ breadcrumbs: [],
+ loading: true,
+ page: 0,
+ total: 0
+ };
+ this.refreshBranchStatus = debounce(this.refreshBranchStatus, 1000);
+ }
componentDidMount() {
this.mounted = true;
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as key from 'keymaster';
-import { keyBy } from 'lodash';
+import { debounce, keyBy } from 'lodash';
import * as React from 'react';
import Helmet from 'react-helmet';
import { connect } from 'react-redux';
export class App extends React.PureComponent<Props, State> {
mounted = false;
- state: State = {
- loading: true,
- measures: [],
- metrics: {}
- };
+ state: State;
+
+ constructor(props: Props) {
+ super(props);
+ this.state = {
+ loading: true,
+ measures: [],
+ metrics: {}
+ };
+ this.refreshBranchStatus = debounce(this.refreshBranchStatus, 1000);
+ }
componentDidMount() {
this.mounted = true;
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as key from 'keymaster';
-import { keyBy, omit, without } from 'lodash';
+import { debounce, keyBy, omit, without } from 'lodash';
import * as React from 'react';
import Helmet from 'react-helmet';
import { FormattedMessage } from 'react-intl';
referencedUsers: {},
selected: getOpen(props.location.query)
};
+ this.refreshBranchStatus = debounce(this.refreshBranchStatus, 1000);
}
componentDidMount() {
*/
import * as React from 'react';
import { connect } from 'react-redux';
+import { debounce } from 'lodash';
import { scrollToElement } from 'sonar-ui-common/helpers/scrolling';
import { getParents } from '../../api/components';
import { isPullRequest, isShortLivingBranch } from '../../helpers/branches';
export class WorkspaceComponentViewer extends React.PureComponent<Props> {
container?: HTMLElement | null;
+ constructor(props: Props) {
+ super(props);
+ this.refreshBranchStatus = debounce(this.refreshBranchStatus, 1000);
+ }
+
componentDidMount() {
if (document.documentElement) {
document.documentElement.classList.add('with-workspace');
import { registerBranchStatusAction } from '../branches';
import { fetchBranchStatus, registerBranchStatus } from '../rootActions';
-jest.useFakeTimers();
-
jest.mock('../branches', () => ({
...require.requireActual('../branches'),
registerBranchStatusAction: jest.fn()
const dispatch = jest.fn();
fetchBranchStatus(branchLike, component)(dispatch);
-
- jest.runAllTimers();
await new Promise(setImmediate);
expect(registerBranchStatusAction).toBeCalledWith(
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { debounce } from 'lodash';
import { InjectedRouter } from 'react-router';
import { Dispatch } from 'redux';
import * as auth from '../api/auth';
};
export function fetchBranchStatus(branchLike: T.BranchLike, projectKey: string) {
- return debounce((dispatch: Dispatch<any>) => {
+ return (dispatch: Dispatch<any>) => {
getQualityGateProjectStatus({ projectKey, ...getBranchLikeQuery(branchLike) }).then(
projectStatus => {
const { ignoredConditions, status } = projectStatus;
dispatch(addGlobalErrorMessage('Fetching Quality Gate status failed'));
}
);
- }, 1000);
+ };
}
export function doLogin(login: string, password: string) {