Merge feature_fix_toggle_error_action into vibes

Prevents misleading toggle error messages. Fixes #14
This commit is contained in:
Vybe (Coding Agent) 2026-05-21 07:04:30 +00:00
commit 4c172e9c8a

View file

@ -12,6 +12,7 @@ PluginComponent {
property bool isConnected: false property bool isConnected: false
property string tailscaleIP: "" property string tailscaleIP: ""
property string _pendingToggleAction: ""
property string currentExitNode: "" property string currentExitNode: ""
property var peers: [] property var peers: []
property string cachedClipboardTool: "" property string cachedClipboardTool: ""
@ -41,10 +42,11 @@ PluginComponent {
onExited: (code, status) => { onExited: (code, status) => {
if (code !== 0) { if (code !== 0) {
var action = root.isConnected ? "disconnect" : "connect" var action = root._pendingToggleAction || (root.isConnected ? "disconnect" : "connect")
var detail = toggleProcess.stderr.text.trim().slice(0, 120) var detail = toggleProcess.stderr.text.trim().slice(0, 120)
ToastService.showError("tailscalectl", TailscaleLib.errorMessage(action) + (detail ? " — " + detail : "")) ToastService.showError("tailscalectl", TailscaleLib.errorMessage(action) + (detail ? " — " + detail : ""))
} }
root._pendingToggleAction = ""
statusCheck.running = true statusCheck.running = true
} }
} }
@ -112,6 +114,7 @@ PluginComponent {
} }
function toggleTailscale() { function toggleTailscale() {
root._pendingToggleAction = root.isConnected ? "disconnect" : "connect"
toggleProcess.command = TailscaleLib.buildToggleCommand(root.isConnected) toggleProcess.command = TailscaleLib.buildToggleCommand(root.isConnected)
toggleProcess.running = true toggleProcess.running = true
} }