diff --git a/src/views/InstanceDetail.vue b/src/views/InstanceDetail.vue index 10c7acb..d444013 100644 --- a/src/views/InstanceDetail.vue +++ b/src/views/InstanceDetail.vue @@ -359,14 +359,14 @@ export default { 'Created At': formatDate(result.data.createdAt) }; } catch (error) { - showNotification('Load instance information failed', 'error'); + showNotification(error.message || 'Load instance information failed', 'error'); } }; const startInstance = async () => { try { - await instanceApi.startInstance(instanceID.value); - showNotification('Instance started successfully', 'success'); + const result = await instanceApi.startInstance(instanceID.value); + showNotification(result.message || `Instance ${instanceName.value} started successfully`, 'success'); await loadInstanceInfo(); // Clear logs && reconnect to websocket logs.value = []; @@ -379,8 +379,8 @@ export default { const stopInstance = async () => { try { - await instanceApi.stopInstance(instanceID.value); - showNotification('Instance stopped successfully', 'success'); + const result = await instanceApi.stopInstance(instanceID.value); + showNotification(result.message || 'Instance stopped successfully', 'success'); await loadInstanceInfo(); // Clear logs && reconnect to websocket logs.value = []; @@ -393,8 +393,8 @@ export default { const deleteInstance = async () => { try { - await instanceApi.deleteInstance(instanceID.value); - showNotification('Instance deleted successfully', 'success'); + const result = await instanceApi.deleteInstance(instanceID.value); + showNotification(result.message || 'Instance deleted successfully', 'success'); router.push('/instances'); } catch (error) { showNotification(error.message || 'Delete instance failed', 'error'); @@ -403,8 +403,8 @@ export default { const restartInstance = async () => { try { - await instanceApi.restartInstance(instanceID.value); - showNotification('Instance restarted successfully', 'success'); + const result = await instanceApi.restartInstance(instanceID.value); + showNotification(result.message || 'Instance restarted successfully', 'success'); await loadInstanceInfo(); // Clear logs && reconnect to websocket logs.value = []; @@ -435,7 +435,7 @@ export default { remotePort: proxy.remotePort })); } catch (error) { - showNotification('Load proxy list failed', 'error'); + showNotification(error.message || 'Load proxy list failed', 'error'); } }; @@ -493,8 +493,9 @@ export default { level: log.level, message: log.content })) : []; + showNotification(result.message || 'Logs loaded successfully', 'success'); } catch (error) { - showNotification('Load logs failed', 'error'); + showNotification(error.message || 'Load logs failed', 'error'); } connectLogWebSocket(); }; @@ -520,8 +521,9 @@ export default { bootAtStart: result.data.bootAtStart || false, runUser: result.data.runUser || 'root' }; + showNotification(result.message || 'Instance data loaded successfully', 'success'); } catch (error) { - showNotification('Load instance data failed', 'error'); + showNotification(error.message || 'Load instance data failed', 'error'); return; } showEditConfigModal.value = true; @@ -593,8 +595,8 @@ export default { const confirmDeleteProxy = async () => { loading.value = true; try { - await instanceApi.deleteProxy(instanceID.value, selectedProxyName.value); - showNotification('Proxy deleted successfully', 'success'); + const result = await instanceApi.deleteProxy(instanceID.value, selectedProxyName.value); + showNotification(result.message || 'Proxy deleted successfully', 'success'); closeDeleteProxyModal(); await loadProxies(); } catch (error) { @@ -615,12 +617,13 @@ export default { remotePort: formData.value.remotePort }; + let result; if (isEditProxy.value) { - await instanceApi.modifyProxy(instanceID.value, proxyInfo); - showNotification('Proxy updated successfully', 'success'); + result = await instanceApi.modifyProxy(instanceID.value, proxyInfo); + showNotification(result.message || 'Proxy updated successfully', 'success'); } else { - await instanceApi.createProxy(instanceID.value, proxyInfo); - showNotification('Proxy created successfully', 'success'); + result = await instanceApi.createProxy(instanceID.value, proxyInfo); + showNotification(result.message || 'Proxy created successfully', 'success'); } closeAddProxyModal(); @@ -690,9 +693,9 @@ export default { remotePort: formData.value.remotePort.toString() }; - await instanceApi.createProxy(instanceID.value, proxyInfo); + const result = await instanceApi.createProxy(instanceID.value, proxyInfo); - showNotification('Proxy created successfully', 'success'); + showNotification(result.message || 'Proxy created successfully', 'success'); closeAddProxyModal(); await loadProxies(); } catch (error) {