mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:47:10 +00:00
fix(multi-app-manager): sub-app asynchronous quick start (#5571)
This commit is contained in:
parent
08ce9fa923
commit
17582e9351
@ -13,7 +13,10 @@ import lodash from 'lodash';
|
||||
import path from 'path';
|
||||
import { ApplicationModel } from '../server';
|
||||
|
||||
export type AppDbCreator = (app: Application, options?: Transactionable & { context?: any }) => Promise<void>;
|
||||
export type AppDbCreator = (
|
||||
app: Application,
|
||||
options?: Transactionable & { context?: any; applicationModel?: ApplicationModel },
|
||||
) => Promise<void>;
|
||||
export type AppOptionsFactory = (appName: string, mainApp: Application) => any;
|
||||
export type SubAppUpgradeHandler = (mainApp: Application) => Promise<void>;
|
||||
|
||||
@ -189,17 +192,22 @@ export class PluginMultiAppManagerServer extends Plugin {
|
||||
appOptionsFactory: this.appOptionsFactory,
|
||||
});
|
||||
|
||||
// create database
|
||||
await this.appDbCreator(subApp, {
|
||||
transaction,
|
||||
context: options.context,
|
||||
});
|
||||
const quickstart = async () => {
|
||||
// create database
|
||||
await this.appDbCreator(subApp, {
|
||||
transaction,
|
||||
applicationModel: model,
|
||||
context: options.context,
|
||||
});
|
||||
|
||||
const startPromise = subApp.runCommand('start', '--quickstart');
|
||||
const startPromise = subApp.runCommand('start', '--quickstart');
|
||||
|
||||
if (options?.context?.waitSubAppInstall) {
|
||||
await startPromise;
|
||||
}
|
||||
if (options?.context?.waitSubAppInstall) {
|
||||
await startPromise;
|
||||
}
|
||||
};
|
||||
|
||||
quickstart();
|
||||
},
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user