feat: add display of directory information

This commit is contained in:
hayden
2024-11-06 13:51:38 +08:00
parent 0a8c532506
commit 288f026d47
3 changed files with 20 additions and 3 deletions

View File

@@ -29,11 +29,13 @@
<col />
</colgroup>
<tbody>
<tr v-for="item in information" class="h-8 border-b">
<tr v-for="item in information" class="h-8 whitespace-nowrap border-b">
<td class="border-r bg-gray-300 px-4 dark:bg-gray-800">
{{ $t(`info.${item.key}`) }}
</td>
<td class="break-all px-4">{{ item.display }}</td>
<td class="overflow-hidden text-ellipsis break-all px-4">
{{ item.display }}
</td>
</tr>
</tbody>
</table>
@@ -81,7 +83,8 @@ const pathOptions = computed(() => {
const information = computed(() => {
return Object.values(baseInfo.value).filter((row) => {
if (editable.value) {
return row.key !== 'fullname'
const hiddenKeys = ['fullname', 'pathIndex']
return !hiddenKeys.includes(row.key)
}
return true
})

View File

@@ -1,3 +1,4 @@
import { useConfig } from 'hooks/config'
import { useLoading } from 'hooks/loading'
import { useMarkdown } from 'hooks/markdown'
import { request, useRequest } from 'hooks/request'
@@ -203,6 +204,8 @@ const baseInfoKey = Symbol('baseInfo') as InjectionKey<
export const useModelBaseInfoEditor = (formInstance: ModelFormInstance) => {
const { formData: model, modelData } = formInstance
const { modelFolders } = useConfig()
const type = computed({
get: () => {
return model.value.type
@@ -251,6 +254,15 @@ export const useModelBaseInfoEditor = (formInstance: ModelFormInstance) => {
key: 'type',
formatter: () => modelData.value.type,
},
{
key: 'pathIndex',
formatter: () => {
const modelType = modelData.value.type
const pathIndex = modelData.value.pathIndex
const folders = modelFolders.value[modelType] ?? []
return `${folders[pathIndex]}`
},
},
{
key: 'fullname',
formatter: (val) => val,

View File

@@ -32,6 +32,7 @@ const messages = {
},
info: {
type: 'Model Type',
pathIndex: 'Directory',
fullname: 'File Name',
sizeBytes: 'File Size',
createdAt: 'Created At',
@@ -69,6 +70,7 @@ const messages = {
},
info: {
type: '类型',
pathIndex: '目录',
fullname: '文件名',
sizeBytes: '文件大小',
createdAt: '创建时间',