fix: parse Peer (singular) key, remove clipboard for now
This commit is contained in:
parent
0d3f500a2c
commit
3a8fa8abd1
1 changed files with 10 additions and 39 deletions
|
|
@ -47,8 +47,8 @@ PluginComponent {
|
||||||
root.isConnected = data.BackendState === "Running"
|
root.isConnected = data.BackendState === "Running"
|
||||||
root.tailscaleIP = (data.Self?.TailscaleIPs?.[0]) || ""
|
root.tailscaleIP = (data.Self?.TailscaleIPs?.[0]) || ""
|
||||||
root.currentExitNode = data.CurrentExitNode?.HostName || ""
|
root.currentExitNode = data.CurrentExitNode?.HostName || ""
|
||||||
root.peers = Object.keys(data.Peers || {}).map(function(key) {
|
root.peers = Object.keys(data.Peer || {}).map(function(key) {
|
||||||
var p = data.Peers[key]
|
var p = data.Peer[key]
|
||||||
return {
|
return {
|
||||||
hostname: p.HostName || key,
|
hostname: p.HostName || key,
|
||||||
ip: (p.TailscaleIPs && p.TailscaleIPs.length) ? p.TailscaleIPs[0] : "",
|
ip: (p.TailscaleIPs && p.TailscaleIPs.length) ? p.TailscaleIPs[0] : "",
|
||||||
|
|
@ -84,11 +84,6 @@ PluginComponent {
|
||||||
toggleProcess.running = true
|
toggleProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyToClipboard(text) {
|
|
||||||
Quickshell.execDetached(["sh", "-c", "echo -n '" + text + "' | wl-copy"])
|
|
||||||
ToastService.showInfo("tailscalectl", "Copied: " + text)
|
|
||||||
}
|
|
||||||
|
|
||||||
popoutContent: Component {
|
popoutContent: Component {
|
||||||
PopoutComponent {
|
PopoutComponent {
|
||||||
headerText: "Tailscale"
|
headerText: "Tailscale"
|
||||||
|
|
@ -166,36 +161,13 @@ PluginComponent {
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
hoverEnabled: true
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: peerHostnameText.implicitWidth
|
|
||||||
height: peerHostnameText.implicitHeight
|
|
||||||
onClicked: {
|
|
||||||
root.copyToClipboard(modelData.hostname)
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: peerHostnameText
|
|
||||||
text: modelData.hostname
|
text: modelData.hostname
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: modelData.online ? Theme.primary : Theme.surfaceVariantText
|
color: modelData.online ? Theme.primary : Theme.surfaceVariantText
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
hoverEnabled: true
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: peerIpText.implicitWidth
|
|
||||||
height: peerIpText.implicitHeight
|
|
||||||
onClicked: {
|
|
||||||
root.copyToClipboard(modelData.ip)
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: peerIpText
|
|
||||||
text: modelData.ip
|
text: modelData.ip
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
|
|
@ -206,7 +178,6 @@ PluginComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue