Commit 505c18c8 authored by Scott Stern's avatar Scott Stern Committed by Paul Slaughter

Replace underscore with lodash in app/assets/javascripts/pipeline

https://gitlab.com/gitlab-org/gitlab/-/merge_requests/24719
parent 8b5f1fc2
<script> <script>
import _ from 'underscore';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import StageColumnComponent from './stage_column_component.vue'; import StageColumnComponent from './stage_column_component.vue';
import GraphMixin from '../../mixins/graph_component_mixin'; import GraphMixin from '../../mixins/graph_component_mixin';
...@@ -70,7 +69,7 @@ export default { ...@@ -70,7 +69,7 @@ export default {
expandedTriggeredBy() { expandedTriggeredBy() {
return ( return (
this.pipeline.triggered_by && this.pipeline.triggered_by &&
_.isArray(this.pipeline.triggered_by) && Array.isArray(this.pipeline.triggered_by) &&
this.pipeline.triggered_by.find(el => el.isExpanded) this.pipeline.triggered_by.find(el => el.isExpanded)
); );
}, },
......
<script> <script>
import _ from 'underscore'; import { isEmpty, escape as esc } from 'lodash';
import stageColumnMixin from '../../mixins/stage_column_mixin'; import stageColumnMixin from '../../mixins/stage_column_mixin';
import JobItem from './job_item.vue'; import JobItem from './job_item.vue';
import JobGroupDropdown from './job_group_dropdown.vue'; import JobGroupDropdown from './job_group_dropdown.vue';
...@@ -39,12 +39,12 @@ export default { ...@@ -39,12 +39,12 @@ export default {
}, },
computed: { computed: {
hasAction() { hasAction() {
return !_.isEmpty(this.action); return !isEmpty(this.action);
}, },
}, },
methods: { methods: {
groupId(group) { groupId(group) {
return `ci-badge-${_.escape(group.name)}`; return `ci-badge-${esc(group.name)}`;
}, },
pipelineActionRequestComplete() { pipelineActionRequestComplete() {
this.$emit('refreshPipelineGraph'); this.$emit('refreshPipelineGraph');
......
<script> <script>
import _ from 'underscore'; import { isEmpty } from 'lodash';
import { GlLink } from '@gitlab/ui'; import { GlLink } from '@gitlab/ui';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue'; import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import CiIcon from '~/vue_shared/components/ci_icon.vue'; import CiIcon from '~/vue_shared/components/ci_icon.vue';
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
); );
}, },
hasRef() { hasRef() {
return !_.isEmpty(this.pipeline.ref); return !isEmpty(this.pipeline.ref);
}, },
}, },
methods: { methods: {
......
<script> <script>
import { GlLink, GlTooltipDirective } from '@gitlab/ui'; import { GlLink, GlTooltipDirective } from '@gitlab/ui';
import _ from 'underscore'; import { escape } from 'lodash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import popover from '~/vue_shared/directives/popover'; import popover from '~/vue_shared/directives/popover';
const popoverTitle = sprintf( const popoverTitle = sprintf(
_.escape( escape(
__( __(
`This pipeline makes use of a predefined CI/CD configuration enabled by %{strongStart}Auto DevOps.%{strongEnd}`, `This pipeline makes use of a predefined CI/CD configuration enabled by %{strongStart}Auto DevOps.%{strongEnd}`,
), ),
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
href="${this.autoDevopsHelpPath}" href="${this.autoDevopsHelpPath}"
target="_blank" target="_blank"
rel="noopener noreferrer nofollow"> rel="noopener noreferrer nofollow">
${_.escape(__('Learn more about Auto DevOps'))} ${escape(__('Learn more about Auto DevOps'))}
</a>`, </a>`,
}; };
}, },
......
<script> <script>
import _ from 'underscore'; import { isEqual } from 'lodash';
import { __, sprintf, s__ } from '../../locale'; import { __, sprintf, s__ } from '../../locale';
import createFlash from '../../flash'; import createFlash from '../../flash';
import PipelinesService from '../services/pipelines_service'; import PipelinesService from '../services/pipelines_service';
...@@ -218,7 +218,7 @@ export default { ...@@ -218,7 +218,7 @@ export default {
successCallback(resp) { successCallback(resp) {
// Because we are polling & the user is interacting verify if the response received // Because we are polling & the user is interacting verify if the response received
// matches the last request made // matches the last request made
if (_.isEqual(resp.config.params, this.requestData)) { if (isEqual(resp.config.params, this.requestData)) {
this.store.storeCount(resp.data.count); this.store.storeCount(resp.data.count);
this.store.storePagination(resp.headers); this.store.storePagination(resp.headers);
this.setCommonData(resp.data.pipelines); this.setCommonData(resp.data.pipelines);
......
import _ from 'underscore'; import { escape } from 'lodash';
export default { export default {
props: { props: {
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
}, },
methods: { methods: {
capitalizeStageName(name) { capitalizeStageName(name) {
const escapedName = _.escape(name); const escapedName = escape(name);
return escapedName.charAt(0).toUpperCase() + escapedName.slice(1); return escapedName.charAt(0).toUpperCase() + escapedName.slice(1);
}, },
isFirstColumn(index) { isFirstColumn(index) {
......
import Vue from 'vue'; import Vue from 'vue';
import _ from 'underscore';
export default class PipelineStore { export default class PipelineStore {
constructor() { constructor() {
...@@ -61,7 +60,7 @@ export default class PipelineStore { ...@@ -61,7 +60,7 @@ export default class PipelineStore {
Vue.set(newPipeline, 'isLoading', false); Vue.set(newPipeline, 'isLoading', false);
if (newPipeline.triggered_by) { if (newPipeline.triggered_by) {
if (!_.isArray(newPipeline.triggered_by)) { if (!Array.isArray(newPipeline.triggered_by)) {
Object.assign(newPipeline, { triggered_by: [newPipeline.triggered_by] }); Object.assign(newPipeline, { triggered_by: [newPipeline.triggered_by] });
} }
this.parseTriggeredByPipelines(oldPipeline, newPipeline.triggered_by[0]); this.parseTriggeredByPipelines(oldPipeline, newPipeline.triggered_by[0]);
......
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