diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 12:09:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 12:09:24 +0300 |
commit | 4720b569f0fcbb47e9f1a60e95172ae63b6f065a (patch) | |
tree | 5c6bcecbca227e608753a57a9aad19ccfe0567b6 /app/assets/javascripts/jobs | |
parent | cefe554b7ce2d0b52f9de855be832a47c2bc24ab (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/jobs')
7 files changed, 28 insertions, 26 deletions
diff --git a/app/assets/javascripts/jobs/components/environments_block.vue b/app/assets/javascripts/jobs/components/environments_block.vue index 797aa15a2b9..d9168f57cc7 100644 --- a/app/assets/javascripts/jobs/components/environments_block.vue +++ b/app/assets/javascripts/jobs/components/environments_block.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { escape as esc, isEmpty } from 'lodash'; import CiIcon from '~/vue_shared/components/ci_icon.vue'; import { sprintf, __ } from '../../locale'; @@ -43,7 +43,7 @@ export default { '%{startLink}%{name}%{endLink}', { startLink: `<a href="${this.deploymentStatus.environment.environment_path}" class="js-environment-link">`, - name: _.escape(this.deploymentStatus.environment.name), + name: esc(this.deploymentStatus.environment.name), endLink: '</a>', }, false, @@ -58,10 +58,10 @@ export default { return this.hasLastDeployment ? this.deploymentStatus.environment.last_deployment : {}; }, hasEnvironment() { - return !_.isEmpty(this.deploymentStatus.environment); + return !isEmpty(this.deploymentStatus.environment); }, lastDeploymentPath() { - return !_.isEmpty(this.lastDeployment.deployable) + return !isEmpty(this.lastDeployment.deployable) ? this.lastDeployment.deployable.build_path : ''; }, @@ -74,8 +74,8 @@ export default { } const { name, path } = this.deploymentCluster; - const escapedName = _.escape(name); - const escapedPath = _.escape(path); + const escapedName = esc(name); + const escapedPath = esc(path); if (!escapedPath) { return escapedName; diff --git a/app/assets/javascripts/jobs/components/erased_block.vue b/app/assets/javascripts/jobs/components/erased_block.vue index 8437ad89301..fc5e022f44a 100644 --- a/app/assets/javascripts/jobs/components/erased_block.vue +++ b/app/assets/javascripts/jobs/components/erased_block.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { isEmpty } from 'lodash'; import { GlLink } from '@gitlab/ui'; import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; @@ -21,7 +21,7 @@ export default { }, computed: { isErasedByUser() { - return !_.isEmpty(this.user); + return !isEmpty(this.user); }, }, }; diff --git a/app/assets/javascripts/jobs/components/job_app.vue b/app/assets/javascripts/jobs/components/job_app.vue index bc310f77a58..0783d1157be 100644 --- a/app/assets/javascripts/jobs/components/job_app.vue +++ b/app/assets/javascripts/jobs/components/job_app.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { throttle, isEmpty } from 'lodash'; import { mapGetters, mapState, mapActions } from 'vuex'; import { GlLoadingIcon } from '@gitlab/ui'; import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils'; @@ -125,7 +125,7 @@ export default { // Once the job log is loaded, // fetch the stages for the dropdown on the sidebar job(newVal, oldVal) { - if (_.isEmpty(oldVal) && !_.isEmpty(newVal.pipeline)) { + if (isEmpty(oldVal) && !isEmpty(newVal.pipeline)) { const stages = this.job.pipeline.details.stages || []; const defaultStage = stages.find(stage => stage && stage.name === this.selectedStage); @@ -145,7 +145,7 @@ export default { }, }, created() { - this.throttled = _.throttle(this.toggleScrollButtons, 100); + this.throttled = throttle(this.toggleScrollButtons, 100); window.addEventListener('resize', this.onResize); window.addEventListener('scroll', this.updateScroll); diff --git a/app/assets/javascripts/jobs/components/manual_variables_form.vue b/app/assets/javascripts/jobs/components/manual_variables_form.vue index c32a3cac7be..a23f30d571a 100644 --- a/app/assets/javascripts/jobs/components/manual_variables_form.vue +++ b/app/assets/javascripts/jobs/components/manual_variables_form.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { uniqueId } from 'lodash'; import { mapActions } from 'vuex'; import { GlButton } from '@gitlab/ui'; import { s__, sprintf } from '~/locale'; @@ -19,7 +19,9 @@ export default { validator(value) { return ( value === null || - (_.has(value, 'path') && _.has(value, 'method') && _.has(value, 'button_title')) + (Object.prototype.hasOwnProperty.call(value, 'path') && + Object.prototype.hasOwnProperty.call(value, 'method') && + Object.prototype.hasOwnProperty.call(value, 'button_title')) ); }, }, @@ -78,7 +80,7 @@ export default { const newVariable = { key: this.key, secret_value: this.secretValue, - id: _.uniqueId(), + id: uniqueId(), }; this.variables.push(newVariable); diff --git a/app/assets/javascripts/jobs/components/sidebar.vue b/app/assets/javascripts/jobs/components/sidebar.vue index a61acf2f6eb..f1683bc2195 100644 --- a/app/assets/javascripts/jobs/components/sidebar.vue +++ b/app/assets/javascripts/jobs/components/sidebar.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { isEmpty } from 'lodash'; import { mapActions, mapState } from 'vuex'; import { GlLink, GlButton } from '@gitlab/ui'; import { __, sprintf } from '~/locale'; @@ -84,10 +84,10 @@ export default { ); }, hasArtifact() { - return !_.isEmpty(this.job.artifact); + return !isEmpty(this.job.artifact); }, hasTriggers() { - return !_.isEmpty(this.job.trigger); + return !isEmpty(this.job.trigger); }, hasStages() { return ( diff --git a/app/assets/javascripts/jobs/components/stages_dropdown.vue b/app/assets/javascripts/jobs/components/stages_dropdown.vue index 09f9647a680..ddcfc3d6db6 100644 --- a/app/assets/javascripts/jobs/components/stages_dropdown.vue +++ b/app/assets/javascripts/jobs/components/stages_dropdown.vue @@ -1,5 +1,5 @@ <script> -import _ from 'underscore'; +import { isEmpty } from 'lodash'; import { GlLink } from '@gitlab/ui'; import CiIcon from '~/vue_shared/components/ci_icon.vue'; @@ -24,7 +24,7 @@ export default { }, computed: { hasRef() { - return !_.isEmpty(this.pipeline.ref); + return !isEmpty(this.pipeline.ref); }, isTriggeredByMergeRequest() { return Boolean(this.pipeline.merge_request); diff --git a/app/assets/javascripts/jobs/store/getters.js b/app/assets/javascripts/jobs/store/getters.js index 406b1a2e375..3f02f924eed 100644 --- a/app/assets/javascripts/jobs/store/getters.js +++ b/app/assets/javascripts/jobs/store/getters.js @@ -1,4 +1,4 @@ -import _ from 'underscore'; +import { isEmpty, isString } from 'lodash'; import { isScrolledToBottom } from '~/lib/utils/scroll_utils'; export const headerTime = state => (state.job.started ? state.job.started : state.job.created_at); @@ -7,15 +7,15 @@ export const hasUnmetPrerequisitesFailure = state => state.job && state.job.failure_reason && state.job.failure_reason === 'unmet_prerequisites'; export const shouldRenderCalloutMessage = state => - !_.isEmpty(state.job.status) && !_.isEmpty(state.job.callout_message); + !isEmpty(state.job.status) && !isEmpty(state.job.callout_message); /** * When job has not started the key will be null * When job started the key will be a string with a date. */ -export const shouldRenderTriggeredLabel = state => _.isString(state.job.started); +export const shouldRenderTriggeredLabel = state => isString(state.job.started); -export const hasEnvironment = state => !_.isEmpty(state.job.deployment_status); +export const hasEnvironment = state => !isEmpty(state.job.deployment_status); /** * Checks if it the job has trace. @@ -23,7 +23,7 @@ export const hasEnvironment = state => !_.isEmpty(state.job.deployment_status); * @returns {Boolean} */ export const hasTrace = state => - state.job.has_trace || (!_.isEmpty(state.job.status) && state.job.status.group === 'running'); + state.job.has_trace || (!isEmpty(state.job.status) && state.job.status.group === 'running'); export const emptyStateIllustration = state => (state.job && state.job.status && state.job.status.illustration) || {}; @@ -38,8 +38,8 @@ export const emptyStateAction = state => * @returns {Boolean} */ export const shouldRenderSharedRunnerLimitWarning = state => - !_.isEmpty(state.job.runners) && - !_.isEmpty(state.job.runners.quota) && + !isEmpty(state.job.runners) && + !isEmpty(state.job.runners.quota) && state.job.runners.quota.used >= state.job.runners.quota.limit; export const isScrollingDown = state => isScrolledToBottom() && !state.isTraceComplete; |