From ea3306a15e945e694afba62dc93b17500ffaec7f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 14 Jan 2021 18:10:59 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../diffs/components/diff_line_note_form.vue | 11 +- .../javascripts/diffs/components/diff_row.vue | 79 ++++++- .../javascripts/diffs/components/diff_row_utils.js | 6 +- .../javascripts/diffs/components/diff_view.vue | 39 +++- .../diffs/components/inline_diff_table_row.vue | 7 +- .../diffs/components/parallel_diff_table_row.vue | 24 +- app/assets/javascripts/diffs/store/utils.js | 9 + .../access_request_action_buttons.vue | 4 +- .../action_buttons/invite_action_buttons.vue | 2 +- .../action_buttons/user_action_buttons.vue | 4 +- .../members/components/modals/leave_modal.vue | 4 +- .../members/components/table/member_source.vue | 2 +- .../notes/components/multiline_comment_form.vue | 7 +- .../javascripts/notes/stores/modules/index.js | 2 +- .../projects/pipelines/charts/components/app.vue | 242 ++++++--------------- .../pipelines/charts/components/app_legacy.vue | 164 +++----------- .../charts/components/pipeline_charts.vue | 176 +++++++++++++++ 17 files changed, 442 insertions(+), 340 deletions(-) create mode 100644 app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/diffs/components/diff_line_note_form.vue b/app/assets/javascripts/diffs/components/diff_line_note_form.vue index 6e22e181c02..463b7f5cff4 100644 --- a/app/assets/javascripts/diffs/components/diff_line_note_form.vue +++ b/app/assets/javascripts/diffs/components/diff_line_note_form.vue @@ -56,10 +56,11 @@ export default { }, computed: { ...mapState({ - noteableData: (state) => state.notes.noteableData, - diffViewType: (state) => state.diffs.diffViewType, + diffViewType: ({ diffs }) => diffs.diffViewType, + showSuggestPopover: ({ diffs }) => diffs.showSuggestPopover, + noteableData: ({ notes }) => notes.noteableData, + selectedCommentPosition: ({ notes }) => notes.selectedCommentPosition, }), - ...mapState('diffs', ['showSuggestPopover']), ...mapGetters('diffs', ['getDiffFileByHash', 'diffLines']), ...mapGetters([ 'isLoggedIn', @@ -126,6 +127,10 @@ export default { this.initAutoSave(this.noteableData, keys); } + + if (this.selectedCommentPosition) { + this.commentLineStart = this.selectedCommentPosition.start; + } }, methods: { ...mapActions('diffs', [ diff --git a/app/assets/javascripts/diffs/components/diff_row.vue b/app/assets/javascripts/diffs/components/diff_row.vue index 9e1385853b6..9054a8aec04 100644 --- a/app/assets/javascripts/diffs/components/diff_row.vue +++ b/app/assets/javascripts/diffs/components/diff_row.vue @@ -10,6 +10,7 @@ import { CONFLICT_THEIR, CONFLICT_MARKER, } from '../constants'; +import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import DiffGutterAvatars from './diff_gutter_avatars.vue'; import * as utils from './diff_row_utils'; @@ -22,6 +23,7 @@ export default { GlTooltip: GlTooltipDirective, SafeHtml, }, + mixins: [glFeatureFlagsMixin()], props: { fileHash: { type: String, @@ -45,6 +47,15 @@ export default { required: false, default: false, }, + index: { + type: Number, + required: true, + }, + }, + data() { + return { + dragging: false, + }; }, computed: { ...mapGetters('diffs', ['fileLineCoverage']), @@ -52,26 +63,35 @@ export default { ...mapState({ isHighlighted(state) { const line = this.line.left?.line_code ? this.line.left : this.line.right; - return utils.isHighlighted(state, line, this.isCommented); + return utils.isHighlighted(state, line, false); }, }), classNameMap() { return { [CONTEXT_LINE_CLASS_NAME]: this.line.isContextLineLeft, [PARALLEL_DIFF_VIEW_TYPE]: !this.inline, + commented: this.isCommented, }; }, parallelViewLeftLineType() { - return utils.parallelViewLeftLineType(this.line, this.isHighlighted); + return utils.parallelViewLeftLineType(this.line, this.isHighlighted || this.isCommented); }, coverageState() { return this.fileLineCoverage(this.filePath, this.line.right.new_line); }, classNameMapCellLeft() { - return utils.classNameMapCell(this.line.left, this.isHighlighted, this.isLoggedIn); + return utils.classNameMapCell({ + line: this.line.left, + hll: this.isHighlighted || this.isCommented, + isLoggedIn: this.isLoggedIn, + }); }, classNameMapCellRight() { - return utils.classNameMapCell(this.line.right, this.isHighlighted, this.isLoggedIn); + return utils.classNameMapCell({ + line: this.line.right, + hll: this.isHighlighted || this.isCommented, + isLoggedIn: this.isLoggedIn, + }); }, addCommentTooltipLeft() { return utils.addCommentTooltip(this.line.left); @@ -131,6 +151,22 @@ export default { ? this.$options.THEIR_CHANGES : this.$options.OUR_CHANGES; }, + onDragEnd() { + this.dragging = false; + if (!this.glFeatures.dragCommentSelection) return; + + this.$emit('stopdragging'); + }, + onDragEnter(line, index) { + if (!this.glFeatures.dragCommentSelection) return; + + this.$emit('enterdragging', { ...line, index }); + }, + onDragStart(line) { + this.$root.$emit('bv::hide::tooltip'); + this.dragging = true; + this.$emit('startdragging', line); + }, }, OUR_CHANGES: 'HEAD//our changes', THEIR_CHANGES: 'origin//their changes', @@ -143,7 +179,13 @@ export default {