diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 00:09:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 00:09:46 +0300 |
commit | 8a7aaf86831d2a556578ae558a4fcab8bb659b20 (patch) | |
tree | 61c2b55aa48ff8e853e546cd3009dfc5423279c8 /app/assets/javascripts/vue_shared | |
parent | 967812838c7e7742729a4c7aeb9859f98a509622 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared')
9 files changed, 19 insertions, 20 deletions
diff --git a/app/assets/javascripts/vue_shared/components/commit.vue b/app/assets/javascripts/vue_shared/components/commit.vue index f7c508c4e23..356f733fb8c 100644 --- a/app/assets/javascripts/vue_shared/components/commit.vue +++ b/app/assets/javascripts/vue_shared/components/commit.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { isString, isEmpty } from 'lodash'; import { GlTooltipDirective, GlLink } from '@gitlab/ui'; import { __, sprintf } from '~/locale'; import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate.vue'; @@ -56,7 +56,7 @@ export default { required: false, default: undefined, validator: ref => - _.isUndefined(ref) || (_.isFinite(ref.iid) && _.isString(ref.path) && !_.isEmpty(ref.path)), + ref === undefined || (Number.isFinite(ref.iid) && isString(ref.path) && !isEmpty(ref.path)), }, /** diff --git a/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue b/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue index 9f98943f6b4..328c7e3fd32 100644 --- a/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue +++ b/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { throttle } from 'lodash'; import { numberToHumanSize } from '../../../../lib/utils/number_utils'; export default { @@ -48,7 +48,7 @@ export default { mounted() { // The onImgLoad may have happened before the control was actually mounted this.onImgLoad(); - this.resizeThrottled = _.throttle(this.onImgLoad, 400); + this.resizeThrottled = throttle(this.onImgLoad, 400); window.addEventListener('resize', this.resizeThrottled, false); }, methods: { diff --git a/app/assets/javascripts/vue_shared/components/diff_viewer/viewers/image_diff/swipe_viewer.vue b/app/assets/javascripts/vue_shared/components/diff_viewer/viewers/image_diff/swipe_viewer.vue index 8d77b156aa4..2f2618d448f 100644 --- a/app/assets/javascripts/vue_shared/components/diff_viewer/viewers/image_diff/swipe_viewer.vue +++ b/app/assets/javascripts/vue_shared/components/diff_viewer/viewers/image_diff/swipe_viewer.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { throttle } from 'lodash'; import { pixeliseValue } from '../../../lib/utils/dom_utils'; import ImageViewer from '../../../content_viewer/viewers/image_viewer.vue'; @@ -98,7 +98,7 @@ export default { this.swipeOldImgInfo = imgInfo; this.prepareSwipe(); }, - resize: _.throttle(function throttledResize() { + resize: throttle(function throttledResize() { this.swipeBarPos = 0; this.swipeWrapWidth = 0; this.prepareSwipe(); diff --git a/app/assets/javascripts/vue_shared/components/issue/issue_warning.vue b/app/assets/javascripts/vue_shared/components/issue/issue_warning.vue index b5d3f3685bc..89a8595fc79 100644 --- a/app/assets/javascripts/vue_shared/components/issue/issue_warning.vue +++ b/app/assets/javascripts/vue_shared/components/issue/issue_warning.vue @@ -1,11 +1,11 @@ <script> import { GlLink } from '@gitlab/ui'; -import _ from 'underscore'; +import { escape as esc } from 'lodash'; import { __, sprintf } from '~/locale'; import icon from '../../../vue_shared/components/icon.vue'; function buildDocsLinkStart(path) { - return `<a href="${_.escape(path)}" target="_blank" rel="noopener noreferrer">`; + return `<a href="${esc(path)}" target="_blank" rel="noopener noreferrer">`; } export default { diff --git a/app/assets/javascripts/vue_shared/components/markdown/field.vue b/app/assets/javascripts/vue_shared/components/markdown/field.vue index e30876813c2..26e878d56a0 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/field.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/field.vue @@ -1,7 +1,7 @@ <script> import $ from 'jquery'; import '~/behaviors/markdown/render_gfm'; -import _ from 'underscore'; +import { unescape as unesc } from 'lodash'; import { __, sprintf } from '~/locale'; import { stripHtml } from '~/lib/utils/text_utility'; import Flash from '../../../flash'; @@ -115,7 +115,7 @@ export default { return text; } - return _.unescape(stripHtml(richText).replace(/\n/g, '')); + return unesc(stripHtml(richText).replace(/\n/g, '')); } return ''; diff --git a/app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue b/app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue index c472e54efda..a51b2a3ab6d 100644 --- a/app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue +++ b/app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue @@ -1,6 +1,6 @@ <script> import { GlButton } from '@gitlab/ui'; -import _ from 'underscore'; +import { isString } from 'lodash'; import Icon from '~/vue_shared/components/icon.vue'; import ProjectAvatar from '~/vue_shared/components/project_avatar/default.vue'; import highlight from '~/lib/utils/highlight'; @@ -17,7 +17,7 @@ export default { project: { type: Object, required: true, - validator: p => _.isFinite(p.id) && _.isString(p.name) && _.isString(p.name_with_namespace), + validator: p => Number.isFinite(p.id) && isString(p.name) && isString(p.name_with_namespace), }, selected: { type: Boolean, diff --git a/app/assets/javascripts/vue_shared/components/project_selector/project_selector.vue b/app/assets/javascripts/vue_shared/components/project_selector/project_selector.vue index f984a0a6203..30a9633b6dc 100644 --- a/app/assets/javascripts/vue_shared/components/project_selector/project_selector.vue +++ b/app/assets/javascripts/vue_shared/components/project_selector/project_selector.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { debounce } from 'lodash'; import { GlLoadingIcon, GlSearchBoxByType, GlInfiniteScroll } from '@gitlab/ui'; import ProjectListItem from './project_list_item.vue'; @@ -61,9 +61,9 @@ export default { this.$emit('bottomReached'); }, isSelected(project) { - return Boolean(_.find(this.selectedProjects, { id: project.id })); + return this.selectedProjects.some(({ id }) => project.id === id); }, - onInput: _.debounce(function debouncedOnInput() { + onInput: debounce(function debouncedOnInput() { this.$emit('searched', this.searchQuery); }, SEARCH_INPUT_TIMEOUT_MS), }, diff --git a/app/assets/javascripts/vue_shared/components/split_button.vue b/app/assets/javascripts/vue_shared/components/split_button.vue index f02b412e8a1..b11ec8b8838 100644 --- a/app/assets/javascripts/vue_shared/components/split_button.vue +++ b/app/assets/javascripts/vue_shared/components/split_button.vue @@ -1,10 +1,9 @@ <script> -import _ from 'underscore'; - +import { isString } from 'lodash'; import { GlDropdown, GlDropdownDivider, GlDropdownItem } from '@gitlab/ui'; const isValidItem = item => - _.isString(item.eventName) && _.isString(item.title) && _.isString(item.description); + isString(item.eventName) && isString(item.title) && isString(item.description); export default { components: { diff --git a/app/assets/javascripts/vue_shared/mixins/related_issuable_mixin.js b/app/assets/javascripts/vue_shared/mixins/related_issuable_mixin.js index fbebd7c7945..4fad34d22d8 100644 --- a/app/assets/javascripts/vue_shared/mixins/related_issuable_mixin.js +++ b/app/assets/javascripts/vue_shared/mixins/related_issuable_mixin.js @@ -1,4 +1,4 @@ -import _ from 'underscore'; +import { isEmpty } from 'lodash'; import { sprintf, __ } from '~/locale'; import { formatDate } from '~/lib/utils/datetime_utility'; import tooltip from '~/vue_shared/directives/tooltip'; @@ -130,7 +130,7 @@ const mixins = { return this.assignees.length > 0; }, hasMilestone() { - return !_.isEmpty(this.milestone); + return !isEmpty(this.milestone); }, iconName() { if (this.isMergeRequest && this.isMerged) { |