Commit 42428923 authored by Phil Hughes's avatar Phil Hughes

Added truncation to the tree view

This change also adds the title attribute to the rows
parent f40db2a8
...@@ -62,6 +62,7 @@ export default { ...@@ -62,6 +62,7 @@ export default {
v-bind="$attrs" v-bind="$attrs"
:class="{ 'is-active': isActive }" :class="{ 'is-active': isActive }"
class="diff-file-row" class="diff-file-row"
truncate-middle
:file-classes="fileClasses" :file-classes="fileClasses"
v-on="$listeners" v-on="$listeners"
> >
......
<script> <script>
import { GlTruncate } from '@gitlab/ui';
import FileHeader from '~/vue_shared/components/file_row_header.vue'; import FileHeader from '~/vue_shared/components/file_row_header.vue';
import FileIcon from '~/vue_shared/components/file_icon.vue'; import FileIcon from '~/vue_shared/components/file_icon.vue';
import { escapeFileUrl } from '~/lib/utils/url_utility'; import { escapeFileUrl } from '~/lib/utils/url_utility';
...@@ -8,6 +9,7 @@ export default { ...@@ -8,6 +9,7 @@ export default {
components: { components: {
FileHeader, FileHeader,
FileIcon, FileIcon,
GlTruncate,
}, },
props: { props: {
file: { file: {
...@@ -28,6 +30,11 @@ export default { ...@@ -28,6 +30,11 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
truncateMiddle: {
type: Boolean,
required: false,
default: false,
},
}, },
computed: { computed: {
isTree() { isTree() {
...@@ -134,9 +141,9 @@ export default { ...@@ -134,9 +141,9 @@ export default {
<span <span
ref="textOutput" ref="textOutput"
:style="levelIndentation" :style="levelIndentation"
class="file-row-name str-truncated" class="file-row-name"
data-qa-selector="file_name_content" data-qa-selector="file_name_content"
:class="fileClasses" :class="[fileClasses, { 'str-truncated': !truncateMiddle, 'gl-min-w-0': truncateMiddle }]"
> >
<file-icon <file-icon
class="file-row-icon" class="file-row-icon"
...@@ -147,7 +154,8 @@ export default { ...@@ -147,7 +154,8 @@ export default {
:opened="file.opened" :opened="file.opened"
:size="16" :size="16"
/> />
{{ file.name }} <gl-truncate v-if="truncateMiddle" :text="file.name" position="middle" class="gl-pr-7" />
<template v-else>{{ file.name }}</template>
</span> </span>
<slot></slot> <slot></slot>
</div> </div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment