1
- import React , { Fragment } from 'react' ;
1
+ import React , { Fragment } from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
3
4
4
import { withStyles } from '@material-ui/core/styles' ;
@@ -67,7 +67,7 @@ class WiFiSettingsForm extends React.Component {
67
67
</ ListItemAvatar >
68
68
< ListItemText
69
69
primary = { selectedNetwork . ssid }
70
- secondary = { "Security: " + networkSecurityMode ( selectedNetwork ) + ", Ch: " + selectedNetwork . channel }
70
+ secondary = { "Security: " + networkSecurityMode ( selectedNetwork ) + ", Ch: " + selectedNetwork . channel }
71
71
/>
72
72
< ListItemSecondaryAction >
73
73
< IconButton aria-label = "Manual Config" onClick = { deselectNetwork } >
@@ -84,57 +84,57 @@ class WiFiSettingsForm extends React.Component {
84
84
return (
85
85
< div >
86
86
{
87
- ! wifiSettingsFetched ?
88
-
89
- < div className = { classes . loadingSettings } >
90
- < LinearProgress className = { classes . loadingSettingsDetails } />
91
- < Typography variant = "h4" className = { classes . loadingSettingsDetails } >
92
- Loading...
93
- </ Typography >
94
- </ div >
95
-
96
- : wifiSettings ?
97
-
98
- < ValidatorForm onSubmit = { onSubmit } ref = "WiFiSettingsForm" >
99
- {
100
- selectedNetwork ? this . renderSelectedNetwork ( ) :
101
- < TextValidator
102
- validators = { [ 'required' , 'matchRegexp:^.{0,32}$' ] }
103
- errorMessages = { [ 'SSID is required' , 'SSID must be 32 characeters or less' ] }
104
- name = "ssid"
105
- label = "SSID"
106
- className = { classes . textField }
107
- value = { wifiSettings . ssid }
108
- onChange = { handleValueChange ( 'ssid' ) }
109
- margin = "normal"
110
- />
111
- }
112
- {
113
- ! isNetworkOpen ( selectedNetwork ) &&
114
- < PasswordValidator
115
- validators = { [ 'matchRegexp:^.{0,64}$' ] }
116
- errorMessages = { [ 'Password must be 64 characters or less' ] }
117
- name = "password"
118
- label = "Password"
119
- className = { classes . textField }
120
- value = { wifiSettings . password }
121
- onChange = { handleValueChange ( 'password' ) }
122
- margin = "normal"
123
- />
124
- }
125
-
126
- < TextValidator
127
- validators = { [ 'required' , 'isHostname' ] }
128
- errorMessages = { [ 'Hostname is required' , "Not a valid hostname" ] }
129
- name = "hostname"
130
- label = "Hostname"
87
+ ! wifiSettingsFetched ?
88
+
89
+ < div className = { classes . loadingSettings } >
90
+ < LinearProgress className = { classes . loadingSettingsDetails } />
91
+ < Typography variant = "h4" className = { classes . loadingSettingsDetails } >
92
+ Loading...
93
+ </ Typography >
94
+ </ div >
95
+
96
+ : wifiSettings ?
97
+
98
+ < ValidatorForm onSubmit = { onSubmit } ref = "WiFiSettingsForm" >
99
+ {
100
+ selectedNetwork ? this . renderSelectedNetwork ( ) :
101
+ < TextValidator
102
+ validators = { [ 'required' , 'matchRegexp:^.{1,32}$' ] }
103
+ errorMessages = { [ 'SSID is required' , 'SSID must be 32 characeters or less' ] }
104
+ name = "ssid"
105
+ label = "SSID"
106
+ className = { classes . textField }
107
+ value = { wifiSettings . ssid }
108
+ onChange = { handleValueChange ( 'ssid' ) }
109
+ margin = "normal"
110
+ />
111
+ }
112
+ {
113
+ ! isNetworkOpen ( selectedNetwork ) &&
114
+ < PasswordValidator
115
+ validators = { [ 'matchRegexp:^.{0,64}$' ] }
116
+ errorMessages = { [ 'Password must be 64 characters or less' ] }
117
+ name = "password"
118
+ label = "Password"
131
119
className = { classes . textField }
132
- value = { wifiSettings . hostname }
133
- onChange = { handleValueChange ( 'hostname ' ) }
120
+ value = { wifiSettings . password }
121
+ onChange = { handleValueChange ( 'password ' ) }
134
122
margin = "normal"
135
123
/>
124
+ }
136
125
137
- < FormControlLabel className = { classes . checkboxControl }
126
+ < TextValidator
127
+ validators = { [ 'required' , 'isHostname' ] }
128
+ errorMessages = { [ 'Hostname is required' , "Not a valid hostname" ] }
129
+ name = "hostname"
130
+ label = "Hostname"
131
+ className = { classes . textField }
132
+ value = { wifiSettings . hostname }
133
+ onChange = { handleValueChange ( 'hostname' ) }
134
+ margin = "normal"
135
+ />
136
+
137
+ < FormControlLabel className = { classes . checkboxControl }
138
138
control = {
139
139
< Checkbox
140
140
value = "static_ip_config"
@@ -145,82 +145,82 @@ class WiFiSettingsForm extends React.Component {
145
145
label = "Static IP Config?"
146
146
/>
147
147
148
- {
149
- wifiSettings . static_ip_config &&
150
- < Fragment >
151
- < TextValidator
152
- validators = { [ 'required' , 'isIP' ] }
153
- errorMessages = { [ 'Local IP is required' , 'Must be an IP address' ] }
154
- name = "local_ip"
155
- label = "Local IP"
156
- className = { classes . textField }
157
- value = { wifiSettings . local_ip }
158
- onChange = { handleValueChange ( 'local_ip' ) }
159
- margin = "normal"
160
- />
161
- < TextValidator
162
- validators = { [ 'required' , 'isIP' ] }
163
- errorMessages = { [ 'Gateway IP is required' , 'Must be an IP address' ] }
164
- name = "gateway_ip"
165
- label = "Gateway"
166
- className = { classes . textField }
167
- value = { wifiSettings . gateway_ip }
168
- onChange = { handleValueChange ( 'gateway_ip' ) }
169
- margin = "normal"
170
- />
171
- < TextValidator
172
- validators = { [ 'required' , 'isIP' ] }
173
- errorMessages = { [ 'Subnet mask is required' , 'Must be an IP address' ] }
174
- name = "subnet_mask"
175
- label = "Subnet"
176
- className = { classes . textField }
177
- value = { wifiSettings . subnet_mask }
178
- onChange = { handleValueChange ( 'subnet_mask' ) }
179
- margin = "normal"
180
- />
181
- < TextValidator
182
- validators = { [ 'isOptionalIP' ] }
183
- errorMessages = { [ 'Must be an IP address' ] }
184
- name = "dns_ip_1"
185
- label = "DNS IP #1"
186
- className = { classes . textField }
187
- value = { wifiSettings . dns_ip_1 }
188
- onChange = { handleValueChange ( 'dns_ip_1' ) }
189
- margin = "normal"
190
- />
191
- < TextValidator
192
- validators = { [ 'isOptionalIP' ] }
193
- errorMessages = { [ 'Must be an IP address' ] }
194
- name = "dns_ip_2"
195
- label = "DNS IP #2"
196
- className = { classes . textField }
197
- value = { wifiSettings . dns_ip_2 }
198
- onChange = { handleValueChange ( 'dns_ip_2' ) }
199
- margin = "normal"
200
- />
201
- </ Fragment >
202
- }
148
+ {
149
+ wifiSettings . static_ip_config &&
150
+ < Fragment >
151
+ < TextValidator
152
+ validators = { [ 'required' , 'isIP' ] }
153
+ errorMessages = { [ 'Local IP is required' , 'Must be an IP address' ] }
154
+ name = "local_ip"
155
+ label = "Local IP"
156
+ className = { classes . textField }
157
+ value = { wifiSettings . local_ip }
158
+ onChange = { handleValueChange ( 'local_ip' ) }
159
+ margin = "normal"
160
+ />
161
+ < TextValidator
162
+ validators = { [ 'required' , 'isIP' ] }
163
+ errorMessages = { [ 'Gateway IP is required' , 'Must be an IP address' ] }
164
+ name = "gateway_ip"
165
+ label = "Gateway"
166
+ className = { classes . textField }
167
+ value = { wifiSettings . gateway_ip }
168
+ onChange = { handleValueChange ( 'gateway_ip' ) }
169
+ margin = "normal"
170
+ />
171
+ < TextValidator
172
+ validators = { [ 'required' , 'isIP' ] }
173
+ errorMessages = { [ 'Subnet mask is required' , 'Must be an IP address' ] }
174
+ name = "subnet_mask"
175
+ label = "Subnet"
176
+ className = { classes . textField }
177
+ value = { wifiSettings . subnet_mask }
178
+ onChange = { handleValueChange ( 'subnet_mask' ) }
179
+ margin = "normal"
180
+ />
181
+ < TextValidator
182
+ validators = { [ 'isOptionalIP' ] }
183
+ errorMessages = { [ 'Must be an IP address' ] }
184
+ name = "dns_ip_1"
185
+ label = "DNS IP #1"
186
+ className = { classes . textField }
187
+ value = { wifiSettings . dns_ip_1 }
188
+ onChange = { handleValueChange ( 'dns_ip_1' ) }
189
+ margin = "normal"
190
+ />
191
+ < TextValidator
192
+ validators = { [ 'isOptionalIP' ] }
193
+ errorMessages = { [ 'Must be an IP address' ] }
194
+ name = "dns_ip_2"
195
+ label = "DNS IP #2"
196
+ className = { classes . textField }
197
+ value = { wifiSettings . dns_ip_2 }
198
+ onChange = { handleValueChange ( 'dns_ip_2' ) }
199
+ margin = "normal"
200
+ />
201
+ </ Fragment >
202
+ }
203
203
204
- < Button variant = "contained" color = "primary" className = { classes . button } type = "submit" >
205
- Save
204
+ < Button variant = "contained" color = "primary" className = { classes . button } type = "submit" >
205
+ Save
206
206
</ Button >
207
- < Button variant = "contained" color = "secondary" className = { classes . button } onClick = { onReset } >
208
- Reset
207
+ < Button variant = "contained" color = "secondary" className = { classes . button } onClick = { onReset } >
208
+ Reset
209
209
</ Button >
210
210
211
- </ ValidatorForm >
211
+ </ ValidatorForm >
212
212
213
- :
213
+ :
214
214
215
- < div className = { classes . loadingSettings } >
216
- < Typography variant = "h4" className = { classes . loadingSettingsDetails } >
217
- { errorMessage }
218
- </ Typography >
219
- < Button variant = "contained" color = "secondary" className = { classes . button } onClick = { onReset } >
220
- Reset
215
+ < div className = { classes . loadingSettings } >
216
+ < Typography variant = "h4" className = { classes . loadingSettingsDetails } >
217
+ { errorMessage }
218
+ </ Typography >
219
+ < Button variant = "contained" color = "secondary" className = { classes . button } onClick = { onReset } >
220
+ Reset
221
221
</ Button >
222
- </ div >
223
- }
222
+ </ div >
223
+ }
224
224
</ div >
225
225
) ;
226
226
}
0 commit comments