ui update
This commit is contained in:
parent
279e891773
commit
5733e855f7
|
|
@ -263,23 +263,22 @@ $selected_interface = $_GET['interface'] ?? array_keys($interface_data)[0] ?? nu
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Multicast toggle switch functionality
|
// Multicast toggle switch functionality - simplified approach
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// Find all multicast toggle switches
|
// Add event listeners to all multicast checkboxes
|
||||||
const multicastSwitches = document.querySelectorAll('.switch input[type="checkbox"]');
|
const checkboxes = document.querySelectorAll('input[id^="multicast-"]');
|
||||||
|
|
||||||
multicastSwitches.forEach(checkbox => {
|
checkboxes.forEach(checkbox => {
|
||||||
checkbox.addEventListener('change', function() {
|
checkbox.addEventListener('change', function() {
|
||||||
// Get the interface name from the checkbox ID
|
// Extract interface name from ID (format: multicast-eth0)
|
||||||
// ID format: "multicast-eth0" -> split by "-" -> [0] = "multicast", [1] = "eth0"
|
const idParts = this.id.split('-');
|
||||||
const interfaceName = this.id.split('-')[1];
|
const interfaceName = idParts[1]; // Get the interface name part
|
||||||
const label = document.getElementById(`multicast-label-${interfaceName}`);
|
|
||||||
|
|
||||||
|
if (interfaceName) {
|
||||||
|
const label = document.getElementById(`multicast-label-${interfaceName}`);
|
||||||
if (label) {
|
if (label) {
|
||||||
if (this.checked) {
|
// Update label text based on checkbox state
|
||||||
label.textContent = 'Enabled';
|
label.textContent = this.checked ? 'Enabled' : 'Disabled';
|
||||||
} else {
|
|
||||||
label.textContent = 'Disabled';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue