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

View File

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