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