From 372a0c372c654c3aebf51296a89148ede237f577 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 19 Nov 2021 15:40:29 +0800 Subject: [PATCH] feat(docs): update doc --- docs/plugins/action-logs.md | 1 + docs/plugins/automations.md | 1 + docs/plugins/china-region.md | 2 + docs/plugins/client.md | 1 + docs/plugins/collections.md | 2 +- docs/plugins/export.md | 1 + docs/plugins/file-manager.md | 1 + docs/plugins/index.md | 101 ++++++++++------------------ docs/plugins/index.zh-CN.md | 99 ++++++++++----------------- docs/plugins/multi-apps.md | 1 + docs/plugins/notifications.md | 1 + docs/plugins/permissions.md | 2 +- docs/plugins/system-settings.md | 1 + docs/plugins/ui-router.md | 1 + docs/plugins/ui-schema.md | 1 + docs/plugins/users.md | 1 + docs/reference/application.md | 7 -- docs/reference/overview.md | 37 ++++++++++ docs/reference/repository.md | 54 ++++++++++++--- packages/client/src/locale/zh_CN.ts | 2 +- 20 files changed, 169 insertions(+), 148 deletions(-) create mode 100644 docs/plugins/action-logs.md create mode 100644 docs/plugins/automations.md create mode 100644 docs/plugins/china-region.md create mode 100644 docs/plugins/client.md create mode 100644 docs/plugins/export.md create mode 100644 docs/plugins/file-manager.md create mode 100644 docs/plugins/multi-apps.md create mode 100644 docs/plugins/notifications.md create mode 100644 docs/plugins/system-settings.md create mode 100644 docs/plugins/ui-router.md create mode 100644 docs/plugins/ui-schema.md create mode 100644 docs/plugins/users.md create mode 100644 docs/reference/overview.md diff --git a/docs/plugins/action-logs.md b/docs/plugins/action-logs.md new file mode 100644 index 000000000..29102c600 --- /dev/null +++ b/docs/plugins/action-logs.md @@ -0,0 +1 @@ +# action-logs \ No newline at end of file diff --git a/docs/plugins/automations.md b/docs/plugins/automations.md new file mode 100644 index 000000000..42b9eba63 --- /dev/null +++ b/docs/plugins/automations.md @@ -0,0 +1 @@ +# automations \ No newline at end of file diff --git a/docs/plugins/china-region.md b/docs/plugins/china-region.md new file mode 100644 index 000000000..100a05b2e --- /dev/null +++ b/docs/plugins/china-region.md @@ -0,0 +1,2 @@ +# china-region + diff --git a/docs/plugins/client.md b/docs/plugins/client.md new file mode 100644 index 000000000..68734b02a --- /dev/null +++ b/docs/plugins/client.md @@ -0,0 +1 @@ +# client \ No newline at end of file diff --git a/docs/plugins/collections.md b/docs/plugins/collections.md index 05618b48c..cfd4ba0bd 100644 --- a/docs/plugins/collections.md +++ b/docs/plugins/collections.md @@ -1,4 +1,4 @@ -# @nocobase/plugin-collections +# collections 提供 HTTP API 的方式管理数据表和字段 diff --git a/docs/plugins/export.md b/docs/plugins/export.md new file mode 100644 index 000000000..cfca97015 --- /dev/null +++ b/docs/plugins/export.md @@ -0,0 +1 @@ +# export \ No newline at end of file diff --git a/docs/plugins/file-manager.md b/docs/plugins/file-manager.md new file mode 100644 index 000000000..5ff9f3f31 --- /dev/null +++ b/docs/plugins/file-manager.md @@ -0,0 +1 @@ +# file-manager \ No newline at end of file diff --git a/docs/plugins/index.md b/docs/plugins/index.md index 8c9e23c23..2c9408072 100644 --- a/docs/plugins/index.md +++ b/docs/plugins/index.md @@ -1,6 +1,5 @@ --- -title: Plugins -toc: menu +title: Overview nav: title: Plugins order: 4 @@ -8,12 +7,16 @@ nav: # Plugins -## Plugin Manager +## Plugin Manager Not Available + + +It is not yet possible to manage plugins via the CLI, this part is still under design and development. + Development can download, activate, disable, and remove plugins via the command line, which corresponds to ```bash -## Download plugins, which can be activated quickly with the --enable parameter +# Download plugins, which can be activated quickly with the --enable argument yarn nocobase pm:download --enable # Activate the plugin yarn nocobase pm:enable @@ -25,66 +28,36 @@ yarn nocobase pm:remove ## List of existing plugins -### @nocobase/plugin-collections datasheet configuration +Core plugins -Provides an HTTP API for managing data tables and fields +- [@nocobase/plugin-collections](plugins/collections) + Provides an HTTP API for managing data tables and fields +- [@nocobase/plugin-permissions](plugins/permissions) + Permissions module (server-side) +- [@nocobase/plugin-users](plugins/users) + User module (server-side) +- [@nocobase/plugin-client](plugins/client) + Client-side plugin that provides a GUI for the server and connects @nocobase/server to @nocobase/client +- [@nocobase/plugin-ui-schema](plugins/ui-schema) + Store the Schema of the client SchemaComponent on the server side for on-demand dynamic output +- [@nocobase/plugin-ui-router](plugins/ui-router) + Client-side routing table, storing client-side route config on the server side for on-demand dynamic output -### @nocobase/plugin-permissions +Other plugins -Permissions module - -### @nocobase/plugin-users - -User module - -### @nocobase/plugin-system-settings - -Site information configuration - -### @nocobase/plugin-china-region - -Field extension, China region - -### @nocobase/plugin-file-manager - -Field extension, attachment field - -### @nocobase/plugin-action-logs - -Action logs - -### @nocobase/plugin-multi-apps - -Dynamic multi-apps, a simple SaaS - -### @nocobase/plugin-export - -Operation extensions, export - -### @nocobase/plugin-notifications - -Notifications module (half-baked), only supports emailing for now, no visual interface - -### @nocobase/plugin-automations - -Automation (not available at the moment) - -### @nocobase/plugin-client - -Client-side plugin that provides visual configuration support for nocobase. Dependent plugins are. - -- @nocobase/plugin-collections (required) -- @nocobase/plugin-permissions (required) -- @nocobase/plugin-users (required) -- @nocobase/plugin-system-settings (required) -- @nocobase/plugin-file-manager (required) -- @nocobase/plugin-china-region (optional) -- @nocobase/plugin-action-logs (optional) - -Several components are included. - -- Store client ui-schema on the server side for on-demand dynamic output -- Store client-side ui-router on the server side for on-demand dynamic output -- Provide static server support for app dist, allowing configuration of app dist paths -- Provide initial demo data import support for nocobase installation, configurable via importData -- Provide visualization support for collections +- [@nocobase/plugin-action-logs](plugins/action-logs) + Action logs +- [@nocobase/plugin-file-manager](plugins/file-manager) + File Manager +- [@nocobase/plugin-china-region](plugins/china-region) + China region, field extensions +- [@nocobase/plugin-export](plugins/export) + Export plugin +- [@nocobase/plugin-system-settings](plugins/system-settings) + System information configuration +- [@nocobase/plugin-multi-apps](plugins/multi-apps) + Dynamic multi-apps, easy SaaS plugin +- [@nocobase/plugin-notifications](plugins/notifications) + Notifications module (half-finished), only supports emailing for now, no visual interface +- [@nocobase/plugin-automations](plugins/automations) + Automation module (temporarily unavailable) diff --git a/docs/plugins/index.zh-CN.md b/docs/plugins/index.zh-CN.md index bd6931dcb..e8679cac7 100644 --- a/docs/plugins/index.zh-CN.md +++ b/docs/plugins/index.zh-CN.md @@ -1,6 +1,5 @@ --- -title: 插件 -toc: menu +title: 概述 nav: title: 插件 order: 4 @@ -8,7 +7,11 @@ nav: # 插件 -## 插件管理器 +## 插件管理器 待完善 + + +暂时还不能通过 CLI 的方式管理插件,这部分还在设计开发中。 + 开发可以通过命令行下载、激活、禁用、移除插件,对应的命令行有: @@ -25,66 +28,36 @@ yarn nocobase pm:remove ## 已有的插件列表 -### @nocobase/plugin-collections 数据表配置 +核心插件 -提供 HTTP API 的方式管理数据表和字段 +- [@nocobase/plugin-collections](plugins/collections) + 提供 HTTP API 的方式管理数据表和字段 +- [@nocobase/plugin-permissions](plugins/permissions) + 权限模块(服务端) +- [@nocobase/plugin-users](plugins/users) + 用户模块(服务端) +- [@nocobase/plugin-client](plugins/client) + 客户端插件,为 server 提供 GUI,将 @nocobase/server 和 @nocobase/client 连接起来 +- [@nocobase/plugin-ui-schema](plugins/ui-schema) + 将客户端 SchemaComponent 的 Schema 存储在服务端,以实现按需动态输出 +- [@nocobase/plugin-ui-router](plugins/ui-router) + 客户端路由表,将客户端 route config 存储在服务端,以实现按需动态输出 -### @nocobase/plugin-permissions +其他插件 -权限模块 - -### @nocobase/plugin-users - -用户模块 - -### @nocobase/plugin-system-settings - -站点信息配置 - -### @nocobase/plugin-china-region - -字段扩展,中国行政区 - -### @nocobase/plugin-file-manager - -字段扩展,附件字段 - -### @nocobase/plugin-action-logs - -操作日志 - -### @nocobase/plugin-multi-apps - -动态多应用,一个简易的 SaaS - -### @nocobase/plugin-export - -操作扩展,导出 - -### @nocobase/plugin-notifications - -通知模块(半成品),暂时只支持邮件发送,没有可视化界面 - -### @nocobase/plugin-automations - -自动化(暂不可用) - -### @nocobase/plugin-client - -客户端插件,为 nocobase 提供可视化配置的支持。依赖的插件有: - -- @nocobase/plugin-collections(必须) -- @nocobase/plugin-permissions(必须) -- @nocobase/plugin-users(必须) -- @nocobase/plugin-system-settings(必须) -- @nocobase/plugin-file-manager(必须) -- @nocobase/plugin-china-region(可选) -- @nocobase/plugin-action-logs(可选) - -包括几部分内容: - -- 将客户端 ui-schema 存储在服务端,以实现按需动态输出 -- 将客户端 ui-router 存储在服务端,以实现按需动态输出 -- 提供 app dist 的 static server 支持,可以配置 app 的 dist 路径 -- 为 nocobase 安装提供初始化 demo 数据导入的支持,可通过 importData 配置 -- 提供 collections 可视化支持 +- [@nocobase/plugin-action-logs](plugins/action-logs) + 操作日志 +- [@nocobase/plugin-file-manager](plugins/file-manager) + 文件管理器 +- [@nocobase/plugin-china-region](plugins/china-region) + 中国行政区,字段扩展 +- [@nocobase/plugin-export](plugins/export) + 导出插件 +- [@nocobase/plugin-system-settings](plugins/system-settings) + 系统信息配置 +- [@nocobase/plugin-multi-apps](plugins/multi-apps) + 动态多应用,简易的 SaaS 插件 +- [@nocobase/plugin-notifications](plugins/notifications) + 通知模块(半成品),暂时只支持邮件发送,没有可视化界面 +- [@nocobase/plugin-automations](plugins/automations) + 自动化模块(暂不可用) diff --git a/docs/plugins/multi-apps.md b/docs/plugins/multi-apps.md new file mode 100644 index 000000000..fefe51d29 --- /dev/null +++ b/docs/plugins/multi-apps.md @@ -0,0 +1 @@ +# multi-apps diff --git a/docs/plugins/notifications.md b/docs/plugins/notifications.md new file mode 100644 index 000000000..ffdc6a173 --- /dev/null +++ b/docs/plugins/notifications.md @@ -0,0 +1 @@ +# notifications diff --git a/docs/plugins/permissions.md b/docs/plugins/permissions.md index 57e50de84..4f12950e4 100644 --- a/docs/plugins/permissions.md +++ b/docs/plugins/permissions.md @@ -1,3 +1,3 @@ -# @nocobase/plugin-permissions +# permissions diff --git a/docs/plugins/system-settings.md b/docs/plugins/system-settings.md new file mode 100644 index 000000000..2dac88bb4 --- /dev/null +++ b/docs/plugins/system-settings.md @@ -0,0 +1 @@ +# system-settings \ No newline at end of file diff --git a/docs/plugins/ui-router.md b/docs/plugins/ui-router.md new file mode 100644 index 000000000..ceba4d74a --- /dev/null +++ b/docs/plugins/ui-router.md @@ -0,0 +1 @@ +# ui-router \ No newline at end of file diff --git a/docs/plugins/ui-schema.md b/docs/plugins/ui-schema.md new file mode 100644 index 000000000..491d61dcd --- /dev/null +++ b/docs/plugins/ui-schema.md @@ -0,0 +1 @@ +# ui-schema diff --git a/docs/plugins/users.md b/docs/plugins/users.md new file mode 100644 index 000000000..318f38267 --- /dev/null +++ b/docs/plugins/users.md @@ -0,0 +1 @@ +# users diff --git a/docs/reference/application.md b/docs/reference/application.md index 43b41fc2b..0be033b64 100644 --- a/docs/reference/application.md +++ b/docs/reference/application.md @@ -1,10 +1,3 @@ ---- -nav: - title: API - order: 3 -toc: menu ---- - # Application ## `app.db` diff --git a/docs/reference/overview.md b/docs/reference/overview.md new file mode 100644 index 000000000..66a08e49f --- /dev/null +++ b/docs/reference/overview.md @@ -0,0 +1,37 @@ +--- +nav: + title: API + order: 3 +order: 0 +--- + +# Overview + +核心 API 总共可以分为四部分: + +## Database + +- [Database](database.md) +- [Repository](repository.md) +- [Collection](collection.md) +- [Model](model.md) +- [Field Types](field-types.md) +- [Operators](operators.md) + +## Application + +- [Application](application.md) +- [Context](context.md) +- [Resourcer](resourcer.md) +- [CLI](cli.md) + +## PluginManager + +- [PluginManager](plugin-manager.md) +- [Plugin](plugin.md) + +## Client + +- [Client](client.md) +- [JavaScript SDK(API Client)](client.md) +- [REST API](rest-api.md) diff --git a/docs/reference/repository.md b/docs/reference/repository.md index 726d9c4c1..ab4f45527 100644 --- a/docs/reference/repository.md +++ b/docs/reference/repository.md @@ -713,6 +713,8 @@ interface destroy { interface DestroyOptions { filter?: any; + filterByPk?: number | string | number[] | string[]; + transaction?: Sequelize.Transaction; } ``` @@ -778,9 +780,9 @@ interface IHasOneRepository { // 删除 destroy(): Promise; // 建立关联 - set(primaryKey: any): Promise; + set(options: PrimaryKey | AssociatedOptions): Promise; // 移除关联 - remove(): Promise; + remove(options?: AssociatedOptions): Promise; } interface HasOneFindOptions { @@ -820,9 +822,15 @@ interface IBelongsToRepository { // 删除 destroy(): Promise; // 建立关联 - set(primaryKey: any): Promise; + set(options: PrimaryKey | AssociatedOptions): Promise; // 移除关联 - remove(): Promise; + remove(options?: AssociatedOptions): Promise; +} + +type PrimaryKey = string | number; + +interface AssociatedOptions { + transaction?: Sequelize.Transaction; } interface HasOneFindOptions { @@ -863,11 +871,18 @@ interface IHasManyRepository { // 删除 destroy(options?: number | string | number[] | string[] | DestroyOptions): Promise; // 建立关联 - set(primaryKey: any | primaryKeys: any[]): Promise; + set(options: PrimaryKey | PrimaryKey[] | AssociatedOptions): Promise; // 附加关联 - add(primaryKey: any | primaryKeys: any[]): Promise; + add(options: PrimaryKey | PrimaryKey[] | AssociatedOptions): Promise; // 移除关联 - remove(primaryKey: any | primaryKeys: any[]): Promise; + remove(options: PrimaryKey | PrimaryKey[] | AssociatedOptions): Promise; +} + +type PrimaryKey = string | number; + +interface AssociatedOptions { + pk?: PrimaryKey | PrimaryKey[]; + transaction?: Sequelize.Transaction; } ``` @@ -903,12 +918,19 @@ interface IBelongsToManyRepository { // 删除 destroy(options?: number | string | number[] | string[] | DestroyOptions): Promise; // 建立关联 - set(primaryKey: any | primaryKeys: any[]): Promise; + set(options: PrimaryKey | PrimaryKey[] | ThroughValues | ThroughValues[] | AssociatedOptions): Promise; // 附加关联,存在中间表数据 - add(primaryKey: any | primaryKeys: any[]): Promise; + add(options: PrimaryKey | PrimaryKey[] | ThroughValues | ThroughValues[] | AssociatedOptions): Promise; // 移除关联 - remove(primaryKey: any | primaryKeys: any[]): Promise; - toggle(primaryKey: any): Promise; + remove(options: PrimaryKey | PrimaryKey[] | AssociatedOptions): Promise; + toggle(options: PrimaryKey | AssociatedOptions): Promise; +} + +type PrimaryKey = string | number; + +interface AssociatedOptions { + pk?: PrimaryKey | PrimaryKey[]; + transaction?: Sequelize.Transaction; } ``` @@ -917,7 +939,17 @@ interface IBelongsToManyRepository { 多对多关系多了中间表的处理 ```ts +repository.add(1); +repository.add([1, {/* 中间表数据 */}]); +repository.add([1,2,3]); +repository.add([ + [1, {/* 中间表数据 */}], + [2, {/* 中间表数据 */}], + [3, {/* 中间表数据 */}], +]); + repository.set(1); +repository.set([1, {/* 中间表数据 */}]); repository.set([1,2,3]); repository.set([ [1, {/* 中间表数据 */}], diff --git a/packages/client/src/locale/zh_CN.ts b/packages/client/src/locale/zh_CN.ts index 80381cfee..c8fbfa910 100644 --- a/packages/client/src/locale/zh_CN.ts +++ b/packages/client/src/locale/zh_CN.ts @@ -170,7 +170,7 @@ export default { 'Edit tab': '编辑标签页', 'Relationship blocks': '关系数据区块', 'Select record': '选择数据', - 'Display name': 'Display name', + 'Display name': '显示名称', 'Select icon': '选择图标', 'Custom column name': '自定义列名称', 'Edit description': '编辑描述',