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
 | 
			
		||||
                        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,
 | 
			
		||||
    }));
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user