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>
import _ from 'underscore';
import { throttle } from 'lodash';
import { GlTooltipDirective, GlLoadingIcon } from '@gitlab/ui';
import { mapState } from 'vuex';
import Icon from '~/vue_shared/components/icon.vue';
......@@ -49,7 +49,7 @@ export default {
watch: {
// We want to throttle the `isLoading` updates so that
// the user actually sees an indicator that changes are sent.
isLoadingState: _.throttle(function watchIsLoadingState(val) {
isLoadingState: throttle(function watchIsLoadingState(val) {
this.isLoading = val;
}, 150),
},
......
import _ from 'underscore';
import createDiff from './create_diff';
import { getWebSocketUrl, mergeUrlParams } from '~/lib/utils/url_utility';
import { __ } from '~/locale';
......@@ -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
// so that the service has sufficiently started.
const noop = () => {};
export const SERVICE_DELAY = 8000;
const cancellableWait = time => {
......@@ -62,12 +63,12 @@ export const canConnect = ({ services = [] }) => services.some(name => name ===
export const createMirror = () => {
let socket = null;
let cancelHandler = _.noop;
let nextMessageHandler = _.noop;
let cancelHandler = noop;
let nextMessageHandler = noop;
const cancelConnect = () => {
cancelHandler();
cancelHandler = _.noop;
cancelHandler = noop;
};
const onCancelConnect = fn => {
......@@ -76,7 +77,7 @@ export const createMirror = () => {
const receiveMessage = ev => {
const handle = nextMessageHandler;
nextMessageHandler = _.noop;
nextMessageHandler = noop;
handle(JSON.parse(ev.data));
};
......
import _ from 'underscore';
import { escape as esc } from 'lodash';
import { __, sprintf } from '~/locale';
import httpStatus from '~/lib/utils/http_status';
......@@ -32,7 +32,7 @@ export const configCheckError = (status, helpUrl) => {
return sprintf(
ERROR_CONFIG,
{
helpStart: `<a href="${_.escape(helpUrl)}" target="_blank">`,
helpStart: `<a href="${esc(helpUrl)}" target="_blank">`,
helpEnd: '</a>',
},
false,
......@@ -48,7 +48,7 @@ export const runnersCheckEmpty = helpUrl =>
sprintf(
EMPTY_RUNNERS,
{
helpStart: `<a href="${_.escape(helpUrl)}" target="_blank">`,
helpStart: `<a href="${esc(helpUrl)}" target="_blank">`,
helpEnd: '</a>',
},
false,
......
import _ from 'underscore';
import { debounce } from 'lodash';
import eventHub from '~/ide/eventhub';
import terminalSyncModule from '../modules/terminal_sync';
import { isEndingStatus, isRunningStatus } from '../../utils';
......@@ -15,7 +15,7 @@ export default function createMirrorPlugin() {
return store => {
store.registerModule('terminalSync', terminalSyncModule());
const upload = _.debounce(() => {
const upload = debounce(() => {
store.dispatch(`terminalSync/upload`);
}, UPLOAD_DEBOUNCE);
......
......@@ -6,6 +6,7 @@ import { createStore } from '~/ide/stores';
import eventHub from '~/ide/eventhub';
jest.mock('ee/ide/lib/mirror');
jest.mock('lodash/debounce', () => jest.fn);
const ACTION_START = 'terminalSync/start';
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