From ace62327876dce61d28454d11b98ba8fa67db0fc Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 27 Oct 2022 14:04:04 +0800 Subject: [PATCH] feat: file storage settings --- .../app/client/src/plugins/file-manager.ts | 1 + .../client/src/plugins/sample-shop-i18n.ts | 1 - packages/core/client/src/pm/index.tsx | 15 ------- .../file-manager/src/client/FileStorage.tsx | 24 ++++++++++++ .../src/client/FileStorageShortcut.tsx | 2 +- .../plugins/file-manager/src/client/index.tsx | 39 +++++++++++++------ .../src/client/schemas/storage.ts | 2 +- 7 files changed, 54 insertions(+), 30 deletions(-) create mode 100644 packages/app/client/src/plugins/file-manager.ts delete mode 100644 packages/app/client/src/plugins/sample-shop-i18n.ts create mode 100644 packages/plugins/file-manager/src/client/FileStorage.tsx diff --git a/packages/app/client/src/plugins/file-manager.ts b/packages/app/client/src/plugins/file-manager.ts new file mode 100644 index 000000000..655be00ce --- /dev/null +++ b/packages/app/client/src/plugins/file-manager.ts @@ -0,0 +1 @@ +export { default } from '@nocobase/plugin-file-manager/client'; diff --git a/packages/app/client/src/plugins/sample-shop-i18n.ts b/packages/app/client/src/plugins/sample-shop-i18n.ts deleted file mode 100644 index 01dddf816..000000000 --- a/packages/app/client/src/plugins/sample-shop-i18n.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from '@nocobase/plugin-sample-shop-i18n/client'; \ No newline at end of file diff --git a/packages/core/client/src/pm/index.tsx b/packages/core/client/src/pm/index.tsx index 763cf1d11..5c7d869f0 100644 --- a/packages/core/client/src/pm/index.tsx +++ b/packages/core/client/src/pm/index.tsx @@ -8,7 +8,6 @@ import { ACLPane } from '../acl'; import { useAPIClient, useRequest } from '../api-client'; import { CollectionManagerPane } from '../collection-manager'; import { useDocumentTitle } from '../document-title'; -import { FileStoragePane } from '../file-manager'; import { Icon } from '../icon'; import { RouteSwitchContext } from '../route-switch'; import { useCompile } from '../schema-component'; @@ -252,20 +251,6 @@ const settings = { }, }, }, - 'file-manager': { - title: '{{t("File manager")}}', - icon: 'FileOutlined', - tabs: { - storages: { - title: '{{t("File storages")}}', - component: FileStoragePane, - }, - // test: { - // title: 'Test', - // component: FileStoragePane, - // }, - }, - }, 'system-settings': { icon: 'SettingOutlined', title: '{{t("System settings")}}', diff --git a/packages/plugins/file-manager/src/client/FileStorage.tsx b/packages/plugins/file-manager/src/client/FileStorage.tsx new file mode 100644 index 000000000..9ab11cf16 --- /dev/null +++ b/packages/plugins/file-manager/src/client/FileStorage.tsx @@ -0,0 +1,24 @@ +import { uid } from '@formily/shared'; +import { SchemaComponent } from '@nocobase/client'; +import { Card } from 'antd'; +import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { storageSchema } from './schemas/storage'; +import { StorageOptions } from './StorageOptions'; + +const schema = { + type: 'object', + properties: { + [uid()]: storageSchema, + }, +}; + +export const FileStoragePane = () => { + const [visible, setVisible] = useState(false); + const { t } = useTranslation(); + return ( + + + + ); +}; diff --git a/packages/plugins/file-manager/src/client/FileStorageShortcut.tsx b/packages/plugins/file-manager/src/client/FileStorageShortcut.tsx index 6104e7129..fa7657fe8 100644 --- a/packages/plugins/file-manager/src/client/FileStorageShortcut.tsx +++ b/packages/plugins/file-manager/src/client/FileStorageShortcut.tsx @@ -36,4 +36,4 @@ export const FileStorageShortcut = () => { ); -}; \ No newline at end of file +}; diff --git a/packages/plugins/file-manager/src/client/index.tsx b/packages/plugins/file-manager/src/client/index.tsx index b970550d3..cf2b9d365 100644 --- a/packages/plugins/file-manager/src/client/index.tsx +++ b/packages/plugins/file-manager/src/client/index.tsx @@ -1,20 +1,35 @@ -import React from 'react'; -import { PluginManagerContext } from '@nocobase/client'; -import { useContext } from 'react'; +import { PluginManagerContext, SettingsCenterProvider } from '@nocobase/client'; +import React, { useContext } from 'react'; +import { FileStoragePane } from './FileStorage'; import { FileStorageShortcut } from './FileStorageShortcut'; -export default function(props) { +export default function (props) { const ctx = useContext(PluginManagerContext); return ( - - {props.children} - + + {props.children} + + ); -}; +} diff --git a/packages/plugins/file-manager/src/client/schemas/storage.ts b/packages/plugins/file-manager/src/client/schemas/storage.ts index fdc798274..14711eb02 100644 --- a/packages/plugins/file-manager/src/client/schemas/storage.ts +++ b/packages/plugins/file-manager/src/client/schemas/storage.ts @@ -1,6 +1,6 @@ import { ISchema } from '@formily/react'; import { uid } from '@formily/shared'; -import { useRequest, useActionContext } from '@nocobase/client'; +import { useActionContext, useRequest } from '@nocobase/client'; const collection = { name: 'storages',