1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-25 00:11:36 +01:00

!fixup WiFi API update

This commit is contained in:
Aleksandr Gumroian 2024-12-05 09:36:47 +01:00
parent 01d4ae74e4
commit 30fa79b55e
No known key found for this signature in database
GPG Key ID: 9E77849C64F0A733

View File

@ -156,25 +156,25 @@ function DeviceForm({
<RadioSet
name={`band-${deviceID}`}
label="GHz"
label={_("Band")}
choices={getBandChoices(formData)}
value={formData.band}
helpText={HELP_TEXTS.band}
inline
onChange={setFormValue((value) => {
// Get the last item in an array of available HT modes
const [best2] = bnds[0].available_htmodes.slice(-1);
const [best5] = bnds[1].available_htmodes.slice(-1);
// Find the selected band
const selectedBand = bnds.find(
(band) => band.band === value
);
// Get the last item in the available HT modes for the selected band
const bestHtmode =
selectedBand.available_htmodes.slice(-1)[0];
return {
devices: {
[deviceIndex]: {
band: { $set: value },
channel: { $set: "0" },
htmode: {
$set:
// Set HT mode depending on checked frequency
value === "11a" ? best5 : best2,
},
htmode: { $set: bestHtmode },
},
},
};
@ -293,7 +293,7 @@ function getHtmodeChoices(device) {
function getBandChoices(device) {
return device.available_bands.map((availableBand) => ({
label: BANDS[availableBand.band],
label: BANDS[availableBand.band] + _(" GHz"),
value: availableBand.band,
}));
}