diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx b/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx index ee8279907..18279f4fc 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx @@ -168,7 +168,7 @@ export const FileStoragePane = () => { `${prefix}${uid()}`, storageTypes, xStyleProcessDesc }} schema={storageSchema} /> diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/createLocalStorage.test.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/createLocalStorage.test.ts index 6c4852250..8716b3278 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/createLocalStorage.test.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/createLocalStorage.test.ts @@ -18,10 +18,10 @@ test.describe('file manager', () => { await page.getByRole('menuitem', { name: 'Local storage' }).click(); const createLocalStorage = new CreateLocalStorage(page); await createLocalStorage.title.fill(caseTitle); - const storageName = caseNum + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); + const storageName = caseNum + dayjs().format('YYYYMMDDHHmmssSSS').toString(); await createLocalStorage.storageName.fill(storageName); - await createLocalStorage.storagebaseURL.fill('/storage/uploadsFM01AA'); - await createLocalStorage.destination.fill('storage/uploadsFM01AA'); + // await createLocalStorage.storagebaseURL.fill('/storage/uploadsFM01AA'); + // await createLocalStorage.destination.fill('storage/uploadsFM01AA'); // await createLocalStorage.path.fill(''); // await createLocalStorage.defaultStorage.check(); // await createLocalStorage.deleteRecordRetentionFile.check(); diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/editLocalStorage.test.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/editLocalStorage.test.ts index be10d08b7..ac180da61 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/editLocalStorage.test.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/editLocalStorage.test.ts @@ -17,11 +17,11 @@ test.describe('File manager', () => { const createLocalStorage = new CreateLocalStorage(page); await createLocalStorage.title.fill(caseTitle); - const storageName = caseNum + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); + const storageName = caseNum + dayjs().format('YYYYMMDDHHmmssSSS').toString(); await createLocalStorage.storageName.fill(storageName); - await createLocalStorage.storagebaseURL.fill('/storage/uploadsFM02AA'); - await createLocalStorage.destination.fill('storage/uploadsFM02AA'); - // await createLocalStorage.path.fill(''); + // await createLocalStorage.storagebaseURL.fill('/storage/uploadsFM02AA'); + // await createLocalStorage.destination.fill('storage/uploadsFM02AA'); + // // await createLocalStorage.path.fill(''); // await createLocalStorage.defaultStorage.check(); // await createLocalStorage.deleteRecordRetentionFile.check(); await page.getByLabel('action-Action-Submit-storages').click(); @@ -30,7 +30,7 @@ test.describe('File manager', () => { // 2、测试步骤:点击“文件管理器”-“编辑”按钮,编辑标题,点击“确定”按钮 await page.getByText('Edit').nth(2).click(); const editLocalStorage = new EditLocalStorage(page); - caseTitle = caseTitle + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); + caseTitle = caseTitle + dayjs().format('YYYYMMDDHHmmssSSS').toString(); await editLocalStorage.title.fill(caseTitle); // await editLocalStorage.path.fill(''); // await editLocalStorage.defaultStorage.check(); diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/pageobject/localStorage.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/pageobject/localStorage.ts index 24bdac1f4..bd0dd035b 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/pageobject/localStorage.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/__tests__/e2e/pageobject/localStorage.ts @@ -14,8 +14,8 @@ export class CreateLocalStorage { this.page = page; this.title = page.getByLabel('block-item-CollectionField-storages-Title').getByRole('textbox'); this.storageName = page.getByLabel('block-item-CollectionField-storages-Storage name').getByRole('textbox'); - this.storagebaseURL = page.getByLabel('block-item-CollectionField-storages-Storage base URL').getByRole('textbox'); - this.destination = page.getByLabel('block-item-Input-storages-Destination').getByRole('textbox'); + // this.storagebaseURL = page.getByLabel('block-item-CollectionField-storages-Storage base URL').getByRole('textbox'); + // this.destination = page.getByLabel('block-item-Input-storages-Destination').getByRole('textbox'); this.path = page.getByLabel('block-item-CollectionField-storages-Path').getByRole('textbox'); this.defaultStorage = page.getByLabel('Default storage'); this.deleteRecordRetentionFile = page.getByLabel('Keep file in storage when destroy record'); @@ -37,8 +37,8 @@ export class EditLocalStorage { this.page = page; this.title = page.getByLabel('block-item-CollectionField-storages-Title').getByRole('textbox'); this.storageName = page.getByLabel('block-item-CollectionField-storages-Storage name').getByRole('textbox'); - this.storagebaseURL = page.getByLabel('block-item-CollectionField-storages-Storage base URL').getByRole('textbox'); - this.destination = page.getByLabel('block-item-Input-storages-Destination').getByRole('textbox'); + // this.storagebaseURL = page.getByLabel('block-item-CollectionField-storages-Storage base URL').getByRole('textbox'); + // this.destination = page.getByLabel('block-item-Input-storages-Destination').getByRole('textbox'); this.path = page.getByLabel('block-item-CollectionField-storages-Path').getByRole('textbox'); this.defaultStorage = page.getByLabel('Default storage'); this.deleteRecordRetentionFile = page.getByLabel('Keep file in storage when destroy record'); diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/ali-oss.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/ali-oss.ts index c6172a1d7..f24540b6f 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/ali-oss.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/ali-oss.ts @@ -12,6 +12,8 @@ export default { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', 'x-disabled': '{{ !createOnly }}', + required: true, + default: '{{ useNewId("s_") }}', description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}', }, diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/local.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/local.ts index d4405bfea..0d4cf6283 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/local.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/local.ts @@ -12,12 +12,15 @@ export default { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', 'x-disabled': '{{ !createOnly }}', + required: true, + default: '{{ useNewId("s_") }}', description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}', }, baseUrl: { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', + 'x-display': 'hidden', default: '/storage/uploads', }, options: { @@ -29,6 +32,7 @@ export default { type: 'string', 'x-decorator': 'FormItem', 'x-component': 'Input', + 'x-display': 'hidden', default: 'storage/uploads', }, }, @@ -36,6 +40,9 @@ export default { path: { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', + 'x-component-props': { + addonBefore: 'storage/uploads/', + }, }, default: { 'x-component': 'CollectionField', diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/s3.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/s3.ts index 2bce2fb09..0a53f5bd5 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/s3.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/s3.ts @@ -12,6 +12,8 @@ export default { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', 'x-disabled': '{{ !createOnly }}', + required: true, + default: '{{ useNewId("s_") }}', description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}', }, diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/tx-cos.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/tx-cos.ts index 07b04e134..9b477a1d7 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/tx-cos.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/tx-cos.ts @@ -12,6 +12,8 @@ export default { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', 'x-disabled': '{{ !createOnly }}', + required: true, + default: '{{ useNewId("s_") }}', description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}', }, diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/locale/zh-CN.ts b/packages/plugins/@nocobase/plugin-file-manager/src/locale/zh-CN.ts index 28719f2a7..c9647bc56 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/locale/zh-CN.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/locale/zh-CN.ts @@ -23,7 +23,7 @@ export default { 'Tencent COS': '腾讯云 COS', Region: '区域', Bucket: '存储桶', - Path: '相对路径', + Path: '路径', Filename: '文件名', 'Will be used for API': '将用于 API', 'Default storage will be used when not selected': '留空将使用默认存储空间', diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/server/collections/storages.ts b/packages/plugins/@nocobase/plugin-file-manager/src/server/collections/storages.ts index 49ef011a3..6e6ea7722 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/server/collections/storages.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/server/collections/storages.ts @@ -16,7 +16,7 @@ export default { { title: '英文标识', // comment: '英文标识,用于代码层面配置', - type: 'string', + type: 'uid', name: 'name', unique: true, },