foris 6.12.0 → 6.13.0-beta.6d71f397

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,7 +44,7 @@ export default function WiFiForm({
44
44
  }) {
45
45
  return formData.devices.map((device, index) => (
46
46
  <DeviceForm
47
- key={device.id}
47
+ key={device.device_name}
48
48
  formData={device}
49
49
  deviceIndex={index}
50
50
  formErrors={(formErrors || [])[index]}
@@ -58,7 +58,7 @@ export default function WiFiForm({
58
58
 
59
59
  DeviceForm.propTypes = {
60
60
  formData: PropTypes.shape({
61
- id: PropTypes.number.isRequired,
61
+ device_name: PropTypes.string.isRequired,
62
62
  enabled: PropTypes.bool.isRequired,
63
63
  SSID: PropTypes.string.isRequired,
64
64
  password: PropTypes.string.isRequired,
@@ -92,13 +92,14 @@ function DeviceForm({
92
92
  divider,
93
93
  ...props
94
94
  }) {
95
- const deviceID = formData.id;
96
95
  const bnds = formData.available_bands;
97
96
 
98
97
  return (
99
98
  <>
100
99
  <Switch
101
- label={<h2 className="mb-0">{_(`Wi-Fi ${deviceID + 1}`)}</h2>}
100
+ label={
101
+ <h2 className="mb-0">{_(`Wi-Fi ${deviceIndex + 1}`)}</h2>
102
+ }
102
103
  checked={formData.enabled}
103
104
  onChange={setFormValue((value) => ({
104
105
  devices: {
@@ -159,7 +160,7 @@ function DeviceForm({
159
160
  />
160
161
 
161
162
  <RadioSet
162
- name={`band-${deviceID}`}
163
+ name={`band-${deviceIndex}`}
163
164
  label={_("Band")}
164
165
  choices={getBandChoices(formData)}
165
166
  value={formData.band}
@@ -268,10 +269,8 @@ function DeviceForm({
268
269
 
269
270
  {hasGuestNetwork && (
270
271
  <WifiGuestForm
271
- formData={{
272
- id: deviceIndex,
273
- ...formData.guest_wifi,
274
- }}
272
+ formData={formData.guest_wifi}
273
+ deviceIndex={deviceIndex}
275
274
  formErrors={formErrors.guest_wifi || {}}
276
275
  band={formData.band}
277
276
  setFormValue={setFormValue}
@@ -19,7 +19,6 @@ import TextInput from "../../bootstrap/TextInput";
19
19
 
20
20
  WifiGuestForm.propTypes = {
21
21
  formData: PropTypes.shape({
22
- id: PropTypes.number.isRequired,
23
22
  SSID: PropTypes.string.isRequired,
24
23
  password: PropTypes.string.isRequired,
25
24
  enabled: PropTypes.bool.isRequired,
@@ -30,7 +29,8 @@ WifiGuestForm.propTypes = {
30
29
  password: PropTypes.string,
31
30
  }),
32
31
  setFormValue: PropTypes.func.isRequired,
33
- deviceIndex: PropTypes.string,
32
+ /** Position of the device in array */
33
+ deviceIndex: PropTypes.number.isRequired,
34
34
  /** Band of the device the guest network shares the radio with. */
35
35
  band: PropTypes.string,
36
36
  };
@@ -51,7 +51,7 @@ export default function WifiGuestForm({
51
51
  helpText={HELP_TEXTS.guest_wifi_enabled}
52
52
  onChange={setFormValue((value) => ({
53
53
  devices: {
54
- [formData.id]: {
54
+ [deviceIndex]: {
55
55
  guest_wifi: { enabled: { $set: value } },
56
56
  },
57
57
  },
@@ -67,7 +67,7 @@ export default function WifiGuestForm({
67
67
  helpText={HELP_TEXTS.ssid}
68
68
  onChange={setFormValue((value) => ({
69
69
  devices: {
70
- [formData.id]: {
70
+ [deviceIndex]: {
71
71
  guest_wifi: { SSID: { $set: value } },
72
72
  },
73
73
  },
@@ -88,7 +88,7 @@ export default function WifiGuestForm({
88
88
  required
89
89
  onChange={setFormValue((value) => ({
90
90
  devices: {
91
- [formData.id]: {
91
+ [deviceIndex]: {
92
92
  guest_wifi: { password: { $set: value } },
93
93
  },
94
94
  },
@@ -105,7 +105,7 @@ export default function WifiGuestForm({
105
105
  value={formData.encryption}
106
106
  onChange={setFormValue((value) => ({
107
107
  devices: {
108
- [formData.id]: {
108
+ [deviceIndex]: {
109
109
  guest_wifi: { encryption: { $set: value } },
110
110
  },
111
111
  },
@@ -71,7 +71,10 @@ function prepDataToSubmit(formData) {
71
71
  formData.devices[idx].channel = parseInt(device.channel);
72
72
 
73
73
  if (!device.enabled) {
74
- formData.devices[idx] = { id: device.id, enabled: false };
74
+ formData.devices[idx] = {
75
+ device_name: device.device_name,
76
+ enabled: false,
77
+ };
75
78
  return;
76
79
  }
77
80
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foris",
3
- "version": "6.12.0",
3
+ "version": "6.13.0-beta.6d71f397",
4
4
  "description": "Foris JS library is a set of components and utils for reForis application and plugins.",
5
5
  "author": "CZ.NIC, z.s.p.o.",
6
6
  "repository": {
package/foris-6.12.0.tgz DELETED
Binary file