11import React , { Fragment } from 'react' ;
2- import { TextValidator , ValidatorForm , SelectValidator } from 'react-material-ui-form-validator' ;
2+ import { TextValidator , ValidatorForm } from 'react-material-ui-form-validator' ;
3+ import { range } from 'lodash' ;
34
45import MenuItem from '@material-ui/core/MenuItem' ;
6+ import Checkbox from '@material-ui/core/Checkbox' ;
57import SaveIcon from '@material-ui/icons/Save' ;
68
7- import { PasswordValidator , RestFormProps , FormActions , FormButton } from '../components' ;
9+ import { PasswordValidator , RestFormProps , FormActions , FormButton , BlockFormControlLabel } from '../components' ;
810
911import { isAPEnabled } from './APModes' ;
1012import { APSettings , APProvisionMode } from './types' ;
1113import { isIP } from '../validators' ;
14+ import { TextField } from '@material-ui/core' ;
1215
1316type APSettingsFormProps = RestFormProps < APSettings > ;
1417
@@ -22,17 +25,18 @@ class APSettingsForm extends React.Component<APSettingsFormProps> {
2225 const { data, handleValueChange, saveData } = this . props ;
2326 return (
2427 < ValidatorForm onSubmit = { saveData } ref = "APSettingsForm" >
25- < SelectValidator name = "provision_mode"
28+ < TextField name = "provision_mode"
2629 label = "Provide Access Point…"
2730 value = { data . provision_mode }
2831 fullWidth
32+ select
2933 variant = "outlined"
3034 onChange = { handleValueChange ( 'provision_mode' ) }
3135 margin = "normal" >
3236 < MenuItem value = { APProvisionMode . AP_MODE_ALWAYS } > Always</ MenuItem >
3337 < MenuItem value = { APProvisionMode . AP_MODE_DISCONNECTED } > When WiFi Disconnected</ MenuItem >
3438 < MenuItem value = { APProvisionMode . AP_NEVER } > Never</ MenuItem >
35- </ SelectValidator >
39+ </ TextField >
3640 {
3741 isAPEnabled ( data ) &&
3842 < Fragment >
@@ -58,6 +62,43 @@ class APSettingsForm extends React.Component<APSettingsFormProps> {
5862 onChange = { handleValueChange ( 'password' ) }
5963 margin = "normal"
6064 />
65+ < TextField name = "channel"
66+ label = "Preferred Channel"
67+ value = { data . channel }
68+ fullWidth
69+ select
70+ type = "number"
71+ variant = "outlined"
72+ onChange = { handleValueChange ( 'channel' ) }
73+ margin = "normal" >
74+ {
75+ range ( 1 , 14 ) . map ( i => < MenuItem value = { i } > { i } </ MenuItem > )
76+ }
77+ </ TextField >
78+ < BlockFormControlLabel
79+ control = {
80+ < Checkbox
81+ value = "ssid_hidden"
82+ checked = { data . ssid_hidden }
83+ onChange = { handleValueChange ( "ssid_hidden" ) }
84+ />
85+ }
86+ label = "Hide SSID?"
87+ />
88+ < TextField name = "max_clients"
89+ label = "Max Clients"
90+ value = { data . max_clients }
91+ fullWidth
92+ select
93+ type = "number"
94+ variant = "outlined"
95+ onChange = { handleValueChange ( 'max_clients' ) }
96+ margin = "normal"
97+ >
98+ {
99+ range ( 1 , 9 ) . map ( i => < MenuItem value = { i } > { i } </ MenuItem > )
100+ }
101+ </ TextField >
61102 < TextValidator
62103 validators = { [ 'required' , 'isIP' ] }
63104 errorMessages = { [ 'Local IP is required' , 'Must be an IP address' ] }
0 commit comments