diff --git a/packages/plugins/multi-app-manager/src/client/AppManager.tsx b/packages/plugins/multi-app-manager/src/client/AppManager.tsx index 5e1d07c8f..bd66cf223 100644 --- a/packages/plugins/multi-app-manager/src/client/AppManager.tsx +++ b/packages/plugins/multi-app-manager/src/client/AppManager.tsx @@ -4,11 +4,19 @@ import React from 'react'; import { schema } from './settings/schemas/applications'; import { usePluginUtils } from './utils'; -const AppVisitor = () => { +const useLink = () => { const record = useRecord(); + if (record.options?.standaloneDeployment && record.cname) { + return `//${record.cname}`; + } + return `/apps/${record.name}/admin/`; +}; + +const AppVisitor = () => { const { t } = usePluginUtils(); + const link = useLink(); return ( - + {t('View', { ns: 'client' })} ); diff --git a/packages/plugins/multi-app-manager/src/client/index.tsx b/packages/plugins/multi-app-manager/src/client/index.tsx index 603ea01f8..f422b0995 100644 --- a/packages/plugins/multi-app-manager/src/client/index.tsx +++ b/packages/plugins/multi-app-manager/src/client/index.tsx @@ -27,11 +27,15 @@ const MultiAppManager = () => { const menu = ( {(data?.data || []).map((app) => { + let link = `/apps/${app.name}/admin/`; + if (app.options?.standaloneDeployment && app.cname) { + link = `//${app.cname}`; + } return ( { - window.open(`/apps/${app.name}/admin/`, '_blank'); + window.open(link, '_blank'); }} > {app.displayName || app.name} diff --git a/packages/plugins/multi-app-manager/src/client/settings/schemas/applications.ts b/packages/plugins/multi-app-manager/src/client/settings/schemas/applications.ts index 3f8b9e6a8..743cb5cf8 100644 --- a/packages/plugins/multi-app-manager/src/client/settings/schemas/applications.ts +++ b/packages/plugins/multi-app-manager/src/client/settings/schemas/applications.ts @@ -122,6 +122,11 @@ export const tableActionColumnSchema = { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', }, + 'options.standaloneDeployment': { + 'x-component': 'Checkbox', + 'x-decorator': 'FormItem', + 'x-content': '{{t("Standalone deployment")}}', + }, cname: { title: i18nText('Custom domain'), 'x-component': 'Input', @@ -252,6 +257,11 @@ export const schema: ISchema = { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', }, + 'options.standaloneDeployment': { + 'x-component': 'Checkbox', + 'x-decorator': 'FormItem', + 'x-content': '{{t("Standalone deployment")}}', + }, cname: { title: i18nText('Custom domain'), 'x-component': 'Input', diff --git a/packages/plugins/multi-app-manager/src/server/server.ts b/packages/plugins/multi-app-manager/src/server/server.ts index c351662c3..c6b4002b9 100644 --- a/packages/plugins/multi-app-manager/src/server/server.ts +++ b/packages/plugins/multi-app-manager/src/server/server.ts @@ -160,6 +160,13 @@ export class PluginMultiAppManager extends Plugin { }, })) as ApplicationModel | null; + const instanceOptions = applicationRecord.get('options'); + + // skip standalone deployment application + if (instanceOptions?.standaloneDeployment) { + return; + } + if (!applicationRecord) { return; } @@ -192,6 +199,13 @@ export class PluginMultiAppManager extends Plugin { const instances = await repository.find(findOptions); for (const instance of instances) { + const instanceOptions = instance.get('options'); + + // skip standalone deployment application + if (instanceOptions?.standaloneDeployment) { + continue; + } + const subApp = await appManager.getApplication(instance.name, { upgrading: true, });