mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
eslint
This commit is contained in:
@@ -4,7 +4,13 @@ import { TextValidator, ValidatorForm } from 'react-material-ui-form-validator';
|
||||
import { Checkbox } from '@material-ui/core';
|
||||
import SaveIcon from '@material-ui/icons/Save';
|
||||
|
||||
import { RestFormProps, BlockFormControlLabel, PasswordValidator, FormButton, FormActions } from '../components';
|
||||
import {
|
||||
RestFormProps,
|
||||
BlockFormControlLabel,
|
||||
PasswordValidator,
|
||||
FormButton,
|
||||
FormActions
|
||||
} from '../components';
|
||||
import { isIP, isHostname, or } from '../validators';
|
||||
|
||||
import { OTASettings } from './types';
|
||||
@@ -12,7 +18,6 @@ import { OTASettings } from './types';
|
||||
type OTASettingsFormProps = RestFormProps<OTASettings>;
|
||||
|
||||
class OTASettingsForm extends React.Component<OTASettingsFormProps> {
|
||||
|
||||
componentDidMount() {
|
||||
ValidatorForm.addValidationRule('isIPOrHostname', or(isIP, isHostname));
|
||||
}
|
||||
@@ -25,14 +30,24 @@ class OTASettingsForm extends React.Component<OTASettingsFormProps> {
|
||||
control={
|
||||
<Checkbox
|
||||
checked={data.enabled}
|
||||
onChange={handleValueChange("enabled")}
|
||||
onChange={handleValueChange('enabled')}
|
||||
/>
|
||||
}
|
||||
label="Enable OTA Updates"
|
||||
/>
|
||||
<TextValidator
|
||||
validators={['required', 'isNumber', 'minNumber:1025', 'maxNumber:65535']}
|
||||
errorMessages={['Port is required', "Must be a number", "Must be greater than 1024 ", "Max value is 65535"]}
|
||||
validators={[
|
||||
'required',
|
||||
'isNumber',
|
||||
'minNumber:1025',
|
||||
'maxNumber:65535'
|
||||
]}
|
||||
errorMessages={[
|
||||
'Port is required',
|
||||
'Must be a number',
|
||||
'Must be greater than 1024 ',
|
||||
'Max value is 65535'
|
||||
]}
|
||||
name="port"
|
||||
label="Port"
|
||||
fullWidth
|
||||
@@ -44,7 +59,10 @@ class OTASettingsForm extends React.Component<OTASettingsFormProps> {
|
||||
/>
|
||||
<PasswordValidator
|
||||
validators={['required', 'matchRegexp:^.{1,64}$']}
|
||||
errorMessages={['OTA Password is required', 'OTA Point Password must be 64 characters or less']}
|
||||
errorMessages={[
|
||||
'OTA Password is required',
|
||||
'OTA Point Password must be 64 characters or less'
|
||||
]}
|
||||
name="password"
|
||||
label="Password"
|
||||
fullWidth
|
||||
@@ -54,7 +72,12 @@ class OTASettingsForm extends React.Component<OTASettingsFormProps> {
|
||||
margin="normal"
|
||||
/>
|
||||
<FormActions>
|
||||
<FormButton startIcon={<SaveIcon />} variant="contained" color="primary" type="submit">
|
||||
<FormButton
|
||||
startIcon={<SaveIcon />}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
type="submit"
|
||||
>
|
||||
Save
|
||||
</FormButton>
|
||||
</FormActions>
|
||||
|
||||
Reference in New Issue
Block a user