diff --git a/packages/core/client/src/application/Application.tsx b/packages/core/client/src/application/Application.tsx
index d53598fb4..7469f0bd0 100644
--- a/packages/core/client/src/application/Application.tsx
+++ b/packages/core/client/src/application/Application.tsx
@@ -9,7 +9,6 @@ import { APIClient, APIClientProvider } from '../api-client';
import { BlockSchemaComponentProvider } from '../block-provider';
import { CollectionManagerShortcut } from '../collection-manager';
import { RemoteDocumentTitleProvider } from '../document-title';
-import { FileStorageShortcut } from '../file-manager';
import { i18n } from '../i18n';
import { PluginManagerProvider } from '../plugin-manager';
import PMProvider, { PluginManagerLink, SettingsCenterDropdown } from '../pm';
@@ -101,7 +100,6 @@ export class Application {
CollectionManagerShortcut,
SystemSettingsShortcut,
SchemaTemplateShortcut,
- FileStorageShortcut,
PluginManagerLink,
SettingsCenterDropdown,
},
diff --git a/packages/core/client/src/file-manager/FileStorage.tsx b/packages/core/client/src/file-manager/FileStorage.tsx
deleted file mode 100644
index 3ca927af8..000000000
--- a/packages/core/client/src/file-manager/FileStorage.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { uid } from '@formily/shared';
-import { Card } from 'antd';
-import React, { useState } from 'react';
-import { useTranslation } from 'react-i18next';
-import { SchemaComponent } from '../schema-component';
-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 (
-
-
-
- );
-};
-
-// WZvC&6cR8@aAJu!
diff --git a/packages/core/client/src/file-manager/index.ts b/packages/core/client/src/file-manager/index.ts
deleted file mode 100644
index 543062555..000000000
--- a/packages/core/client/src/file-manager/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './FileStorage';
-export * from './FileStorageShortcut';
-
diff --git a/packages/core/client/src/index.tsx b/packages/core/client/src/index.tsx
index 6bb4a8225..57c75634c 100644
--- a/packages/core/client/src/index.tsx
+++ b/packages/core/client/src/index.tsx
@@ -11,7 +11,6 @@ export * from './board';
export * from './china-region';
export * from './collection-manager';
export * from './document-title';
-export * from './file-manager';
export * from './i18n';
export * from './icon';
export * from './plugin-manager';
diff --git a/packages/core/client/src/locale/zh_CN.ts b/packages/core/client/src/locale/zh_CN.ts
index 15af77f28..7524683ac 100644
--- a/packages/core/client/src/locale/zh_CN.ts
+++ b/packages/core/client/src/locale/zh_CN.ts
@@ -497,11 +497,14 @@ export default {
'Add storage': '添加文件存储',
'Edit storage': '编辑文件存储',
'Storage base URL': 'Base URL',
- 'Destination': '文件路径',
+ 'Destination': '存储路径(绝对)',
'Use the built-in static file server': '使用内置静态文件服务',
'Local storage': '本地存储',
'Aliyun OSS': '阿里云 OSS',
'Amazon S3': '亚马逊 S3',
+ 'Region': '区域',
+ 'Bucket': '存储桶',
+ 'Path': '路径(相对)',
// plugins/workflow
'Workflow': '工作流',
diff --git a/packages/plugins/file-manager/client.d.ts b/packages/plugins/file-manager/client.d.ts
new file mode 100644
index 000000000..765db9222
--- /dev/null
+++ b/packages/plugins/file-manager/client.d.ts
@@ -0,0 +1,4 @@
+// @ts-nocheck
+export * from './lib/client';
+export { default } from './lib/client';
+
diff --git a/packages/plugins/file-manager/client.js b/packages/plugins/file-manager/client.js
new file mode 100644
index 000000000..238820257
--- /dev/null
+++ b/packages/plugins/file-manager/client.js
@@ -0,0 +1,30 @@
+"use strict";
+
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+var _index = _interopRequireWildcard(require("./lib/client"));
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+var _exportNames = {};
+Object.defineProperty(exports, "default", {
+ enumerable: true,
+ get: function get() {
+ return _index.default;
+ }
+});
+
+Object.keys(_index).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
+ if (key in exports && exports[key] === _index[key]) return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function get() {
+ return _index[key];
+ }
+ });
+});
diff --git a/packages/plugins/file-manager/package.json b/packages/plugins/file-manager/package.json
index ddcd12fee..fb9d5e1da 100644
--- a/packages/plugins/file-manager/package.json
+++ b/packages/plugins/file-manager/package.json
@@ -12,6 +12,7 @@
"dependencies": {
"@koa/multer": "^3.0.0",
"@nocobase/server": "0.8.0-alpha.1",
+ "@nocobase/client": "0.8.0-alpha.1",
"aws-sdk": "^2.2.32",
"koa-static": "^5.0.0",
"mime-match": "^1.0.2",
diff --git a/packages/plugins/file-manager/server.d.ts b/packages/plugins/file-manager/server.d.ts
new file mode 100644
index 000000000..e70edb928
--- /dev/null
+++ b/packages/plugins/file-manager/server.d.ts
@@ -0,0 +1,4 @@
+// @ts-nocheck
+export * from './lib/server';
+export { default } from './lib/server';
+
diff --git a/packages/plugins/file-manager/server.js b/packages/plugins/file-manager/server.js
new file mode 100644
index 000000000..d06a7eb92
--- /dev/null
+++ b/packages/plugins/file-manager/server.js
@@ -0,0 +1,30 @@
+"use strict";
+
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+var _index = _interopRequireWildcard(require("./lib/server"));
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+var _exportNames = {};
+Object.defineProperty(exports, "default", {
+ enumerable: true,
+ get: function get() {
+ return _index.default;
+ }
+});
+
+Object.keys(_index).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
+ if (key in exports && exports[key] === _index[key]) return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function get() {
+ return _index[key];
+ }
+ });
+});
diff --git a/packages/core/client/src/file-manager/FileStorageShortcut.tsx b/packages/plugins/file-manager/src/client/FileStorageShortcut.tsx
similarity index 67%
rename from packages/core/client/src/file-manager/FileStorageShortcut.tsx
rename to packages/plugins/file-manager/src/client/FileStorageShortcut.tsx
index 27d063e92..6104e7129 100644
--- a/packages/core/client/src/file-manager/FileStorageShortcut.tsx
+++ b/packages/plugins/file-manager/src/client/FileStorageShortcut.tsx
@@ -1,10 +1,8 @@
import { FileOutlined } from '@ant-design/icons';
import { uid } from '@formily/shared';
+import { ActionContext, PluginManager, SchemaComponent } from '@nocobase/client';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { useHistory } from 'react-router-dom';
-import { PluginManager } from '..';
-import { ActionContext, SchemaComponent } from '../schema-component';
import { storageSchema } from './schemas/storage';
import { StorageOptions } from './StorageOptions';
@@ -23,20 +21,6 @@ const schema = {
};
export const FileStorageShortcut = () => {
- const { t } = useTranslation();
- const history = useHistory();
- return (
- }
- title={t('File storages')}
- onClick={() => {
- history.push('/admin/settings/file-manager/storages');
- }}
- />
- );
-};
-
-export const FileStorageShortcut2 = () => {
const [visible, setVisible] = useState(false);
const { t } = useTranslation();
return (
@@ -52,4 +36,4 @@ export const FileStorageShortcut2 = () => {
);
-};
+};
\ No newline at end of file
diff --git a/packages/core/client/src/file-manager/StorageOptions.tsx b/packages/plugins/file-manager/src/client/StorageOptions.tsx
similarity index 69%
rename from packages/core/client/src/file-manager/StorageOptions.tsx
rename to packages/plugins/file-manager/src/client/StorageOptions.tsx
index c42776caa..996e37606 100644
--- a/packages/core/client/src/file-manager/StorageOptions.tsx
+++ b/packages/plugins/file-manager/src/client/StorageOptions.tsx
@@ -13,6 +13,12 @@ const schema = {
'x-component': 'Input',
default: 'uploads',
},
+ path: {
+ title: '{{t("Path")}}',
+ type: 'string',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ },
serve: {
type: 'string',
'x-decorator': 'FormItem',
@@ -52,6 +58,44 @@ const schema = {
'x-component': 'Input',
required: true,
},
+ path: {
+ title: '{{t("Path")}}',
+ type: 'string',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ },
+ },
+ },
+ 'tx-cos': {
+ properties: {
+ Region: {
+ title: '{{t("Region")}}',
+ type: 'string',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ required: true,
+ },
+ SecretId: {
+ title: '{{t("SecretId")}}',
+ type: 'string',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ required: true,
+ },
+ SecretKey: {
+ title: '{{t("SecretKey")}}',
+ type: 'string',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Password',
+ required: true,
+ },
+ Bucket: {
+ title: '{{t("Bucket")}}',
+ type: 'string',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ required: true,
+ },
},
},
s3: {
@@ -84,6 +128,12 @@ const schema = {
'x-component': 'Input',
required: true,
},
+ path: {
+ title: '{{t("Path")}}',
+ type: 'string',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ },
},
},
};
diff --git a/packages/plugins/file-manager/src/client/index.tsx b/packages/plugins/file-manager/src/client/index.tsx
new file mode 100644
index 000000000..b970550d3
--- /dev/null
+++ b/packages/plugins/file-manager/src/client/index.tsx
@@ -0,0 +1,20 @@
+import React from 'react';
+import { PluginManagerContext } from '@nocobase/client';
+import { useContext } from 'react';
+import { FileStorageShortcut } from './FileStorageShortcut';
+
+export default function(props) {
+ const ctx = useContext(PluginManagerContext);
+ return (
+
+ {props.children}
+
+ );
+};
diff --git a/packages/core/client/src/file-manager/schemas/storage.ts b/packages/plugins/file-manager/src/client/schemas/storage.ts
similarity index 99%
rename from packages/core/client/src/file-manager/schemas/storage.ts
rename to packages/plugins/file-manager/src/client/schemas/storage.ts
index feba4e7ed..fdc798274 100644
--- a/packages/core/client/src/file-manager/schemas/storage.ts
+++ b/packages/plugins/file-manager/src/client/schemas/storage.ts
@@ -1,7 +1,6 @@
import { ISchema } from '@formily/react';
import { uid } from '@formily/shared';
-import { useRequest } from '../../api-client';
-import { useActionContext } from '../../schema-component';
+import { useRequest, useActionContext } from '@nocobase/client';
const collection = {
name: 'storages',
diff --git a/packages/plugins/file-manager/src/index.ts b/packages/plugins/file-manager/src/index.ts
index 4a1cca823..7ddad5814 100644
--- a/packages/plugins/file-manager/src/index.ts
+++ b/packages/plugins/file-manager/src/index.ts
@@ -1,3 +1 @@
-export * from './constants';
export { default } from './server';
-
diff --git a/packages/plugins/file-manager/src/__tests__/action.test.ts b/packages/plugins/file-manager/src/server/__tests__/action.test.ts
similarity index 100%
rename from packages/plugins/file-manager/src/__tests__/action.test.ts
rename to packages/plugins/file-manager/src/server/__tests__/action.test.ts
diff --git a/packages/plugins/file-manager/src/__tests__/files/image.jpg b/packages/plugins/file-manager/src/server/__tests__/files/image.jpg
similarity index 100%
rename from packages/plugins/file-manager/src/__tests__/files/image.jpg
rename to packages/plugins/file-manager/src/server/__tests__/files/image.jpg
diff --git a/packages/plugins/file-manager/src/__tests__/files/image.png b/packages/plugins/file-manager/src/server/__tests__/files/image.png
similarity index 100%
rename from packages/plugins/file-manager/src/__tests__/files/image.png
rename to packages/plugins/file-manager/src/server/__tests__/files/image.png
diff --git a/packages/plugins/file-manager/src/__tests__/files/text.txt b/packages/plugins/file-manager/src/server/__tests__/files/text.txt
similarity index 100%
rename from packages/plugins/file-manager/src/__tests__/files/text.txt
rename to packages/plugins/file-manager/src/server/__tests__/files/text.txt
diff --git a/packages/plugins/file-manager/src/__tests__/index.ts b/packages/plugins/file-manager/src/server/__tests__/index.ts
similarity index 100%
rename from packages/plugins/file-manager/src/__tests__/index.ts
rename to packages/plugins/file-manager/src/server/__tests__/index.ts
diff --git a/packages/plugins/file-manager/src/__tests__/storages/ali-oss.test.ts b/packages/plugins/file-manager/src/server/__tests__/storages/ali-oss.test.ts
similarity index 100%
rename from packages/plugins/file-manager/src/__tests__/storages/ali-oss.test.ts
rename to packages/plugins/file-manager/src/server/__tests__/storages/ali-oss.test.ts
diff --git a/packages/plugins/file-manager/src/__tests__/storages/s3.test.ts b/packages/plugins/file-manager/src/server/__tests__/storages/s3.test.ts
similarity index 100%
rename from packages/plugins/file-manager/src/__tests__/storages/s3.test.ts
rename to packages/plugins/file-manager/src/server/__tests__/storages/s3.test.ts
diff --git a/packages/plugins/file-manager/src/__tests__/tables/users.ts b/packages/plugins/file-manager/src/server/__tests__/tables/users.ts
similarity index 100%
rename from packages/plugins/file-manager/src/__tests__/tables/users.ts
rename to packages/plugins/file-manager/src/server/__tests__/tables/users.ts
diff --git a/packages/plugins/file-manager/src/actions/upload.ts b/packages/plugins/file-manager/src/server/actions/upload.ts
similarity index 100%
rename from packages/plugins/file-manager/src/actions/upload.ts
rename to packages/plugins/file-manager/src/server/actions/upload.ts
diff --git a/packages/plugins/file-manager/src/collections/attachments.ts b/packages/plugins/file-manager/src/server/collections/attachments.ts
similarity index 100%
rename from packages/plugins/file-manager/src/collections/attachments.ts
rename to packages/plugins/file-manager/src/server/collections/attachments.ts
diff --git a/packages/plugins/file-manager/src/collections/storages.ts b/packages/plugins/file-manager/src/server/collections/storages.ts
similarity index 100%
rename from packages/plugins/file-manager/src/collections/storages.ts
rename to packages/plugins/file-manager/src/server/collections/storages.ts
diff --git a/packages/plugins/file-manager/src/constants.ts b/packages/plugins/file-manager/src/server/constants.ts
similarity index 100%
rename from packages/plugins/file-manager/src/constants.ts
rename to packages/plugins/file-manager/src/server/constants.ts
diff --git a/packages/plugins/file-manager/src/server/index.ts b/packages/plugins/file-manager/src/server/index.ts
new file mode 100644
index 000000000..4a1cca823
--- /dev/null
+++ b/packages/plugins/file-manager/src/server/index.ts
@@ -0,0 +1,3 @@
+export * from './constants';
+export { default } from './server';
+
diff --git a/packages/plugins/file-manager/src/rules/index.ts b/packages/plugins/file-manager/src/server/rules/index.ts
similarity index 100%
rename from packages/plugins/file-manager/src/rules/index.ts
rename to packages/plugins/file-manager/src/server/rules/index.ts
diff --git a/packages/plugins/file-manager/src/rules/mimetype.ts b/packages/plugins/file-manager/src/server/rules/mimetype.ts
similarity index 100%
rename from packages/plugins/file-manager/src/rules/mimetype.ts
rename to packages/plugins/file-manager/src/server/rules/mimetype.ts
diff --git a/packages/plugins/file-manager/src/server.ts b/packages/plugins/file-manager/src/server/server.ts
similarity index 100%
rename from packages/plugins/file-manager/src/server.ts
rename to packages/plugins/file-manager/src/server/server.ts
diff --git a/packages/plugins/file-manager/src/storages/ali-oss.ts b/packages/plugins/file-manager/src/server/storages/ali-oss.ts
similarity index 100%
rename from packages/plugins/file-manager/src/storages/ali-oss.ts
rename to packages/plugins/file-manager/src/server/storages/ali-oss.ts
diff --git a/packages/plugins/file-manager/src/storages/index.ts b/packages/plugins/file-manager/src/server/storages/index.ts
similarity index 100%
rename from packages/plugins/file-manager/src/storages/index.ts
rename to packages/plugins/file-manager/src/server/storages/index.ts
diff --git a/packages/plugins/file-manager/src/storages/local.ts b/packages/plugins/file-manager/src/server/storages/local.ts
similarity index 100%
rename from packages/plugins/file-manager/src/storages/local.ts
rename to packages/plugins/file-manager/src/server/storages/local.ts
diff --git a/packages/plugins/file-manager/src/storages/s3.ts b/packages/plugins/file-manager/src/server/storages/s3.ts
similarity index 100%
rename from packages/plugins/file-manager/src/storages/s3.ts
rename to packages/plugins/file-manager/src/server/storages/s3.ts
diff --git a/packages/plugins/file-manager/src/utils.ts b/packages/plugins/file-manager/src/server/utils.ts
similarity index 100%
rename from packages/plugins/file-manager/src/utils.ts
rename to packages/plugins/file-manager/src/server/utils.ts