[Update] Config Page: Device tab. add mic device list.(not selectable yet.)
This commit is contained in:
@@ -18,6 +18,8 @@ export const App = () => {
|
|||||||
getSoftwareVersion,
|
getSoftwareVersion,
|
||||||
getMicHostList,
|
getMicHostList,
|
||||||
getSelectedMicHost,
|
getSelectedMicHost,
|
||||||
|
getMicDeviceList,
|
||||||
|
getSelectedMicDevice,
|
||||||
} = useConfig();
|
} = useConfig();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -27,8 +29,10 @@ export const App = () => {
|
|||||||
getSoftwareVersion();
|
getSoftwareVersion();
|
||||||
getMicHostList();
|
getMicHostList();
|
||||||
getSelectedMicHost();
|
getSelectedMicHost();
|
||||||
|
getMicDeviceList();
|
||||||
|
getSelectedMicDevice();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return () => hasRunRef.current = true;
|
return () => hasRunRef.current = true;
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ export const Device = () => {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "mic_device":
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -45,14 +49,15 @@ export const Device = () => {
|
|||||||
selectFunction={selectFunction}
|
selectFunction={selectFunction}
|
||||||
state={currentSelectedMicHost.state}
|
state={currentSelectedMicHost.state}
|
||||||
/>
|
/>
|
||||||
{/* <DropdownMenuContainer
|
|
||||||
|
<DropdownMenuContainer
|
||||||
dropdown_id="mic_device"
|
dropdown_id="mic_device"
|
||||||
label={t("config_page.mic_device.label")}
|
label={t("config_page.mic_device.label")}
|
||||||
selected_id={currentSelectedMicDevice.data}
|
selected_id={currentSelectedMicDevice.data}
|
||||||
list={currentMicDeviceList.data}
|
list={currentMicDeviceList.data}
|
||||||
selectFunction={selectFunction}
|
selectFunction={selectFunction}
|
||||||
state={currentSelectedMicDevice.state}
|
state={currentSelectedMicDevice.state}
|
||||||
/> */}
|
/>
|
||||||
{/*
|
{/*
|
||||||
<ThresholdContainer label={t("config_page.mic_dynamic_energy_threshold.label_for_manual")} desc={t("config_page.mic_dynamic_energy_threshold.desc_for_manual")} id="mic_threshold" min="0" max="3000"/>
|
<ThresholdContainer label={t("config_page.mic_dynamic_energy_threshold.label_for_manual")} desc={t("config_page.mic_dynamic_energy_threshold.desc_for_manual")} id="mic_threshold" min="0" max="3000"/>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import {
|
|||||||
useSoftwareVersion,
|
useSoftwareVersion,
|
||||||
useMicHostList,
|
useMicHostList,
|
||||||
useSelectedMicHost,
|
useSelectedMicHost,
|
||||||
|
useMicDeviceList,
|
||||||
|
useSelectedMicDevice,
|
||||||
} from "@store";
|
} from "@store";
|
||||||
|
|
||||||
import { useStdoutToPython } from "./useStdoutToPython";
|
import { useStdoutToPython } from "./useStdoutToPython";
|
||||||
@@ -14,6 +16,8 @@ export const useConfig = () => {
|
|||||||
const { updateSoftwareVersion } = useSoftwareVersion();
|
const { updateSoftwareVersion } = useSoftwareVersion();
|
||||||
const { updateMicHostList } = useMicHostList();
|
const { updateMicHostList } = useMicHostList();
|
||||||
const { updateSelectedMicHost } = useSelectedMicHost();
|
const { updateSelectedMicHost } = useSelectedMicHost();
|
||||||
|
const { updateMicDeviceList } = useMicDeviceList();
|
||||||
|
const { updateSelectedMicDevice } = useSelectedMicDevice();
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -29,6 +33,15 @@ export const useConfig = () => {
|
|||||||
updateSelectedMicHost(payload.data);
|
updateSelectedMicHost(payload.data);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getMicDeviceList: () => asyncStdoutToPython("/controller/list_mic_device"),
|
||||||
|
updateMicDeviceList: (payload) => {
|
||||||
|
updateMicDeviceList(arrayToObject(payload.data));
|
||||||
|
},
|
||||||
|
getSelectedMicDevice: () => asyncStdoutToPython("/config/choice_mic_device"),
|
||||||
|
updateSelectedMicDevice: (payload) => {
|
||||||
|
updateSelectedMicDevice(payload.data);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -19,6 +19,8 @@ export const useReceiveRoutes = () => {
|
|||||||
updateSoftwareVersion,
|
updateSoftwareVersion,
|
||||||
updateMicHostList,
|
updateMicHostList,
|
||||||
updateSelectedMicHost,
|
updateSelectedMicHost,
|
||||||
|
updateMicDeviceList,
|
||||||
|
updateSelectedMicDevice,
|
||||||
} = useConfig();
|
} = useConfig();
|
||||||
|
|
||||||
const routes = {
|
const routes = {
|
||||||
@@ -32,7 +34,8 @@ export const useReceiveRoutes = () => {
|
|||||||
"/config/version": updateSoftwareVersion,
|
"/config/version": updateSoftwareVersion,
|
||||||
"/controller/list_mic_host": updateMicHostList,
|
"/controller/list_mic_host": updateMicHostList,
|
||||||
"/config/choice_mic_host": updateSelectedMicHost,
|
"/config/choice_mic_host": updateSelectedMicHost,
|
||||||
|
"/controller/list_mic_device": updateMicDeviceList,
|
||||||
|
"/config/choice_mic_device": updateSelectedMicDevice,
|
||||||
|
|
||||||
"/controller/callback_messagebox_send": updateSentMessageLog,
|
"/controller/callback_messagebox_send": updateSentMessageLog,
|
||||||
"/action/transcription_send_mic_message": addSentMessageLog,
|
"/action/transcription_send_mic_message": addSentMessageLog,
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ export const { atomInstance: Atom_IsOpenedDropdownMenu, useHook: useIsOpenedDrop
|
|||||||
// Config Page
|
// Config Page
|
||||||
export const { atomInstance: Atom_MicHostList, useHook: useMicHostList } = createAsyncAtomWithHook([], "MicHostList");
|
export const { atomInstance: Atom_MicHostList, useHook: useMicHostList } = createAsyncAtomWithHook([], "MicHostList");
|
||||||
export const { atomInstance: Atom_SelectedMicHost, useHook: useSelectedMicHost } = createAsyncAtomWithHook("Nothing Selected", "SelectedMicHost");
|
export const { atomInstance: Atom_SelectedMicHost, useHook: useSelectedMicHost } = createAsyncAtomWithHook("Nothing Selected", "SelectedMicHost");
|
||||||
export const { atomInstance: Atom_MicDeviceList, useHook: useMicDeviceList } = createAsyncAtomWithHook(test_device_list, "MicDeviceList");
|
export const { atomInstance: Atom_MicDeviceList, useHook: useMicDeviceList } = createAsyncAtomWithHook([], "MicDeviceList");
|
||||||
export const { atomInstance: Atom_SelectedMicDevice, useHook: useSelectedMicDevice } = createAsyncAtomWithHook("device b", "SelectedMicDevice");
|
export const { atomInstance: Atom_SelectedMicDevice, useHook: useSelectedMicDevice } = createAsyncAtomWithHook("Nothing Selected", "SelectedMicDevice");
|
||||||
|
|
||||||
|
|
||||||
export const { atomInstance: Atom_SendMessageFormat, useHook: useSendMessageFormat } = createAtomWithHook({
|
export const { atomInstance: Atom_SendMessageFormat, useHook: useSendMessageFormat } = createAtomWithHook({
|
||||||
|
|||||||
Reference in New Issue
Block a user