mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-22 14:22:23 +00:00
Wire up checkboxes for allowGlobal, allowDefault, allowManaged to set the proper state in zerotier daemon
checkboxes are disabled if the network is not currently connected.
This commit is contained in:
parent
d57e343245
commit
1756e8b0f2
@ -42,14 +42,10 @@ class NetworkInfoCell: NSTableCellView {
|
||||
}
|
||||
|
||||
@IBAction func onConnectCheckStateChanged(sender: NSButton) {
|
||||
NSLog("Checked State Changed")
|
||||
|
||||
if(sender.state == NSOnState) {
|
||||
NSLog("Checked")
|
||||
joinNetwork(networkIdField.stringValue)
|
||||
}
|
||||
else {
|
||||
NSLog("Unchecked")
|
||||
leaveNetwork(networkIdField.stringValue)
|
||||
}
|
||||
}
|
||||
@ -60,10 +56,17 @@ class NetworkInfoCell: NSTableCellView {
|
||||
}
|
||||
|
||||
func joinNetwork(nwid: String) {
|
||||
ServiceCom.joinNetwork(nwid)
|
||||
ServiceCom.joinNetwork(nwid,
|
||||
allowManaged: allowManaged.state == NSOnState,
|
||||
allowGlobal: allowGlobal.state == NSOnState,
|
||||
allowDefault: !defaultRouteExists(parent.networkList) && (allowDefault.state == NSOnState))
|
||||
}
|
||||
|
||||
func leaveNetwork(nwid: String) {
|
||||
ServiceCom.leaveNetwork(nwid)
|
||||
}
|
||||
|
||||
@IBAction func onAllowStatusChanged(sender: NSButton) {
|
||||
joinNetwork(networkIdField.stringValue)
|
||||
}
|
||||
}
|
||||
|
@ -103,9 +103,17 @@ class ShowNetworksViewController: NSViewController, NSTableViewDelegate, NSTable
|
||||
|
||||
if network.connected {
|
||||
cell.connectedCheckbox.state = NSOnState
|
||||
|
||||
cell.allowDefault.enabled = true
|
||||
cell.allowGlobal.enabled = true
|
||||
cell.allowManaged.enabled = true
|
||||
}
|
||||
else {
|
||||
cell.connectedCheckbox.state = NSOffState
|
||||
|
||||
cell.allowDefault.enabled = false
|
||||
cell.allowGlobal.enabled = false
|
||||
cell.allowManaged.enabled = false
|
||||
}
|
||||
|
||||
return cell
|
||||
|
@ -168,6 +168,9 @@
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="onAllowStatusChanged:" target="rmb-il-W5I" id="FW8-5N-vt1"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8CS-6g-NFI">
|
||||
<rect key="frame" x="504" y="122" width="22" height="18"/>
|
||||
@ -175,6 +178,9 @@
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="onAllowStatusChanged:" target="rmb-il-W5I" id="ahh-N8-nhW"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="URn-qw-7jG">
|
||||
<rect key="frame" x="504" y="146" width="22" height="18"/>
|
||||
@ -182,6 +188,9 @@
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="onAllowStatusChanged:" target="rmb-il-W5I" id="XGy-pE-Dzf"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jdz-W3-UwS">
|
||||
<rect key="frame" x="19" y="147" width="79" height="17"/>
|
||||
|
Loading…
Reference in New Issue
Block a user