mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
Merge remote-tracking branch 'origin/dev' for 3.6.5
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"airbnb/hooks",
|
||||
"airbnb-typescript",
|
||||
// "airbnb/hooks",
|
||||
// "airbnb-typescript",
|
||||
"plugin:react/recommended",
|
||||
"plugin:react/jsx-runtime",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4,4 +4,4 @@ enableGlobalCache: false
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.0.2.cjs
|
||||
yarnPath: .yarn/releases/yarn-4.1.1.cjs
|
||||
|
||||
@@ -12,28 +12,30 @@
|
||||
"preview": "vite preview",
|
||||
"build-hosted": "typesafe-i18n --no-watch && vite build --mode hosted",
|
||||
"preview-standalone": "typesafe-i18n --no-watch && vite build && concurrently -c \"auto\" \"npm:mock-api\" \"vite preview\"",
|
||||
"mock-api": "node --watch ../mock-api ../mock-api/server.js",
|
||||
"mock-api": "bun --watch ../mock-api/server.ts",
|
||||
"old_mock-api": "bun --watch ../mock-api/server.js",
|
||||
"standalone": "concurrently -c \"auto\" \"typesafe-i18n\" \"npm:mock-api\" \"vite\"",
|
||||
"old_standalone": "concurrently -c \"auto\" \"typesafe-i18n\" \"npm:old_mock-api\" \"vite\"",
|
||||
"typesafe-i18n": "typesafe-i18n --no-watch",
|
||||
"webUI": "node progmem-generator.js",
|
||||
"format": "prettier --write '**/*.{ts,tsx,js,css,json,md}'",
|
||||
"lint": "eslint . --cache --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alova/adapter-xhr": "^1.0.1",
|
||||
"@babel/core": "^7.23.3",
|
||||
"@emotion/react": "^11.11.1",
|
||||
"@alova/adapter-xhr": "^1.0.3",
|
||||
"@babel/core": "^7.24.3",
|
||||
"@emotion/react": "^11.11.4",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@mui/icons-material": "^5.14.18",
|
||||
"@mui/material": "^5.14.18",
|
||||
"@mui/icons-material": "^5.15.14",
|
||||
"@mui/material": "^5.15.14",
|
||||
"@table-library/react-table-library": "4.1.7",
|
||||
"@types/imagemin": "^8.0.5",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^20.10.0",
|
||||
"@types/react": "^18.2.38",
|
||||
"@types/react-dom": "^18.2.17",
|
||||
"@types/node": "^20.11.30",
|
||||
"@types/react": "^18.2.69",
|
||||
"@types/react-dom": "^18.2.22",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"alova": "^2.14.0",
|
||||
"alova": "^2.18.0",
|
||||
"async-validator": "^4.2.5",
|
||||
"history": "^5.3.0",
|
||||
"jwt-decode": "^4.0.0",
|
||||
@@ -42,37 +44,35 @@
|
||||
"react": "latest",
|
||||
"react-dom": "latest",
|
||||
"react-dropzone": "^14.2.3",
|
||||
"react-icons": "^4.12.0",
|
||||
"react-router-dom": "^6.20.0",
|
||||
"react-toastify": "^9.1.3",
|
||||
"react-icons": "^5.0.1",
|
||||
"react-router-dom": "^6.22.3",
|
||||
"react-toastify": "^10.0.5",
|
||||
"sockette": "^2.0.6",
|
||||
"typesafe-i18n": "^5.26.2",
|
||||
"typescript": "^5.3.2"
|
||||
"typescript": "^5.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@preact/compat": "^17.1.2",
|
||||
"@preact/preset-vite": "^2.7.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
||||
"@typescript-eslint/parser": "^6.12.0",
|
||||
"@preact/preset-vite": "^2.8.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||
"@typescript-eslint/parser": "^7.3.1",
|
||||
"concurrently": "^8.2.2",
|
||||
"eslint": "^8.54.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-autofix": "^1.1.0",
|
||||
"eslint-plugin-import": "^2.29.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||
"eslint-plugin-prettier": "alpha",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"eslint-plugin-react": "^7.34.1",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"preact": "^10.19.2",
|
||||
"prettier": "^3.1.0",
|
||||
"rollup-plugin-visualizer": "^5.9.3",
|
||||
"terser": "^5.24.0",
|
||||
"vite": "^5.0.2",
|
||||
"preact": "^10.20.1",
|
||||
"prettier": "^3.2.5",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"terser": "^5.29.2",
|
||||
"vite": "^5.2.4",
|
||||
"vite-plugin-imagemin": "^0.6.1",
|
||||
"vite-tsconfig-paths": "^4.2.1"
|
||||
"vite-tsconfig-paths": "^4.3.2"
|
||||
},
|
||||
"packageManager": "yarn@4.0.2"
|
||||
"packageManager": "yarn@4.1.1"
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { readdirSync, existsSync, unlinkSync, readFileSync, createWriteStream }
|
||||
import { resolve, relative, sep } from 'path';
|
||||
import zlib from 'zlib';
|
||||
import mime from 'mime-types';
|
||||
import crypto from 'crypto';
|
||||
|
||||
const ARDUINO_INCLUDES = '#include <Arduino.h>\n\n';
|
||||
const INDENT = ' ';
|
||||
@@ -11,13 +12,17 @@ const bytesPerLine = 20;
|
||||
var totalSize = 0;
|
||||
|
||||
const generateWWWClass = () =>
|
||||
`typedef std::function<void(const String& uri, const String& contentType, const uint8_t * content, size_t len)> RouteRegistrationHandler;
|
||||
`typedef std::function<void(const char * uri, const String & contentType, const uint8_t * content, size_t len, const String & hash)> RouteRegistrationHandler;
|
||||
// Total size is ${totalSize} bytes
|
||||
|
||||
class WWWData {
|
||||
${indent}public:
|
||||
${indent.repeat(2)}static void registerRoutes(RouteRegistrationHandler handler) {
|
||||
${fileInfo
|
||||
.map((file) => `${indent.repeat(3)}handler("${file.uri}", "${file.mimeType}", ${file.variable}, ${file.size});`)
|
||||
.map(
|
||||
(file) =>
|
||||
`${indent.repeat(3)}handler("${file.uri}", "${file.mimeType}", ${file.variable}, ${file.size}, "${file.hash}");`
|
||||
)
|
||||
.join('\n')}
|
||||
${indent.repeat(2)}}
|
||||
};
|
||||
@@ -49,6 +54,12 @@ const writeFile = (relativeFilePath, buffer) => {
|
||||
writeStream.write('const uint8_t ' + variable + '[] = {');
|
||||
// const zipBuffer = zlib.brotliCompressSync(buffer, { quality: 1 });
|
||||
const zipBuffer = zlib.gzipSync(buffer, { level: 9 });
|
||||
|
||||
// create sha
|
||||
const hashSum = crypto.createHash('sha256');
|
||||
hashSum.update(zipBuffer);
|
||||
const hash = hashSum.digest('hex');
|
||||
|
||||
zipBuffer.forEach((b) => {
|
||||
if (!(size % bytesPerLine)) {
|
||||
writeStream.write('\n');
|
||||
@@ -57,15 +68,19 @@ const writeFile = (relativeFilePath, buffer) => {
|
||||
writeStream.write('0x' + ('00' + b.toString(16).toUpperCase()).slice(-2) + ',');
|
||||
size++;
|
||||
});
|
||||
|
||||
if (size % bytesPerLine) {
|
||||
writeStream.write('\n');
|
||||
}
|
||||
|
||||
writeStream.write('};\n\n');
|
||||
|
||||
fileInfo.push({
|
||||
uri: '/' + relativeFilePath.replace(sep, '/'),
|
||||
mimeType,
|
||||
variable,
|
||||
size
|
||||
size,
|
||||
hash
|
||||
});
|
||||
|
||||
// console.log(relativeFilePath + ' (size ' + size + ' bytes)');
|
||||
|
||||
Binary file not shown.
@@ -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';
|
||||
@@ -22,6 +21,7 @@ import ITflag from 'i18n/IT.svg';
|
||||
import NLflag from 'i18n/NL.svg';
|
||||
import NOflag from 'i18n/NO.svg';
|
||||
import PLflag from 'i18n/PL.svg';
|
||||
import SKflag from 'i18n/SK.svg';
|
||||
import SVflag from 'i18n/SV.svg';
|
||||
import TRflag from 'i18n/TR.svg';
|
||||
import { I18nContext } from 'i18n/i18n-react';
|
||||
@@ -34,8 +34,6 @@ const SignIn: FC = () => {
|
||||
|
||||
const { LL, setLocale, locale } = useContext(I18nContext);
|
||||
|
||||
const { features } = useContext(FeaturesContext);
|
||||
|
||||
const [signInRequest, setSignInRequest] = useState<SignInRequest>({
|
||||
username: '',
|
||||
password: ''
|
||||
@@ -111,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">
|
||||
@@ -142,6 +139,10 @@ const SignIn: FC = () => {
|
||||
<img src={PLflag} style={{ width: 16, verticalAlign: 'middle' }} />
|
||||
PL
|
||||
</MenuItem>
|
||||
<MenuItem key="sk" value="sk">
|
||||
<img src={SKflag} style={{ width: 16, verticalAlign: 'middle' }} />
|
||||
SK
|
||||
</MenuItem>
|
||||
<MenuItem key="sv" value="sv">
|
||||
<img src={SVflag} style={{ width: 16, verticalAlign: 'middle' }} />
|
||||
SV
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import { alovaInstance } from './endpoints';
|
||||
|
||||
import type { Features } from 'types';
|
||||
|
||||
export const readFeatures = () => alovaInstance.Get<Features>('/rest/features');
|
||||
@@ -14,11 +14,9 @@ import {
|
||||
} from '@mui/material';
|
||||
import { useState, useContext } from 'react';
|
||||
import type { TypographyProps } from '@mui/material';
|
||||
|
||||
import type { Locales } from 'i18n/i18n-types';
|
||||
import type { FC, ChangeEventHandler } from 'react';
|
||||
import { AuthenticatedContext } from 'contexts/authentication';
|
||||
|
||||
import DEflag from 'i18n/DE.svg';
|
||||
import FRflag from 'i18n/FR.svg';
|
||||
import GBflag from 'i18n/GB.svg';
|
||||
@@ -26,8 +24,10 @@ import ITflag from 'i18n/IT.svg';
|
||||
import NLflag from 'i18n/NL.svg';
|
||||
import NOflag from 'i18n/NO.svg';
|
||||
import PLflag from 'i18n/PL.svg';
|
||||
import SKflag from 'i18n/SK.svg';
|
||||
import SVflag from 'i18n/SV.svg';
|
||||
import TRflag from 'i18n/TR.svg';
|
||||
|
||||
import { I18nContext } from 'i18n/i18n-react';
|
||||
import { loadLocaleAsync } from 'i18n/i18n-util.async';
|
||||
|
||||
@@ -102,6 +102,10 @@ const LayoutAuthMenu: FC = () => {
|
||||
<img src={PLflag} style={{ width: 16, verticalAlign: 'middle' }} />
|
||||
PL
|
||||
</MenuItem>
|
||||
<MenuItem key="sk" value="sk">
|
||||
<img src={SKflag} style={{ width: 16, verticalAlign: 'middle' }} />
|
||||
SK
|
||||
</MenuItem>
|
||||
<MenuItem key="sv" value="sv">
|
||||
<img src={SVflag} style={{ width: 16, verticalAlign: 'middle' }} />
|
||||
SV
|
||||
|
||||
@@ -14,7 +14,7 @@ const RouterTabs: FC<RouterTabsProps> = ({ value, children }) => {
|
||||
const theme = useTheme();
|
||||
const smallDown = useMediaQuery(theme.breakpoints.down('sm'));
|
||||
|
||||
const handleTabChange = (event: React.ChangeEvent<HTMLInputElement>, path: string) => {
|
||||
const handleTabChange = (_event: any, path: string) => {
|
||||
navigate(path);
|
||||
};
|
||||
|
||||
|
||||
@@ -4,5 +4,9 @@ export const useRouterTab = () => {
|
||||
const loc = useLocation().pathname;
|
||||
const routerTab = loc.substring(0, loc.lastIndexOf('/')) ? loc : false;
|
||||
|
||||
// const routerTabPath = useResolvedPath(':tab');
|
||||
// const routerTabPathMatch = useMatch(routerTabPath.pathname);
|
||||
// const routerTab = routerTabPathMatch?.params?.tab || false;
|
||||
|
||||
return { routerTab } as const;
|
||||
};
|
||||
|
||||
@@ -50,8 +50,10 @@ const SingleUpload: FC<SingleUploadProps> = ({ onDrop, onCancel, isUploading, pr
|
||||
|
||||
const progressText = () => {
|
||||
if (uploading) {
|
||||
if (progress.total) {
|
||||
return LL.UPLOADING() + ': ' + Math.round((progress.loaded * 100) / progress.total) + '%';
|
||||
if (progress.total && progress.loaded) {
|
||||
return progress.loaded <= progress.total
|
||||
? LL.UPLOADING() + ': ' + Math.round((progress.loaded * 100) / progress.total) + '%'
|
||||
: LL.UPLOADING() + ': ' + Math.round((progress.total * 100) / progress.loaded) + '%';
|
||||
}
|
||||
}
|
||||
return LL.UPLOAD_DROP_TEXT();
|
||||
@@ -83,7 +85,13 @@ const SingleUpload: FC<SingleUploadProps> = ({ onDrop, onCancel, isUploading, pr
|
||||
<Box width="100%" p={2}>
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={progress.total === 0 ? 0 : Math.round((progress.loaded * 100) / progress.total)}
|
||||
value={
|
||||
progress.total === 0 || progress.loaded === 0
|
||||
? 0
|
||||
: progress.loaded <= progress.total
|
||||
? Math.round((progress.loaded * 100) / progress.total)
|
||||
: Math.round((progress.total * 100) / progress.loaded)
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
<Button startIcon={<CancelIcon />} variant="outlined" color="secondary" onClick={onCancel}>
|
||||
|
||||
@@ -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';
|
||||
@@ -72,6 +72,7 @@ const MqttSettingsForm: FC = () => {
|
||||
name="host"
|
||||
label={LL.ADDRESS_OF(LL.BROKER())}
|
||||
fullWidth
|
||||
multiline
|
||||
variant="outlined"
|
||||
value={data.host}
|
||||
onChange={updateFormValue}
|
||||
@@ -168,20 +169,24 @@ const MqttSettingsForm: FC = () => {
|
||||
<MenuItem value={2}>2</MenuItem>
|
||||
</TextField>
|
||||
</Grid>
|
||||
{data.rootCA !== undefined && (
|
||||
<Grid item xs={12} sm={6}>
|
||||
<ValidatedPasswordField
|
||||
name="rootCA"
|
||||
label={LL.CERT()}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
value={data.rootCA}
|
||||
onChange={updateFormValue}
|
||||
margin="normal"
|
||||
/>
|
||||
</Grid>
|
||||
)}
|
||||
</Grid>
|
||||
{data.enableTLS !== undefined && (
|
||||
<BlockFormControlLabel
|
||||
control={<Checkbox name="enableTLS" checked={data.enableTLS} onChange={updateFormValue} />}
|
||||
label={LL.ENABLE_TLS()}
|
||||
/>
|
||||
)}
|
||||
{data.enableTLS === true && (
|
||||
<ValidatedPasswordField
|
||||
name="rootCA"
|
||||
label={LL.CERT()}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
value={data.rootCA}
|
||||
onChange={updateFormValue}
|
||||
margin="normal"
|
||||
/>
|
||||
)}
|
||||
|
||||
<BlockFormControlLabel
|
||||
control={<Checkbox name="clean_session" checked={data.clean_session} onChange={updateFormValue} />}
|
||||
@@ -269,6 +274,7 @@ const MqttSettingsForm: FC = () => {
|
||||
>
|
||||
<MenuItem value={0}>Home Assistant</MenuItem>
|
||||
<MenuItem value={1}>Domoticz</MenuItem>
|
||||
<MenuItem value={2}>Domoticz (latest)</MenuItem>
|
||||
</TextField>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6} md={4}>
|
||||
|
||||
@@ -15,8 +15,8 @@ import {
|
||||
ListItemSecondaryAction,
|
||||
ListItemText,
|
||||
Typography,
|
||||
InputAdornment,
|
||||
TextField
|
||||
TextField,
|
||||
MenuItem
|
||||
} from '@mui/material';
|
||||
// eslint-disable-next-line import/named
|
||||
import { updateState, useRequest } from 'alova';
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
} from 'components';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
import { numberValue, updateValueDirty, useRest } from 'utils';
|
||||
import { updateValueDirty, useRest } from 'utils';
|
||||
|
||||
import { validate } from 'validators';
|
||||
import { createNetworkSettingsValidator } from 'validators/network';
|
||||
@@ -88,7 +88,7 @@ const WiFiSettingsForm: FC = () => {
|
||||
static_ip_config: false,
|
||||
enableIPv6: false,
|
||||
bandwidth20: false,
|
||||
tx_power: 20,
|
||||
tx_power: 0,
|
||||
nosleep: false,
|
||||
enableMDNS: true,
|
||||
enableCORS: false,
|
||||
@@ -196,20 +196,29 @@ const WiFiSettingsForm: FC = () => {
|
||||
margin="normal"
|
||||
/>
|
||||
)}
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
<TextField
|
||||
name="tx_power"
|
||||
label={LL.TX_POWER()}
|
||||
InputProps={{
|
||||
endAdornment: <InputAdornment position="end">dBm</InputAdornment>
|
||||
}}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
value={numberValue(data.tx_power)}
|
||||
value={data.tx_power}
|
||||
onChange={updateFormValue}
|
||||
type="number"
|
||||
margin="normal"
|
||||
/>
|
||||
select
|
||||
>
|
||||
<MenuItem value={0}>Auto</MenuItem>
|
||||
<MenuItem value={78}>19.5 dBm</MenuItem>
|
||||
<MenuItem value={76}>19 dBm</MenuItem>
|
||||
<MenuItem value={74}>18.5 dBm</MenuItem>
|
||||
<MenuItem value={68}>17 dBm</MenuItem>
|
||||
<MenuItem value={60}>15 dBm</MenuItem>
|
||||
<MenuItem value={52}>13 dBm</MenuItem>
|
||||
<MenuItem value={44}>11 dBm</MenuItem>
|
||||
<MenuItem value={34}>8.5 dBm</MenuItem>
|
||||
<MenuItem value={28}>7 dBm</MenuItem>
|
||||
<MenuItem value={20}>5 dBm</MenuItem>
|
||||
<MenuItem value={8}>2 dBm</MenuItem>
|
||||
</TextField>
|
||||
<BlockFormControlLabel
|
||||
control={<Checkbox name="nosleep" checked={data.nosleep} onChange={updateFormValue} />}
|
||||
label={LL.NETWORK_DISABLE_SLEEP()}
|
||||
@@ -250,10 +259,12 @@ const WiFiSettingsForm: FC = () => {
|
||||
margin="normal"
|
||||
/>
|
||||
)}
|
||||
<BlockFormControlLabel
|
||||
control={<Checkbox name="enableIPv6" checked={data.enableIPv6} onChange={updateFormValue} />}
|
||||
label={LL.NETWORK_ENABLE_IPV6()}
|
||||
/>
|
||||
{data.enableIPv6 !== undefined && (
|
||||
<BlockFormControlLabel
|
||||
control={<Checkbox name="enableIPv6" checked={data.enableIPv6} onChange={updateFormValue} />}
|
||||
label={LL.NETWORK_ENABLE_IPV6()}
|
||||
/>
|
||||
)}
|
||||
<BlockFormControlLabel
|
||||
control={<Checkbox name="static_ip_config" checked={data.static_ip_config} onChange={updateFormValue} />}
|
||||
label={LL.NETWORK_FIXED_IP()}
|
||||
@@ -313,7 +324,7 @@ const WiFiSettingsForm: FC = () => {
|
||||
</>
|
||||
)}
|
||||
{restartNeeded && (
|
||||
<MessageBox my={2} level="warning" message={LL.RESTART_TEXT()}>
|
||||
<MessageBox my={2} level="warning" message={LL.RESTART_TEXT(0)}>
|
||||
<Button startIcon={<PowerSettingsNewIcon />} variant="contained" color="error" onClick={restart}>
|
||||
{LL.RESTART()}
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import DeviceHubIcon from '@mui/icons-material/DeviceHub';
|
||||
import DnsIcon from '@mui/icons-material/Dns';
|
||||
import GiteIcon from '@mui/icons-material/Gite';
|
||||
import RefreshIcon from '@mui/icons-material/Refresh';
|
||||
import RouterIcon from '@mui/icons-material/Router';
|
||||
import SettingsInputAntennaIcon from '@mui/icons-material/SettingsInputAntenna';
|
||||
@@ -115,6 +116,15 @@ const NetworkStatusForm: FC = () => {
|
||||
<ListItemText primary="Status" secondary={networkStatus(data)} />
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar sx={{ bgcolor: networkStatusHighlight(data, theme) }}>
|
||||
<GiteIcon />
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="Hostname" secondary={data.hostname} />
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
{isWiFi(data) && (
|
||||
<>
|
||||
<ListItem>
|
||||
|
||||
@@ -37,7 +37,8 @@ const GenerateToken: FC<GenerateTokenProps> = ({ username, onClose }) => {
|
||||
if (open) {
|
||||
void generateToken();
|
||||
}
|
||||
}, [open, generateToken]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [open]);
|
||||
|
||||
return (
|
||||
<Dialog sx={dialogStyle} onClose={onClose} open={!!username} fullWidth maxWidth="sm">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import AppsIcon from '@mui/icons-material/Apps';
|
||||
import BuildIcon from '@mui/icons-material/Build';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import DeveloperBoardIcon from '@mui/icons-material/DeveloperBoard';
|
||||
import DevicesIcon from '@mui/icons-material/Devices';
|
||||
import FolderIcon from '@mui/icons-material/Folder';
|
||||
import MemoryIcon from '@mui/icons-material/Memory';
|
||||
@@ -9,7 +10,6 @@ import RefreshIcon from '@mui/icons-material/Refresh';
|
||||
import SdCardAlertIcon from '@mui/icons-material/SdCardAlert';
|
||||
import SdStorageIcon from '@mui/icons-material/SdStorage';
|
||||
import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore';
|
||||
import ShowChartIcon from '@mui/icons-material/ShowChart';
|
||||
import TimerIcon from '@mui/icons-material/Timer';
|
||||
import {
|
||||
Avatar,
|
||||
@@ -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
|
||||
});
|
||||
@@ -200,15 +197,6 @@ const SystemStatusForm: FC = () => {
|
||||
</Button>
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<DevicesIcon />
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary={LL.PLATFORM()} secondary={data.esp_platform + ' / ' + data.sdk_version} />
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
@@ -221,10 +209,33 @@ const SystemStatusForm: FC = () => {
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<ShowChartIcon />
|
||||
<DevicesIcon />
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary={LL.CPU_FREQ()} secondary={data.cpu_freq_mhz + ' MHz'} />
|
||||
<ListItemText primary="SDK" secondary={data.arduino_version + ' / ESP-IDF ' + data.sdk_version} />
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<DeveloperBoardIcon />
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText
|
||||
primary="CPU"
|
||||
secondary={
|
||||
data.esp_platform +
|
||||
'/' +
|
||||
data.cpu_type +
|
||||
' (rev.' +
|
||||
data.cpu_rev +
|
||||
', ' +
|
||||
(data.cpu_cores == 1 ? 'single-core)' : 'dual-core)') +
|
||||
' @ ' +
|
||||
data.cpu_freq_mhz +
|
||||
' Mhz'
|
||||
}
|
||||
/>
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
<ListItem>
|
||||
@@ -277,7 +288,9 @@ const SystemStatusForm: FC = () => {
|
||||
</ListItemAvatar>
|
||||
<ListItemText
|
||||
primary={LL.APPSIZE()}
|
||||
secondary={formatNumber(data.app_used) + ' KB / ' + formatNumber(data.app_free) + ' KB'}
|
||||
secondary={
|
||||
data.partition + ': ' + formatNumber(data.app_used) + ' KB / ' + formatNumber(data.app_free) + ' KB'
|
||||
}
|
||||
/>
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
@@ -339,7 +352,7 @@ const SystemStatusForm: FC = () => {
|
||||
open={versionDialogOpen}
|
||||
onClose={() => setVersionDialogOpen(false)}
|
||||
version={data.emsesp_version}
|
||||
platform={features.platform}
|
||||
platform={data.esp_platform}
|
||||
/>
|
||||
)}
|
||||
</SectionContent>
|
||||
|
||||
@@ -19,7 +19,7 @@ const UploadFileForm: FC = () => {
|
||||
const { send: getSettings, onSuccess: onSuccessGetSettings } = useRequest(EMSESP.getSettings(), {
|
||||
immediate: false
|
||||
});
|
||||
const { send: getCustomizations, onSuccess: onSuccessgetCustomizations } = useRequest(EMSESP.getCustomizations(), {
|
||||
const { send: getCustomizations, onSuccess: onSuccessGetCustomizations } = useRequest(EMSESP.getCustomizations(), {
|
||||
immediate: false
|
||||
});
|
||||
const { send: getEntities, onSuccess: onSuccessGetEntities } = useRequest(EMSESP.getEntities(), {
|
||||
@@ -28,7 +28,7 @@ const UploadFileForm: FC = () => {
|
||||
const { send: getSchedule, onSuccess: onSuccessGetSchedule } = useRequest(EMSESP.getSchedule(), {
|
||||
immediate: false
|
||||
});
|
||||
const { send: getInfo, onSuccess: onSuccessGetInfo } = useRequest((data) => EMSESP.API(data), {
|
||||
const { send: getAPI, onSuccess: onGetAPI } = useRequest((data) => EMSESP.API(data), {
|
||||
immediate: false
|
||||
});
|
||||
|
||||
@@ -71,26 +71,26 @@ const UploadFileForm: FC = () => {
|
||||
type: 'text/plain'
|
||||
})
|
||||
);
|
||||
anchor.download = 'emsesp_' + endpoint + '.json';
|
||||
anchor.download = 'emsesp_' + endpoint;
|
||||
anchor.click();
|
||||
URL.revokeObjectURL(anchor.href);
|
||||
toast.info(LL.DOWNLOAD_SUCCESSFUL());
|
||||
};
|
||||
|
||||
onSuccessGetSettings((event) => {
|
||||
saveFile(event.data, 'settings');
|
||||
saveFile(event.data, 'settings.json');
|
||||
});
|
||||
onSuccessgetCustomizations((event) => {
|
||||
saveFile(event.data, 'customizations');
|
||||
onSuccessGetCustomizations((event) => {
|
||||
saveFile(event.data, 'customizations.json');
|
||||
});
|
||||
onSuccessGetEntities((event) => {
|
||||
saveFile(event.data, 'entities');
|
||||
saveFile(event.data, 'entities.json');
|
||||
});
|
||||
onSuccessGetSchedule((event) => {
|
||||
saveFile(event.data, 'schedule');
|
||||
saveFile(event.data, 'schedule.json');
|
||||
});
|
||||
onSuccessGetInfo((event) => {
|
||||
saveFile(event.data, 'info');
|
||||
onGetAPI((event) => {
|
||||
saveFile(event.data, event.sendArgs[0].device + '_' + event.sendArgs[0].entity + '.txt');
|
||||
});
|
||||
|
||||
const downloadSettings = async () => {
|
||||
@@ -112,13 +112,17 @@ const UploadFileForm: FC = () => {
|
||||
};
|
||||
|
||||
const downloadSchedule = async () => {
|
||||
await getSchedule().catch((error) => {
|
||||
toast.error(error.message);
|
||||
});
|
||||
await getSchedule()
|
||||
.catch((error) => {
|
||||
toast.error(error.message);
|
||||
})
|
||||
.finally(() => {
|
||||
toast.info(LL.DOWNLOAD_SUCCESSFUL());
|
||||
});
|
||||
};
|
||||
|
||||
const downloadInfo = async () => {
|
||||
await getInfo({ device: 'system', entity: 'info', id: 0 }).catch((error) => {
|
||||
const callAPI = async (device: string, entity: string) => {
|
||||
await getAPI({ device, entity, id: 0 }).catch((error) => {
|
||||
toast.error(error.message);
|
||||
});
|
||||
};
|
||||
@@ -132,7 +136,8 @@ const UploadFileForm: FC = () => {
|
||||
<Typography variant="body2">
|
||||
{LL.UPLOAD_TEXT()}
|
||||
<br />
|
||||
{LL.RESTART_TEXT()}.
|
||||
<br />
|
||||
{LL.RESTART_TEXT(1)}.
|
||||
</Typography>
|
||||
</Box>
|
||||
{md5 && (
|
||||
@@ -143,8 +148,34 @@ const UploadFileForm: FC = () => {
|
||||
<SingleUpload onDrop={startUpload} onCancel={cancelUpload} isUploading={isUploading} progress={progress} />
|
||||
{!isUploading && (
|
||||
<>
|
||||
<Typography sx={{ pt: 2, pb: 2 }} variant="h6" color="primary">
|
||||
{LL.DOWNLOAD(0)}
|
||||
<Typography sx={{ pt: 4, pb: 2 }} variant="h6" color="primary">
|
||||
{LL.DOWNLOAD(0)} {LL.SUPPORT_INFORMATION(1)}
|
||||
</Typography>
|
||||
<Box color="warning.main">
|
||||
<Typography mb={1} variant="body2">
|
||||
{LL.HELP_INFORMATION_4()}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Button
|
||||
startIcon={<DownloadIcon />}
|
||||
variant="outlined"
|
||||
color="primary"
|
||||
onClick={() => callAPI('system', 'info')}
|
||||
>
|
||||
{LL.SUPPORT_INFORMATION(0)}
|
||||
</Button>
|
||||
<Button
|
||||
sx={{ ml: 2 }}
|
||||
startIcon={<DownloadIcon />}
|
||||
variant="outlined"
|
||||
color="primary"
|
||||
onClick={() => callAPI('system', 'allvalues')}
|
||||
>
|
||||
All Values
|
||||
</Button>
|
||||
|
||||
<Typography sx={{ pt: 4, pb: 2 }} variant="h6" color="primary">
|
||||
{LL.DOWNLOAD(0)} {LL.SETTINGS(1)}
|
||||
</Typography>
|
||||
<Box color="warning.main">
|
||||
<Typography mb={1} variant="body2">
|
||||
@@ -179,14 +210,6 @@ const UploadFileForm: FC = () => {
|
||||
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={downloadSchedule}>
|
||||
{LL.SCHEDULE(0)}
|
||||
</Button>
|
||||
<Box color="warning.main">
|
||||
<Typography mt={2} mb={1} variant="body2">
|
||||
{LL.DOWNLOAD(0)} {LL.SUPPORT_INFORMATION()}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={downloadInfo}>
|
||||
{LL.SUPPORT_INFORMATION()}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
1
interface/src/i18n/SK.svg
Normal file
1
interface/src/i18n/SK.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFF" d="M0 85.337h512v341.326H0z"/><path fill="#0052B4" d="M0 196.641h512v118.717H0z"/><path fill="#D80027" d="M0 315.359h512v111.304H0z"/><path fill="#FFF" d="M129.468 181.799v85.136c0 48.429 63.267 63.267 63.267 63.267S256 315.362 256 266.935v-85.136H129.468z"/><path fill="#D80027" d="M146.126 184.294v81.941c0 5.472 1.215 10.64 3.623 15.485h85.97c2.408-4.844 3.623-10.012 3.623-15.485v-81.941h-93.216z"/><path fill="#FFF" d="M221.301 241.427h-21.425v-14.283h14.284v-14.283h-14.284v-14.284h-14.283v14.284h-14.282v14.283h14.282v14.283h-21.426v14.284h21.426v14.283h14.283v-14.283h21.425z"/><path fill="#0052B4" d="M169.232 301.658c9.204 5.783 18.66 9.143 23.502 10.636 4.842-1.494 14.298-4.852 23.502-10.636 9.282-5.833 15.79-12.506 19.484-19.939a24.878 24.878 0 0 0-14.418-4.583c-1.956 0-3.856.232-5.682.657-3.871-8.796-12.658-14.94-22.884-14.94-10.227 0-19.013 6.144-22.884 14.94a25.048 25.048 0 0 0-5.682-.657 24.88 24.88 0 0 0-14.418 4.583c3.691 7.433 10.198 14.106 19.48 19.939z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -191,16 +191,14 @@ const de: Translation = {
|
||||
THE_LATEST: 'Die neueste',
|
||||
OFFICIAL: 'offizielle',
|
||||
DEVELOPMENT: 'Entwicklungs',
|
||||
RELEASE_IS: 'release ist', // TODO translate
|
||||
RELEASE_IS: 'Release ist',
|
||||
RELEASE_NOTES: 'Versionshinweise',
|
||||
EMS_ESP_VER: 'EMS-ESP Version',
|
||||
PLATFORM: 'Platform (Platform / SDK)',
|
||||
UPTIME: 'System Betriebszeit',
|
||||
CPU_FREQ: 'CPU Frequenz',
|
||||
HEAP: 'freier RAM Speicher (Gesamt / max. Block)',
|
||||
PSRAM: 'PSRAM (Größe / Frei)',
|
||||
FLASH: 'Flash Speicher (Größe / Geschwindigkeit)',
|
||||
APPSIZE: 'Programm (Genutzt / Frei)',
|
||||
APPSIZE: 'Programm (Partition: Genutzt / Frei)',
|
||||
FILESYSTEM: 'Dateisystem (Genutzt / Frei)',
|
||||
BUFFER_SIZE: 'max. Puffergröße',
|
||||
COMPACT: 'Kompakte Darstellung',
|
||||
@@ -230,7 +228,7 @@ const de: Translation = {
|
||||
BROKER: 'Broker',
|
||||
CLIENT: 'Client',
|
||||
BASE_TOPIC: 'Base',
|
||||
OPTIONAL: 'Optional', // TODO translate
|
||||
OPTIONAL: 'Optional',
|
||||
FORMATTING: 'Formattierung',
|
||||
MQTT_FORMAT: 'Topic/Payload Format',
|
||||
MQTT_NEST_1: 'Eingebettet in einem Gesamttopic',
|
||||
@@ -309,7 +307,7 @@ const de: Translation = {
|
||||
LEAVE: 'Verlassen',
|
||||
SCHEDULER: 'Planer',
|
||||
SCHEDULER_HELP_1: 'Fügen Sie eigene, geplante Befehle zur Automatisierung hinzu. Vergeben Sie einen Entitätsnamen um die Aktivierung über API/Mqtt zu steuern',
|
||||
SCHEDULER_HELP_2: 'Use 00:00 to trigger once on start-up', // TODO translate
|
||||
SCHEDULER_HELP_2: '00:00 aktiviert einmalige Ausführung am Start',
|
||||
SCHEDULE: 'Zeitplan',
|
||||
TIME: 'Zeit',
|
||||
TIMER: 'Timer',
|
||||
@@ -318,12 +316,13 @@ const de: Translation = {
|
||||
SCHEDULE_TIMER_2: 'jede Minute',
|
||||
SCHEDULE_TIMER_3: 'jede Stunde',
|
||||
CUSTOM_ENTITIES: 'Individuelle Entitäten',
|
||||
ENTITIES_HELP_1: 'Abfrage von Werten auf dem EMS-Bus',
|
||||
ENTITIES_HELP_1: 'Definition eigener EMS-Werte oder dynamischer Variablen',
|
||||
ENTITIES_UPDATED: 'Entitäten gespeichert',
|
||||
WRITEABLE: 'Schreibbar',
|
||||
SHOWING: 'Anzeigen von',
|
||||
SEARCH: 'Suche',
|
||||
CERT: 'TLS Zertifikat (Freilassen um TLS zu deaktivieren)',
|
||||
CERT: 'TLS Zertifikat (Freilassen für unsichere Verbindung)',
|
||||
ENABLE_TLS: 'Aktiviere TLS',
|
||||
ON: 'An',
|
||||
OFF: 'Aus',
|
||||
POLARITY: 'Polarität',
|
||||
|
||||
@@ -63,7 +63,7 @@ const en: Translation = {
|
||||
FREQ: 'Frequency',
|
||||
DUTY_CYCLE: 'Duty Cycle',
|
||||
UNIT: 'UoM',
|
||||
STARTVALUE: 'Start value',
|
||||
STARTVALUE: 'Start Value',
|
||||
WARN_GPIO: 'Warning: be careful when assigning a GPIO!',
|
||||
EDIT: 'Edit',
|
||||
SENSOR: 'Sensor',
|
||||
@@ -169,7 +169,7 @@ const en: Translation = {
|
||||
HELP_INFORMATION_1: 'Visit the online wiki to get instructions on how to configure EMS-ESP',
|
||||
HELP_INFORMATION_2: 'For live community chat join our Discord server',
|
||||
HELP_INFORMATION_3: 'To request a feature or report a bug',
|
||||
HELP_INFORMATION_4: 'remember to download and attach your system information for a faster response when reporting an issue',
|
||||
HELP_INFORMATION_4: 'Remember to download and attach your support information for a faster response when reporting an issue',
|
||||
HELP_INFORMATION_5: 'EMS-ESP is a free and open-source project. Please support its future development by giving it a star on Github!',
|
||||
UPLOAD: 'Upload',
|
||||
DOWNLOAD: '{{D|d|d}}ownload',
|
||||
@@ -196,11 +196,10 @@ const en: Translation = {
|
||||
EMS_ESP_VER: 'EMS-ESP Version',
|
||||
PLATFORM: 'Device (Platform / SDK)',
|
||||
UPTIME: 'System Uptime',
|
||||
CPU_FREQ: 'CPU Frequency',
|
||||
HEAP: 'Heap (Free / Max Alloc)',
|
||||
PSRAM: 'PSRAM (Size / Free)',
|
||||
FLASH: 'Flash Chip (Size / Speed)',
|
||||
APPSIZE: 'Application (Used / Free)',
|
||||
APPSIZE: 'Application (Partition: Used / Free)',
|
||||
FILESYSTEM: 'File System (Used / Free)',
|
||||
BUFFER_SIZE: 'Max Buffer Size',
|
||||
COMPACT: 'Compact',
|
||||
@@ -318,12 +317,13 @@ const en: Translation = {
|
||||
SCHEDULE_TIMER_2: 'every minute',
|
||||
SCHEDULE_TIMER_3: 'every hour',
|
||||
CUSTOM_ENTITIES: 'Custom Entities',
|
||||
ENTITIES_HELP_1: 'Fetch custom entities from the EMS bus',
|
||||
ENTITIES_HELP_1: 'Define custom EMS entities or dynamic user variables',
|
||||
ENTITIES_UPDATED: 'Entities Updated',
|
||||
WRITEABLE: 'Writeable',
|
||||
SHOWING: 'Showing',
|
||||
SEARCH: 'Search',
|
||||
CERT: 'TLS root certificate (leave blank to disable TLS)',
|
||||
CERT: 'TLS root certificate (leave blank for insecure)',
|
||||
ENABLE_TLS: 'Enable TLS',
|
||||
ON: 'On',
|
||||
OFF: 'Off',
|
||||
POLARITY: 'Polarity',
|
||||
|
||||
@@ -169,7 +169,7 @@ const fr: Translation = {
|
||||
HELP_INFORMATION_1: 'Visitez le wiki en ligne pour obtenir des instructions sur la façon de configurer EMS-ESP.',
|
||||
HELP_INFORMATION_2: 'Pour une discussion en direct avec la communauté, rejoignez notre serveur Discord',
|
||||
HELP_INFORMATION_3: 'Pour demander une fonctionnalité ou signaler un problème',
|
||||
HELP_INFORMATION_4: 'n\'oubliez pas de télécharger et de joindre les informations relatives à votre système pour obtenir une réponse plus rapide lorsque vous signalez un problème',
|
||||
HELP_INFORMATION_4: 'N\'oubliez pas de télécharger et de joindre les informations relatives à votre système pour obtenir une réponse plus rapide lorsque vous signalez un problème',
|
||||
HELP_INFORMATION_5: 'EMS-ESP est un projet libre et open-source. Merci de soutenir son développement futur en lui donnant une étoile sur Github !',
|
||||
UPLOAD: 'Upload',
|
||||
DOWNLOAD: '{{D|d|d}}ownload',
|
||||
@@ -194,13 +194,11 @@ const fr: Translation = {
|
||||
RELEASE_IS: 'release est', // TODO translate
|
||||
RELEASE_NOTES: 'notes de version',
|
||||
EMS_ESP_VER: 'Version EMS-ESP',
|
||||
PLATFORM: 'Appareil (Plateforme / SDK)',
|
||||
UPTIME: 'Durée de fonctionnement du système',
|
||||
CPU_FREQ: 'Fréquence du CPU',
|
||||
HEAP: 'Heap (Libre / Max Allouée)',
|
||||
PSRAM: 'PSRAM (Taille / Libre)',
|
||||
FLASH: 'Flash Chip (Taille / Vitesse)',
|
||||
APPSIZE: 'Application (Utilisée / Libre)',
|
||||
APPSIZE: 'Application (Partition: Utilisée / Libre)',
|
||||
FILESYSTEM: 'File System (Utilisée / Libre)',
|
||||
BUFFER_SIZE: 'Max taille du buffer',
|
||||
COMPACT: 'Compact',
|
||||
@@ -323,7 +321,8 @@ const fr: Translation = {
|
||||
WRITEABLE: 'Writeable', // TODO translate
|
||||
SHOWING: 'Showing', // TODO translate
|
||||
SEARCH: 'Search', // TODO translate
|
||||
CERT: 'TLS root certificate (leave blank to disable TLS)', // TODO translate
|
||||
CERT: 'TLS root certificate (leave blank for insecure)', // TODO translate
|
||||
ENABLE_TLS: 'Activer TLS',
|
||||
ON: 'On', // TODO translate
|
||||
OFF: 'Off', // TODO translate
|
||||
POLARITY: 'Polarity', // TODO translate
|
||||
|
||||
@@ -171,7 +171,7 @@ const it: Translation = {
|
||||
HELP_INFORMATION_1: 'Visita il wiki online per ottenere istruzioni su come configurare EMS-ESP',
|
||||
HELP_INFORMATION_2: 'Per la chat della community dal vivo unisciti al nostro server Discord',
|
||||
HELP_INFORMATION_3: 'Per richiedere una funzionalità o segnalare un errore',
|
||||
HELP_INFORMATION_4: 'ricordati di scaricare e allegare le informazioni del tuo sistema per una risposta più rapida quando segnali un problema',
|
||||
HELP_INFORMATION_4: 'Ricordati di scaricare e allegare le informazioni del tuo sistema per una risposta più rapida quando segnali un problema',
|
||||
HELP_INFORMATION_5: 'EMS-ESP è un progetto gratuito e open-source. Supporta il suo sviluppo futuro assegnandogli una stella su Github!',
|
||||
UPLOAD: 'Carica',
|
||||
DOWNLOAD: 'Scarica',
|
||||
@@ -196,13 +196,11 @@ const it: Translation = {
|
||||
RELEASE_IS: 'rilascio é',
|
||||
RELEASE_NOTES: 'note rilascio',
|
||||
EMS_ESP_VER: 'Versione EMS-ESP',
|
||||
PLATFORM: 'Dispositivo (Piattaforma / SDK)',
|
||||
UPTIME: 'Tempo di attività del sistema',
|
||||
CPU_FREQ: 'Frequenza CPU ',
|
||||
HEAP: 'Heap (Free / Max Alloc)',
|
||||
PSRAM: 'PSRAM (Size / Free)',
|
||||
FLASH: 'Flash Chip (Size / Speed)',
|
||||
APPSIZE: 'Applicazione (Usata / Libera)',
|
||||
APPSIZE: 'Applicazione (Partizione: Usata / Libera)',
|
||||
FILESYSTEM: 'Memoria Sistema (Usata / Libera)',
|
||||
BUFFER_SIZE: 'Max Buffer Size',
|
||||
COMPACT: 'Compact',
|
||||
@@ -320,12 +318,13 @@ const it: Translation = {
|
||||
SCHEDULE_TIMER_2: 'Ogni minuto',
|
||||
SCHEDULE_TIMER_3: 'Ogni ora',
|
||||
CUSTOM_ENTITIES: 'Entità personalizzate',
|
||||
ENTITIES_HELP_1: 'Recupera entità personalizzate dal BUS EMS',
|
||||
ENTITIES_HELP_1: 'Recupera entità personalizzate dal BUS EMS', // TODO translate
|
||||
ENTITIES_UPDATED: 'Entità aggiornate',
|
||||
WRITEABLE: 'Scrivibile',
|
||||
SHOWING: 'Visualizza',
|
||||
SEARCH: 'Ricerca',
|
||||
CERT: 'TLS root certificate (leave blank to disable TLS)', // TODO translate
|
||||
CERT: 'TLS root certificate (leave blank for insecure)', // TODO translate
|
||||
ENABLE_TLS: 'Abilita TLS',
|
||||
ON: 'On', // TODO translate
|
||||
OFF: 'Off', // TODO translate
|
||||
POLARITY: 'Polarity', // TODO translate
|
||||
|
||||
@@ -169,7 +169,7 @@ const nl: Translation = {
|
||||
HELP_INFORMATION_1: 'Bezoek de online wiki om instructies te vinden om EMS-ESP te configureren',
|
||||
HELP_INFORMATION_2: 'Voor de live community ga naar de Discord server',
|
||||
HELP_INFORMATION_3: 'Om een nieuwe feature te vragen of een bug te rapporteren',
|
||||
HELP_INFORMATION_4: 'zorg dat je ook je systeem details zijn toevoeged voor een sneller antwoord',
|
||||
HELP_INFORMATION_4: 'Zorg dat je ook je systeem details zijn toevoeged voor een sneller antwoord',
|
||||
HELP_INFORMATION_5: 'EMS-ESP is een gratis en open source project. Steun ons met een Star op Github!',
|
||||
UPLOAD: 'Upload',
|
||||
DOWNLOAD: '{{D|d|d}}ownload',
|
||||
@@ -194,13 +194,11 @@ const nl: Translation = {
|
||||
RELEASE_IS: 'release is',
|
||||
RELEASE_NOTES: 'release notes',
|
||||
EMS_ESP_VER: 'EMS-ESP Versie',
|
||||
PLATFORM: 'Apparaat (Platform / SDK)',
|
||||
UPTIME: 'Systeem Uptime',
|
||||
CPU_FREQ: 'CPU Frequency',
|
||||
HEAP: 'Heap (Free / Max Alloc)',
|
||||
PSRAM: 'PSRAM (Size / Free)',
|
||||
FLASH: 'Flash Chip (Size / Speed)',
|
||||
APPSIZE: 'Application (Used / Free)',
|
||||
APPSIZE: 'Application (Partition: Used / Free)',
|
||||
FILESYSTEM: 'File System (Used / Free)',
|
||||
BUFFER_SIZE: 'Max Buffer Size',
|
||||
COMPACT: 'Compact',
|
||||
@@ -318,12 +316,13 @@ const nl: Translation = {
|
||||
SCHEDULE_TIMER_2: 'elke minuut',
|
||||
SCHEDULE_TIMER_3: 'elke huur',
|
||||
CUSTOM_ENTITIES: 'Aangepaste Entiteiten',
|
||||
ENTITIES_HELP_1: 'Aangepaste entiteiten ophalen uit de EMS-bus',
|
||||
ENTITIES_HELP_1: 'Aangepaste entiteiten ophalen uit de EMS-bus', // TODO translate
|
||||
ENTITIES_UPDATED: 'Entiteiten bijgewerkt',
|
||||
WRITEABLE: 'Beschrijfbare',
|
||||
SHOWING: 'Tonen',
|
||||
SEARCH: 'Zoek',
|
||||
CERT: 'TLS rootcertificaat (laat leeg om TLS uit te schakelen)',
|
||||
CERT: 'TLS rootcertificaat (laat leeg om TLS-insecure)', // TODO translate
|
||||
ENABLE_TLS: 'Activeer TLS',
|
||||
ON: 'On', // TODO translate
|
||||
OFF: 'Off', // TODO translate
|
||||
POLARITY: 'Polarity', // TODO translate
|
||||
|
||||
@@ -169,7 +169,7 @@ const no: Translation = {
|
||||
HELP_INFORMATION_1: 'Besøk wiki for instruksjoner for å konfigurere EMS-ESP',
|
||||
HELP_INFORMATION_2: 'For community-support besøk vår Discord-server',
|
||||
HELP_INFORMATION_3: 'For å be om en ny funksjon eller melde feil',
|
||||
HELP_INFORMATION_4: 'husk å laste ned og legg ved din systeminformasjon for en raskere respons når du rapporterer et problem',
|
||||
HELP_INFORMATION_4: 'Husk å laste ned og legg ved din systeminformasjon for en raskere respons når du rapporterer et problem',
|
||||
HELP_INFORMATION_5: 'EMS-ESP er gratis og åpen kildekode. Bidra til utviklingen ved å gi oss en stjerne på GitHub!',
|
||||
UPLOAD: 'Opplasning',
|
||||
DOWNLOAD: '{{N|n|n}}edlasting',
|
||||
@@ -194,13 +194,11 @@ const no: Translation = {
|
||||
RELEASE_IS: 'release er',
|
||||
RELEASE_NOTES: 'release notes',
|
||||
EMS_ESP_VER: 'EMS-ESP Version',
|
||||
PLATFORM: 'Enhet (Platform / SDK)',
|
||||
UPTIME: 'System Oppetid',
|
||||
CPU_FREQ: 'CPU Frekvens',
|
||||
HEAP: 'Heap (Ledig / Max Allokert)',
|
||||
PSRAM: 'PSRAM (Størrelse / Ledig)',
|
||||
FLASH: 'Flash Chip (Størrelse / Hastighet)',
|
||||
APPSIZE: 'Applikasjon (Brukt / Ledig)',
|
||||
APPSIZE: 'Applikasjon (Partition: Brukt / Ledig)',
|
||||
FILESYSTEM: 'File System (Brukt / Ledig)',
|
||||
BUFFER_SIZE: 'Max Buffer Størrelse',
|
||||
COMPACT: 'Komprimere',
|
||||
@@ -323,7 +321,8 @@ const no: Translation = {
|
||||
WRITEABLE: 'Writeable', // TODO translate
|
||||
SHOWING: 'Showing', // TODO translate
|
||||
SEARCH: 'Search', // TODO translate
|
||||
CERT: 'TLS root certificate (leave blank to disable TLS)', // TODO translate
|
||||
CERT: 'TLS root certificate (leave blank for insecure)', // TODO translate
|
||||
ENABLE_TLS: 'Aktiviser TLS',
|
||||
ON: 'On', // TODO translate
|
||||
OFF: 'Off', // TODO translate
|
||||
POLARITY: 'Polarity', // TODO translate
|
||||
|
||||
@@ -53,7 +53,7 @@ const pl: BaseTranslation = {
|
||||
PROBLEM_LOADING: 'Problem z załadowaniem!',
|
||||
ANALOG_SENSOR: '{{u|u||ustawienia u|ustawień u}}rządzeni{{a podłączonego do EMS-ESP|e||a podłączonego do EMS-ESP|a podłączonego do EMS-ESP}}',
|
||||
ANALOG_SENSORS: 'Urządzenia podłączone do EMS-ESP',
|
||||
SETTINGS: 'ustawienia',
|
||||
SETTINGS: 'ustawie{{nia|ń|}}',
|
||||
UPDATED_OF: 'Zaktualizowano {0}.',
|
||||
UPDATE_OF: 'Aktualizacja {0}',
|
||||
REMOVED_OF: 'Usunięto ustawienia {0}.',
|
||||
@@ -126,7 +126,7 @@ const pl: BaseTranslation = {
|
||||
BYPASS_TOKEN: 'Pomiń autoryzację tokenem w wywołaniach API',
|
||||
READONLY: 'Tryb pracy "tylko do odczytu" (blokuje wszystkie komendy zapisu na magistralę EMS)',
|
||||
UNDERCLOCK_CPU: 'Obniż taktowanie CPU',
|
||||
HEATINGOFF: 'Uruchom boiler z wymuszonym wyłączonym grzaniem',
|
||||
HEATINGOFF: 'Uruchom kocioł z wymuszonym wyłączonym grzaniem',
|
||||
ENABLE_SHOWER_TIMER: 'Aktywuj minutnik prysznica',
|
||||
ENABLE_SHOWER_ALERT: 'Aktywuj alarm prysznica',
|
||||
TRIGGER_TIME: 'Wyzwalaj po czasie',
|
||||
@@ -146,13 +146,13 @@ const pl: BaseTranslation = {
|
||||
MINUTES: 'minut',
|
||||
HOURS: 'godzin',
|
||||
RESTART: 'Restart',
|
||||
RESTART_TEXT: 'Aby zastosować wprowadzone zmiany interfejs EMS-ESP musi zostać zrestartowany.',
|
||||
RESTART_TEXT: 'Aby zastosować wprowadzone zmiany, interfejs EMS-ESP {{musi zostać|zostanie|}} uruchomiony ponowni{{e.|e|}}',
|
||||
RESTART_CONFIRM: 'Na pewno chcesz zrestartować interfejs EMS-ESP?',
|
||||
COMMAND: '{{Komenda|KOMENDA|}}',
|
||||
CUSTOMIZATIONS_RESTART: 'Wszystkie personalizacje zostały usunięte. Restartuję...',
|
||||
CUSTOMIZATIONS_FULL: 'Wybrano za dużo obiektów. Wprowadź zmiany w mniejszych partiach.',
|
||||
CUSTOMIZATIONS_SAVED: 'Personalizacje zostały zapisane.',
|
||||
CUSTOMIZATIONS_HELP_1: 'Wybierz urządzenie EMS, dostosuj opcje lub kliknij by zmienić nazwę encji.',
|
||||
CUSTOMIZATIONS_HELP_1: 'Wybierz urządzenie EMS, a następnie dostosuj opcje lub kliknij na nazwie encji by tę nazwę zmienić',
|
||||
CUSTOMIZATIONS_HELP_2: 'oznacz jako ulubioną',
|
||||
CUSTOMIZATIONS_HELP_3: 'zablokuj akcje zapisu',
|
||||
CUSTOMIZATIONS_HELP_4: 'wyklucz z MQTT i API',
|
||||
@@ -164,12 +164,12 @@ const pl: BaseTranslation = {
|
||||
NAME: '{{Nazwa|nazwa|}}',
|
||||
CUSTOMIZATIONS_RESET: 'Na pewno chcesz usunąć wszystkie personalizacje łącznie z ustawieniami dla czujników temperatury 1-Wire® i urządzeń podłączonych do EMS-ESP?',
|
||||
DEVICE_ENTITIES: 'Encje urządzenia',
|
||||
SUPPORT_INFORMATION: 'Informacje dotyczące wsparcia',
|
||||
SUPPORT_INFORMATION: '{{I|i|}}nformacj{{e|i|}} o systemie',
|
||||
CLICK_HERE: 'Kliknij tu',
|
||||
HELP_INFORMATION_1: 'Aby uzyskać instrukcje dotyczące konfiguracji EMS-ESP skorzystaj z wiki w internecie',
|
||||
HELP_INFORMATION_1: 'Aby uzyskać instrukcje dotyczące konfiguracji EMS-ESP, skorzystaj z wiki w internecie',
|
||||
HELP_INFORMATION_2: 'Aby dołączyć do naszego serwera Discord i komunikować się na żywo ze społecznością',
|
||||
HELP_INFORMATION_3: 'Aby zaproponować nową funkcjonalność lub zgłosić problem',
|
||||
HELP_INFORMATION_4: 'Zgłaszając problem, nie zapomnij dołączyć informacji o swoim systemie!',
|
||||
HELP_INFORMATION_4: 'Zgłaszając problem, nie zapomnij pobrać i dołączyć informacji o swoim systemie!',
|
||||
HELP_INFORMATION_5: 'EMS-ESP jest darmowym projektem typu open-source. Aby go wesprzeć, rozważ przyznanie nam gwiazdki na Github!',
|
||||
UPLOAD: 'Wysyłanie',
|
||||
DOWNLOAD: '{{P|p||P}}obier{{anie|z||z}}',
|
||||
@@ -194,21 +194,19 @@ const pl: BaseTranslation = {
|
||||
RELEASE_IS: 'wydanie to',
|
||||
RELEASE_NOTES: 'lista zmian',
|
||||
EMS_ESP_VER: 'Wersja EMS-ESP',
|
||||
PLATFORM: 'Urządzenie (platforma / SDK)',
|
||||
UPTIME: 'Czas działania systemu',
|
||||
CPU_FREQ: 'Taktowanie CPU',
|
||||
HEAP: 'HEAP (wolne / maksymalny przydział)',
|
||||
PSRAM: 'PSRAM (rozmiar / wolne)',
|
||||
FLASH: 'FLASH (rozmiar / taktowanie)',
|
||||
APPSIZE: 'Aplikacja (wykorzystane / wolne)',
|
||||
APPSIZE: 'Aplikacja (partycja: wykorzystane / wolne)',
|
||||
FILESYSTEM: 'System plików (wykorzystane / wolne)',
|
||||
BUFFER_SIZE: 'Maksymalna pojemność bufora (ilość wpisów)',
|
||||
COMPACT: 'Kompaktowy',
|
||||
ENABLE_OTA: 'Aktywuj aktualizację OTA',
|
||||
DOWNLOAD_CUSTOMIZATION_TEXT: 'Pobierz personalizacje.',
|
||||
DOWNLOAD_SCHEDULE_TEXT: 'Pobierz harmonogram zdarzeń.',
|
||||
DOWNLOAD_SETTINGS_TEXT: 'Pobierz ustawienia aplikacji. Uważaj jeśli udostępniasz plik z ustawieniami, ponieważ zawiera on hasła oraz inne wrażliwe informacje!',
|
||||
UPLOAD_TEXT: 'Wyślij firmware (.bin), ustawienia lub personalizacje (.json). Opcjonalnie, wyślij wcześniej plik walidacji (.md5).',
|
||||
DOWNLOAD_SETTINGS_TEXT: 'Pobierz ustawienia aplikacji. Uwaga! Plik z ustawieniami zawiera hasła oraz inne wrażliwe informacje systemowe! Nie udostepniaj go pochopnie!',
|
||||
UPLOAD_TEXT: 'Wyślij firmware (.bin), ustawienia lub personalizacje (.json). Opcjonalnie, wyślij wcześniej plik walidacji z sumą kontrolną (.md5).',
|
||||
UPLOADING: 'Wysłano',
|
||||
UPLOAD_DROP_TEXT: 'Przeciągnij tutaj plik lub kliknij',
|
||||
ERROR: 'Nieoczekiwany błąd, spróbuj ponownie!',
|
||||
@@ -318,19 +316,20 @@ const pl: BaseTranslation = {
|
||||
SCHEDULE_TIMER_2: 'co minutę',
|
||||
SCHEDULE_TIMER_3: 'co godzinę',
|
||||
CUSTOM_ENTITIES: '{{N|n|}}iestandardowe{{|j|}} encj{{e|i|}}',
|
||||
ENTITIES_HELP_1: 'Zdefiniuj niestandardowe encje dla magistrali EMS.',
|
||||
ENTITIES_HELP_1: 'Zdefiniuj niestandardowe encje dla magistrali EMS.', // TODO translate
|
||||
ENTITIES_UPDATED: 'Niestandardowe encje zostały uaktualnione.',
|
||||
WRITEABLE: 'zapisywalna',
|
||||
WRITEABLE: 'Zapisywalna',
|
||||
SHOWING: 'Wyświetlane',
|
||||
SEARCH: 'Szukaj',
|
||||
CERT: 'Certyfikat główny TLS (pozostaw puste zby wyłączyć TLS)',
|
||||
ON: 'włączony',
|
||||
CERT: 'Certyfikat główny TLS (pozostaw puste dla TLS-insecure)',
|
||||
ENABLE_TLS: 'Włącz wsparcie dla TLS',
|
||||
ON: 'włączony',
|
||||
OFF: 'wyłączony',
|
||||
POLARITY: 'Typ przekaźnika',
|
||||
ACTIVEHIGH: 'Wyzwalany stanem wysokim',
|
||||
ACTIVELOW: 'Wyzwalany stanem niskim',
|
||||
UNCHANGED: 'Zachowaj stan',
|
||||
ALWAYS: 'Zawsze'
|
||||
ACTIVEHIGH: 'Wyzwalany stanem wysokim',
|
||||
ACTIVELOW: 'Wyzwalany stanem niskim',
|
||||
UNCHANGED: 'Zachowaj stan',
|
||||
ALWAYS: 'Zawsze'
|
||||
};
|
||||
|
||||
export default pl;
|
||||
|
||||
335
interface/src/i18n/sk/index.ts
Normal file
335
interface/src/i18n/sk/index.ts
Normal file
@@ -0,0 +1,335 @@
|
||||
import type { Translation } from '../i18n-types';
|
||||
/* prettier-ignore */
|
||||
/* eslint-disable */
|
||||
|
||||
const sk: Translation = {
|
||||
LANGUAGE: 'Jazyk',
|
||||
RETRY: 'Opakovať',
|
||||
LOADING: 'Načítanie',
|
||||
IS_REQUIRED: '{0} je požadovaných',
|
||||
SIGN_IN: 'Prihlásiť sa',
|
||||
SIGN_OUT: 'Odhlásiť sa',
|
||||
USERNAME: 'Užívateľské meno',
|
||||
PASSWORD: 'Heslo',
|
||||
SU_PASSWORD: 'su heslo',
|
||||
DASHBOARD: 'Panel',
|
||||
SETTINGS_OF: '{0} Nastavenia',
|
||||
HELP_OF: '{0} Pomoc',
|
||||
LOGGED_IN: 'Prihlásený ako {name}',
|
||||
PLEASE_SIGNIN: 'Ak chcete pokračovať, prihláste sa',
|
||||
UPLOAD_SUCCESSFUL: 'Nahratie úspešné',
|
||||
DOWNLOAD_SUCCESSFUL: 'Stiahnutie úspešné',
|
||||
INVALID_LOGIN: 'Nesprávne prihlasovacie údaje',
|
||||
NETWORK: 'Sieť',
|
||||
SECURITY: 'Zabezpečenie',
|
||||
ONOFF_CAP: 'ZAP/VYP',
|
||||
ONOFF: 'zap/vyp',
|
||||
TYPE: 'Typ',
|
||||
DESCRIPTION: 'Popis',
|
||||
ENTITIES: 'Entity',
|
||||
REFRESH: 'Obnoviť',
|
||||
EXPORT: 'Export',
|
||||
DEVICE_DETAILS: 'Detaily zariadenia',
|
||||
ID_OF: '{0} ID',
|
||||
DEVICE: 'Zariadenie',
|
||||
PRODUCT: 'Produkt',
|
||||
VERSION: 'Verzia',
|
||||
BRAND: 'Značka',
|
||||
ENTITY_NAME: 'Názov entity',
|
||||
VALUE: '{{Value|value}}',
|
||||
DEVICE_DATA: 'Dáta zariadenia',
|
||||
SENSOR_DATA: 'Dáta snímača',
|
||||
DEVICES: 'Zariadenia',
|
||||
SENSORS: 'Snímače',
|
||||
RUN_COMMAND: 'Volať príkaz',
|
||||
CHANGE_VALUE: 'Zmena hodnoty',
|
||||
CANCEL: 'Zrušiť',
|
||||
RESET: 'Reset',
|
||||
APPLY_CHANGES: 'Aplikovať zmeny ({0})',
|
||||
UPDATE: 'Aktualizovať',
|
||||
EXECUTE: 'Spustiť',
|
||||
REMOVE: 'Odstrániť',
|
||||
PROBLEM_UPDATING: 'Problém s aktualizáciou',
|
||||
PROBLEM_LOADING: 'Problém s načítaním',
|
||||
ANALOG_SENSOR: 'Analógový snímač',
|
||||
ANALOG_SENSORS: 'Analógové snímače',
|
||||
SETTINGS: 'Nastavenia',
|
||||
UPDATED_OF: '{0} aktualizovaných',
|
||||
UPDATE_OF: '{0} aktualizované',
|
||||
REMOVED_OF: '{0} odstránených',
|
||||
DELETION_OF: '{0} zmazaných',
|
||||
OFFSET: 'Ofset',
|
||||
FACTOR: 'Faktor',
|
||||
FREQ: 'Frekvencia',
|
||||
DUTY_CYCLE: 'Duty Cycle',
|
||||
UNIT: 'UoM',
|
||||
STARTVALUE: 'Počiatočná hodnota',
|
||||
WARN_GPIO: 'Upozornenie: Buďte opatrní pri priraďovaní GPIO!',
|
||||
EDIT: 'Editovať',
|
||||
SENSOR: 'Snímač',
|
||||
TEMP_SENSOR: 'Snímač teploty',
|
||||
TEMP_SENSORS: 'Snímače teploty',
|
||||
WRITE_CMD_SENT: 'Príkaz zápisu bol odoslaný',
|
||||
EMS_BUS_WARNING: 'Zbernica EMS odpojená. Ak toto upozornenie pretrváva aj po niekoľkých sekundách, skontrolujte nastavenia a profil dosky',
|
||||
EMS_BUS_SCANNING: 'Zisťovanie EMS zariadení...',
|
||||
CONNECTED: 'Pripojené',
|
||||
TX_ISSUES: 'Problémy s Tx – skontrolujte Tx režim',
|
||||
DISCONNECTED: 'Odpojené',
|
||||
EMS_SCAN: 'Naozaj chcete spustiť úplnú kontrolu zariadenia zbernice EMS?',
|
||||
EMS_BUS_STATUS: 'Stav zbernice EMS',
|
||||
ACTIVE_DEVICES: 'Aktívne zariadenia a snímače',
|
||||
EMS_DEVICE: 'EMS zariadenie',
|
||||
SUCCESS: 'ÚSPEŠNÉ',
|
||||
FAIL: 'ZLYHANIE',
|
||||
QUALITY: 'KVALITA',
|
||||
SCAN_DEVICES: 'Scan pre nové zariadenia',
|
||||
EMS_BUS_STATUS_TITLE: 'EMS zbernica & stav aktivity',
|
||||
SCAN: 'Scan',
|
||||
STATUS_NAMES: [
|
||||
'EMS Telegramy prijaté (Rx)',
|
||||
'EMS Čítania (Tx)',
|
||||
'EMS Zápisy (Tx)',
|
||||
'Čítanie snímača teploty',
|
||||
'Analógové snímanie',
|
||||
'MQTT Publikovanie',
|
||||
'API volania',
|
||||
'Syslog správy'
|
||||
],
|
||||
NUM_DEVICES: '{num} Zariadenia{{s}}',
|
||||
NUM_TEMP_SENSORS: '{num} Teplotné snímače{{s}}',
|
||||
NUM_ANALOG_SENSORS: '{num} Analógové snímače{{s}}',
|
||||
NUM_DAYS: '{num} dní{{s}}',
|
||||
NUM_SECONDS: '{num} sekúnd{{s}}',
|
||||
NUM_HOURS: '{num} hodín{{s}}',
|
||||
NUM_MINUTES: '{num} minút{{s}}',
|
||||
APPLICATION_SETTINGS: 'Nastavenia aplikácie',
|
||||
CUSTOMIZATIONS: 'Prispôsobenia',
|
||||
APPLICATION_RESTARTING: 'EMS-ESP sa reštartuje',
|
||||
INTERFACE_BOARD_PROFILE: 'Profil boardu rozhrania',
|
||||
BOARD_PROFILE_TEXT: 'Vyberte vopred nakonfigurovaný profil dosky rozhrania zo zoznamu nižšie alebo vyberte možnosť Vlastné a nakonfigurujte svoje vlastné hardvérové nastavenia',
|
||||
BOARD_PROFILE: 'Board profil',
|
||||
CUSTOM: 'Vlastné',
|
||||
GPIO_OF: '{0} GPIO',
|
||||
BUTTON: 'Tlačidlo',
|
||||
TEMPERATURE: 'Teplota',
|
||||
PHY_TYPE: 'Eth PHY Typ',
|
||||
DISABLED: 'zakázané',
|
||||
TX_MODE: 'Tx režim',
|
||||
HARDWARE: 'Hardware',
|
||||
EMS_BUS: '{{BUS|EMS BUS}}',
|
||||
GENERAL_OPTIONS: 'Všeobecné možnosti',
|
||||
LANGUAGE_ENTITIES: 'Jazyk (pre entity zariadenia)',
|
||||
HIDE_LED: 'Skryť LED',
|
||||
ENABLE_TELNET: 'Povoliť Telnet konzolu',
|
||||
ENABLE_ANALOG: 'Povoliť analógové snímače',
|
||||
CONVERT_FAHRENHEIT: 'Previesť hodnoty teploty na fahrenheity',
|
||||
BYPASS_TOKEN: 'Vynechajte autorizáciu prístupového tokenu pri volaniach API',
|
||||
READONLY: 'Povoliť režim len na čítanie (blokuje všetky odchádzajúce príkazy EMS Tx Write)',
|
||||
UNDERCLOCK_CPU: 'Podtaktovanie rýchlosti procesora',
|
||||
HEATINGOFF: 'Spustite kotol s núteným vykurovaním',
|
||||
ENABLE_SHOWER_TIMER: 'Povoliť časovač sprchovania',
|
||||
ENABLE_SHOWER_ALERT: 'Povoliť upozornenie na sprchu',
|
||||
TRIGGER_TIME: 'Čas spustenia',
|
||||
COLD_SHOT_DURATION: 'Trvanie studeného záberu',
|
||||
FORMATTING_OPTIONS: 'Možnosti formátovania',
|
||||
BOOLEAN_FORMAT_DASHBOARD: 'Panel Boolean formát',
|
||||
BOOLEAN_FORMAT_API: 'Boolean formát API/MQTT',
|
||||
ENUM_FORMAT: 'Enum formát API/MQTT',
|
||||
INDEX: 'Index',
|
||||
ENABLE_PARASITE: 'Povolenie parazitného napájania',
|
||||
LOGGING: 'Logovanie',
|
||||
LOG_HEX: 'Záznam telegramov EMS v hexadecimálnej sústave',
|
||||
ENABLE_SYSLOG: 'Povoliť Syslog',
|
||||
LOG_LEVEL: 'Log úroveň',
|
||||
MARK_INTERVAL: 'Označenie intervalu',
|
||||
SECONDS: 'sekundy',
|
||||
MINUTES: 'minúty',
|
||||
HOURS: 'hodiny',
|
||||
RESTART: 'Reštart',
|
||||
RESTART_TEXT: 'EMS-ESP sa musí reštartovať, aby sa použili zmenené systémové nastavenia',
|
||||
RESTART_CONFIRM: 'Ste si istí, že chcete reštartovať EMS-ESP?',
|
||||
COMMAND: 'Príkaz',
|
||||
CUSTOMIZATIONS_RESTART: 'Ste si istí, že chcete reštartovať EMS-ESP?',
|
||||
CUSTOMIZATIONS_FULL: 'Vybrané subjekty prekročili limit. Prosím, ukladajte v dávkach',
|
||||
CUSTOMIZATIONS_SAVED: 'Uložené prispôsobenia',
|
||||
CUSTOMIZATIONS_HELP_1: 'Vyberte zariadenie a prispôsobte možnosti entít alebo kliknutím premenujte',
|
||||
CUSTOMIZATIONS_HELP_2: 'označiť ako obľúbené',
|
||||
CUSTOMIZATIONS_HELP_3: 'zakázať akciu zápisu',
|
||||
CUSTOMIZATIONS_HELP_4: 'vylúčiť z MQTT a API',
|
||||
CUSTOMIZATIONS_HELP_5: 'skryť z panela',
|
||||
CUSTOMIZATIONS_HELP_6: 'odstrániť z pamäte',
|
||||
SELECT_DEVICE: 'Zvoliť zariadenie',
|
||||
SET_ALL: 'nastaviť všetko',
|
||||
OPTIONS: 'Možnosti',
|
||||
NAME: 'Názov',
|
||||
CUSTOMIZATIONS_RESET: 'Naozaj chcete odstrániť všetky prispôsobenia vrátane vlastných nastavení snímačov teploty a analógových snímačov?',
|
||||
DEVICE_ENTITIES: 'Entity zariadenia',
|
||||
SUPPORT_INFORMATION: 'Informácie o podpore',
|
||||
CLICK_HERE: 'Kliknite tu',
|
||||
HELP_INFORMATION_1: 'Navštívte online wiki, kde nájdete pokyny na konfiguráciu EMS-ESP',
|
||||
HELP_INFORMATION_2: 'Pre živý komunitný chat sa pripojte na náš Discord server',
|
||||
HELP_INFORMATION_3: 'Ak chcete požiadať o funkciu alebo nahlásiť chybu',
|
||||
HELP_INFORMATION_4: 'nezabudnite si stiahnuť a pripojiť informácie o vašom systéme, aby ste mohli rýchlejšie reagovať pri nahlasovaní problému',
|
||||
HELP_INFORMATION_5: 'EMS-ESP je bezplatný a open source projekt. Podporte jeho budúci vývoj tým, že mu dáte hviezdičku na Github!',
|
||||
UPLOAD: 'Nahrať',
|
||||
DOWNLOAD: '{{S|s|s}}tiahnuť',
|
||||
ABORTED: 'zrušené',
|
||||
FAILED: 'chybné',
|
||||
SUCCESSFUL: 'úspešné',
|
||||
SYSTEM: 'Systém',
|
||||
LOG_OF: '{0} Log',
|
||||
STATUS_OF: '{0} Stav',
|
||||
UPLOAD_DOWNLOAD: 'Nahrať/Stiahnuť',
|
||||
VERSION_ON: 'Momentálne ste vo verzii',
|
||||
SYSTEM_APPLY_FIRMWARE: 'na použitie nového firmvéru',
|
||||
CLOSE: 'Zatvoriť',
|
||||
USE: 'Použiť',
|
||||
FACTORY_RESET: 'Továrenské nastavenia',
|
||||
SYSTEM_FACTORY_TEXT: 'Zariadenie bolo obnovené z výroby a teraz sa reštartuje',
|
||||
SYSTEM_FACTORY_TEXT_DIALOG: 'Naozaj chcete resetovať EMS-ESP na predvolené výrobné nastavenia?',
|
||||
VERSION_CHECK: 'Kontrola verzie',
|
||||
THE_LATEST: 'Posledná',
|
||||
OFFICIAL: 'officiálna',
|
||||
DEVELOPMENT: 'vývojárska',
|
||||
RELEASE_IS: 'vydanie je',
|
||||
RELEASE_NOTES: 'poznámky k vydaniu',
|
||||
EMS_ESP_VER: 'EMS-ESP verzia',
|
||||
UPTIME: 'Beh systému',
|
||||
HEAP: 'Zásobník (voľné / max pridelenie)',
|
||||
PSRAM: 'PSRAM (Veľkosť / Voľné)',
|
||||
FLASH: 'Flash chip (Veľkosť / Rýchlosť)',
|
||||
APPSIZE: 'Applikácia (Priečka: Použité / Voľné)',
|
||||
FILESYSTEM: 'Súborový systém (Použité / Voľné)',
|
||||
BUFFER_SIZE: 'Maximálna veľkosť vyrovnávacej pamäte',
|
||||
COMPACT: 'Kompaktné',
|
||||
ENABLE_OTA: 'Povoliť OTA aktualizácie',
|
||||
DOWNLOAD_CUSTOMIZATION_TEXT: 'Stiahnutie prispôsobení entity',
|
||||
DOWNLOAD_SCHEDULE_TEXT: 'Stiahnutie plánovača udalostí',
|
||||
DOWNLOAD_SETTINGS_TEXT: 'Stiahnite si nastavenia aplikácie. Pri zdieľaní nastavení buďte opatrní, pretože tento súbor obsahuje heslá a iné citlivé systémové informácie.',
|
||||
UPLOAD_TEXT: 'Najskôr nahrajte nový súbor firmvéru (.bin), nastavenia alebo prispôsobenia (.json), pre voliteľné overenie nahrajte súbor (.md5)',
|
||||
UPLOADING: 'Nahrávanie',
|
||||
UPLOAD_DROP_TEXT: 'Zahodiť súbor alebo kliknúť sem',
|
||||
ERROR: 'Neočakávaná chyba, prosím skúste to znova',
|
||||
TIME_SET: 'Nastavený čas',
|
||||
MANAGE_USERS: 'Správa používateľov',
|
||||
IS_ADMIN: 'je Admin',
|
||||
USER_WARNING: 'Musíte mať nakonfigurovaného aspoň jedného používateľa administrátora',
|
||||
ADD: 'Pridať',
|
||||
ACCESS_TOKEN_FOR: 'Prístupový token pre',
|
||||
ACCESS_TOKEN_TEXT: 'Nižšie uvedený token sa používa pri volaniach REST API, ktoré vyžadujú autorizáciu. Môže byť odovzdaný buď ako token Bearer v hlavičke Authorization (Autorizácia), alebo v parametri dotazu URL access_token.',
|
||||
GENERATING_TOKEN: 'Generovanie tokenu',
|
||||
USER: 'Užívateľ',
|
||||
MODIFY: 'Upraviť',
|
||||
SU_TEXT: 'Heslo su (superužívateľ) sa používa na podpisovanie autentifikačných tokenov a tiež na povolenie oprávnení správcu v rámci konzoly.',
|
||||
NOT_ENABLED: 'Nie je povolené',
|
||||
ERRORS_OF: '{0} errory',
|
||||
DISCONNECT_REASON: 'Dôvod odpojenia',
|
||||
ENABLE_MQTT: 'Povoliť MQTT',
|
||||
BROKER: 'Broker',
|
||||
CLIENT: 'Klient',
|
||||
BASE_TOPIC: 'Base',
|
||||
OPTIONAL: 'voliteľné',
|
||||
FORMATTING: 'Formátovanie',
|
||||
MQTT_FORMAT: 'Formát témy/záťaže',
|
||||
MQTT_NEST_1: 'Vnorené do jednej témy',
|
||||
MQTT_NEST_2: 'Ako jednotlivé témy',
|
||||
MQTT_RESPONSE: 'Publikovanie výstupu príkazu do témy `response`',
|
||||
MQTT_PUBLISH_TEXT_1: 'Zverejňovanie tém jednotlivých hodnôt pri zmene',
|
||||
MQTT_PUBLISH_TEXT_2: 'Publikovanie do tém príkazov (ioBroker)',
|
||||
MQTT_PUBLISH_TEXT_3: 'Povolenie zisťovania MQTT',
|
||||
MQTT_PUBLISH_TEXT_4: 'Predpona tém Discovery',
|
||||
MQTT_PUBLISH_TEXT_5: 'Typ zistenia',
|
||||
MQTT_PUBLISH_INTERVALS: 'Intervaly zverejňovania',
|
||||
MQTT_INT_BOILER: 'Kotly a tepelné čerpadlá',
|
||||
MQTT_INT_THERMOSTATS: 'Termostaty',
|
||||
MQTT_INT_SOLAR: 'Solárne moduly',
|
||||
MQTT_INT_MIXER: 'Zmiešavacie moduley',
|
||||
MQTT_QUEUE: 'Fronta MQTT',
|
||||
DEFAULT: 'Predvolené',
|
||||
MQTT_ENTITY_FORMAT: 'ID formát entity',
|
||||
MQTT_ENTITY_FORMAT_0: 'Jedna inštancia, dlhý názov (v3.4)',
|
||||
MQTT_ENTITY_FORMAT_1: 'Jedna inštancia, krátky názov',
|
||||
MQTT_ENTITY_FORMAT_2: 'Viacero inštancií, krátky názov',
|
||||
MQTT_CLEAN_SESSION: 'Nastavenie čistej relácie',
|
||||
MQTT_RETAIN_FLAG: 'Vždy nastaviť príznak Retain',
|
||||
INACTIVE: 'Neaktívne',
|
||||
ACTIVE: 'Aktívne',
|
||||
UNKNOWN: 'Neznáme',
|
||||
SET_TIME: 'Nastavený čas',
|
||||
SET_TIME_TEXT: 'Na nastavenie času zadajte miestny dátum a čas nižšie',
|
||||
LOCAL_TIME: 'Lokálny čas',
|
||||
UTC_TIME: 'UTC čas',
|
||||
ENABLE_NTP: 'Povoliť NTP',
|
||||
NTP_SERVER: 'NTP Server',
|
||||
TIME_ZONE: 'Časová zóna',
|
||||
ACCESS_POINT: 'Prístupový bod',
|
||||
AP_PROVIDE: 'Povoliť prístupový bod',
|
||||
AP_PROVIDE_TEXT_1: 'vždy',
|
||||
AP_PROVIDE_TEXT_2: 'keď WiFi je odpojená',
|
||||
AP_PROVIDE_TEXT_3: 'nikdy',
|
||||
AP_PREFERRED_CHANNEL: 'Preferovaný kanál',
|
||||
AP_HIDE_SSID: 'Skryť SSID',
|
||||
AP_CLIENTS: 'AP klienti',
|
||||
AP_MAX_CLIENTS: 'Max klientov',
|
||||
AP_LOCAL_IP: 'Lokálna IP',
|
||||
NETWORK_SCAN: 'Scan WiFi siete',
|
||||
IDLE: 'Nečinné',
|
||||
LOST: 'Stratené',
|
||||
SCANNING: 'Scanovanie',
|
||||
SCAN_AGAIN: 'Scanovať znova',
|
||||
NETWORK_SCANNER: 'Sieťový scanner',
|
||||
NETWORK_NO_WIFI: 'WiFi siete nenájdené',
|
||||
NETWORK_BLANK_SSID: 'nechajte prázdne, ak chcete zakázať WiFi a povoliť ETH',
|
||||
NETWORK_BLANK_BSSID: 'ponechajte prázdne, ak chcete používať iba SSID',
|
||||
TX_POWER: 'Tx výkon',
|
||||
HOSTNAME: 'Hostname',
|
||||
NETWORK_DISABLE_SLEEP: 'Zakázanie režimu spánku WiFi',
|
||||
NETWORK_LOW_BAND: 'Používanie menšej šírky pásma WiFi',
|
||||
NETWORK_USE_DNS: 'Povoliť mDNS službu',
|
||||
NETWORK_ENABLE_CORS: 'Povoliť CORS',
|
||||
NETWORK_CORS_ORIGIN: 'CORS origin',
|
||||
NETWORK_ENABLE_IPV6: 'Povoliť podporu IPv6',
|
||||
NETWORK_FIXED_IP: 'Použiť fixnú IP adresu',
|
||||
NETWORK_GATEWAY: 'Brána',
|
||||
NETWORK_SUBNET: 'Maska podsiete',
|
||||
NETWORK_DNS: 'DNS servery',
|
||||
ADDRESS_OF: '{0} adries',
|
||||
ADMIN: 'Admin',
|
||||
GUEST: 'Hosť',
|
||||
NEW: 'Nová',
|
||||
NEW_NAME_OF: 'Nových {0} názvov',
|
||||
ENTITY: 'entita',
|
||||
MIN: 'min',
|
||||
MAX: 'max',
|
||||
BLOCK_NAVIGATE_1: 'Máte neuložené zmeny',
|
||||
BLOCK_NAVIGATE_2: 'Ak prejdete na inú stránku, neuložené zmeny sa stratia. Ste si istí, že chcete opustiť túto stránku?',
|
||||
STAY: 'Zostať',
|
||||
LEAVE: 'Opustiť',
|
||||
SCHEDULER: 'Plánovač',
|
||||
SCHEDULER_HELP_1: 'Automatizujte príkazy pridaním naplánovaných udalostí nižšie. Nastavte jedinečné meno na aktiváciu/deaktiváciu cez API/MQTT.',
|
||||
SCHEDULER_HELP_2: 'Použite 00:00 na jednorazové spustenie pri štarte',
|
||||
SCHEDULE: 'Plánovať',
|
||||
TIME: 'Čas',
|
||||
TIMER: 'Časovač',
|
||||
SCHEDULE_UPDATED: 'Plánovanie aktualizované',
|
||||
SCHEDULE_TIMER_1: 'pri spustení',
|
||||
SCHEDULE_TIMER_2: 'každú minútu',
|
||||
SCHEDULE_TIMER_3: 'každú hodinu',
|
||||
CUSTOM_ENTITIES: 'Vlastné entity',
|
||||
ENTITIES_HELP_1: 'Získavanie vlastných entít zo zbernice EMS', // TODO translate
|
||||
ENTITIES_UPDATED: 'Aktualizované entity',
|
||||
WRITEABLE: 'Zapísateľný',
|
||||
SHOWING: 'Zobrazenie',
|
||||
SEARCH: 'Vyhľadať',
|
||||
CERT: 'Koreňový certifikát TLS (ak chcete vypnúť TLS, nechajte prázdne)',
|
||||
ENABLE_TLS: 'Povoliť TLS',
|
||||
ON: 'Zap',
|
||||
OFF: 'Vyp',
|
||||
POLARITY: 'Polarita',
|
||||
ACTIVEHIGH: 'Aktívny Vysoký',
|
||||
ACTIVELOW: 'Aktívny Nízky',
|
||||
UNCHANGED: 'Nezmenené',
|
||||
ALWAYS: 'Vždy'
|
||||
};
|
||||
|
||||
export default sk;
|
||||
@@ -194,13 +194,11 @@ const sv: Translation = {
|
||||
RELEASE_IS: 'release är', // TODO translate
|
||||
RELEASE_NOTES: 'release-logg',
|
||||
EMS_ESP_VER: 'EMS-ESP Version',
|
||||
PLATFORM: 'Enhet (Plattform / SDK)',
|
||||
UPTIME: 'Systemets Upptid',
|
||||
CPU_FREQ: 'CPU-frekvens',
|
||||
HEAP: 'Heap (Ledigt / Max allokerat)',
|
||||
PSRAM: 'PSRAM (Storlek / Ledigt)',
|
||||
FLASH: 'Flashminne (Storlek / Hastighet)',
|
||||
APPSIZE: 'Applikationer (Använt / Ledigt)',
|
||||
APPSIZE: 'Applikationer (Partition: Använt / Ledigt)',
|
||||
FILESYSTEM: 'Filsystem (Använt / Ledigt)',
|
||||
BUFFER_SIZE: 'Max Bufferstorlek',
|
||||
COMPACT: 'Komprimera',
|
||||
@@ -323,7 +321,8 @@ const sv: Translation = {
|
||||
WRITEABLE: 'Writeable', // TODO translate
|
||||
SHOWING: 'Showing', // TODO translate
|
||||
SEARCH: 'Search', // TODO translate
|
||||
CERT: 'TLS root certificate (leave blank to disable TLS)', // TODO translate
|
||||
CERT: 'TLS root certificate (leave blank for insecure)', // TODO translate
|
||||
ENABLE_TLS: 'Aktivera TLS',
|
||||
ON: 'On', // TODO translate
|
||||
OFF: 'Off', // TODO translate
|
||||
POLARITY: 'Polarity', // TODO translate
|
||||
|
||||
@@ -194,13 +194,11 @@ const tr: Translation = {
|
||||
RELEASE_IS: 'release is', // TODO translate
|
||||
RELEASE_NOTES: 'yayınlanma notları',
|
||||
EMS_ESP_VER: 'EMS-ESP Sürümü',
|
||||
PLATFORM: 'Cihaz (Platform / SDK)',
|
||||
UPTIME: 'Sistem Çalışma Süresi',
|
||||
CPU_FREQ: 'İşlemci frekansı',
|
||||
HEAP: 'Yığın (Boş / Maksimum Tahsis)',
|
||||
PSRAM: 'PSRAM (Boyut / Boş)',
|
||||
FLASH: 'Flash Çipi (Boyut / Hız)',
|
||||
APPSIZE: 'Uygulama (Kullanılmış / Boş)',
|
||||
APPSIZE: 'Uygulama (Bölme: Kullanılmış / Boş)',
|
||||
FILESYSTEM: 'Dosya Sistemi (Kullanılmış / Boş)',
|
||||
BUFFER_SIZE: 'En fazla bellek boyutu',
|
||||
COMPACT: 'Sıkışık',
|
||||
@@ -323,7 +321,8 @@ const tr: Translation = {
|
||||
WRITEABLE: 'Writeable', // TODO translate
|
||||
SHOWING: 'Showing', // TODO translate
|
||||
SEARCH: 'Search', // TODO translate
|
||||
CERT: 'TLS root certificate (leave blank to disable TLS)', // TODO translate
|
||||
CERT: 'TLS root certificate (leave blank for insecure)',
|
||||
ENABLE_TLS: 'TLS deveye al',
|
||||
ON: 'On', // TODO translate
|
||||
OFF: 'Off', // TODO translate
|
||||
POLARITY: 'Polarity', // TODO translate
|
||||
|
||||
@@ -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,37 +422,39 @@ 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()} />
|
||||
)}
|
||||
)} */}
|
||||
|
||||
<Table data={{ nodes: coreData.devices }} select={device_select} theme={device_theme} layout={{ custom: true }}>
|
||||
{(tableList: any) => (
|
||||
<>
|
||||
<Header>
|
||||
<HeaderRow>
|
||||
<HeaderCell stiff />
|
||||
<HeaderCell resize>{LL.DESCRIPTION()}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.TYPE(0)}</HeaderCell>
|
||||
</HeaderRow>
|
||||
</Header>
|
||||
<Body>
|
||||
{tableList.map((device: Device) => (
|
||||
<Row key={device.id} item={device}>
|
||||
<Cell stiff>
|
||||
<DeviceIcon type_id={device.t} />
|
||||
</Cell>
|
||||
<Cell>
|
||||
{device.n}
|
||||
<span style={{ color: 'lightblue' }}> ({device.e})</span>
|
||||
</Cell>
|
||||
<Cell stiff>{device.tn}</Cell>
|
||||
</Row>
|
||||
))}
|
||||
</Body>
|
||||
</>
|
||||
)}
|
||||
</Table>
|
||||
{coreData.connected && (
|
||||
<Table data={{ nodes: coreData.devices }} select={device_select} theme={device_theme} layout={{ custom: true }}>
|
||||
{(tableList: any) => (
|
||||
<>
|
||||
<Header>
|
||||
<HeaderRow>
|
||||
<HeaderCell stiff />
|
||||
<HeaderCell resize>{LL.DESCRIPTION()}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.TYPE(0)}</HeaderCell>
|
||||
</HeaderRow>
|
||||
</Header>
|
||||
<Body>
|
||||
{tableList.map((device: Device) => (
|
||||
<Row key={device.id} item={device}>
|
||||
<Cell stiff>
|
||||
<DeviceIcon type_id={device.t} />
|
||||
</Cell>
|
||||
<Cell>
|
||||
{device.n}
|
||||
<span style={{ color: 'lightblue' }}> ({device.e})</span>
|
||||
</Cell>
|
||||
<Cell stiff>{device.tn}</Cell>
|
||||
</Row>
|
||||
))}
|
||||
</Body>
|
||||
</>
|
||||
)}
|
||||
</Table>
|
||||
)}
|
||||
</IconContext.Provider>
|
||||
);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import type { ValidateFieldsError } from 'async-validator';
|
||||
import { dialogStyle } from 'CustomTheme';
|
||||
import { ValidatedTextField } from 'components';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
import { updateValue } from 'utils';
|
||||
import { updateValue, numberValue } from 'utils';
|
||||
|
||||
import { validate } from 'validators';
|
||||
|
||||
@@ -133,7 +133,7 @@ const DashboardDevicesDialog = ({
|
||||
fieldErrors={fieldErrors}
|
||||
name="v"
|
||||
label={LL.VALUE(1)}
|
||||
value={Math.round(editItem.v * 10) / 10}
|
||||
value={numberValue(Math.round(editItem.v * 10) / 10)}
|
||||
autoFocus
|
||||
disabled={!writeable}
|
||||
type="number"
|
||||
|
||||
@@ -262,7 +262,7 @@ const DashboardSensors: FC = () => {
|
||||
setSelectedAnalogSensor({
|
||||
id: Math.floor(Math.random() * (Math.floor(200) - 100) + 100),
|
||||
n: '',
|
||||
g: 40,
|
||||
g: 21, // default GPIO 21 which is safe for all platforms
|
||||
u: 0,
|
||||
v: 0,
|
||||
o: 0,
|
||||
|
||||
@@ -182,7 +182,7 @@ const DashboardSensorsAnalogDialog = ({
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="o"
|
||||
label={LL.VALUE(0)}
|
||||
label={LL.VALUE(1)}
|
||||
value={numberValue(editItem.o)}
|
||||
fullWidth
|
||||
type="number"
|
||||
@@ -197,7 +197,7 @@ const DashboardSensorsAnalogDialog = ({
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="o"
|
||||
label={LL.VALUE(0)}
|
||||
label={LL.VALUE(1)}
|
||||
value={numberValue(editItem.o)}
|
||||
fullWidth
|
||||
select
|
||||
|
||||
@@ -1,20 +1,45 @@
|
||||
import CommentIcon from '@mui/icons-material/CommentTwoTone';
|
||||
import EastIcon from '@mui/icons-material/East';
|
||||
import DownloadIcon from '@mui/icons-material/GetApp';
|
||||
import GitHubIcon from '@mui/icons-material/GitHub';
|
||||
import MenuBookIcon from '@mui/icons-material/MenuBookTwoTone';
|
||||
import { Box, List, ListItem, ListItemAvatar, ListItemText, Link, Typography } from '@mui/material';
|
||||
import { Box, List, ListItem, ListItemAvatar, ListItemText, Link, Typography, Button } from '@mui/material';
|
||||
import { useRequest } from 'alova';
|
||||
import { toast } from 'react-toastify';
|
||||
import type { FC } from 'react';
|
||||
import { SectionContent, useLayoutTitle } from 'components';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
import * as EMSESP from 'project/api';
|
||||
|
||||
const Help: FC = () => {
|
||||
const { LL } = useI18nContext();
|
||||
useLayoutTitle(LL.HELP_OF(''));
|
||||
|
||||
const uploadURL = window.location.origin + '/system/upload';
|
||||
const { send: getAPI, onSuccess: onGetAPI } = useRequest((data) => EMSESP.API(data), {
|
||||
immediate: false
|
||||
});
|
||||
|
||||
onGetAPI((event) => {
|
||||
const anchor = document.createElement('a');
|
||||
anchor.href = URL.createObjectURL(
|
||||
new Blob([JSON.stringify(event.data, null, 2)], {
|
||||
type: 'text/plain'
|
||||
})
|
||||
);
|
||||
anchor.download = 'emsesp_' + event.sendArgs[0].device + '_' + event.sendArgs[0].entity + '.txt';
|
||||
anchor.click();
|
||||
URL.revokeObjectURL(anchor.href);
|
||||
toast.info(LL.DOWNLOAD_SUCCESSFUL());
|
||||
});
|
||||
|
||||
const callAPI = async (device: string, entity: string) => {
|
||||
await getAPI({ device, entity, id: 0 }).catch((error) => {
|
||||
toast.error(error.message);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<SectionContent title={LL.SUPPORT_INFORMATION()} titleGutter>
|
||||
<SectionContent title={LL.SUPPORT_INFORMATION(0)} titleGutter>
|
||||
<List>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
@@ -55,15 +80,28 @@ const Help: FC = () => {
|
||||
{LL.CLICK_HERE()}
|
||||
</Link>
|
||||
<br />
|
||||
<i>({LL.HELP_INFORMATION_4()}</i>
|
||||
<Link href={uploadURL} color="primary">
|
||||
{LL.UPLOAD()}
|
||||
</Link>
|
||||
)
|
||||
</ListItemText>
|
||||
</ListItem>
|
||||
</List>
|
||||
|
||||
<Box color="warning.main">
|
||||
<Typography mb={1} variant="body2">
|
||||
{LL.HELP_INFORMATION_4()}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={() => callAPI('system', 'info')}>
|
||||
{LL.SUPPORT_INFORMATION(0)}
|
||||
</Button>
|
||||
<Button
|
||||
sx={{ ml: 2 }}
|
||||
startIcon={<DownloadIcon />}
|
||||
variant="outlined"
|
||||
color="primary"
|
||||
onClick={() => callAPI('system', 'allvalues')}
|
||||
>
|
||||
All Values
|
||||
</Button>
|
||||
|
||||
<Box border={1} p={1} mt={4} color="orange">
|
||||
<Typography align="center" variant="subtitle1" color="orange">
|
||||
<b>{LL.HELP_INFORMATION_5()}</b>
|
||||
@@ -73,7 +111,7 @@ const Help: FC = () => {
|
||||
{'github.com/emsesp/EMS-ESP32'}
|
||||
</Link>
|
||||
</Typography>
|
||||
<Typography color="white" align="center">
|
||||
<Typography color="white" variant="subtitle2" align="center">
|
||||
@proddy @MichaelDvP
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Tab } from '@mui/material';
|
||||
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||
|
||||
import SettingsApplication from './SettingsApplication';
|
||||
import SettingsCustomEntities from './SettingsCustomEntities';
|
||||
import SettingsCustomization from './SettingsCustomization';
|
||||
import SettingsEntities from './SettingsEntities';
|
||||
import SettingsScheduler from './SettingsScheduler';
|
||||
import type { FC } from 'react';
|
||||
import { RouterTabs, useRouterTab, useLayoutTitle } from 'components';
|
||||
@@ -27,7 +27,7 @@ const Settings: FC = () => {
|
||||
<Route path="application" element={<SettingsApplication />} />
|
||||
<Route path="customization" element={<SettingsCustomization />} />
|
||||
<Route path="scheduler" element={<SettingsScheduler />} />
|
||||
<Route path="customentities" element={<SettingsEntities />} />
|
||||
<Route path="customentities" element={<SettingsCustomEntities />} />
|
||||
<Route path="*" element={<Navigate replace to="/settings/application" />} />
|
||||
</Routes>
|
||||
</>
|
||||
|
||||
@@ -384,6 +384,7 @@ const SettingsApplication: FC = () => {
|
||||
<MenuItem value="nl">Nederlands (NL)</MenuItem>
|
||||
<MenuItem value="no">Norsk (NO)</MenuItem>
|
||||
<MenuItem value="pl">Polski (PL)</MenuItem>
|
||||
<MenuItem value="sk">Slovenčina (SK)</MenuItem>
|
||||
<MenuItem value="sv">Svenska (SV)</MenuItem>
|
||||
<MenuItem value="tr">Türk (TR)</MenuItem>
|
||||
</TextField>
|
||||
@@ -644,7 +645,7 @@ const SettingsApplication: FC = () => {
|
||||
</Grid>
|
||||
)}
|
||||
{restartNeeded && (
|
||||
<MessageBox my={2} level="warning" message={LL.RESTART_TEXT()}>
|
||||
<MessageBox my={2} level="warning" message={LL.RESTART_TEXT(0)}>
|
||||
<Button startIcon={<PowerSettingsNewIcon />} variant="contained" color="error" onClick={restart}>
|
||||
{LL.RESTART()}
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import AddIcon from '@mui/icons-material/Add';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
|
||||
import RefreshIcon from '@mui/icons-material/Refresh';
|
||||
import WarningIcon from '@mui/icons-material/Warning';
|
||||
import { Button, Typography, Box } from '@mui/material';
|
||||
import { Table, Header, HeaderRow, HeaderCell, Body, Row, Cell } from '@table-library/react-table-library/table';
|
||||
@@ -11,7 +13,7 @@ import { useBlocker } from 'react-router-dom';
|
||||
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
import SettingsEntitiesDialog from './SettingsEntitiesDialog';
|
||||
import SettingsCustomEntitiesDialog from './SettingsCustomEntitiesDialog';
|
||||
import * as EMSESP from './api';
|
||||
import { DeviceValueTypeNames, DeviceValueUOM_s } from './types';
|
||||
import { entityItemValidation } from './validators';
|
||||
@@ -21,7 +23,7 @@ import { ButtonRow, FormLoader, SectionContent, BlockNavigation } from 'componen
|
||||
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
const SettingsEntities: FC = () => {
|
||||
const SettingsCustomEntities: FC = () => {
|
||||
const { LL } = useI18nContext();
|
||||
const [numChanges, setNumChanges] = useState<number>(0);
|
||||
const blocker = useBlocker(numChanges !== 0);
|
||||
@@ -43,6 +45,7 @@ const SettingsEntities: FC = () => {
|
||||
function hasEntityChanged(ei: EntityItem) {
|
||||
return (
|
||||
ei.id !== ei.o_id ||
|
||||
ei.ram !== ei.o_ram ||
|
||||
(ei?.name || '') !== (ei?.o_name || '') ||
|
||||
ei.device_id !== ei.o_device_id ||
|
||||
ei.type_id !== ei.o_type_id ||
|
||||
@@ -51,7 +54,8 @@ const SettingsEntities: FC = () => {
|
||||
ei.factor !== ei.o_factor ||
|
||||
ei.value_type !== ei.o_value_type ||
|
||||
ei.writeable !== ei.o_writeable ||
|
||||
ei.deleted !== ei.o_deleted
|
||||
ei.deleted !== ei.o_deleted ||
|
||||
(ei.value || '') !== (ei.o_value || '')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -118,6 +122,7 @@ const SettingsEntities: FC = () => {
|
||||
.filter((ei) => !ei.deleted)
|
||||
.map((condensed_ei) => ({
|
||||
id: condensed_ei.id,
|
||||
ram: condensed_ei.ram,
|
||||
name: condensed_ei.name,
|
||||
device_id: condensed_ei.device_id,
|
||||
type_id: condensed_ei.type_id,
|
||||
@@ -125,7 +130,8 @@ const SettingsEntities: FC = () => {
|
||||
factor: condensed_ei.factor,
|
||||
uom: condensed_ei.uom,
|
||||
writeable: condensed_ei.writeable,
|
||||
value_type: condensed_ei.value_type
|
||||
value_type: condensed_ei.value_type,
|
||||
value: condensed_ei.value
|
||||
}))
|
||||
})
|
||||
.then(() => {
|
||||
@@ -173,14 +179,16 @@ const SettingsEntities: FC = () => {
|
||||
setSelectedEntityItem({
|
||||
id: Math.floor(Math.random() * (Math.floor(200) - 100) + 100),
|
||||
name: '',
|
||||
device_id: '',
|
||||
type_id: '',
|
||||
ram: 0,
|
||||
device_id: '0',
|
||||
type_id: '0',
|
||||
offset: 0,
|
||||
factor: 1,
|
||||
uom: 0,
|
||||
value_type: 0,
|
||||
writeable: false,
|
||||
deleted: false
|
||||
deleted: false,
|
||||
value: ''
|
||||
});
|
||||
setDialogOpen(true);
|
||||
};
|
||||
@@ -212,18 +220,21 @@ const SettingsEntities: FC = () => {
|
||||
<HeaderCell stiff>{LL.ID_OF(LL.DEVICE())}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.ID_OF(LL.TYPE(1))}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.OFFSET()}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.VALUE(1) + ' ' + LL.TYPE(1)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.TYPE(1)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.VALUE(1)}</HeaderCell>
|
||||
</HeaderRow>
|
||||
</Header>
|
||||
<Body>
|
||||
{tableList.map((ei: EntityItem) => (
|
||||
<Row key={ei.name} item={ei} onClick={() => editEntityItem(ei)}>
|
||||
<Cell>{ei.name}</Cell>
|
||||
<Cell>{showHex(ei.device_id as number, 2)}</Cell>
|
||||
<Cell>{showHex(ei.type_id as number, 3)}</Cell>
|
||||
<Cell>{ei.offset}</Cell>
|
||||
<Cell>{DeviceValueTypeNames[ei.value_type]}</Cell>
|
||||
<Cell>
|
||||
{ei.name}
|
||||
{ei.writeable && <EditOutlinedIcon color="primary" sx={{ fontSize: 12 }} />}
|
||||
</Cell>
|
||||
<Cell>{ei.ram === 1 ? '' : showHex(ei.device_id as number, 2)}</Cell>
|
||||
<Cell>{ei.ram === 1 ? '' : showHex(ei.type_id as number, 3)}</Cell>
|
||||
<Cell>{ei.ram === 1 ? '' : ei.offset}</Cell>
|
||||
<Cell>{ei.ram === 1 ? 'RAM' : DeviceValueTypeNames[ei.value_type]}</Cell>
|
||||
<Cell>{formatValue(ei.value, ei.uom)}</Cell>
|
||||
</Row>
|
||||
))}
|
||||
@@ -244,7 +255,7 @@ const SettingsEntities: FC = () => {
|
||||
{renderEntity()}
|
||||
|
||||
{selectedEntityItem && (
|
||||
<SettingsEntitiesDialog
|
||||
<SettingsCustomEntitiesDialog
|
||||
open={dialogOpen}
|
||||
creating={creating}
|
||||
onClose={onDialogClose}
|
||||
@@ -274,7 +285,10 @@ const SettingsEntities: FC = () => {
|
||||
</Box>
|
||||
<Box flexWrap="nowrap" whiteSpace="nowrap">
|
||||
<ButtonRow>
|
||||
<Button startIcon={<AddIcon />} variant="outlined" color="secondary" onClick={addEntityItem}>
|
||||
<Button startIcon={<RefreshIcon />} variant="outlined" color="secondary" onClick={fetchEntities}>
|
||||
{LL.REFRESH()}
|
||||
</Button>
|
||||
<Button startIcon={<AddIcon />} variant="outlined" color="primary" onClick={addEntityItem}>
|
||||
{LL.ADD(0)}
|
||||
</Button>
|
||||
</ButtonRow>
|
||||
@@ -284,4 +298,4 @@ const SettingsEntities: FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default SettingsEntities;
|
||||
export default SettingsCustomEntities;
|
||||
284
interface/src/project/SettingsCustomEntitiesDialog.tsx
Normal file
284
interface/src/project/SettingsCustomEntitiesDialog.tsx
Normal file
@@ -0,0 +1,284 @@
|
||||
import AddIcon from '@mui/icons-material/Add';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import DoneIcon from '@mui/icons-material/Done';
|
||||
import RemoveIcon from '@mui/icons-material/RemoveCircleOutline';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Checkbox,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
Grid,
|
||||
InputAdornment,
|
||||
MenuItem,
|
||||
TextField
|
||||
} from '@mui/material';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { DeviceValueUOM_s, DeviceValueType } from './types';
|
||||
import type { EntityItem } from './types';
|
||||
import type Schema from 'async-validator';
|
||||
import type { ValidateFieldsError } from 'async-validator';
|
||||
|
||||
import { dialogStyle } from 'CustomTheme';
|
||||
import { BlockFormControlLabel, ValidatedTextField } from 'components';
|
||||
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
import { numberValue, updateValue } from 'utils';
|
||||
import { validate } from 'validators';
|
||||
|
||||
type SettingsCustomEntitiesDialogProps = {
|
||||
open: boolean;
|
||||
creating: boolean;
|
||||
onClose: () => void;
|
||||
onSave: (ei: EntityItem) => void;
|
||||
selectedItem: EntityItem;
|
||||
validator: Schema;
|
||||
};
|
||||
|
||||
const SettingsCustomEntitiesDialog = ({
|
||||
open,
|
||||
creating,
|
||||
onClose,
|
||||
onSave,
|
||||
selectedItem,
|
||||
validator
|
||||
}: SettingsCustomEntitiesDialogProps) => {
|
||||
const { LL } = useI18nContext();
|
||||
const [editItem, setEditItem] = useState<EntityItem>(selectedItem);
|
||||
const [fieldErrors, setFieldErrors] = useState<ValidateFieldsError>();
|
||||
const updateFormValue = updateValue(setEditItem);
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setFieldErrors(undefined);
|
||||
setEditItem(selectedItem);
|
||||
// convert to hex strings straight away
|
||||
setEditItem({
|
||||
...selectedItem,
|
||||
device_id: selectedItem.device_id.toString(16).toUpperCase(),
|
||||
type_id: selectedItem.type_id.toString(16).toUpperCase()
|
||||
});
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
|
||||
const close = () => {
|
||||
onClose();
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
try {
|
||||
setFieldErrors(undefined);
|
||||
await validate(validator, editItem);
|
||||
if (typeof editItem.device_id === 'string') {
|
||||
editItem.device_id = parseInt(editItem.device_id, 16);
|
||||
}
|
||||
if (typeof editItem.type_id === 'string') {
|
||||
editItem.type_id = parseInt(editItem.type_id, 16);
|
||||
}
|
||||
onSave(editItem);
|
||||
} catch (errors: any) {
|
||||
setFieldErrors(errors);
|
||||
}
|
||||
};
|
||||
|
||||
const remove = () => {
|
||||
editItem.deleted = true;
|
||||
onSave(editItem);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog sx={dialogStyle} open={open} onClose={close}>
|
||||
<DialogTitle>
|
||||
{creating ? LL.ADD(1) + ' ' + LL.NEW(1) : LL.EDIT()} {LL.ENTITY()}
|
||||
</DialogTitle>
|
||||
<DialogContent dividers>
|
||||
<Box display="flex" flexWrap="wrap" mb={1}>
|
||||
<Box flexWrap="nowrap" whiteSpace="nowrap" />
|
||||
</Box>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={4}>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="name"
|
||||
label={LL.NAME(0)}
|
||||
value={editItem.name}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="ram"
|
||||
label={LL.VALUE(1) + ' ' + LL.TYPE(1)}
|
||||
value={editItem.ram}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
select
|
||||
>
|
||||
<MenuItem value={0}>EMS-{LL.VALUE(1)}</MenuItem>
|
||||
<MenuItem value={1}>RAM-{LL.VALUE(1)}</MenuItem>
|
||||
</TextField>
|
||||
</Grid>
|
||||
{editItem.ram === 1 && (
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="value"
|
||||
label={LL.DEFAULT(0) + ' ' + LL.VALUE(1)}
|
||||
value={editItem.value}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
fullWidth
|
||||
margin="normal"
|
||||
/>
|
||||
</Grid>
|
||||
)}
|
||||
{editItem.ram === 0 && (
|
||||
<>
|
||||
<Grid item xs={4} mt={3}>
|
||||
<BlockFormControlLabel
|
||||
control={<Checkbox checked={editItem.writeable} onChange={updateFormValue} name="writeable" />}
|
||||
label={LL.WRITEABLE()}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="device_id"
|
||||
label={LL.ID_OF(LL.DEVICE())}
|
||||
margin="normal"
|
||||
type="string"
|
||||
fullWidth
|
||||
value={editItem.device_id as string}
|
||||
onChange={updateFormValue}
|
||||
inputProps={{ style: { textTransform: 'uppercase' } }}
|
||||
InputProps={{ startAdornment: <InputAdornment position="start">0x</InputAdornment> }}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="type_id"
|
||||
label={LL.ID_OF(LL.TYPE(1))}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
value={editItem.type_id}
|
||||
onChange={updateFormValue}
|
||||
inputProps={{ style: { textTransform: 'uppercase' } }}
|
||||
InputProps={{ startAdornment: <InputAdornment position="start">0x</InputAdornment> }}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="offset"
|
||||
label={LL.OFFSET()}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
type="number"
|
||||
value={editItem.offset}
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="value_type"
|
||||
label={LL.VALUE(1) + ' ' + LL.TYPE(1)}
|
||||
value={editItem.value_type}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
select
|
||||
>
|
||||
<MenuItem value={DeviceValueType.BOOL}>BOOL</MenuItem>
|
||||
<MenuItem value={DeviceValueType.INT}>INT</MenuItem>
|
||||
<MenuItem value={DeviceValueType.UINT}>UINT</MenuItem>
|
||||
<MenuItem value={DeviceValueType.SHORT}>SHORT</MenuItem>
|
||||
<MenuItem value={DeviceValueType.USHORT}>USHORT</MenuItem>
|
||||
<MenuItem value={DeviceValueType.ULONG}>ULONG</MenuItem>
|
||||
<MenuItem value={DeviceValueType.TIME}>TIME</MenuItem>
|
||||
<MenuItem value={DeviceValueType.STRING}>RAW</MenuItem>
|
||||
</TextField>
|
||||
</Grid>
|
||||
|
||||
{editItem.value_type !== DeviceValueType.BOOL && editItem.value_type !== DeviceValueType.STRING && (
|
||||
<>
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="factor"
|
||||
label={LL.FACTOR()}
|
||||
value={numberValue(editItem.factor)}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
fullWidth
|
||||
margin="normal"
|
||||
type="number"
|
||||
inputProps={{ step: '0.001' }}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="uom"
|
||||
label={LL.UNIT()}
|
||||
value={editItem.uom}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
onChange={updateFormValue}
|
||||
select
|
||||
>
|
||||
{DeviceValueUOM_s.map((val, i) => (
|
||||
<MenuItem key={i} value={i}>
|
||||
{val}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
</Grid>
|
||||
</>
|
||||
)}
|
||||
{editItem.value_type === DeviceValueType.STRING && editItem.device_id !== '0' && (
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="factor"
|
||||
label="Bytes"
|
||||
value={editItem.factor}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
fullWidth
|
||||
margin="normal"
|
||||
type="number"
|
||||
inputProps={{ min: '1', max: '27', step: '1' }}
|
||||
/>
|
||||
</Grid>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Grid>
|
||||
</DialogContent>
|
||||
|
||||
<DialogActions>
|
||||
{!creating && (
|
||||
<Box flexGrow={1}>
|
||||
<Button startIcon={<RemoveIcon />} variant="outlined" color="warning" onClick={remove}>
|
||||
{LL.REMOVE()}
|
||||
</Button>
|
||||
</Box>
|
||||
)}
|
||||
<Button startIcon={<CancelIcon />} variant="outlined" onClick={close} color="secondary">
|
||||
{LL.CANCEL()}
|
||||
</Button>
|
||||
<Button startIcon={creating ? <AddIcon /> : <DoneIcon />} variant="outlined" onClick={save} color="primary">
|
||||
{creating ? LL.ADD(0) : LL.UPDATE()}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default SettingsCustomEntitiesDialog;
|
||||
@@ -514,7 +514,7 @@ const SettingsCustomization: FC = () => {
|
||||
{devices && renderDeviceList()}
|
||||
{deviceEntities && renderDeviceData()}
|
||||
{restartNeeded && (
|
||||
<MessageBox my={2} level="warning" message={LL.RESTART_TEXT()}>
|
||||
<MessageBox my={2} level="warning" message={LL.RESTART_TEXT(0)}>
|
||||
<Button startIcon={<PowerSettingsNewIcon />} variant="contained" color="error" onClick={restart}>
|
||||
{LL.RESTART()}
|
||||
</Button>
|
||||
|
||||
@@ -70,7 +70,7 @@ const SettingsCustomizationDialog = ({ open, onClose, onSave, selectedItem }: Se
|
||||
<DialogContent dividers>
|
||||
<Grid container direction="row">
|
||||
<Typography variant="body2" color="warning.main">
|
||||
{LL.ENTITY() + ' ID'}:
|
||||
{LL.ID_OF(LL.ENTITY())}:
|
||||
</Typography>
|
||||
<Typography variant="body2">{editItem.id}</Typography>
|
||||
</Grid>
|
||||
|
||||
@@ -1,252 +0,0 @@
|
||||
import AddIcon from '@mui/icons-material/Add';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import DoneIcon from '@mui/icons-material/Done';
|
||||
import RemoveIcon from '@mui/icons-material/RemoveCircleOutline';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Checkbox,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
Grid,
|
||||
InputAdornment,
|
||||
MenuItem,
|
||||
TextField
|
||||
} from '@mui/material';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { DeviceValueUOM_s, DeviceValueType } from './types';
|
||||
import type { EntityItem } from './types';
|
||||
import type Schema from 'async-validator';
|
||||
import type { ValidateFieldsError } from 'async-validator';
|
||||
|
||||
import { dialogStyle } from 'CustomTheme';
|
||||
import { BlockFormControlLabel, ValidatedTextField } from 'components';
|
||||
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
import { updateValue } from 'utils';
|
||||
import { validate } from 'validators';
|
||||
|
||||
type SettingsEntitiesDialogProps = {
|
||||
open: boolean;
|
||||
creating: boolean;
|
||||
onClose: () => void;
|
||||
onSave: (ei: EntityItem) => void;
|
||||
selectedItem: EntityItem;
|
||||
validator: Schema;
|
||||
};
|
||||
|
||||
const SettingsEntitiesDialog = ({
|
||||
open,
|
||||
creating,
|
||||
onClose,
|
||||
onSave,
|
||||
selectedItem,
|
||||
validator
|
||||
}: SettingsEntitiesDialogProps) => {
|
||||
const { LL } = useI18nContext();
|
||||
const [editItem, setEditItem] = useState<EntityItem>(selectedItem);
|
||||
const [fieldErrors, setFieldErrors] = useState<ValidateFieldsError>();
|
||||
const updateFormValue = updateValue(setEditItem);
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setFieldErrors(undefined);
|
||||
setEditItem(selectedItem);
|
||||
// convert to hex strings straight away
|
||||
setEditItem({
|
||||
...selectedItem,
|
||||
device_id: selectedItem.device_id.toString(16).toUpperCase(),
|
||||
type_id: selectedItem.type_id.toString(16).toUpperCase()
|
||||
});
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
|
||||
const close = () => {
|
||||
onClose();
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
try {
|
||||
setFieldErrors(undefined);
|
||||
await validate(validator, editItem);
|
||||
if (typeof editItem.device_id === 'string') {
|
||||
editItem.device_id = parseInt(editItem.device_id, 16);
|
||||
}
|
||||
if (typeof editItem.type_id === 'string') {
|
||||
editItem.type_id = parseInt(editItem.type_id, 16);
|
||||
}
|
||||
onSave(editItem);
|
||||
} catch (errors: any) {
|
||||
setFieldErrors(errors);
|
||||
}
|
||||
};
|
||||
|
||||
const remove = () => {
|
||||
editItem.deleted = true;
|
||||
onSave(editItem);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog sx={dialogStyle} open={open} onClose={close}>
|
||||
<DialogTitle>
|
||||
{creating ? LL.ADD(1) + ' ' + LL.NEW(1) : LL.EDIT()} {LL.ENTITY()}
|
||||
</DialogTitle>
|
||||
<DialogContent dividers>
|
||||
<Box display="flex" flexWrap="wrap" mb={1}>
|
||||
<Box flexWrap="nowrap" whiteSpace="nowrap" />
|
||||
</Box>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={8}>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="name"
|
||||
label={LL.NAME(0)}
|
||||
value={editItem.name}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} mt={3}>
|
||||
<BlockFormControlLabel
|
||||
control={<Checkbox checked={editItem.writeable} onChange={updateFormValue} name="writeable" />}
|
||||
label={LL.WRITEABLE()}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="device_id"
|
||||
label={LL.ID_OF(LL.DEVICE())}
|
||||
margin="normal"
|
||||
type="string"
|
||||
fullWidth
|
||||
value={editItem.device_id as string}
|
||||
onChange={updateFormValue}
|
||||
inputProps={{ style: { textTransform: 'uppercase' } }}
|
||||
InputProps={{ startAdornment: <InputAdornment position="start">0x</InputAdornment> }}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="type_id"
|
||||
label={LL.ID_OF(LL.TYPE(1))}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
value={editItem.type_id}
|
||||
onChange={updateFormValue}
|
||||
inputProps={{ style: { textTransform: 'uppercase' } }}
|
||||
InputProps={{ startAdornment: <InputAdornment position="start">0x</InputAdornment> }}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="offset"
|
||||
label={LL.OFFSET()}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
type="number"
|
||||
value={editItem.offset}
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="value_type"
|
||||
label={LL.VALUE(1) + ' ' + LL.TYPE(1)}
|
||||
value={editItem.value_type}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
select
|
||||
>
|
||||
<MenuItem value={DeviceValueType.BOOL}>BOOL</MenuItem>
|
||||
<MenuItem value={DeviceValueType.INT}>INT</MenuItem>
|
||||
<MenuItem value={DeviceValueType.UINT}>UINT</MenuItem>
|
||||
<MenuItem value={DeviceValueType.SHORT}>SHORT</MenuItem>
|
||||
<MenuItem value={DeviceValueType.USHORT}>USHORT</MenuItem>
|
||||
<MenuItem value={DeviceValueType.ULONG}>ULONG</MenuItem>
|
||||
<MenuItem value={DeviceValueType.TIME}>TIME</MenuItem>
|
||||
<MenuItem value={DeviceValueType.STRING}>RAW</MenuItem>
|
||||
</TextField>
|
||||
</Grid>
|
||||
|
||||
{editItem.value_type !== DeviceValueType.BOOL && editItem.value_type !== DeviceValueType.STRING && (
|
||||
<>
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="factor"
|
||||
label={LL.FACTOR()}
|
||||
value={editItem.factor}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
fullWidth
|
||||
margin="normal"
|
||||
type="number"
|
||||
inputProps={{ step: '0.001' }}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="uom"
|
||||
label={LL.UNIT()}
|
||||
value={editItem.uom}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
onChange={updateFormValue}
|
||||
select
|
||||
>
|
||||
{DeviceValueUOM_s.map((val, i) => (
|
||||
<MenuItem key={i} value={i}>
|
||||
{val}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
</Grid>
|
||||
</>
|
||||
)}
|
||||
{editItem.value_type === DeviceValueType.STRING && (
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="factor"
|
||||
label="Bytes"
|
||||
value={editItem.factor}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
fullWidth
|
||||
margin="normal"
|
||||
type="number"
|
||||
inputProps={{ min: '1', max: '27', step: '1' }}
|
||||
/>
|
||||
</Grid>
|
||||
)}
|
||||
</Grid>
|
||||
</DialogContent>
|
||||
|
||||
<DialogActions>
|
||||
{!creating && (
|
||||
<Box flexGrow={1}>
|
||||
<Button startIcon={<RemoveIcon />} variant="outlined" color="warning" onClick={remove}>
|
||||
{LL.REMOVE()}
|
||||
</Button>
|
||||
</Box>
|
||||
)}
|
||||
<Button startIcon={<CancelIcon />} variant="outlined" onClick={close} color="secondary">
|
||||
{LL.CANCEL()}
|
||||
</Button>
|
||||
<Button startIcon={creating ? <AddIcon /> : <DoneIcon />} variant="outlined" onClick={save} color="primary">
|
||||
{creating ? LL.ADD(0) : LL.UPDATE()}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default SettingsEntitiesDialog;
|
||||
@@ -208,7 +208,7 @@ const SettingsScheduler: FC = () => {
|
||||
<HeaderCell stiff>{LL.SCHEDULE(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.TIME(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.COMMAND(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.VALUE(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.VALUE(1)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.NAME(0)}</HeaderCell>
|
||||
</HeaderRow>
|
||||
</Header>
|
||||
|
||||
@@ -19,7 +19,8 @@ import { alovaInstance } from 'api/endpoints';
|
||||
export const readCoreData = () => alovaInstance.Get<CoreData>(`/rest/coreData`);
|
||||
export const readDeviceData = (id: number) =>
|
||||
alovaInstance.Get<DeviceData>('/rest/deviceData', {
|
||||
params: { id },
|
||||
// alovaInstance.Get<DeviceData>(`/rest/deviceData/${id}`, {
|
||||
params: { id }, // TODO replace later with id
|
||||
responseType: 'arraybuffer' // uses msgpack
|
||||
});
|
||||
export const writeDeviceValue = (data: any) => alovaInstance.Post('/rest/writeDeviceValue', data);
|
||||
@@ -53,8 +54,9 @@ export const getSchedule = () => alovaInstance.Get('/rest/getSchedule');
|
||||
|
||||
// SettingsCustomization
|
||||
export const readDeviceEntities = (id: number) =>
|
||||
alovaInstance.Get<DeviceEntity[]>('/rest/deviceEntities', {
|
||||
params: { id },
|
||||
// alovaInstance.Get<DeviceEntity[]>(`/rest/deviceEntities/${id}`, {
|
||||
alovaInstance.Get<DeviceEntity[]>(`/rest/deviceEntities`, {
|
||||
params: { id }, // TODO replace later with id
|
||||
responseType: 'arraybuffer',
|
||||
transformData(data: any) {
|
||||
return data.map((de: DeviceEntity) => ({ ...de, o_m: de.m, o_cn: de.cn, o_mi: de.mi, o_ma: de.ma }));
|
||||
@@ -86,7 +88,7 @@ export const writeSchedule = (data: any) => alovaInstance.Post('/rest/schedule',
|
||||
|
||||
// SettingsEntities
|
||||
export const readCustomEntities = () =>
|
||||
alovaInstance.Get<EntityItem[]>('/rest/customentities', {
|
||||
alovaInstance.Get<EntityItem[]>('/rest/customEntities', {
|
||||
name: 'entities',
|
||||
transformData(data: any) {
|
||||
return data.entities.map((ei: EntityItem) => ({
|
||||
@@ -104,4 +106,4 @@ export const readCustomEntities = () =>
|
||||
}));
|
||||
}
|
||||
});
|
||||
export const writeCustomEntities = (data: any) => alovaInstance.Post('/rest/customentities', data);
|
||||
export const writeCustomEntities = (data: any) => alovaInstance.Post('/rest/customEntities', data);
|
||||
|
||||
@@ -130,7 +130,7 @@ export interface DeviceValue {
|
||||
c?: string; // command, optional
|
||||
l?: string[]; // list, optional
|
||||
h?: string; // help text, optional
|
||||
s?: number; // steps for up/down, optional
|
||||
s?: string; // steps for up/down, optional
|
||||
m?: number; // min, optional
|
||||
x?: number; // max, optional
|
||||
}
|
||||
@@ -177,7 +177,8 @@ export enum DeviceValueUOM {
|
||||
L,
|
||||
KMIN,
|
||||
K,
|
||||
VOLTS
|
||||
VOLTS,
|
||||
MBAR
|
||||
}
|
||||
|
||||
export const DeviceValueUOM_s = [
|
||||
@@ -204,7 +205,8 @@ export const DeviceValueUOM_s = [
|
||||
'l',
|
||||
'K*min',
|
||||
'K',
|
||||
'V'
|
||||
'V',
|
||||
'mbar'
|
||||
];
|
||||
|
||||
export enum AnalogType {
|
||||
@@ -223,12 +225,12 @@ export enum AnalogType {
|
||||
|
||||
export const AnalogTypeNames = [
|
||||
'(disabled)',
|
||||
'Digital in',
|
||||
'Digital In',
|
||||
'Counter',
|
||||
'ADC',
|
||||
'Timer',
|
||||
'Rate',
|
||||
'Digital out',
|
||||
'Digital Out',
|
||||
'PWM 0',
|
||||
'PWM 1',
|
||||
'PWM 2'
|
||||
@@ -323,6 +325,7 @@ export enum ScheduleFlag {
|
||||
|
||||
export interface EntityItem {
|
||||
id: number; // unique number
|
||||
ram: number;
|
||||
name: string;
|
||||
device_id: number | string;
|
||||
type_id: number | string;
|
||||
@@ -334,6 +337,7 @@ export interface EntityItem {
|
||||
writeable: boolean;
|
||||
deleted?: boolean;
|
||||
o_id?: number;
|
||||
o_ram?: number;
|
||||
o_name?: string;
|
||||
o_device_id?: number | string;
|
||||
o_type_id?: number | string;
|
||||
@@ -343,6 +347,7 @@ export interface EntityItem {
|
||||
o_value_type?: number;
|
||||
o_deleted?: boolean;
|
||||
o_writeable?: boolean;
|
||||
o_value?: any;
|
||||
}
|
||||
|
||||
export interface Entities {
|
||||
@@ -387,6 +392,7 @@ export const enum DeviceValueType {
|
||||
}
|
||||
|
||||
export const DeviceValueTypeNames = [
|
||||
//
|
||||
'BOOL',
|
||||
'INT',
|
||||
'UINT',
|
||||
@@ -395,6 +401,6 @@ export const DeviceValueTypeNames = [
|
||||
'ULONG',
|
||||
'TIME',
|
||||
'ENUM',
|
||||
'STRING',
|
||||
'RAW',
|
||||
'CMD'
|
||||
];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export * from './ap';
|
||||
export * from './features';
|
||||
export * from './me';
|
||||
export * from './mqtt';
|
||||
export * from './ntp';
|
||||
|
||||
@@ -25,6 +25,7 @@ export interface MqttSettings {
|
||||
port: number;
|
||||
base: string;
|
||||
rootCA?: string;
|
||||
enableTLS?: boolean;
|
||||
username: string;
|
||||
password: string;
|
||||
client_id: string;
|
||||
|
||||
@@ -33,6 +33,7 @@ export interface NetworkStatus {
|
||||
gateway_ip: string;
|
||||
dns_ip_1: string;
|
||||
dns_ip_2: string;
|
||||
hostname: string;
|
||||
}
|
||||
|
||||
export interface NetworkSettings {
|
||||
@@ -41,7 +42,7 @@ export interface NetworkSettings {
|
||||
password: string;
|
||||
hostname: string;
|
||||
static_ip_config: boolean;
|
||||
enableIPv6: boolean;
|
||||
enableIPv6?: boolean;
|
||||
bandwidth20: boolean;
|
||||
nosleep: boolean;
|
||||
tx_power: number;
|
||||
|
||||
@@ -9,7 +9,6 @@ export interface NTPStatus {
|
||||
utc_time: string;
|
||||
local_time: string;
|
||||
server: string;
|
||||
uptime: number;
|
||||
}
|
||||
|
||||
export interface NTPSettings {
|
||||
|
||||
@@ -2,9 +2,14 @@ export interface SystemStatus {
|
||||
emsesp_version: string;
|
||||
esp_platform: string;
|
||||
max_alloc_heap: number;
|
||||
cpu_type: string;
|
||||
cpu_rev: number;
|
||||
cpu_cores: number;
|
||||
cpu_freq_mhz: number;
|
||||
free_heap: number;
|
||||
arduino_version: string;
|
||||
sdk_version: string;
|
||||
partition: string;
|
||||
flash_chip_size: number;
|
||||
flash_chip_speed: number;
|
||||
app_used: number;
|
||||
|
||||
@@ -33,7 +33,7 @@ export const useRest = <D>({ read, update }: RestRequestOptions2<D>) => {
|
||||
};
|
||||
|
||||
onWriteSuccess(() => {
|
||||
toast.success(LL.UPDATED_OF(LL.SETTINGS()));
|
||||
toast.success(LL.UPDATED_OF(LL.SETTINGS(0)));
|
||||
setDirtyFlags([]);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
import { debounce } from 'lodash-es';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import Sockette from 'sockette';
|
||||
|
||||
import { addAccessTokenParameter } from 'api/authentication';
|
||||
|
||||
interface WebSocketIdMessage {
|
||||
type: 'id';
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface WebSocketPayloadMessage<D> {
|
||||
type: 'payload';
|
||||
origin_id: string;
|
||||
payload: D;
|
||||
}
|
||||
|
||||
export type WebSocketMessage<D> = WebSocketIdMessage | WebSocketPayloadMessage<D>;
|
||||
|
||||
export const useWs = <D>(wsUrl: string, wsThrottle = 100) => {
|
||||
const ws = useRef<Sockette>();
|
||||
const clientId = useRef<string>();
|
||||
|
||||
const [connected, setConnected] = useState<boolean>(false);
|
||||
const [data, setData] = useState<D>();
|
||||
const [transmit, setTransmit] = useState<boolean>();
|
||||
const [clear, setClear] = useState<boolean>();
|
||||
|
||||
const onMessage = useCallback((event: MessageEvent) => {
|
||||
const rawData = event.data;
|
||||
if (typeof rawData === 'string' || rawData instanceof String) {
|
||||
const message = JSON.parse(rawData as string) as WebSocketMessage<D>;
|
||||
switch (message.type) {
|
||||
case 'id':
|
||||
clientId.current = message.id;
|
||||
break;
|
||||
case 'payload':
|
||||
if (clientId.current) {
|
||||
setData((existingData) => (clientId.current === message.origin_id && existingData) || message.payload);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
const doSaveData = useCallback((newData: D, clearData = false) => {
|
||||
if (!ws.current) {
|
||||
return;
|
||||
}
|
||||
if (clearData) {
|
||||
setData(undefined);
|
||||
}
|
||||
ws.current.json(newData);
|
||||
}, []);
|
||||
|
||||
const saveData = useRef(debounce(doSaveData, wsThrottle));
|
||||
|
||||
const updateData = (newData: React.SetStateAction<D | undefined>, transmitData: true, clearData: false) => {
|
||||
setData(newData);
|
||||
setTransmit(transmitData);
|
||||
setClear(clearData);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!transmit) {
|
||||
return;
|
||||
}
|
||||
data && saveData.current(data, clear);
|
||||
setTransmit(false);
|
||||
setClear(false);
|
||||
}, [doSaveData, data, transmit, clear]);
|
||||
|
||||
useEffect(() => {
|
||||
const instance = new Sockette(addAccessTokenParameter(wsUrl), {
|
||||
onmessage: onMessage,
|
||||
onopen: () => {
|
||||
setConnected(true);
|
||||
},
|
||||
onclose: () => {
|
||||
clientId.current = undefined;
|
||||
setConnected(false);
|
||||
setData(undefined);
|
||||
}
|
||||
});
|
||||
ws.current = instance;
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
return instance.close;
|
||||
}, [wsUrl, onMessage]);
|
||||
|
||||
return { connected, data, updateData } as const;
|
||||
};
|
||||
@@ -14,9 +14,5 @@ export const createNetworkSettingsValidator = (networkSettings: NetworkSettings)
|
||||
subnet_mask: [{ required: true, message: 'Subnet mask is required' }, IP_ADDRESS_VALIDATOR],
|
||||
dns_ip_1: IP_ADDRESS_VALIDATOR,
|
||||
dns_ip_2: IP_ADDRESS_VALIDATOR
|
||||
}),
|
||||
tx_power: [
|
||||
{ required: true, message: 'Tx Power is required' },
|
||||
{ type: 'number', min: 0, max: 20, message: 'Tx Power must be between 0 and 20dBm' }
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ export const IP_ADDRESS_VALIDATOR = {
|
||||
}
|
||||
};
|
||||
|
||||
const HOSTNAME_LENGTH_REGEXP = /^.{0,63}$/;
|
||||
const HOSTNAME_LENGTH_REGEXP = /^.{0,200}$/;
|
||||
const HOSTNAME_PATTERN_REGEXP =
|
||||
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/;
|
||||
|
||||
@@ -42,7 +42,7 @@ const isValidHostname = (value: string) => HOSTNAME_LENGTH_REGEXP.test(value) &&
|
||||
export const HOSTNAME_VALIDATOR = {
|
||||
validator(rule: InternalRuleItem, value: string, callback: (error?: string) => void) {
|
||||
if (value && !isValidHostname(value)) {
|
||||
callback('Must be a valid hostname of up to 63 characters');
|
||||
callback('Must be a valid hostname');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export const HOSTNAME_VALIDATOR = {
|
||||
export const IP_OR_HOSTNAME_VALIDATOR = {
|
||||
validator(rule: InternalRuleItem, value: string, callback: (error?: string) => void) {
|
||||
if (value && !(isValidIpAddress(value) || isValidHostname(value))) {
|
||||
callback('Must be a valid IP address or hostname of up to 63 characters');
|
||||
callback('Must be a valid IP address or hostname');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { defineConfig, splitVendorChunkPlugin } from 'vite';
|
||||
import viteTsconfigPaths from 'vite-tsconfig-paths';
|
||||
import preact from '@preact/preset-vite';
|
||||
import viteImagemin from 'vite-plugin-imagemin';
|
||||
@@ -44,6 +44,7 @@ export default defineConfig(({ command, mode }) => {
|
||||
plugins: [
|
||||
preact(),
|
||||
viteTsconfigPaths(),
|
||||
splitVendorChunkPlugin(),
|
||||
{
|
||||
...viteImagemin({
|
||||
verbose: false,
|
||||
@@ -112,6 +113,20 @@ export default defineConfig(({ command, mode }) => {
|
||||
nameCache: null,
|
||||
safari10: false,
|
||||
toplevel: false
|
||||
},
|
||||
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id: string) {
|
||||
if (id.includes('node_modules')) {
|
||||
// creating a chunk to react routes deps. Reducing the vendor chunk size
|
||||
if (id.includes('react-router-dom') || id.includes('@remix-run') || id.includes('react-router')) {
|
||||
return '@react-router';
|
||||
}
|
||||
return 'vendor';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
3933
interface/yarn.lock
3933
interface/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user