From 80f479344d435b7e13d0ffd99b662123f8edd76a Mon Sep 17 00:00:00 2001
From: Doug Wegscheid <5349196+fovea1959@users.noreply.github.com>
Date: Fri, 12 May 2023 18:01:09 -0400
Subject: [PATCH] Allow arbitrary networktables address (#764)
* Allow specifying NT server address by ip.
---
photon-client/src/App.vue | 4 +--
photon-client/src/store/index.js | 2 +-
photon-client/src/views/PipelineView.vue | 2 +-
.../src/views/SettingsViews/Networking.vue | 35 ++++++++++++-------
.../common/configuration/NetworkConfig.java | 8 +++--
.../networktables/NetworkTablesManager.java | 22 +++++++++---
.../common/networking/NetworkManager.java | 2 +-
.../configuration/NetworkConfigTest.java | 16 +++++++++
photon-server/netTest.json | 2 +-
.../networkSettings.json | 3 ++
.../networkSettings.json | 3 ++
11 files changed, 73 insertions(+), 26 deletions(-)
create mode 100644 test-resources/network-new-team-number/networkSettings.json
create mode 100644 test-resources/network-old-team-number/networkSettings.json
diff --git a/photon-client/src/App.vue b/photon-client/src/App.vue
index 99a9416fe..c0cf83c2a 100644
--- a/photon-client/src/App.vue
+++ b/photon-client/src/App.vue
@@ -81,7 +81,7 @@
- Team number is {{ $store.state.settings.networkSettings.teamNumber }}
+ NT server is {{ $store.state.settings.networkSettings.ntServerAddress }}
@@ -151,7 +151,7 @@ export default {
computed: {
needsTeamNumberSet: {
get() {
- return this.$store.state.settings.networkSettings.teamNumber < 1
+ return this.$store.state.settings.networkSettings.ntServerAddress == ""
&& this.teamNumberDialog && this.$store.state.backendConnected
&& !this.$route.name.toLowerCase().includes("settings");
}
diff --git a/photon-client/src/store/index.js b/photon-client/src/store/index.js
index b0e475569..52e29e524 100644
--- a/photon-client/src/store/index.js
+++ b/photon-client/src/store/index.js
@@ -135,7 +135,7 @@ export default new Vuex.Store({
hardwarePlatform: "Unknown",
},
networkSettings: {
- teamNumber: 0,
+ ntServerAddress: "",
supported: true,
// Below options are only configurable if supported is true
diff --git a/photon-client/src/views/PipelineView.vue b/photon-client/src/views/PipelineView.vue
index a6f7ef489..910642a1f 100644
--- a/photon-client/src/views/PipelineView.vue
+++ b/photon-client/src/views/PipelineView.vue
@@ -475,7 +475,7 @@ export default {
},
showNTWarning: {
get() {
- return (!this.$store.state.ntConnectionInfo.connected || this.$store.state.settings.networkSettings.runNTServer) && this.$store.state.settings.networkSettings.teamNumber > 0 && this.$store.state.backendConnected && !this.hideNTWarning;
+ return (!this.$store.state.ntConnectionInfo.connected || this.$store.state.settings.networkSettings.runNTServer) && this.$store.state.settings.networkSettings.ntServerAddress != "" && this.$store.state.backendConnected && !this.hideNTWarning;
}
},
},
diff --git a/photon-client/src/views/SettingsViews/Networking.vue b/photon-client/src/views/SettingsViews/Networking.vue
index 38ed868fb..507dd9bf7 100644
--- a/photon-client/src/views/SettingsViews/Networking.vue
+++ b/photon-client/src/views/SettingsViews/Networking.vue
@@ -4,21 +4,21 @@
ref="form"
v-model="valid"
>
-
- Team number is unset or invalid. NetworkTables will not be able to connect.
+ Team Number unset or invalid. NetworkTables will not be able to connect.