[Update] Config Page: Device Tab. Fetch latest data mic host list and device list when open the list container every time.

This commit is contained in:
Sakamoto Shiina
2024-09-03 10:49:52 +09:00
parent aed9faa72f
commit 96708a27a6
3 changed files with 42 additions and 12 deletions

View File

@@ -20,31 +20,49 @@ export const useConfig = () => {
const { updateSelectedMicDevice } = useSelectedMicDevice();
const asyncPending = () => new Promise(() => {});
return {
getSoftwareVersion: () => asyncStdoutToPython("/config/version"),
getSoftwareVersion: () => {
updateSoftwareVersion(asyncPending);
asyncStdoutToPython("/config/version");
},
updateSoftwareVersion: (payload) => updateSoftwareVersion(payload.data),
getMicHostList: () => asyncStdoutToPython("/controller/list_mic_host"),
getMicHostList: () => {
updateMicHostList(asyncPending);
asyncStdoutToPython("/controller/list_mic_host");
},
updateMicHostList: (payload) => {
updateMicHostList(arrayToObject(payload.data));
},
getSelectedMicHost: () => asyncStdoutToPython("/config/choice_mic_host"),
getSelectedMicHost: () => {
updateSelectedMicHost(asyncPending);
asyncStdoutToPython("/config/choice_mic_host");
},
updateSelectedMicHost: (payload) => {
updateSelectedMicHost(payload.data);
},
setSelectedMicHost: (selected_mic_host) => {
updateSelectedMicHost(asyncPending);
asyncStdoutToPython("/controller/callback_set_mic_host", selected_mic_host);
},
getMicDeviceList: () => asyncStdoutToPython("/controller/list_mic_device"),
getMicDeviceList: () => {
updateMicDeviceList(asyncPending);
asyncStdoutToPython("/controller/list_mic_device");
},
updateMicDeviceList: (payload) => {
updateMicDeviceList(arrayToObject(payload.data));
},
getSelectedMicDevice: () => asyncStdoutToPython("/config/choice_mic_device"),
getSelectedMicDevice: () => {
updateSelectedMicDevice(asyncPending);
asyncStdoutToPython("/config/choice_mic_device");
},
updateSelectedMicDevice: (payload) => {
updateSelectedMicDevice(payload.data);
},
setSelectedMicDevice: (selected_mic_device) => {
updateSelectedMicDevice(asyncPending);
asyncStdoutToPython("/controller/callback_set_mic_device", selected_mic_device);
},