2018-06-21 08:22:40 -04:00
|
|
|
<script>
|
2018-11-09 04:44:07 -05:00
|
|
|
import { mapGetters } from 'vuex';
|
2019-03-04 08:29:17 -05:00
|
|
|
import draftCommentsMixin from 'ee_else_ce/diffs/mixins/draft_comments';
|
2018-07-03 19:18:27 -04:00
|
|
|
import parallelDiffTableRow from './parallel_diff_table_row.vue';
|
2018-06-27 17:20:41 -04:00
|
|
|
import parallelDiffCommentRow from './parallel_diff_comment_row.vue';
|
2019-08-09 22:36:32 -04:00
|
|
|
import parallelDiffExpansionRow from './parallel_diff_expansion_row.vue';
|
2018-06-21 08:22:40 -04:00
|
|
|
|
|
|
|
export default {
|
2018-06-27 17:20:41 -04:00
|
|
|
components: {
|
2019-08-09 22:36:32 -04:00
|
|
|
parallelDiffExpansionRow,
|
2018-07-03 19:18:27 -04:00
|
|
|
parallelDiffTableRow,
|
2018-06-27 17:20:41 -04:00
|
|
|
parallelDiffCommentRow,
|
2019-03-04 08:29:17 -05:00
|
|
|
ParallelDraftCommentRow: () =>
|
|
|
|
import('ee_component/batch_comments/components/parallel_draft_comment_row.vue'),
|
2018-06-27 17:20:41 -04:00
|
|
|
},
|
2019-03-04 08:29:17 -05:00
|
|
|
mixins: [draftCommentsMixin],
|
2018-07-03 19:18:27 -04:00
|
|
|
props: {
|
|
|
|
diffFile: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
diffLines: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
},
|
2018-12-13 14:17:19 -05:00
|
|
|
helpPagePath: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2018-07-03 19:18:27 -04:00
|
|
|
},
|
2018-06-21 08:22:40 -04:00
|
|
|
computed: {
|
2018-11-09 04:44:07 -05:00
|
|
|
...mapGetters('diffs', ['commitId']),
|
2018-07-03 19:18:27 -04:00
|
|
|
diffLinesLength() {
|
2018-08-06 17:13:34 -04:00
|
|
|
return this.diffLines.length;
|
2018-07-03 19:18:27 -04:00
|
|
|
},
|
2018-06-21 08:22:40 -04:00
|
|
|
},
|
2018-11-09 04:44:07 -05:00
|
|
|
userColorScheme: window.gon.user_color_scheme,
|
2018-06-21 08:22:40 -04:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2019-03-23 09:22:16 -04:00
|
|
|
<table
|
2018-11-09 04:44:07 -05:00
|
|
|
:class="$options.userColorScheme"
|
2018-06-21 08:22:40 -04:00
|
|
|
:data-commit-id="commitId"
|
2018-06-27 17:20:41 -04:00
|
|
|
class="code diff-wrap-lines js-syntax-highlight text-file"
|
|
|
|
>
|
2019-10-01 17:06:09 -04:00
|
|
|
<colgroup>
|
|
|
|
<col style="width: 50px;" />
|
2020-03-17 14:09:44 -04:00
|
|
|
<col style="width: 8px;" />
|
2019-10-01 17:06:09 -04:00
|
|
|
<col />
|
|
|
|
<col style="width: 50px;" />
|
2020-03-17 14:09:44 -04:00
|
|
|
<col style="width: 8px;" />
|
2019-10-01 17:06:09 -04:00
|
|
|
<col />
|
|
|
|
</colgroup>
|
2019-03-23 09:22:16 -04:00
|
|
|
<tbody>
|
|
|
|
<template v-for="(line, index) in diffLines">
|
2019-08-09 22:36:32 -04:00
|
|
|
<parallel-diff-expansion-row
|
|
|
|
:key="`expand-${index}`"
|
|
|
|
:file-hash="diffFile.file_hash"
|
|
|
|
:context-lines-path="diffFile.context_lines_path"
|
|
|
|
:line="line"
|
|
|
|
:is-top="index === 0"
|
|
|
|
:is-bottom="index + 1 === diffLinesLength"
|
|
|
|
/>
|
2019-03-23 09:22:16 -04:00
|
|
|
<parallel-diff-table-row
|
|
|
|
:key="line.line_code"
|
|
|
|
:file-hash="diffFile.file_hash"
|
2020-03-17 14:09:44 -04:00
|
|
|
:file-path="diffFile.file_path"
|
2019-03-23 09:22:16 -04:00
|
|
|
:context-lines-path="diffFile.context_lines_path"
|
|
|
|
:line="line"
|
|
|
|
:is-bottom="index + 1 === diffLinesLength"
|
|
|
|
/>
|
|
|
|
<parallel-diff-comment-row
|
|
|
|
:key="`dcr-${line.line_code || index}`"
|
|
|
|
:line="line"
|
|
|
|
:diff-file-hash="diffFile.file_hash"
|
|
|
|
:line-index="index"
|
|
|
|
:help-page-path="helpPagePath"
|
2019-07-08 05:49:48 -04:00
|
|
|
:has-draft-left="hasParallelDraftLeft(diffFile.file_hash, line) || false"
|
|
|
|
:has-draft-right="hasParallelDraftRight(diffFile.file_hash, line) || false"
|
2019-03-23 09:22:16 -04:00
|
|
|
/>
|
|
|
|
<parallel-draft-comment-row
|
|
|
|
v-if="shouldRenderParallelDraftRow(diffFile.file_hash, line)"
|
|
|
|
:key="`drafts-${index}`"
|
|
|
|
:line="line"
|
|
|
|
:diff-file-content-sha="diffFile.file_hash"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2018-06-21 08:22:40 -04:00
|
|
|
</template>
|