Skip to content

Commit

Permalink
GUI Improvement: when server device host api changed, auto select none
Browse files Browse the repository at this point in the history
  • Loading branch information
w-okada committed Jul 4, 2023
1 parent e07300f commit 1449a71
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/demo/dist/index.js

Large diffs are not rendered by default.

31 changes: 27 additions & 4 deletions client/demo/src/components/demo/components2/102-3_DeviceArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ export const DeviceArea = (_props: DeviceAreaProps) => {
);
})
.filter((x) => x != null);
const currentValue = devices.find((x) => {
return (x.hostAPI == inputHostApi || inputHostApi == "ALL") && x.index == serverSetting.serverSetting.serverInputDeviceId;
})
? serverSetting.serverSetting.serverInputDeviceId
: -1;

return (
<div className="config-sub-area-control">
Expand All @@ -176,12 +181,15 @@ export const DeviceArea = (_props: DeviceAreaProps) => {
</select>
<select
className="config-sub-area-control-field-auido-io-select"
value={serverSetting.serverSetting.serverInputDeviceId}
value={currentValue}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, serverInputDeviceId: Number(e.target.value) });
}}
>
{filteredDevice}
<option value="-1" key="none">
none
</option>
</select>
</div>
</div>
Expand Down Expand Up @@ -390,6 +398,12 @@ export const DeviceArea = (_props: DeviceAreaProps) => {
})
.filter((x) => x != null);

const currentValue = devices.find((x) => {
return (x.hostAPI == outputHostApi || outputHostApi == "ALL") && x.index == serverSetting.serverSetting.serverOutputDeviceId;
})
? serverSetting.serverSetting.serverOutputDeviceId
: -1;

return (
<div className="config-sub-area-control">
<div className="config-sub-area-control-title left-padding-1">output</div>
Expand All @@ -411,12 +425,15 @@ export const DeviceArea = (_props: DeviceAreaProps) => {
</select>
<select
className="config-sub-area-control-field-auido-io-select"
value={serverSetting.serverSetting.serverOutputDeviceId}
value={currentValue}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, serverOutputDeviceId: Number(e.target.value) });
}}
>
{filteredDevice}
<option value="-1" key="none">
none
</option>
</select>
</div>
</div>
Expand Down Expand Up @@ -523,10 +540,16 @@ export const DeviceArea = (_props: DeviceAreaProps) => {
.filter((x) => x != null);
filteredDevice.unshift(
<option value={-1} key={-1}>
None
none
</option>
);

const currentValue = devices.find((x) => {
return (x.hostAPI == monitorHostApi || monitorHostApi == "ALL") && x.index == serverSetting.serverSetting.serverMonitorDeviceId;
})
? serverSetting.serverSetting.serverMonitorDeviceId
: -1;

return (
<div className="config-sub-area-control">
<div className="config-sub-area-control-title left-padding-1">monitor</div>
Expand All @@ -548,7 +571,7 @@ export const DeviceArea = (_props: DeviceAreaProps) => {
</select>
<select
className="config-sub-area-control-field-auido-io-select"
value={serverSetting.serverSetting.serverMonitorDeviceId}
value={currentValue}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, serverMonitorDeviceId: Number(e.target.value) });
}}
Expand Down

0 comments on commit 1449a71

Please sign in to comment.