diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 18:09:03 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 18:09:03 +0000 |
commit | d7ce7307dca551759ffa972015875f8ebe476927 (patch) | |
tree | 7cb8c211b737de7120dd2f1e825852e77ac5d380 /app/assets/javascripts/vue_shared/components | |
parent | e43077ab4742ba5083a01a1e5341db1a1b7a1701 (diff) | |
download | gitlab-ce-d7ce7307dca551759ffa972015875f8ebe476927.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared/components')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/file_row.vue | 78 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/file_tree.vue | 47 |
2 files changed, 77 insertions, 48 deletions
diff --git a/app/assets/javascripts/vue_shared/components/file_row.vue b/app/assets/javascripts/vue_shared/components/file_row.vue index 611001df32f..d962f644ff8 100644 --- a/app/assets/javascripts/vue_shared/components/file_row.vue +++ b/app/assets/javascripts/vue_shared/components/file_row.vue @@ -62,9 +62,6 @@ export default { 'is-open': this.file.opened, }; }, - childFilesLevel() { - return this.file.isHeader ? 0 : this.level + 1; - }, }, watch: { 'file.active': function fileActiveWatch(active) { @@ -131,53 +128,38 @@ export default { </script> <template> - <div> - <file-header v-if="file.isHeader" :path="file.path" /> - <div - v-else - :class="fileClass" - :title="file.name" - class="file-row" - role="button" - @click="clickFile" - @mouseleave="toggleDropdown(false)" - > - <div class="file-row-name-container"> - <span ref="textOutput" :style="levelIndentation" class="file-row-name str-truncated"> - <file-icon - v-if="!showChangedIcon || file.type === 'tree'" - class="file-row-icon" - :file-name="file.name" - :loading="file.loading" - :folder="isTree" - :opened="file.opened" - :size="16" - /> - <changed-file-icon v-else :file="file" :size="16" class="append-right-5" /> - {{ file.name }} - </span> - <component - :is="extraComponent" - v-if="extraComponent && !(hideExtraOnTree && file.type === 'tree')" - :file="file" - :dropdown-open="dropdownOpen" - @toggle="toggleDropdown($event)" + <file-header v-if="file.isHeader" :path="file.path" /> + <div + v-else + :class="fileClass" + :title="file.name" + class="file-row" + role="button" + @click="clickFile" + @mouseleave="toggleDropdown(false)" + > + <div class="file-row-name-container"> + <span ref="textOutput" :style="levelIndentation" class="file-row-name str-truncated"> + <file-icon + v-if="!showChangedIcon || file.type === 'tree'" + class="file-row-icon" + :file-name="file.name" + :loading="file.loading" + :folder="isTree" + :opened="file.opened" + :size="16" /> - </div> - </div> - <template v-if="file.opened || file.isHeader"> - <file-row - v-for="childFile in file.tree" - :key="childFile.key" - :file="childFile" - :level="childFilesLevel" - :hide-extra-on-tree="hideExtraOnTree" - :extra-component="extraComponent" - :show-changed-icon="showChangedIcon" - @toggleTreeOpen="toggleTreeOpen" - @clickFile="clickedFile" + <changed-file-icon v-else :file="file" :size="16" class="append-right-5" /> + {{ file.name }} + </span> + <component + :is="extraComponent" + v-if="extraComponent && !(hideExtraOnTree && file.type === 'tree')" + :file="file" + :dropdown-open="dropdownOpen" + @toggle="toggleDropdown($event)" /> - </template> + </div> </div> </template> diff --git a/app/assets/javascripts/vue_shared/components/file_tree.vue b/app/assets/javascripts/vue_shared/components/file_tree.vue new file mode 100644 index 00000000000..e7817b8f910 --- /dev/null +++ b/app/assets/javascripts/vue_shared/components/file_tree.vue @@ -0,0 +1,47 @@ +<script> +export default { + name: 'FileTree', + props: { + fileRowComponent: { + type: Object, + required: true, + }, + level: { + type: Number, + required: true, + }, + file: { + type: Object, + required: true, + }, + }, + computed: { + childFilesLevel() { + return this.file.isHeader ? 0 : this.level + 1; + }, + }, +}; +</script> + +<template> + <div> + <component + :is="fileRowComponent" + :level="level" + :file="file" + v-bind="$attrs" + v-on="$listeners" + /> + <template v-if="file.opened || file.isHeader"> + <file-tree + v-for="childFile in file.tree" + :key="childFile.key" + :file-row-component="fileRowComponent" + :level="childFilesLevel" + :file="childFile" + v-bind="$attrs" + v-on="$listeners" + /> + </template> + </div> +</template> |