Commit f40db2a8 authored by Phil Hughes's avatar Phil Hughes

Fixed paths in MR sidebar truncating incorrectly

This fixes a bug where long paths would actually just get
truncated into a long path of ellipsis', instead of including
any part of the path name.

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/25973
parent efceaf81
<script> <script>
import { truncatePathMiddleToLength } from '~/lib/utils/text_utility'; import { GlTruncate } from '@gitlab/ui';
const MAX_PATH_LENGTH = 40;
export default { export default {
components: {
GlTruncate,
},
props: { props: {
path: { path: {
type: String, type: String,
required: true, required: true,
}, },
}, },
computed: {
truncatedPath() {
return truncatePathMiddleToLength(this.path, MAX_PATH_LENGTH);
},
},
}; };
</script> </script>
<template> <template>
<div class="file-row-header bg-white sticky-top p-2 js-file-row-header" :title="path"> <div class="file-row-header bg-white sticky-top p-2 js-file-row-header" :title="path">
<span class="bold">{{ truncatedPath }}</span> <gl-truncate :text="path" position="middle" class="bold" />
</div> </div>
</template> </template>
---
title: Fixed long paths truncating in merge request sidebar incorrectly
merge_request:
author:
type: fixed
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