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

Compare commits

..

7 Commits

Author SHA1 Message Date
Štěpán Henek
29e7ac4e34 Merge branch 'feature/wifi-API-update' into 'master'
Draft: WiFi API update

See merge request turris/reforis/foris-js!252
2024-12-05 17:48:40 +01:00
Aleksandr Gumroian
605f61bdd6
Update Snapshots 2024-12-05 17:48:19 +01:00
Aleksandr Gumroian
25181db628
Fix tests 2024-12-05 17:48:10 +01:00
Aleksandr Gumroian
10c328f15f
fixup! fixup! !fixup WiFi API update 2024-12-05 17:47:11 +01:00
Stepan Henek
a7f36be30c
fixup! !fixup WiFi API update 2024-12-05 17:46:06 +01:00
Aleksandr Gumroian
30fa79b55e
!fixup WiFi API update 2024-12-05 17:46:06 +01:00
Stepan Henek
01d4ae74e4
WiFi API update
Deprecated option `hwmode=11g/11a` was replaced by `band=2g/5g/6g`
2024-12-05 17:46:06 +01:00
3 changed files with 15 additions and 15 deletions

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,
}));
}

View File

@ -77,7 +77,7 @@ describe("<WiFiSettings/>", () => {
it("Snapshot 2.4 GHz", () => {
fireEvent.click(getByText("Wi-Fi 1"));
const enabledRender = asFragment();
fireEvent.click(getAllByText("2.4")[0]);
fireEvent.click(getAllByText(/2.4/)[0]);
expect(diffSnapshot(enabledRender, asFragment())).toMatchSnapshot();
});
@ -135,7 +135,7 @@ describe("<WiFiSettings/>", () => {
it("Post form: 2.4 GHz", () => {
fireEvent.click(getByText("Wi-Fi 1"));
fireEvent.click(getAllByText("2.4")[0]);
fireEvent.click(getAllByText(/2.4/)[0]);
fireEvent.click(getByText("Save"));
expect(mockAxios.post).toBeCalled();

View File

@ -555,7 +555,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ class="d-block"
+ for="6"
+ >
+ GHz
+ Band
+ </label>
+ <div
+ class="mb-3 form-check form-check-inline"
@ -571,7 +571,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ class="form-check-label"
+ for="band-0-0"
+ >
+ 2.4
+ 2.4 GHz
+ </label>
+ </div>
+ <div
@ -589,7 +589,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ class="form-check-label"
+ for="band-0-1"
+ >
+ 5
+ 5 GHz
+ </label>
+ </div>
+ <div