debian-mirror-gitlab/app/assets/javascripts/blob/components/blob_header_filepath.vue

58 lines
1.4 KiB
Vue
Raw Normal View History

2020-03-13 15:44:24 +05:30
<script>
2022-03-02 08:16:31 +05:30
import { GlBadge } from '@gitlab/ui';
2020-03-13 15:44:24 +05:30
import { numberToHumanSize } from '~/lib/utils/number_utils';
2021-03-11 19:13:27 +05:30
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import FileIcon from '~/vue_shared/components/file_icon.vue';
2020-03-13 15:44:24 +05:30
export default {
components: {
FileIcon,
ClipboardButton,
2022-03-02 08:16:31 +05:30
GlBadge,
2020-03-13 15:44:24 +05:30
},
props: {
blob: {
type: Object,
required: true,
},
},
computed: {
blobSize() {
return numberToHumanSize(this.blob.size);
},
gfmCopyText() {
return `\`${this.blob.path}\``;
},
2022-03-02 08:16:31 +05:30
showLfsBadge() {
return this.blob.storedExternally && this.blob.externalStorage === 'lfs';
},
2020-03-13 15:44:24 +05:30
},
};
</script>
<template>
<div class="file-header-content d-flex align-items-center lh-100">
2021-01-29 00:20:46 +05:30
<slot name="filepath-prepend"></slot>
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
<template v-if="blob.path">
2021-09-30 23:02:18 +05:30
<file-icon :file-name="blob.path" :size="16" aria-hidden="true" css-classes="mr-2" />
2020-05-24 23:13:21 +05:30
<strong
class="file-title-name mr-1 js-blob-header-filepath"
2020-06-23 00:09:42 +05:30
data-qa-selector="file_title_content"
2020-05-24 23:13:21 +05:30
>{{ blob.path }}</strong
>
</template>
2020-03-13 15:44:24 +05:30
<clipboard-button
:text="blob.path"
:gfm="gfmCopyText"
:title="__('Copy file path')"
2021-01-03 14:25:43 +05:30
category="tertiary"
2020-03-13 15:44:24 +05:30
css-class="btn-clipboard btn-transparent lh-100 position-static"
/>
2022-03-02 08:16:31 +05:30
<small class="mr-2">{{ blobSize }}</small>
<gl-badge v-if="showLfsBadge">{{ __('LFS') }}</gl-badge>
2020-03-13 15:44:24 +05:30
</div>
</template>