chore: skip get standalone deployment sub application (#1868)

* chore: skip get standalone deployment sub application

* feat: standalone deployment

* fix: link

---------

Co-authored-by: chenos <chenlinxh@gmail.com>
This commit is contained in:
ChengLei Shao 2023-05-16 16:38:17 +08:00 committed by GitHub
parent 9931e6a486
commit 29956150ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 3 deletions

View File

@ -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 (
<a href={`/apps/${record.name}/admin/`} target={'_blank'} rel="noreferrer">
<a href={link} target={'_blank'} rel="noreferrer">
{t('View', { ns: 'client' })}
</a>
);

View File

@ -27,11 +27,15 @@ const MultiAppManager = () => {
const menu = (
<Menu>
{(data?.data || []).map((app) => {
let link = `/apps/${app.name}/admin/`;
if (app.options?.standaloneDeployment && app.cname) {
link = `//${app.cname}`;
}
return (
<Menu.Item
key={app.name}
onClick={() => {
window.open(`/apps/${app.name}/admin/`, '_blank');
window.open(link, '_blank');
}}
>
{app.displayName || app.name}

View File

@ -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',

View File

@ -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,
});