diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 12:07:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 12:07:58 +0300 |
commit | 45b4df3e57c949c88107840c44ccbfaf2eabdf26 (patch) | |
tree | f73c1533a75b03d2ceb1361644e0d8ab97568a8f /app/assets | |
parent | 7421e6f9f2b5889b05738af7eba568af6ae3fcbc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
4 files changed, 26 insertions, 26 deletions
diff --git a/app/assets/javascripts/environments/components/confirm_rollback_modal.vue b/app/assets/javascripts/environments/components/confirm_rollback_modal.vue index 70b5c6b0094..5c03c008faf 100644 --- a/app/assets/javascripts/environments/components/confirm_rollback_modal.vue +++ b/app/assets/javascripts/environments/components/confirm_rollback_modal.vue @@ -3,7 +3,7 @@ * Render modal to confirm rollback/redeploy. */ -import _ from 'underscore'; +import { escape as esc } from 'lodash'; import { GlModal } from '@gitlab/ui'; import { s__, sprintf } from '~/locale'; @@ -30,7 +30,7 @@ export default { : s__('Environments|Rollback environment %{name}?'); return sprintf(title, { - name: _.escape(this.environment.name), + name: esc(this.environment.name), }); }, @@ -50,10 +50,10 @@ export default { }, modalText() { - const linkStart = `<a class="commit-sha mr-0" href="${_.escape(this.commitUrl)}">`; - const commitId = _.escape(this.commitShortSha); + const linkStart = `<a class="commit-sha mr-0" href="${esc(this.commitUrl)}">`; + const commitId = esc(this.commitShortSha); const linkEnd = '</a>'; - const name = _.escape(this.name); + const name = esc(this.name); const body = this.environment.isLastDeployment ? s__( 'Environments|This action will relaunch the job for commit %{linkStart}%{commitId}%{linkEnd}, putting the environment in a previous version. Are you sure you want to continue?', diff --git a/app/assets/javascripts/environments/components/environment_item.vue b/app/assets/javascripts/environments/components/environment_item.vue index ec5b1092c14..305d860a692 100644 --- a/app/assets/javascripts/environments/components/environment_item.vue +++ b/app/assets/javascripts/environments/components/environment_item.vue @@ -1,6 +1,6 @@ <script> /* eslint-disable @gitlab/vue-require-i18n-strings */ -import _ from 'underscore'; +import { isEmpty } from 'lodash'; import { GlTooltipDirective } from '@gitlab/ui'; import { __, sprintf } from '~/locale'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; @@ -79,7 +79,7 @@ export default { * @returns {Boolean} */ hasLastDeploymentKey() { - if (this.model && this.model.last_deployment && !_.isEmpty(this.model.last_deployment)) { + if (this.model && this.model.last_deployment && !isEmpty(this.model.last_deployment)) { return true; } return false; @@ -390,8 +390,8 @@ export default { deploymentHasUser() { return ( this.model && - !_.isEmpty(this.model.last_deployment) && - !_.isEmpty(this.model.last_deployment.user) + !isEmpty(this.model.last_deployment) && + !isEmpty(this.model.last_deployment.user) ); }, @@ -404,8 +404,8 @@ export default { deploymentUser() { if ( this.model && - !_.isEmpty(this.model.last_deployment) && - !_.isEmpty(this.model.last_deployment.user) + !isEmpty(this.model.last_deployment) && + !isEmpty(this.model.last_deployment.user) ) { return this.model.last_deployment.user; } @@ -431,8 +431,8 @@ export default { shouldRenderBuildName() { return ( !this.isFolder && - !_.isEmpty(this.model.last_deployment) && - !_.isEmpty(this.model.last_deployment.deployable) + !isEmpty(this.model.last_deployment) && + !isEmpty(this.model.last_deployment.deployable) ); }, @@ -473,7 +473,7 @@ export default { shouldRenderDeploymentID() { return ( !this.isFolder && - !_.isEmpty(this.model.last_deployment) && + !isEmpty(this.model.last_deployment) && this.model.last_deployment.iid !== undefined ); }, diff --git a/app/assets/javascripts/environments/components/environments_table.vue b/app/assets/javascripts/environments/components/environments_table.vue index 3f316643784..01a00e03814 100644 --- a/app/assets/javascripts/environments/components/environments_table.vue +++ b/app/assets/javascripts/environments/components/environments_table.vue @@ -3,7 +3,7 @@ * Render environments table. */ import { GlLoadingIcon } from '@gitlab/ui'; -import _ from 'underscore'; +import { flow, reverse, sortBy } from 'lodash/fp'; import environmentTableMixin from 'ee_else_ce/environments/mixins/environments_table_mixin'; import { s__ } from '~/locale'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; @@ -102,13 +102,13 @@ export default { * 4. Reverse (last deployment descending, name ascending), * 5. Put folders first. */ - return _.chain(environments) - .sortBy(env => (env.isFolder ? env.folderName : env.name)) - .reverse() - .sortBy(env => (env.last_deployment ? env.last_deployment.created_at : '0000')) - .reverse() - .sortBy(env => (env.isFolder ? -1 : 1)) - .value(); + return flow( + sortBy(env => (env.isFolder ? env.folderName : env.name)), + reverse, + sortBy(env => (env.last_deployment ? env.last_deployment.created_at : '0000')), + reverse, + sortBy(env => (env.isFolder ? -1 : 1)), + )(environments); }, }, }; diff --git a/app/assets/javascripts/environments/mixins/environments_mixin.js b/app/assets/javascripts/environments/mixins/environments_mixin.js index 4fadecdd3e9..73dc8c02485 100644 --- a/app/assets/javascripts/environments/mixins/environments_mixin.js +++ b/app/assets/javascripts/environments/mixins/environments_mixin.js @@ -1,7 +1,7 @@ /** * Common code between environmets app and folder view */ -import _ from 'underscore'; +import { isEqual, isFunction, omitBy } from 'lodash'; import Visibility from 'visibilityjs'; import EnvironmentsStore from 'ee_else_ce/environments/stores/environments_store'; import Poll from '../../lib/utils/poll'; @@ -54,7 +54,7 @@ export default { const response = this.filterNilValues(resp.config.params); const request = this.filterNilValues(this.requestData); - if (_.isEqual(response, request)) { + if (isEqual(response, request)) { this.store.storeAvailableCount(resp.data.available_count); this.store.storeStoppedCount(resp.data.stopped_count); this.store.storeEnvironments(resp.data.environments); @@ -64,7 +64,7 @@ export default { }, filterNilValues(obj) { - return _.omit(obj, value => _.isUndefined(value) || _.isNull(value)); + return omitBy(obj, value => value === undefined || value === null); }, /** @@ -109,7 +109,7 @@ export default { .then(() => this.fetchEnvironments()) .catch(err => { this.isLoading = false; - Flash(_.isFunction(errorMessage) ? errorMessage(err.response.data) : errorMessage); + Flash(isFunction(errorMessage) ? errorMessage(err.response.data) : errorMessage); }); } }, |