Merge branch 'next' into develop

This commit is contained in:
nocobase[bot] 2025-01-06 05:47:12 +00:00
commit a89c17f2a0
2 changed files with 29 additions and 22 deletions

View File

@ -104,6 +104,7 @@ export class Application {
maintained = false; maintained = false;
maintaining = false; maintaining = false;
error = null; error = null;
hasLoadError = false;
private wsAuthorized = false; private wsAuthorized = false;
@ -302,6 +303,7 @@ export class Application {
await this.loadWebSocket(); await this.loadWebSocket();
await this.pm.load(); await this.pm.load();
} catch (error) { } catch (error) {
this.hasLoadError = true;
if (this.ws.enabled) { if (this.ws.enabled) {
await new Promise((resolve) => { await new Promise((resolve) => {
setTimeout(() => resolve(null), 1000); setTimeout(() => resolve(null), 1000);
@ -342,16 +344,21 @@ export class Application {
window.location.reload(); window.location.reload();
return; return;
} }
if (data.type === 'notification') { if (data.type === 'notification') {
this.notification[data.payload?.type || 'info']({ message: data.payload?.message }); this.notification[data.payload?.type || 'info']({ message: data.payload?.message });
return; return;
} }
const maintaining = data.type === 'maintaining' && data.payload.code !== 'APP_RUNNING';
const maintaining = data.type === 'maintaining' && data.payload.code !== 'APP_RUNNING';
if (maintaining) { if (maintaining) {
this.setMaintaining(true); this.setMaintaining(true);
this.error = data.payload; this.error = data.payload;
} else { } else {
if (this.hasLoadError) {
window.location.reload();
}
this.setMaintaining(false); this.setMaintaining(false);
this.maintained = true; this.maintained = true;
this.error = null; this.error = null;

View File

@ -187,31 +187,31 @@ export class WSServer extends EventEmitter {
AppSupervisor.getInstance().bootStrapApp(handleAppName); AppSupervisor.getInstance().bootStrapApp(handleAppName);
} }
const appStatus = AppSupervisor.getInstance().getAppStatus(handleAppName, 'initializing'); // const appStatus = AppSupervisor.getInstance().getAppStatus(handleAppName, 'initializing');
if (appStatus === 'not_found') { // if (appStatus === 'not_found') {
this.sendMessageToConnection(client, { // this.sendMessageToConnection(client, {
type: 'maintaining', // type: 'maintaining',
payload: getPayloadByErrorCode('APP_NOT_FOUND', { appName: handleAppName }), // payload: getPayloadByErrorCode('APP_NOT_FOUND', { appName: handleAppName }),
}); // });
return; // return;
} // }
if (appStatus === 'initializing') { // if (appStatus === 'initializing') {
this.sendMessageToConnection(client, { // this.sendMessageToConnection(client, {
type: 'maintaining', // type: 'maintaining',
payload: getPayloadByErrorCode('APP_INITIALIZING', { appName: handleAppName }), // payload: getPayloadByErrorCode('APP_INITIALIZING', { appName: handleAppName }),
}); // });
return; // return;
} // }
const app = await AppSupervisor.getInstance().getApp(handleAppName); // const app = await AppSupervisor.getInstance().getApp(handleAppName);
//
this.sendMessageToConnection(client, { // this.sendMessageToConnection(client, {
type: 'maintaining', // type: 'maintaining',
payload: getPayloadByErrorCode(appStatus, { app }), // payload: getPayloadByErrorCode(appStatus, { app }),
}); // });
} }
removeConnection(id: string) { removeConnection(id: string) {