feat: file storage settings
This commit is contained in:
parent
08711e6c8e
commit
ace6232787
1
packages/app/client/src/plugins/file-manager.ts
Normal file
1
packages/app/client/src/plugins/file-manager.ts
Normal file
@ -0,0 +1 @@
|
||||
export { default } from '@nocobase/plugin-file-manager/client';
|
@ -1 +0,0 @@
|
||||
export { default } from '@nocobase/plugin-sample-shop-i18n/client';
|
@ -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")}}',
|
||||
|
24
packages/plugins/file-manager/src/client/FileStorage.tsx
Normal file
24
packages/plugins/file-manager/src/client/FileStorage.tsx
Normal 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>
|
||||
);
|
||||
};
|
@ -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) {
|
||||
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>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user