Fix frontend spelling of shouldManage (#898)

This commit is contained in:
Matt
2023-08-21 13:47:28 -07:00
committed by GitHub
parent fd8f16b615
commit 2f2396fe57
4 changed files with 15 additions and 10 deletions

View File

@@ -106,7 +106,7 @@ const saveGeneralSettings = () => {
The NetworkTables Server Address is not set or is invalid. NetworkTables is unable to connect.
</v-banner>
<cv-radio
v-show="useSettingsStore().network.shouldMange"
v-show="useSettingsStore().network.shouldManage"
v-model="useSettingsStore().network.connectionType"
label="IP Assignment Mode"
tooltip="DHCP will make the radio (router) automatically assign an IP address; this may result in an IP address that changes across reboots. Static IP assignment means that you pick the IP address and it won't change."
@@ -121,7 +121,7 @@ const saveGeneralSettings = () => {
:rules="[v => isValidIPv4(v) || 'Invalid IPv4 address']"
/>
<cv-input
v-show="useSettingsStore().network.shouldMange"
v-show="useSettingsStore().network.shouldManage"
v-model="useSettingsStore().network.hostname"
label="Hostname"
:input-cols="12-3"

View File

@@ -30,7 +30,7 @@ export interface NetworkSettings {
staticIp: string,
hostname: string,
runNTServer: boolean
shouldMange: boolean,
shouldManage: boolean,
networkManagerIface?: string,
physicalInterface?: string,
setStaticCommand?: string,

View File

@@ -41,7 +41,7 @@ public class NetworkConfig {
@JsonIgnore public static final String NM_IFACE_STRING = "${interface}";
@JsonIgnore public static final String NM_IP_STRING = "${ipaddr}";
public String networkManagerIface = "Wired\\ connection\\ 1";
public String networkManagerIface = "Wired connection 1";
public String physicalInterface = "eth0";
public String setStaticCommand =
"nmcli con mod ${interface} ipv4.addresses ${ipaddr}/8 ipv4.method \"manual\" ipv6.method \"disabled\"";
@@ -88,6 +88,11 @@ public class NetworkConfig {
}
}
@JsonIgnore
public String getEscapedIfaceName() {
return "\"" + networkManagerIface + "\"";
}
@JsonGetter("shouldManage")
public boolean shouldManage() {
return this.shouldManage || Platform.isLinux();

View File

@@ -99,7 +99,7 @@ public class NetworkManager {
// set nmcli back to DHCP, and re-run dhclient -- this ought to grab a new IP address
shell.executeBashCommand(
config.setDHCPcommand.replace(
NetworkConfig.NM_IFACE_STRING, config.networkManagerIface));
NetworkConfig.NM_IFACE_STRING, config.getEscapedIfaceName()));
shell.executeBashCommand("dhclient " + config.physicalInterface, false);
} catch (Exception e) {
logger.error("Exception while setting DHCP!");
@@ -111,7 +111,7 @@ public class NetworkManager {
shell.executeBashCommand(
config
.setStaticCommand
.replace(NetworkConfig.NM_IFACE_STRING, config.networkManagerIface)
.replace(NetworkConfig.NM_IFACE_STRING, config.getEscapedIfaceName())
.replace(NetworkConfig.NM_IP_STRING, config.staticIp));
if (Platform.isRaspberryPi()) {
@@ -119,17 +119,17 @@ public class NetworkManager {
// integral in my testing (Matt)
shell.executeBashCommand(
"sh -c 'nmcli con down "
+ config.networkManagerIface
+ config.getEscapedIfaceName()
+ "; nmcli con up "
+ config.networkManagerIface
+ config.getEscapedIfaceName()
+ "'");
} else {
// for now just bring down /up -- more testing needed on beelink et al
shell.executeBashCommand(
"sh -c 'nmcli con down "
+ config.networkManagerIface
+ config.getEscapedIfaceName()
+ "; nmcli con up "
+ config.networkManagerIface
+ config.getEscapedIfaceName()
+ "'");
}
} catch (Exception e) {