2018-06-21 08:22:40 -04:00
|
|
|
<script>
|
2018-07-09 07:54:15 -04:00
|
|
|
import { mapGetters, mapState } from 'vuex';
|
2018-07-03 19:18:27 -04:00
|
|
|
import inlineDiffTableRow from './inline_diff_table_row.vue';
|
2018-06-27 17:20:41 -04:00
|
|
|
import inlineDiffCommentRow from './inline_diff_comment_row.vue';
|
2018-06-21 08:22:40 -04:00
|
|
|
|
|
|
|
export default {
|
2018-06-27 17:20:41 -04:00
|
|
|
components: {
|
|
|
|
inlineDiffCommentRow,
|
2018-07-03 19:18:27 -04:00
|
|
|
inlineDiffTableRow,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
diffFile: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
diffLines: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
2018-09-01 17:24:29 -04:00
|
|
|
...mapGetters('diffs', ['commitId', 'shouldRenderInlineCommentRow']),
|
2018-07-09 07:54:15 -04:00
|
|
|
...mapState({
|
|
|
|
diffLineCommentForms: state => state.diffs.diffLineCommentForms,
|
|
|
|
}),
|
2018-07-03 19:18:27 -04:00
|
|
|
diffLinesLength() {
|
2018-09-01 17:24:29 -04:00
|
|
|
return this.diffLines.length;
|
2018-07-03 19:18:27 -04:00
|
|
|
},
|
|
|
|
userColorScheme() {
|
|
|
|
return window.gon.user_color_scheme;
|
|
|
|
},
|
2018-06-21 08:22:40 -04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<table
|
|
|
|
:class="userColorScheme"
|
|
|
|
:data-commit-id="commitId"
|
2018-06-26 14:49:22 -04:00
|
|
|
class="code diff-wrap-lines js-syntax-highlight text-file js-diff-inline-view">
|
2018-06-21 08:22:40 -04:00
|
|
|
<tbody>
|
|
|
|
<template
|
2018-09-01 17:24:29 -04:00
|
|
|
v-for="(line, index) in diffLines"
|
2018-06-21 08:22:40 -04:00
|
|
|
>
|
2018-07-03 19:18:27 -04:00
|
|
|
<inline-diff-table-row
|
2018-11-09 14:48:41 -05:00
|
|
|
:key="line.line_code"
|
|
|
|
:file-hash="diffFile.file_hash"
|
|
|
|
:context-lines-path="diffFile.context_lines_path"
|
2018-06-27 17:20:41 -04:00
|
|
|
:line="line"
|
|
|
|
:is-bottom="index + 1 === diffLinesLength"
|
|
|
|
/>
|
|
|
|
<inline-diff-comment-row
|
2018-08-07 22:50:01 -04:00
|
|
|
v-if="shouldRenderInlineCommentRow(line)"
|
2018-09-20 02:13:50 -04:00
|
|
|
:key="index"
|
2018-11-09 14:48:41 -05:00
|
|
|
:diff-file-hash="diffFile.file_hash"
|
2018-06-27 17:20:41 -04:00
|
|
|
:line="line"
|
|
|
|
:line-index="index"
|
|
|
|
/>
|
2018-06-21 08:22:40 -04:00
|
|
|
</template>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</template>
|