fix: improve app manager (#3841)

This commit is contained in:
chenos 2024-03-27 20:15:13 +08:00 committed by GitHub
parent 74051ff0a5
commit 06980fd87d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 28 additions and 19 deletions

View File

@ -7,7 +7,7 @@ import { usePluginUtils } from './utils';
const useLink = () => { const useLink = () => {
const record = useRecord(); const record = useRecord();
const app = useApp(); const app = useApp();
if (record.options?.standaloneDeployment && record.cname) { if (record.cname) {
return `//${record.cname}`; return `//${record.cname}`;
} }
return app.getRouteUrl(`/apps/${record.name}/admin/`); return app.getRouteUrl(`/apps/${record.name}/admin/`);

View File

@ -24,7 +24,7 @@ const MultiAppManager = () => {
const items = [ const items = [
...(data?.data || []).map((app) => { ...(data?.data || []).map((app) => {
let link = instance.getRouteUrl(`/apps/${app.name}/admin/`); let link = instance.getRouteUrl(`/apps/${app.name}/admin/`);
if (app.options?.standaloneDeployment && app.cname) { if (app.cname) {
link = `//${app.cname}`; link = `//${app.cname}`;
} }
return { return {

View File

@ -2,6 +2,7 @@ import { ISchema } from '@formily/react';
import { uid } from '@formily/shared'; import { uid } from '@formily/shared';
import { import {
SchemaComponentOptions, SchemaComponentOptions,
tval,
useActionContext, useActionContext,
useRecord, useRecord,
useRequest, useRequest,
@ -112,25 +113,30 @@ export const formSchema: ISchema = {
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-disabled': '{{ !createOnly }}', 'x-disabled': '{{ !createOnly }}',
}, },
pinned: { // 'options.standaloneDeployment': {
'x-component': 'CollectionField', // 'x-component': 'Checkbox',
'x-decorator': 'FormItem', // 'x-decorator': 'FormItem',
}, // 'x-content': i18nText('Standalone deployment'),
'options.standaloneDeployment': { // },
'x-component': 'Checkbox',
'x-decorator': 'FormItem',
'x-content': i18nText('Standalone deployment'),
},
'options.autoStart': { 'options.autoStart': {
'x-component': 'Checkbox', title: tval('Start mode', { ns: '@nocobase/plugin-multi-app-manager' }),
'x-component': 'Radio.Group',
'x-decorator': 'FormItem', '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: { cname: {
title: i18nText('Custom domain'), title: i18nText('Custom domain'),
'x-component': 'Input', 'x-component': 'Input',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
}, },
pinned: {
'x-component': 'CollectionField',
'x-decorator': 'FormItem',
},
}, },
}; };

View File

@ -7,5 +7,8 @@
"Custom domain": "自定义域名", "Custom domain": "自定义域名",
"Manage applications": "管理应用", "Manage applications": "管理应用",
"Standalone deployment": "独立部署", "Standalone deployment": "独立部署",
"Auto start": "自动启动" "Auto start": "自动启动",
"Start mode": "启动方式",
"Start on first visit": "首次访问时启动",
"Start with main application": "随主应用一同启动"
} }

View File

@ -166,11 +166,11 @@ export default {
options: { options: {
type: 'object', type: 'object',
properties: { properties: {
standaloneDeployment: { // standaloneDeployment: {
type: 'boolean', // type: 'boolean',
example: true, // example: true,
description: '是否为独立部署的子应用', // description: '是否为独立部署的子应用',
}, // },
autoStart: { autoStart: {
type: 'boolean', type: 'boolean',
example: true, example: true,