fix(Instances): fix start/stop instance fault

Ensure consistent string type for instanceID parameter in API calls to prevent potential type-related issues. Also update status display to use more descriptive 'running'/'stopped' values.
This commit is contained in:
2026-03-25 21:25:07 +08:00
parent d2b45d268c
commit 8f5928b66f

View File

@@ -212,7 +212,7 @@ export default {
for (const instance of instances.value) {
try {
const statusResult = await instanceApi.getInstanceStatus(String(instance.instanceID));
instance.status = statusResult.data.status;
instance.status = statusResult.data.isRunning ? 'running' : 'stopped';
} catch (error) {
console.error(`Failed to load status for instance ${instance.instanceID}:`, error);
}
@@ -224,7 +224,7 @@ export default {
const startInstance = async (instanceID) => {
try {
await instanceApi.startInstance(instanceID);
await instanceApi.startInstance(instanceID.toString());
showNotification('Instance started successfully', 'success');
await loadInstances();
} catch (error) {
@@ -234,7 +234,7 @@ export default {
const stopInstance = async (instanceID) => {
try {
await instanceApi.stopInstance(instanceID);
await instanceApi.stopInstance(instanceID.toString());
showNotification('Instance stopped successfully', 'success');
await loadInstances();
} catch (error) {