mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	!fixup WiFi API update
This commit is contained in:
		@@ -156,25 +156,25 @@ function DeviceForm({
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    <RadioSet
 | 
					                    <RadioSet
 | 
				
			||||||
                        name={`band-${deviceID}`}
 | 
					                        name={`band-${deviceID}`}
 | 
				
			||||||
                        label="GHz"
 | 
					                        label={_("Band")}
 | 
				
			||||||
                        choices={getBandChoices(formData)}
 | 
					                        choices={getBandChoices(formData)}
 | 
				
			||||||
                        value={formData.band}
 | 
					                        value={formData.band}
 | 
				
			||||||
                        helpText={HELP_TEXTS.band}
 | 
					                        helpText={HELP_TEXTS.band}
 | 
				
			||||||
                        inline
 | 
					                        inline
 | 
				
			||||||
                        onChange={setFormValue((value) => {
 | 
					                        onChange={setFormValue((value) => {
 | 
				
			||||||
                            // Get the last item in an array of available HT modes
 | 
					                            // Find the selected band
 | 
				
			||||||
                            const [best2] = bnds[0].available_htmodes.slice(-1);
 | 
					                            const selectedBand = bnds.find(
 | 
				
			||||||
                            const [best5] = bnds[1].available_htmodes.slice(-1);
 | 
					                                (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 {
 | 
					                            return {
 | 
				
			||||||
                                devices: {
 | 
					                                devices: {
 | 
				
			||||||
                                    [deviceIndex]: {
 | 
					                                    [deviceIndex]: {
 | 
				
			||||||
                                        band: { $set: value },
 | 
					                                        band: { $set: value },
 | 
				
			||||||
                                        channel: { $set: "0" },
 | 
					                                        channel: { $set: "0" },
 | 
				
			||||||
                                        htmode: {
 | 
					                                        htmode: { $set: bestHtmode },
 | 
				
			||||||
                                            $set:
 | 
					 | 
				
			||||||
                                                // Set HT mode depending on checked frequency
 | 
					 | 
				
			||||||
                                                value === "11a" ? best5 : best2,
 | 
					 | 
				
			||||||
                                        },
 | 
					 | 
				
			||||||
                                    },
 | 
					                                    },
 | 
				
			||||||
                                },
 | 
					                                },
 | 
				
			||||||
                            };
 | 
					                            };
 | 
				
			||||||
@@ -293,7 +293,7 @@ function getHtmodeChoices(device) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function getBandChoices(device) {
 | 
					function getBandChoices(device) {
 | 
				
			||||||
    return device.available_bands.map((availableBand) => ({
 | 
					    return device.available_bands.map((availableBand) => ({
 | 
				
			||||||
        label: BANDS[availableBand.band],
 | 
					        label: BANDS[availableBand.band] + _(" GHz"),
 | 
				
			||||||
        value: availableBand.band,
 | 
					        value: availableBand.band,
 | 
				
			||||||
    }));
 | 
					    }));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user