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.tailscaleIP = (data.Self?.TailscaleIPs?.[0]) || ""
|
||||
root.currentExitNode = data.CurrentExitNode?.HostName || ""
|
||||
root.peers = Object.keys(data.Peers || {}).map(function(key) {
|
||||
var p = data.Peers[key]
|
||||
root.peers = Object.keys(data.Peer || {}).map(function(key) {
|
||||
var p = data.Peer[key]
|
||||
return {
|
||||
hostname: p.HostName || key,
|
||||
ip: (p.TailscaleIPs && p.TailscaleIPs.length) ? p.TailscaleIPs[0] : "",
|
||||
|
|
@ -84,11 +84,6 @@ PluginComponent {
|
|||
toggleProcess.running = true
|
||||
}
|
||||
|
||||
function copyToClipboard(text) {
|
||||
Quickshell.execDetached(["sh", "-c", "echo -n '" + text + "' | wl-copy"])
|
||||
ToastService.showInfo("tailscalectl", "Copied: " + text)
|
||||
}
|
||||
|
||||
popoutContent: Component {
|
||||
PopoutComponent {
|
||||
headerText: "Tailscale"
|
||||
|
|
@ -166,40 +161,16 @@ PluginComponent {
|
|||
spacing: Theme.spacingS
|
||||
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 {
|
||||
id: peerHostnameText
|
||||
text: modelData.hostname
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: modelData.online ? Theme.primary : Theme.surfaceVariantText
|
||||
}
|
||||
StyledText {
|
||||
text: modelData.hostname
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
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 {
|
||||
id: peerIpText
|
||||
text: modelData.ip
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
StyledText {
|
||||
text: modelData.ip
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue