|
8 | 8 |
|
9 | 9 | <script setup lang="ts"> |
10 | 10 | import { Button } from '@/components/ui/button' |
| 11 | +import { Icon } from '#components' |
11 | 12 |
|
12 | 13 | import DataTable from '@/components/data-table/data-table.vue' |
13 | 14 | import { useDataTable } from '@/components/data-table/useDataTable' |
@@ -47,11 +48,37 @@ const loading = ref(false) |
47 | 48 |
|
48 | 49 | const objectApi = useObject({ bucket: props.bucketName }) |
49 | 50 |
|
| 51 | +const copyVersionId = async (versionId: string) => { |
| 52 | + if (!versionId) return |
| 53 | + try { |
| 54 | + await navigator.clipboard.writeText(versionId) |
| 55 | + message.success(t('Copy Success')) |
| 56 | + } catch (error) { |
| 57 | + message.error(t('Copy Failed')) |
| 58 | + } |
| 59 | +} |
| 60 | +
|
50 | 61 | const columns = computed<ColumnDef<any, any>[]>(() => [ |
51 | 62 | { |
52 | 63 | id: 'versionId', |
53 | 64 | header: () => t('VersionId'), |
54 | | - cell: ({ row }: any) => shortVersionId(row.original.VersionId), |
| 65 | + cell: ({ row }: any) => { |
| 66 | + const versionId = row.original.VersionId || '' |
| 67 | + return h('div', { class: 'flex items-center gap-2' }, [ |
| 68 | + h('span', { class: 'font-mono text-sm' }, versionId), |
| 69 | + h( |
| 70 | + ActionButton, |
| 71 | + { |
| 72 | + variant: 'ghost', |
| 73 | + size: 'sm', |
| 74 | + class: 'h-6 w-6 p-0 shrink-0', |
| 75 | + onClick: () => copyVersionId(versionId), |
| 76 | + title: t('Copy'), |
| 77 | + }, |
| 78 | + () => h(Icon, { name: 'ri:file-copy-line', size: 14 }) |
| 79 | + ), |
| 80 | + ]) |
| 81 | + }, |
55 | 82 | }, |
56 | 83 | { |
57 | 84 | id: 'lastModified', |
|
0 commit comments