mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
Merge branch 'dev' of https://github.com/emsesp/EMS-ESP32 into dev2
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
"prettier": "^3.2.5",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"terser": "^5.27.0",
|
||||
"vite": "^5.1.0",
|
||||
"vite": "^5.1.1",
|
||||
"vite-plugin-imagemin": "^0.6.1",
|
||||
"vite-tsconfig-paths": "^4.3.1"
|
||||
},
|
||||
|
||||
@@ -4,7 +4,6 @@ import { ToastContainer, Slide } from 'react-toastify';
|
||||
import 'react-toastify/dist/ReactToastify.min.css';
|
||||
|
||||
import { localStorageDetector } from 'typesafe-i18n/detectors';
|
||||
import { FeaturesLoader } from './contexts/features';
|
||||
import type { FC } from 'react';
|
||||
import AppRouting from 'AppRouting';
|
||||
import CustomTheme from 'CustomTheme';
|
||||
@@ -27,9 +26,7 @@ const App: FC = () => {
|
||||
return (
|
||||
<TypesafeI18n locale={detectedLocale}>
|
||||
<CustomTheme>
|
||||
<FeaturesLoader>
|
||||
<AppRouting />
|
||||
</FeaturesLoader>
|
||||
<AppRouting />
|
||||
<ToastContainer
|
||||
position="bottom-left"
|
||||
autoClose={3000}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { Box, Paper, Typography, MenuItem, TextField, Button } from '@mui/materi
|
||||
import { useRequest } from 'alova';
|
||||
import { useContext, useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { FeaturesContext } from './contexts/features';
|
||||
import type { ValidateFieldsError } from 'async-validator';
|
||||
|
||||
import type { Locales } from 'i18n/i18n-types';
|
||||
@@ -35,8 +34,6 @@ const SignIn: FC = () => {
|
||||
|
||||
const { LL, setLocale, locale } = useContext(I18nContext);
|
||||
|
||||
const { features } = useContext(FeaturesContext);
|
||||
|
||||
const [signInRequest, setSignInRequest] = useState<SignInRequest>({
|
||||
username: '',
|
||||
password: ''
|
||||
@@ -112,7 +109,6 @@ const SignIn: FC = () => {
|
||||
})}
|
||||
>
|
||||
<Typography variant="h4">{PROJECT_NAME}</Typography>
|
||||
<Typography variant="subtitle2">{features.version}</Typography>
|
||||
|
||||
<TextField name="locale" variant="outlined" value={locale} onChange={onLocaleSelected} size="small" select>
|
||||
<MenuItem key="de" value="de">
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import { alovaInstance } from './endpoints';
|
||||
|
||||
import type { Features } from 'types';
|
||||
|
||||
export const readFeatures = () => alovaInstance.Get<Features>('/rest/features');
|
||||
@@ -1,25 +0,0 @@
|
||||
import { useRequest } from 'alova';
|
||||
|
||||
import { FeaturesContext } from '.';
|
||||
import type { FC } from 'react';
|
||||
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
import * as FeaturesApi from 'api/features';
|
||||
|
||||
const FeaturesLoader: FC<RequiredChildrenProps> = (props) => {
|
||||
const { data: features } = useRequest(FeaturesApi.readFeatures);
|
||||
|
||||
if (features) {
|
||||
return (
|
||||
<FeaturesContext.Provider
|
||||
value={{
|
||||
features
|
||||
}}
|
||||
>
|
||||
{props.children}
|
||||
</FeaturesContext.Provider>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default FeaturesLoader;
|
||||
@@ -1,10 +0,0 @@
|
||||
import { createContext } from 'react';
|
||||
|
||||
import type { Features } from 'types';
|
||||
|
||||
export interface FeaturesContextValue {
|
||||
features: Features;
|
||||
}
|
||||
|
||||
const FeaturesContextDefaultValue = {} as FeaturesContextValue;
|
||||
export const FeaturesContext = createContext(FeaturesContextDefaultValue);
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './context';
|
||||
export { default as FeaturesLoader } from './FeaturesLoader';
|
||||
@@ -29,7 +29,6 @@ import {
|
||||
import { useRequest } from 'alova';
|
||||
import { useContext, useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { FeaturesContext } from '../../contexts/features';
|
||||
import RestartMonitor from './RestartMonitor';
|
||||
import SystemStatusVersionDialog from './SystemStatusVersionDialog';
|
||||
import type { FC } from 'react';
|
||||
@@ -54,8 +53,6 @@ const SystemStatusForm: FC = () => {
|
||||
const [restarting, setRestarting] = useState<boolean>();
|
||||
const [versionDialogOpen, setVersionDialogOpen] = useState<boolean>(false);
|
||||
|
||||
const { features } = useContext(FeaturesContext);
|
||||
|
||||
const { send: restartCommand } = useRequest(SystemApi.restart(), {
|
||||
immediate: false
|
||||
});
|
||||
@@ -215,7 +212,7 @@ const SystemStatusForm: FC = () => {
|
||||
<DevicesIcon />
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="SDK" secondary={data.arduino_version + ' / ESP-IDF v' + data.sdk_version} />
|
||||
<ListItemText primary="SDK" secondary={data.arduino_version + ' / ESP-IDF ' + data.sdk_version} />
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
<ListItem>
|
||||
@@ -355,7 +352,7 @@ const SystemStatusForm: FC = () => {
|
||||
open={versionDialogOpen}
|
||||
onClose={() => setVersionDialogOpen(false)}
|
||||
version={data.emsesp_version}
|
||||
platform={features.platform}
|
||||
platform={data.esp_platform}
|
||||
/>
|
||||
)}
|
||||
</SectionContent>
|
||||
|
||||
@@ -94,8 +94,14 @@ const DashboardDevices: FC = () => {
|
||||
}, []);
|
||||
|
||||
const leftOffset = () => {
|
||||
const left = document.getElementById('devices-window')?.getBoundingClientRect().left;
|
||||
const right = document.getElementById('devices-window')?.getBoundingClientRect().right;
|
||||
const devicesWindow = document.getElementById('devices-window');
|
||||
if (!devicesWindow) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const clientRect = devicesWindow.getBoundingClientRect();
|
||||
const left = clientRect.left;
|
||||
const right = clientRect.right;
|
||||
|
||||
if (!left || !right) {
|
||||
return 0;
|
||||
@@ -416,11 +422,11 @@ const DashboardDevices: FC = () => {
|
||||
const renderCoreData = () => (
|
||||
<IconContext.Provider value={{ color: 'lightblue', size: '24', style: { verticalAlign: 'middle' } }}>
|
||||
{!coreData.connected && <MessageBox my={2} level="error" message={LL.EMS_BUS_WARNING()} />}
|
||||
{coreData.connected && coreData.devices.length === 0 && (
|
||||
{/* {coreData.connected && coreData.devices.length === 0 && (
|
||||
<MessageBox my={2} level="warning" message={LL.EMS_BUS_SCANNING()} />
|
||||
)}
|
||||
)} */}
|
||||
|
||||
{coreData.devices.length !== 0 && (
|
||||
{coreData.connected && (
|
||||
<Table data={{ nodes: coreData.devices }} select={device_select} theme={device_theme} layout={{ custom: true }}>
|
||||
{(tableList: any) => (
|
||||
<>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export * from './ap';
|
||||
export * from './features';
|
||||
export * from './me';
|
||||
export * from './mqtt';
|
||||
export * from './ntp';
|
||||
|
||||
@@ -1895,7 +1895,7 @@ __metadata:
|
||||
terser: "npm:^5.27.0"
|
||||
typesafe-i18n: "npm:^5.26.2"
|
||||
typescript: "npm:^5.3.3"
|
||||
vite: "npm:^5.1.0"
|
||||
vite: "npm:^5.1.1"
|
||||
vite-plugin-imagemin: "npm:^0.6.1"
|
||||
vite-tsconfig-paths: "npm:^4.3.1"
|
||||
languageName: unknown
|
||||
@@ -8793,9 +8793,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"vite@npm:^5.1.0":
|
||||
version: 5.1.0
|
||||
resolution: "vite@npm:5.1.0"
|
||||
"vite@npm:^5.1.1":
|
||||
version: 5.1.1
|
||||
resolution: "vite@npm:5.1.1"
|
||||
dependencies:
|
||||
esbuild: "npm:^0.19.3"
|
||||
fsevents: "npm:~2.3.3"
|
||||
@@ -8829,7 +8829,7 @@ __metadata:
|
||||
optional: true
|
||||
bin:
|
||||
vite: bin/vite.js
|
||||
checksum: 10/14d136f2e71d657cb55bec2a9330951e27e572ed79c4e79e3edc24decfa87f95664b8206614bfcf6a61db933667e554a8eed389291ad8af49de0784548a83a4c
|
||||
checksum: 10/bdb8e683caddaa0a9adcbf40144ca8ea3660836b208862b07d43787ea867845919af16e58745365bd13ed3b7f66bbf9788a6869ee22cfaacac01645b59729c34
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user