From 06980fd87dc92475bb0905020949847593ed9476 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 27 Mar 2024 20:15:13 +0800 Subject: [PATCH] fix: improve app manager (#3841) --- .../src/client/AppManager.tsx | 2 +- .../src/client/MultiAppManagerProvider.tsx | 2 +- .../client/settings/schemas/applications.ts | 28 +++++++++++-------- .../src/locale/zh-CN.json | 5 +++- .../src/swagger/index.ts | 10 +++---- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/AppManager.tsx b/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/AppManager.tsx index be7ae97ed..e614705c3 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/AppManager.tsx +++ b/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/AppManager.tsx @@ -7,7 +7,7 @@ import { usePluginUtils } from './utils'; const useLink = () => { const record = useRecord(); const app = useApp(); - if (record.options?.standaloneDeployment && record.cname) { + if (record.cname) { return `//${record.cname}`; } return app.getRouteUrl(`/apps/${record.name}/admin/`); diff --git a/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/MultiAppManagerProvider.tsx b/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/MultiAppManagerProvider.tsx index d04707df4..162788b84 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/MultiAppManagerProvider.tsx +++ b/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/MultiAppManagerProvider.tsx @@ -24,7 +24,7 @@ const MultiAppManager = () => { const items = [ ...(data?.data || []).map((app) => { let link = instance.getRouteUrl(`/apps/${app.name}/admin/`); - if (app.options?.standaloneDeployment && app.cname) { + if (app.cname) { link = `//${app.cname}`; } return { diff --git a/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/settings/schemas/applications.ts b/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/settings/schemas/applications.ts index 93c6bf5b8..d79625abd 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/settings/schemas/applications.ts +++ b/packages/plugins/@nocobase/plugin-multi-app-manager/src/client/settings/schemas/applications.ts @@ -2,6 +2,7 @@ import { ISchema } from '@formily/react'; import { uid } from '@formily/shared'; import { SchemaComponentOptions, + tval, useActionContext, useRecord, useRequest, @@ -112,25 +113,30 @@ export const formSchema: ISchema = { 'x-decorator': 'FormItem', 'x-disabled': '{{ !createOnly }}', }, - pinned: { - 'x-component': 'CollectionField', - 'x-decorator': 'FormItem', - }, - 'options.standaloneDeployment': { - 'x-component': 'Checkbox', - 'x-decorator': 'FormItem', - 'x-content': i18nText('Standalone deployment'), - }, + // 'options.standaloneDeployment': { + // 'x-component': 'Checkbox', + // 'x-decorator': 'FormItem', + // 'x-content': i18nText('Standalone deployment'), + // }, 'options.autoStart': { - 'x-component': 'Checkbox', + title: tval('Start mode', { ns: '@nocobase/plugin-multi-app-manager' }), + 'x-component': 'Radio.Group', 'x-decorator': 'FormItem', - 'x-content': i18nText('Auto start'), + default: false, + enum: [ + { label: tval('Start on first visit', { ns: '@nocobase/plugin-multi-app-manager' }), value: false }, + { label: tval('Start with main application', { ns: '@nocobase/plugin-multi-app-manager' }), value: true }, + ], }, cname: { title: i18nText('Custom domain'), 'x-component': 'Input', 'x-decorator': 'FormItem', }, + pinned: { + 'x-component': 'CollectionField', + 'x-decorator': 'FormItem', + }, }, }; diff --git a/packages/plugins/@nocobase/plugin-multi-app-manager/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-multi-app-manager/src/locale/zh-CN.json index 1b81f70ff..7ca07d595 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-manager/src/locale/zh-CN.json +++ b/packages/plugins/@nocobase/plugin-multi-app-manager/src/locale/zh-CN.json @@ -7,5 +7,8 @@ "Custom domain": "自定义域名", "Manage applications": "管理应用", "Standalone deployment": "独立部署", - "Auto start": "自动启动" + "Auto start": "自动启动", + "Start mode": "启动方式", + "Start on first visit": "首次访问时启动", + "Start with main application": "随主应用一同启动" } diff --git a/packages/plugins/@nocobase/plugin-multi-app-manager/src/swagger/index.ts b/packages/plugins/@nocobase/plugin-multi-app-manager/src/swagger/index.ts index 3ac0bc01c..c48a388a2 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-manager/src/swagger/index.ts +++ b/packages/plugins/@nocobase/plugin-multi-app-manager/src/swagger/index.ts @@ -166,11 +166,11 @@ export default { options: { type: 'object', properties: { - standaloneDeployment: { - type: 'boolean', - example: true, - description: '是否为独立部署的子应用', - }, + // standaloneDeployment: { + // type: 'boolean', + // example: true, + // description: '是否为独立部署的子应用', + // }, autoStart: { type: 'boolean', example: true,