fix: empêcher réinitialisation dropdowns audio pendant édition
- Ajout état isEditingAudio pour tracker quand utilisateur édite - loadAudioDevices() ne réécrase plus les sélections si isEditingAudio=true - Activation isEditingAudio sur onChange des 3 dropdowns - Désactivation après sauvegarde réussie - Corrige bug: dropdowns se réinitialisaient toutes les 3s (auto-refresh)
This commit is contained in:
@@ -81,7 +81,7 @@ define(['./workbox-290dd570'], (function (workbox) { 'use strict';
|
|||||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||||
}, {
|
}, {
|
||||||
"url": "index.html",
|
"url": "index.html",
|
||||||
"revision": "0.lemq4lha2l8"
|
"revision": "0.u6ufl8c15b8"
|
||||||
}], {});
|
}], {});
|
||||||
workbox.cleanupOutdatedCaches();
|
workbox.cleanupOutdatedCaches();
|
||||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+17
-4
@@ -19,6 +19,7 @@ function Admin() {
|
|||||||
const [selectedInputDevice, setSelectedInputDevice] = useState(null);
|
const [selectedInputDevice, setSelectedInputDevice] = useState(null);
|
||||||
const [selectedOutputDevice, setSelectedOutputDevice] = useState(null);
|
const [selectedOutputDevice, setSelectedOutputDevice] = useState(null);
|
||||||
const [selectedSampleRate, setSelectedSampleRate] = useState(48000);
|
const [selectedSampleRate, setSelectedSampleRate] = useState(48000);
|
||||||
|
const [isEditingAudio, setIsEditingAudio] = useState(false);
|
||||||
|
|
||||||
// Channel names (Phase 2.5)
|
// Channel names (Phase 2.5)
|
||||||
const [channelNames, setChannelNames] = useState({ inputs: {}, outputs: {} });
|
const [channelNames, setChannelNames] = useState({ inputs: {}, outputs: {} });
|
||||||
@@ -104,10 +105,12 @@ function Admin() {
|
|||||||
setCurrentDevice(currentData.device || {});
|
setCurrentDevice(currentData.device || {});
|
||||||
setChannelNames(channelNamesData.channelNames || { inputs: {}, outputs: {} });
|
setChannelNames(channelNamesData.channelNames || { inputs: {}, outputs: {} });
|
||||||
|
|
||||||
// Initialiser les sélections avec les valeurs actuelles
|
// Ne réinitialiser les sélections que si l'utilisateur n'est pas en train d'éditer
|
||||||
|
if (!isEditingAudio) {
|
||||||
setSelectedInputDevice(currentData.device?.inputDeviceId ?? null);
|
setSelectedInputDevice(currentData.device?.inputDeviceId ?? null);
|
||||||
setSelectedOutputDevice(currentData.device?.outputDeviceId ?? null);
|
setSelectedOutputDevice(currentData.device?.outputDeviceId ?? null);
|
||||||
setSelectedSampleRate(currentData.device?.sampleRate || 48000);
|
setSelectedSampleRate(currentData.device?.sampleRate || 48000);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== Gestion groupes ==========
|
// ========== Gestion groupes ==========
|
||||||
@@ -274,6 +277,7 @@ function Admin() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
|
setIsEditingAudio(false); // Désactiver le mode édition
|
||||||
alert('Configuration audio sauvegardée avec succès!');
|
alert('Configuration audio sauvegardée avec succès!');
|
||||||
await loadAudioDevices();
|
await loadAudioDevices();
|
||||||
} else {
|
} else {
|
||||||
@@ -508,7 +512,10 @@ function Admin() {
|
|||||||
<h3>Carte son d'entrée (Input)</h3>
|
<h3>Carte son d'entrée (Input)</h3>
|
||||||
<select
|
<select
|
||||||
value={selectedInputDevice ?? ''}
|
value={selectedInputDevice ?? ''}
|
||||||
onChange={(e) => setSelectedInputDevice(e.target.value === '' ? null : parseInt(e.target.value))}
|
onChange={(e) => {
|
||||||
|
setIsEditingAudio(true);
|
||||||
|
setSelectedInputDevice(e.target.value === '' ? null : parseInt(e.target.value));
|
||||||
|
}}
|
||||||
className="device-select"
|
className="device-select"
|
||||||
>
|
>
|
||||||
<option value="">-- Sélectionner une carte --</option>
|
<option value="">-- Sélectionner une carte --</option>
|
||||||
@@ -531,7 +538,10 @@ function Admin() {
|
|||||||
<h3>Carte son de sortie (Output)</h3>
|
<h3>Carte son de sortie (Output)</h3>
|
||||||
<select
|
<select
|
||||||
value={selectedOutputDevice ?? ''}
|
value={selectedOutputDevice ?? ''}
|
||||||
onChange={(e) => setSelectedOutputDevice(e.target.value === '' ? null : parseInt(e.target.value))}
|
onChange={(e) => {
|
||||||
|
setIsEditingAudio(true);
|
||||||
|
setSelectedOutputDevice(e.target.value === '' ? null : parseInt(e.target.value));
|
||||||
|
}}
|
||||||
className="device-select"
|
className="device-select"
|
||||||
>
|
>
|
||||||
<option value="">-- Sélectionner une carte --</option>
|
<option value="">-- Sélectionner une carte --</option>
|
||||||
@@ -554,7 +564,10 @@ function Admin() {
|
|||||||
<h3>Sample Rate</h3>
|
<h3>Sample Rate</h3>
|
||||||
<select
|
<select
|
||||||
value={selectedSampleRate}
|
value={selectedSampleRate}
|
||||||
onChange={(e) => setSelectedSampleRate(parseInt(e.target.value))}
|
onChange={(e) => {
|
||||||
|
setIsEditingAudio(true);
|
||||||
|
setSelectedSampleRate(parseInt(e.target.value));
|
||||||
|
}}
|
||||||
className="device-select"
|
className="device-select"
|
||||||
>
|
>
|
||||||
<option value={44100}>44100 Hz (CD quality)</option>
|
<option value={44100}>44100 Hz (CD quality)</option>
|
||||||
|
|||||||
Reference in New Issue
Block a user