mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
feat: add config_interface.js for bridge/single interface mode handling
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
scripts=( index.js template.js login.js first-run.js shaped-devices.js tree.js help.js unknown-ips.js configuration.js circuit.js flow_map.js all_tree_sankey.js asn_explorer.js lts_trial.js config_general.js config_anon.js config_tuning.js config_queues.js config_lts.js config_iprange.js config_flows.js config_integration.js config_spylnx.js config_uisp.js config_powercode.js config_sonar.js )
|
||||
scripts=( index.js template.js login.js first-run.js shaped-devices.js tree.js help.js unknown-ips.js configuration.js circuit.js flow_map.js all_tree_sankey.js asn_explorer.js lts_trial.js config_general.js config_anon.js config_tuning.js config_queues.js config_lts.js config_iprange.js config_flows.js config_integration.js config_spylnx.js config_uisp.js config_powercode.js config_sonar.js config_interface.js )
|
||||
for script in "${scripts[@]}"
|
||||
do
|
||||
echo "Building {$script}"
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import {loadConfig} from "./config/config_helper";
|
||||
|
||||
loadConfig(() => {
|
||||
// window.config now contains the configuration.
|
||||
// Populate form fields with config values
|
||||
if (window.config) {
|
||||
// Determine which mode is active
|
||||
if (window.config.bridge) {
|
||||
// Bridge mode
|
||||
document.getElementById('bridgeMode').checked = true;
|
||||
document.getElementById('useXdpBridge').checked =
|
||||
window.config.bridge.use_xdp_bridge ?? true;
|
||||
document.getElementById('toInternet').value =
|
||||
window.config.bridge.to_internet ?? "eth0";
|
||||
document.getElementById('toNetwork').value =
|
||||
window.config.bridge.to_network ?? "eth1";
|
||||
} else if (window.config.single_interface) {
|
||||
// Single interface mode
|
||||
document.getElementById('singleInterfaceMode').checked = true;
|
||||
document.getElementById('interface').value =
|
||||
window.config.single_interface.interface ?? "eth0";
|
||||
document.getElementById('internetVlan').value =
|
||||
window.config.single_interface.internet_vlan ?? 2;
|
||||
document.getElementById('networkVlan').value =
|
||||
window.config.single_interface.network_vlan ?? 3;
|
||||
}
|
||||
|
||||
// Trigger form visibility update
|
||||
const event = new Event('change');
|
||||
document.querySelector('input[name="networkMode"]:checked')?.dispatchEvent(event);
|
||||
} else {
|
||||
console.error("Configuration not found in window.config");
|
||||
}
|
||||
});
|
||||
@@ -98,6 +98,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="config_interface.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const bridgeMode = document.getElementById('bridgeMode');
|
||||
|
||||
Reference in New Issue
Block a user