ui update
This commit is contained in:
parent
8fb3741dbb
commit
038550bb45
|
|
@ -83,9 +83,11 @@ foreach ($output as $line) {
|
|||
}
|
||||
|
||||
// Check if interface is a bridge or docker interface
|
||||
if (strpos($current_interface, 'docker') === 0 ||
|
||||
if (
|
||||
strpos($current_interface, 'docker') === 0 ||
|
||||
strpos($current_interface, 'br-') === 0 ||
|
||||
strpos($current_interface, 'veth') === 0) {
|
||||
strpos($current_interface, 'veth') === 0
|
||||
) {
|
||||
$current_interface = null;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -158,25 +160,25 @@ $general_config = $network_config['general'] ?? [
|
|||
<div class="mb-3">
|
||||
<label for="hostname" class="form-label">Hostname</label>
|
||||
<input type="text" class="form-control" id="hostname" name="hostname"
|
||||
value="<?php echo htmlspecialchars($general_config['hostname']); ?>">
|
||||
value="<?php echo htmlspecialchars($general_config['hostname']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="dns_servers" class="form-label">DNS Servers (comma separated)</label>
|
||||
<input type="text" class="form-control" id="dns_servers" name="dns_servers"
|
||||
value="<?php echo htmlspecialchars($general_config['dns_servers']); ?>">
|
||||
value="<?php echo htmlspecialchars($general_config['dns_servers']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="ntp_servers" class="form-label">NTP Servers (comma separated)</label>
|
||||
<input type="text" class="form-control" id="ntp_servers" name="ntp_servers"
|
||||
value="<?php echo htmlspecialchars($general_config['ntp_servers']); ?>">
|
||||
value="<?php echo htmlspecialchars($general_config['ntp_servers']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="proxy" class="form-label">Proxy Server</label>
|
||||
<input type="text" class="form-control" id="proxy" name="proxy"
|
||||
value="<?php echo htmlspecialchars($general_config['proxy']); ?>">
|
||||
value="<?php echo htmlspecialchars($general_config['proxy']); ?>">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Save General Settings</button>
|
||||
|
|
@ -194,26 +196,29 @@ $general_config = $network_config['general'] ?? [
|
|||
<div class="card-body">
|
||||
<!-- Interface Tabs -->
|
||||
<ul class="nav nav-tabs interface-tabs" id="interfaceTabs" role="tablist">
|
||||
<?php $first = true; foreach ($interface_data as $interface): ?>
|
||||
<?php $first = true;
|
||||
foreach ($interface_data as $interface): ?>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link <?php echo $first ? 'active' : ''; ?>"
|
||||
id="tab-<?php echo $interface['name']; ?>"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#<?php echo $interface['name']; ?>"
|
||||
type="button"
|
||||
role="tab">
|
||||
id="tab-<?php echo $interface['name']; ?>"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#<?php echo $interface['name']; ?>"
|
||||
type="button"
|
||||
role="tab">
|
||||
<?php echo htmlspecialchars($interface['name']); ?>
|
||||
</button>
|
||||
</li>
|
||||
<?php $first = false; endforeach; ?>
|
||||
<?php $first = false;
|
||||
endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<!-- Interface Tab Content -->
|
||||
<div class="tab-content interface-tab-content" id="interfaceTabContent">
|
||||
<?php $first = true; foreach ($interface_data as $interface): ?>
|
||||
<?php $first = true;
|
||||
foreach ($interface_data as $interface): ?>
|
||||
<div class="tab-pane fade <?php echo $first ? 'show active' : ''; ?>"
|
||||
id="<?php echo $interface['name']; ?>"
|
||||
role="tabpanel">
|
||||
id="<?php echo $interface['name']; ?>"
|
||||
role="tabpanel">
|
||||
<div class="interface-settings">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
|
|
@ -229,57 +234,51 @@ $general_config = $network_config['general'] ?? [
|
|||
<form method="post" action="">
|
||||
<input type="hidden" name="interface" value="<?php echo htmlspecialchars($interface['name']); ?>">
|
||||
<input type="hidden" name="action" value="save">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Configuration Method</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="method" id="dhcp-<?php echo $interface['name']; ?>"
|
||||
value="dhcp" <?php echo ($interface['config']['method'] ?? '') === 'dhcp' ? 'checked' : ''; ?>>
|
||||
value="dhcp" <?php echo ($interface['config']['method'] ?? '') === 'dhcp' ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label" for="dhcp-<?php echo $interface['name']; ?>">
|
||||
DHCP
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="method" id="static-<?php echo $interface['name']; ?>"
|
||||
value="static" <?php echo ($interface['config']['method'] ?? '') === 'static' ? 'checked' : ''; ?>>
|
||||
value="static" <?php echo ($interface['config']['method'] ?? '') === 'static' ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label" for="static-<?php echo $interface['name']; ?>">
|
||||
Static IP
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" id="static-ip-fields-<?php echo $interface['name']; ?>"
|
||||
style="<?php echo ($interface['config']['method'] ?? '') === 'static' ? 'display: block;' : 'display: none;'; ?>">
|
||||
style="<?php echo ($interface['config']['method'] ?? '') === 'static' ? 'display: block;' : 'display: none;'; ?>">
|
||||
<label class="form-label">IP Address</label>
|
||||
<input type="text" class="form-control" name="ip"
|
||||
value="<?php echo htmlspecialchars($interface['config']['ip'] ?? ''); ?>"
|
||||
placeholder="192.168.1.100">
|
||||
|
||||
value="<?php echo htmlspecialchars($interface['config']['ip'] ?? ''); ?>"
|
||||
placeholder="192.168.1.100">
|
||||
<label class="form-label mt-2">Netmask</label>
|
||||
<input type="text" class="form-control" name="netmask"
|
||||
value="<?php echo htmlspecialchars($interface['config']['netmask'] ?? ''); ?>"
|
||||
placeholder="255.255.255.0">
|
||||
|
||||
value="<?php echo htmlspecialchars($interface['config']['netmask'] ?? ''); ?>"
|
||||
placeholder="255.255.255.0">
|
||||
<label class="form-label mt-2">Gateway</label>
|
||||
<input type="text" class="form-control" name="gateway"
|
||||
value="<?php echo htmlspecialchars($interface['config']['gateway'] ?? ''); ?>"
|
||||
placeholder="192.168.1.1">
|
||||
|
||||
value="<?php echo htmlspecialchars($interface['config']['gateway'] ?? ''); ?>"
|
||||
placeholder="192.168.1.1">
|
||||
<label class="form-label mt-2">DNS Server</label>
|
||||
<input type="text" class="form-control" name="dns"
|
||||
value="<?php echo htmlspecialchars($interface['config']['dns'] ?? ''); ?>"
|
||||
placeholder="8.8.8.8">
|
||||
value="<?php echo htmlspecialchars($interface['config']['dns'] ?? ''); ?>"
|
||||
placeholder="8.8.8.8">
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<button type="submit" class="btn btn-primary">Save Configuration</button>
|
||||
<div>
|
||||
<button type="submit" name="action" value="activate"
|
||||
class="btn btn-success <?php echo $interface['status'] === 'up' ? 'disabled' : ''; ?>">
|
||||
class="btn btn-success <?php echo $interface['status'] === 'up' ? 'disabled' : ''; ?>">
|
||||
Activate
|
||||
</button>
|
||||
<button type="submit" name="action" value="deactivate"
|
||||
class="btn btn-danger <?php echo $interface['status'] === 'down' ? 'disabled' : ''; ?>">
|
||||
class="btn btn-danger <?php echo $interface['status'] === 'down' ? 'disabled' : ''; ?>">
|
||||
Deactivate
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -289,7 +288,8 @@ $general_config = $network_config['general'] ?? [
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php $first = false; endforeach; ?>
|
||||
<?php $first = false;
|
||||
endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -299,19 +299,19 @@ $general_config = $network_config['general'] ?? [
|
|||
</div>
|
||||
|
||||
<script>
|
||||
// Toggle static IP fields based on method selection
|
||||
document.querySelectorAll('input[name^="method"]').forEach(radio => {
|
||||
radio.addEventListener('change', function() {
|
||||
const interfaceName = this.name.replace('method', '');
|
||||
const staticFields = document.getElementById(`static-ip-fields-${interfaceName}`);
|
||||
// Toggle static IP fields based on method selection
|
||||
document.querySelectorAll('input[name^="method"]').forEach(radio => {
|
||||
radio.addEventListener('change', function() {
|
||||
const interfaceName = this.name.replace('method', '');
|
||||
const staticFields = document.getElementById(`static-ip-fields-${interfaceName}`);
|
||||
|
||||
if (this.value === 'static') {
|
||||
staticFields.style.display = 'block';
|
||||
} else {
|
||||
staticFields.style.display = 'none';
|
||||
}
|
||||
if (this.value === 'static') {
|
||||
staticFields.style.display = 'block';
|
||||
} else {
|
||||
staticFields.style.display = 'none';
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include 'footer.php' ?>
|
||||
Loading…
Reference in New Issue