APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
d455e32f4f
commit
bf0aabcf7c
1 file changed
+1
-47
+1
-47
@@ -2200,12 +2200,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="label" data-i18n="dash_state_title">État de l’AP</div>
|
<div class="label" data-i18n="dash_state_title">État de l’AP</div>
|
||||||
<div id="state" class="metric status"><i class="dot"></i> Chargement</div>
|
<div id="state" class="metric status"><i class="dot"></i> Chargement</div>
|
||||||
<div style="display:flex;align-items:center;gap:6px;margin-top:8px;flex-wrap:wrap">
|
<div id="networkModeBadge" class="pill" style="margin-top:8px;width:fit-content;max-width:100%">—</div>
|
||||||
<div id="networkModeBadge" class="pill" style="width:fit-content;max-width:100%">—</div>
|
|
||||||
<button id="quickSwitchModeBtn" type="button" class="secondary" onclick="quickSwitchMode()"
|
|
||||||
style="padding:3px 9px;font-size:11px;border-radius:999px;line-height:1.3;display:none"
|
|
||||||
title="Basculer instantanément entre Mode AP et Mode Pont">⇄</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="label" data-i18n="dash_clients_title">Clients connectés</div>
|
<div class="label" data-i18n="dash_clients_title">Clients connectés</div>
|
||||||
@@ -7730,37 +7725,6 @@ ${vpnBadgeTopo}
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let _switchingMode = false;
|
|
||||||
async function quickSwitchMode(targetMode) {
|
|
||||||
if (_switchingMode) return;
|
|
||||||
const isBridge = status && status.mode === 'bridge';
|
|
||||||
const nextMode = targetMode || (isBridge ? 'ap' : 'bridge');
|
|
||||||
const btn = $('quickSwitchModeBtn');
|
|
||||||
_switchingMode = true;
|
|
||||||
if (btn) {
|
|
||||||
btn.disabled = true;
|
|
||||||
btn.textContent = '⏳ ' + t('mode_switching', 'Bascule…');
|
|
||||||
}
|
|
||||||
return runAction(async () => {
|
|
||||||
try {
|
|
||||||
const response = await apiFetch('/api/ap/mode', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify({ mode: nextMode })
|
|
||||||
});
|
|
||||||
const data = await response.json();
|
|
||||||
if (!response.ok) throw Error(data.error || 'Échec du changement de mode');
|
|
||||||
await load();
|
|
||||||
} catch (e) {
|
|
||||||
alert(tErr(e.message));
|
|
||||||
} finally {
|
|
||||||
_switchingMode = false;
|
|
||||||
if (btn) btn.disabled = false;
|
|
||||||
render();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
updateApButtons();
|
updateApButtons();
|
||||||
$('clientCount').textContent = status.max_clients > 0 ? `${clients.length} / ${status.max_clients}` : clients.length;
|
$('clientCount').textContent = status.max_clients > 0 ? `${clients.length} / ${status.max_clients}` : clients.length;
|
||||||
@@ -7777,16 +7741,6 @@ ${vpnBadgeTopo}
|
|||||||
$('networkModeBadge').style.background = '';
|
$('networkModeBadge').style.background = '';
|
||||||
$('networkModeBadge').style.color = '';
|
$('networkModeBadge').style.color = '';
|
||||||
}
|
}
|
||||||
if ($('quickSwitchModeBtn')) {
|
|
||||||
const qbtn = $('quickSwitchModeBtn');
|
|
||||||
qbtn.style.display = status.configured ? 'inline-flex' : 'none';
|
|
||||||
if (!_switchingMode) {
|
|
||||||
qbtn.textContent = isBridge ? '⇄ ' + t('btn_switch_to_ap', 'Mode AP') : '⇄ ' + t('btn_switch_to_bridge', 'Mode Pont');
|
|
||||||
qbtn.title = isBridge
|
|
||||||
? t('tip_switch_to_ap', 'Basculer instantanément en Mode AP (Routeur/NAT)')
|
|
||||||
: t('tip_switch_to_bridge', 'Basculer instantanément en Mode Pont (DHCP Box)');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($('settingsModeAp') && $('settingsModeBridge')) {
|
if ($('settingsModeAp') && $('settingsModeBridge')) {
|
||||||
if (isBridge) $('settingsModeBridge').checked = true; else $('settingsModeAp').checked = true;
|
if (isBridge) $('settingsModeBridge').checked = true; else $('settingsModeAp').checked = true;
|
||||||
if ($('settingsBridgeBlock')) $('settingsBridgeBlock').style.display = isBridge ? 'block' : 'none';
|
if ($('settingsBridgeBlock')) $('settingsBridgeBlock').style.display = isBridge ? 'block' : 'none';
|
||||||
|
|||||||
Reference in new issue
Block a user