feat: file storage settings

This commit is contained in:
chenos 2022-10-27 14:04:04 +08:00
parent 08711e6c8e
commit ace6232787
7 changed files with 54 additions and 30 deletions

View File

@ -0,0 +1 @@
export { default } from '@nocobase/plugin-file-manager/client';

View File

@ -1 +0,0 @@
export { default } from '@nocobase/plugin-sample-shop-i18n/client';

View File

@ -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")}}',

View File

@ -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 (
<Card bordered={false}>
<SchemaComponent components={{ StorageOptions }} schema={schema} />
</Card>
);
};

View File

@ -1,11 +1,25 @@
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) {
const ctx = useContext(PluginManagerContext);
return (
<SettingsCenterProvider
settings={{
'file-manager': {
title: '{{t("File manager")}}',
icon: 'FileOutlined',
tabs: {
storages: {
title: '{{t("File storages")}}',
component: FileStoragePane,
},
},
},
}}
>
<PluginManagerContext.Provider
value={{
components: {
@ -16,5 +30,6 @@ export default function(props) {
>
{props.children}
</PluginManagerContext.Provider>
</SettingsCenterProvider>
);
};
}

View File

@ -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',