Commit 4a995726 authored by Jose Vargas's avatar Jose Vargas

Replace underscore/lodash in ee/projects

parent 424778d6
<script>
import { uniqueId } from 'underscore';
import { uniqueId } from 'lodash';
import { GlLink, GlIntersperse, GlModal, GlButton, GlModalDirective } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
......
<script>
import { escape } from 'underscore';
import { escape } from 'lodash';
import { s__, sprintf } from '~/locale';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
......
import _ from 'underscore';
import { uniqueId } from 'lodash';
export const getLicenseKey = ({ id }) => {
if (id) {
return `id_${id}`;
}
return `client_${_.uniqueId()}`;
return `client_${uniqueId()}`;
};
/**
......
/* eslint-disable no-underscore-dangle, class-methods-use-this */
import _ from 'underscore';
import { escape as esc, find, countBy } from 'lodash';
import axios from '~/lib/utils/axios_utils';
import Flash from '~/flash';
import { n__, s__, __ } from '~/locale';
......@@ -269,7 +268,7 @@ export default class AccessDropdown {
}
const labelPieces = [];
const counts = _.countBy(currentItems, item => item.type);
const counts = countBy(currentItems, item => item.type);
if (counts[LEVEL_TYPES.ROLE] > 0) {
labelPieces.push(n__('1 role', '%d roles', counts[LEVEL_TYPES.ROLE]));
......@@ -445,7 +444,7 @@ export default class AccessDropdown {
break;
}
const isActive = _.find(this.getSelectedItems(), criteria) ? 'is-active' : '';
const isActive = find(this.getSelectedItems(), criteria) ? 'is-active' : '';
switch (item.type) {
case LEVEL_TYPES.USER:
......@@ -472,7 +471,7 @@ export default class AccessDropdown {
<li>
<a href="#" class="${isActiveClass}">
<img src="${user.avatar_url}" class="avatar avatar-inline" width="30">
<strong class="dropdown-menu-user-full-name">${_.escape(user.name)}</strong>
<strong class="dropdown-menu-user-full-name">${esc(user.name)}</strong>
<span class="dropdown-menu-user-username">${user.username}</span>
</a>
</li>
......
......@@ -7,9 +7,7 @@ import PaginatedLicensesTable from 'ee/project_licenses/components/paginated_lic
import Pagination from '~/vue_shared/components/pagination_links.vue';
import mockLicensesResponse from '../store/modules/list/data/mock_licenses.json';
jest.mock('underscore', () => ({
uniqueId: () => 'fakeUniqueId',
}));
jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId');
describe('PaginatedLicensesTable component', () => {
const namespace = LICENSE_LIST;
......
import { toLicenseObject } from 'ee/project_licenses/utils/mappers';
const UNIQUE_ID = 'fakeUniqueId';
jest.mock('underscore', () => ({
uniqueId: () => 'fakeUniqueId',
}));
jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId');
describe('ee/project_licenses/utils/mappers', () => {
describe('toLicenseObject', () => {
......
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