From 5fbce9fb65b41b3db26887d805cee88c8692c9fd Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 15 Oct 2023 16:00:21 +0800 Subject: [PATCH] fix(file-manager): improve initialization logic (#2834) --- .../plugin-file-manager/src/client/FileStorage.tsx | 6 +++--- .../plugin-file-manager/src/client/schemas/storage.ts | 2 +- .../src/client/schemas/storageTypes/ali-oss.ts | 1 + .../src/client/schemas/storageTypes/local.ts | 1 + .../src/client/schemas/storageTypes/s3.ts | 1 + .../src/client/schemas/storageTypes/tx-cos.ts | 1 + 6 files changed, 8 insertions(+), 4 deletions(-) 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 b516dcd0a..ee8279907 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx @@ -76,7 +76,7 @@ export const CreateStorage = () => { {t('Add new')} - + ); @@ -99,7 +99,7 @@ export const EditStorage = () => { setSchema({ type: 'object', properties: { - drawer: { + [uid()]: { type: 'void', 'x-component': 'Action.Drawer', 'x-decorator': 'Form', @@ -140,7 +140,7 @@ export const EditStorage = () => { > {t('Edit')} - + ); diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storage.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storage.ts index 4f960f74b..16f004e11 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storage.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storage.ts @@ -179,10 +179,10 @@ export const storageSchema: ISchema = { type: 'void', 'x-decorator': 'Table.Column.Decorator', 'x-component': 'Table.Column', + title: `{{t("Default storage", { ns: "${NAMESPACE}" })}}`, properties: { default: { type: 'string', - title: `{{t("Default storage", { ns: "${NAMESPACE}" })}}`, 'x-component': 'CollectionField', 'x-read-pretty': true, }, 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 b35e299c9..c6172a1d7 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 @@ -11,6 +11,7 @@ export default { name: { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', + 'x-disabled': '{{ !createOnly }}', 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 997b3fa62..d4405bfea 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 @@ -11,6 +11,7 @@ export default { name: { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', + 'x-disabled': '{{ !createOnly }}', 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/s3.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/s3.ts index 870bb9b96..2bce2fb09 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 @@ -11,6 +11,7 @@ export default { name: { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', + 'x-disabled': '{{ !createOnly }}', 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 b203453d8..07b04e134 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 @@ -11,6 +11,7 @@ export default { name: { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', + 'x-disabled': '{{ !createOnly }}', description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}', },