mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
minor optimizations
This commit is contained in:
@@ -88,7 +88,6 @@ export default function ProgmemGenerator({ outputPath = './WWWData.h', bytesPerL
|
|||||||
};
|
};
|
||||||
|
|
||||||
const generateWWWClass = () =>
|
const generateWWWClass = () =>
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
`typedef std::function<void(const String& uri, const String& contentType, const uint8_t * content, size_t len)> RouteRegistrationHandler;
|
`typedef std::function<void(const String& uri, const String& contentType, const uint8_t * content, size_t len)> RouteRegistrationHandler;
|
||||||
|
|
||||||
class WWWData {
|
class WWWData {
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ const APSettingsForm: FC = () => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => loadData()}
|
onClick={loadData}
|
||||||
>
|
>
|
||||||
{LL.CANCEL()}
|
{LL.CANCEL()}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ const MqttSettingsForm: FC = () => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => loadData()}
|
onClick={loadData}
|
||||||
>
|
>
|
||||||
{LL.CANCEL()}
|
{LL.CANCEL()}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ const WiFiSettingsForm: FC = () => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => loadData()}
|
onClick={loadData}
|
||||||
>
|
>
|
||||||
{LL.CANCEL()}
|
{LL.CANCEL()}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ const NTPSettingsForm: FC = () => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => loadData()}
|
onClick={loadData}
|
||||||
>
|
>
|
||||||
{LL.CANCEL()}
|
{LL.CANCEL()}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ const SecuritySettingsForm: FC = () => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => loadData()}
|
onClick={loadData}
|
||||||
>
|
>
|
||||||
{LL.CANCEL()}
|
{LL.CANCEL()}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
|
|||||||
{LL.DOWNLOAD_SETTINGS_TEXT()}
|
{LL.DOWNLOAD_SETTINGS_TEXT()}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={() => downloadSettings()}>
|
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={downloadSettings}>
|
||||||
{LL.SETTINGS_OF('')}
|
{LL.SETTINGS_OF('')}
|
||||||
</Button>
|
</Button>
|
||||||
<Box color="warning.main">
|
<Box color="warning.main">
|
||||||
@@ -124,12 +124,7 @@ const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
|
|||||||
{LL.DOWNLOAD_CUSTOMIZATION_TEXT()}{' '}
|
{LL.DOWNLOAD_CUSTOMIZATION_TEXT()}{' '}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Button
|
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={downloadCustomizations}>
|
||||||
startIcon={<DownloadIcon />}
|
|
||||||
variant="outlined"
|
|
||||||
color="primary"
|
|
||||||
onClick={() => downloadCustomizations()}
|
|
||||||
>
|
|
||||||
{LL.CUSTOMIZATIONS()}
|
{LL.CUSTOMIZATIONS()}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
@@ -137,7 +132,7 @@ const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
|
|||||||
startIcon={<DownloadIcon />}
|
startIcon={<DownloadIcon />}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={() => downloadEntities()}
|
onClick={downloadEntities}
|
||||||
>
|
>
|
||||||
{LL.CUSTOM_ENTITIES(0)}
|
{LL.CUSTOM_ENTITIES(0)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -146,7 +141,7 @@ const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
|
|||||||
{LL.DOWNLOAD_SCHEDULE_TEXT()}{' '}
|
{LL.DOWNLOAD_SCHEDULE_TEXT()}{' '}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={() => downloadSchedule()}>
|
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={downloadSchedule}>
|
||||||
{LL.SCHEDULE(0)}
|
{LL.SCHEDULE(0)}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ const OTASettingsForm: FC = () => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => loadData()}
|
onClick={loadData}
|
||||||
>
|
>
|
||||||
{LL.CANCEL()}
|
{LL.CANCEL()}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ const DashboardDevices: FC = () => {
|
|||||||
return () => {
|
return () => {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line
|
|
||||||
}, [analog, sensor, deviceValue, sensorData]);
|
}, [analog, sensor, deviceValue, sensorData]);
|
||||||
|
|
||||||
const isCmdOnly = (dv: DeviceValue) => dv.v === '' && dv.c;
|
const isCmdOnly = (dv: DeviceValue) => dv.v === '' && dv.c;
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ const DashboardSensors: FC = () => {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<ButtonRow>
|
<ButtonRow>
|
||||||
<Box display="flex" flexWrap="wrap">
|
<Box mt={2} display="flex" flexWrap="wrap">
|
||||||
<Box flexGrow={1}>
|
<Box flexGrow={1}>
|
||||||
<Button startIcon={<RefreshIcon />} variant="outlined" color="secondary" onClick={fetchSensorData}>
|
<Button startIcon={<RefreshIcon />} variant="outlined" color="secondary" onClick={fetchSensorData}>
|
||||||
{LL.REFRESH()}
|
{LL.REFRESH()}
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ const DashboardStatus: FC = () => {
|
|||||||
return () => {
|
return () => {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const showName = (id: any) => {
|
const showName = (id: any) => {
|
||||||
|
|||||||
@@ -643,7 +643,7 @@ const SettingsApplication: FC = () => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => loadData()}
|
onClick={loadData}
|
||||||
>
|
>
|
||||||
{LL.CANCEL()}
|
{LL.CANCEL()}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ const SettingsCustomization: FC = () => {
|
|||||||
startIcon={<WarningIcon color="warning" />}
|
startIcon={<WarningIcon color="warning" />}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="info"
|
color="info"
|
||||||
onClick={() => saveCustomization()}
|
onClick={saveCustomization}
|
||||||
>
|
>
|
||||||
{LL.APPLY_CHANGES(numChanges)}
|
{LL.APPLY_CHANGES(numChanges)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ const SettingsEntities: FC = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
void fetchEntities();
|
void fetchEntities();
|
||||||
}, [fetchEntities]);
|
}, []);
|
||||||
|
|
||||||
const saveEntities = async () => {
|
const saveEntities = async () => {
|
||||||
if (entities) {
|
if (entities) {
|
||||||
@@ -270,14 +270,14 @@ const SettingsEntities: FC = () => {
|
|||||||
<Box flexGrow={1}>
|
<Box flexGrow={1}>
|
||||||
{numChanges > 0 && (
|
{numChanges > 0 && (
|
||||||
<ButtonRow>
|
<ButtonRow>
|
||||||
<Button startIcon={<CancelIcon />} variant="outlined" onClick={() => fetchEntities()} color="secondary">
|
<Button startIcon={<CancelIcon />} variant="outlined" onClick={fetchEntities} color="secondary">
|
||||||
{LL.CANCEL()}
|
{LL.CANCEL()}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
startIcon={<WarningIcon color="warning" />}
|
startIcon={<WarningIcon color="warning" />}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="info"
|
color="info"
|
||||||
onClick={() => saveEntities()}
|
onClick={saveEntities}
|
||||||
>
|
>
|
||||||
{LL.APPLY_CHANGES(numChanges)}
|
{LL.APPLY_CHANGES(numChanges)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -286,7 +286,7 @@ const SettingsEntities: FC = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
<Box flexWrap="nowrap" whiteSpace="nowrap">
|
<Box flexWrap="nowrap" whiteSpace="nowrap">
|
||||||
<ButtonRow>
|
<ButtonRow>
|
||||||
<Button startIcon={<AddIcon />} variant="outlined" color="secondary" onClick={() => addEntityItem()}>
|
<Button startIcon={<AddIcon />} variant="outlined" color="secondary" onClick={addEntityItem}>
|
||||||
{LL.ADD(0)}
|
{LL.ADD(0)}
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonRow>
|
</ButtonRow>
|
||||||
|
|||||||
@@ -280,14 +280,14 @@ const SettingsScheduler: FC = () => {
|
|||||||
<Box flexGrow={1}>
|
<Box flexGrow={1}>
|
||||||
{numChanges !== 0 && (
|
{numChanges !== 0 && (
|
||||||
<ButtonRow>
|
<ButtonRow>
|
||||||
<Button startIcon={<CancelIcon />} variant="outlined" onClick={() => fetchSchedule()} color="secondary">
|
<Button startIcon={<CancelIcon />} variant="outlined" onClick={fetchSchedule} color="secondary">
|
||||||
{LL.CANCEL()}
|
{LL.CANCEL()}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
startIcon={<WarningIcon color="warning" />}
|
startIcon={<WarningIcon color="warning" />}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="info"
|
color="info"
|
||||||
onClick={() => saveSchedule()}
|
onClick={saveSchedule}
|
||||||
>
|
>
|
||||||
{LL.APPLY_CHANGES(numChanges)}
|
{LL.APPLY_CHANGES(numChanges)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -296,7 +296,7 @@ const SettingsScheduler: FC = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
<Box flexWrap="nowrap" whiteSpace="nowrap">
|
<Box flexWrap="nowrap" whiteSpace="nowrap">
|
||||||
<ButtonRow>
|
<ButtonRow>
|
||||||
<Button startIcon={<AddIcon />} variant="outlined" color="secondary" onClick={() => addScheduleItem()}>
|
<Button startIcon={<AddIcon />} variant="outlined" color="secondary" onClick={addScheduleItem}>
|
||||||
{LL.ADD(0)}
|
{LL.ADD(0)}
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonRow>
|
</ButtonRow>
|
||||||
|
|||||||
Reference in New Issue
Block a user