Commit 75e0af59 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'lm-replace-ide' into 'master'

Replace underscore with lodash for ./ee/app/assets/javascripts/ide

See merge request gitlab-org/gitlab!28687
parents 2b396a19 8a510657
<script> <script>
import _ from 'underscore'; import { throttle } from 'lodash';
import { GlTooltipDirective, GlLoadingIcon } from '@gitlab/ui'; import { GlTooltipDirective, GlLoadingIcon } from '@gitlab/ui';
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
watch: { watch: {
// We want to throttle the `isLoading` updates so that // We want to throttle the `isLoading` updates so that
// the user actually sees an indicator that changes are sent. // the user actually sees an indicator that changes are sent.
isLoadingState: _.throttle(function watchIsLoadingState(val) { isLoadingState: throttle(function watchIsLoadingState(val) {
this.isLoading = val; this.isLoading = val;
}, 150), }, 150),
}, },
......
import _ from 'underscore';
import createDiff from './create_diff'; import createDiff from './create_diff';
import { getWebSocketUrl, mergeUrlParams } from '~/lib/utils/url_utility'; import { getWebSocketUrl, mergeUrlParams } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -9,6 +8,8 @@ export const MSG_CONNECTION_ERROR = __('Could not connect to Web IDE file mirror ...@@ -9,6 +8,8 @@ export const MSG_CONNECTION_ERROR = __('Could not connect to Web IDE file mirror
// Before actually connecting to the service, we must delay a bit // Before actually connecting to the service, we must delay a bit
// so that the service has sufficiently started. // so that the service has sufficiently started.
const noop = () => {};
export const SERVICE_DELAY = 8000; export const SERVICE_DELAY = 8000;
const cancellableWait = time => { const cancellableWait = time => {
...@@ -62,12 +63,12 @@ export const canConnect = ({ services = [] }) => services.some(name => name === ...@@ -62,12 +63,12 @@ export const canConnect = ({ services = [] }) => services.some(name => name ===
export const createMirror = () => { export const createMirror = () => {
let socket = null; let socket = null;
let cancelHandler = _.noop; let cancelHandler = noop;
let nextMessageHandler = _.noop; let nextMessageHandler = noop;
const cancelConnect = () => { const cancelConnect = () => {
cancelHandler(); cancelHandler();
cancelHandler = _.noop; cancelHandler = noop;
}; };
const onCancelConnect = fn => { const onCancelConnect = fn => {
...@@ -76,7 +77,7 @@ export const createMirror = () => { ...@@ -76,7 +77,7 @@ export const createMirror = () => {
const receiveMessage = ev => { const receiveMessage = ev => {
const handle = nextMessageHandler; const handle = nextMessageHandler;
nextMessageHandler = _.noop; nextMessageHandler = noop;
handle(JSON.parse(ev.data)); handle(JSON.parse(ev.data));
}; };
......
import _ from 'underscore'; import { escape as esc } from 'lodash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
...@@ -32,7 +32,7 @@ export const configCheckError = (status, helpUrl) => { ...@@ -32,7 +32,7 @@ export const configCheckError = (status, helpUrl) => {
return sprintf( return sprintf(
ERROR_CONFIG, ERROR_CONFIG,
{ {
helpStart: `<a href="${_.escape(helpUrl)}" target="_blank">`, helpStart: `<a href="${esc(helpUrl)}" target="_blank">`,
helpEnd: '</a>', helpEnd: '</a>',
}, },
false, false,
...@@ -48,7 +48,7 @@ export const runnersCheckEmpty = helpUrl => ...@@ -48,7 +48,7 @@ export const runnersCheckEmpty = helpUrl =>
sprintf( sprintf(
EMPTY_RUNNERS, EMPTY_RUNNERS,
{ {
helpStart: `<a href="${_.escape(helpUrl)}" target="_blank">`, helpStart: `<a href="${esc(helpUrl)}" target="_blank">`,
helpEnd: '</a>', helpEnd: '</a>',
}, },
false, false,
......
import _ from 'underscore'; import { debounce } from 'lodash';
import eventHub from '~/ide/eventhub'; import eventHub from '~/ide/eventhub';
import terminalSyncModule from '../modules/terminal_sync'; import terminalSyncModule from '../modules/terminal_sync';
import { isEndingStatus, isRunningStatus } from '../../utils'; import { isEndingStatus, isRunningStatus } from '../../utils';
...@@ -15,7 +15,7 @@ export default function createMirrorPlugin() { ...@@ -15,7 +15,7 @@ export default function createMirrorPlugin() {
return store => { return store => {
store.registerModule('terminalSync', terminalSyncModule()); store.registerModule('terminalSync', terminalSyncModule());
const upload = _.debounce(() => { const upload = debounce(() => {
store.dispatch(`terminalSync/upload`); store.dispatch(`terminalSync/upload`);
}, UPLOAD_DEBOUNCE); }, UPLOAD_DEBOUNCE);
......
...@@ -6,6 +6,7 @@ import { createStore } from '~/ide/stores'; ...@@ -6,6 +6,7 @@ import { createStore } from '~/ide/stores';
import eventHub from '~/ide/eventhub'; import eventHub from '~/ide/eventhub';
jest.mock('ee/ide/lib/mirror'); jest.mock('ee/ide/lib/mirror');
jest.mock('lodash/debounce', () => jest.fn);
const ACTION_START = 'terminalSync/start'; const ACTION_START = 'terminalSync/start';
const ACTION_STOP = 'terminalSync/stop'; const ACTION_STOP = 'terminalSync/stop';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment