fix(instance-detail): reset logs and reconnect websocket on instance state change
Ensure logs are cleared and websocket connection is refreshed when starting, stopping or restarting an instance to maintain accurate log display
This commit is contained in:
@@ -368,6 +368,10 @@ export default {
|
||||
await instanceApi.startInstance(instanceID.value);
|
||||
showNotification('Instance started successfully', 'success');
|
||||
await loadInstanceInfo();
|
||||
// Clear logs && reconnect to websocket
|
||||
logs.value = [];
|
||||
disconnectLogWebSocket();
|
||||
connectLogWebSocket();
|
||||
} catch (error) {
|
||||
showNotification(error.message || 'Start instance failed', 'error');
|
||||
}
|
||||
@@ -378,6 +382,10 @@ export default {
|
||||
await instanceApi.stopInstance(instanceID.value);
|
||||
showNotification('Instance stopped successfully', 'success');
|
||||
await loadInstanceInfo();
|
||||
// Clear logs && reconnect to websocket
|
||||
logs.value = [];
|
||||
disconnectLogWebSocket();
|
||||
connectLogWebSocket();
|
||||
} catch (error) {
|
||||
showNotification(error.message || 'Stop instance failed', 'error');
|
||||
}
|
||||
@@ -398,6 +406,10 @@ export default {
|
||||
await instanceApi.restartInstance(instanceID.value);
|
||||
showNotification('Instance restarted successfully', 'success');
|
||||
await loadInstanceInfo();
|
||||
// Clear logs && reconnect to websocket
|
||||
logs.value = [];
|
||||
disconnectLogWebSocket();
|
||||
connectLogWebSocket();
|
||||
} catch (error) {
|
||||
showNotification(error.message || 'Restart instance failed', 'error');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user