diff --git a/.gitignore b/.gitignore index f7be0a8b2..387e569b9 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,6 @@ interface/tsconfig.tsbuildinfo # python virtual environment venv/ + +# cspell +words-found-verbose.txt diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 92ffba0d3..e9dc87b96 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -39,6 +39,7 @@ - command 'show log' that lists out the current weblog buffer, showing last messages. - default web log buffer to 25 lines for ESP32s with no PSRAM - Try and determine correct board profile if none is set +- Auto Scroll in WebLog UI - reduced delay so incoming logs are faster ## Fixed diff --git a/cspell.json b/cspell.json new file mode 100644 index 000000000..f617c827b --- /dev/null +++ b/cspell.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", + "version": "0.2", + "dictionaryDefinitions": [ + { + "name": "project-words", + "path": "./project-words.txt", + "addWords": true + } + ], + "dictionaries": ["project-words"], + "ignorePaths": ["node_modules", "**/venv/**", "lib/eModbus", "lib/ESPAsyncWebServer", "lib/espMqttClient", "analyse.html", "dist", "**/*.csv", "locale_translations.h", "TZ.tsx", "**/*.txt","build/**", "**/i18n/**", "/project-words.txt"] + } \ No newline at end of file diff --git a/interface/package.json b/interface/package.json index 13e7ee4bd..18e2225dd 100644 --- a/interface/package.json +++ b/interface/package.json @@ -1,9 +1,9 @@ { "name": "EMS-ESP", - "version": "3.7", - "description": "Build the EMS-ESP WebUI", + "version": "3.7.0", + "description": "EMS-ESP WebUI", "homepage": "https://emsesp.org", - "author": "proddy", + "author": "proddy, emsesp.org", "license": "MIT", "private": true, "type": "module", @@ -24,8 +24,8 @@ "@alova/adapter-xhr": "2.0.7", "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", - "@mui/icons-material": "^6.0.2", - "@mui/material": "^6.0.2", + "@mui/icons-material": "^6.1.0", + "@mui/material": "^6.1.0", "@table-library/react-table-library": "4.1.7", "alova": "3.0.16", "async-validator": "^4.2.5", @@ -43,16 +43,15 @@ "devDependencies": { "@babel/core": "^7.25.2", "@eslint/js": "^9.10.0", - "@preact/compat": "^17.1.2", + "@preact/compat": "^18.3.1", "@preact/preset-vite": "^2.9.0", "@trivago/prettier-plugin-sort-imports": "^4.3.0", - "@types/babel__core": "^7", "@types/formidable": "^3", "@types/node": "^22.5.4", "@types/react": "^18.3.5", "@types/react-dom": "^18.3.0", "@types/react-router-dom": "^5.3.3", - "concurrently": "^9.0.0", + "concurrently": "^9.0.1", "eslint": "^9.10.0", "eslint-config-prettier": "^9.1.0", "formidable": "^3.5.1", @@ -64,5 +63,5 @@ "vite-plugin-imagemin": "^0.6.1", "vite-tsconfig-paths": "^5.0.1" }, - "packageManager": "yarn@4.4.0" + "packageManager": "yarn@4.4.1" } diff --git a/interface/src/api/endpoints.ts b/interface/src/api/endpoints.ts index 2df9486cd..08f5dea0f 100644 --- a/interface/src/api/endpoints.ts +++ b/interface/src/api/endpoints.ts @@ -22,7 +22,7 @@ export const alovaInstance = createAlova({ method.config.headers.Authorization = 'Bearer ' + localStorage.getItem(ACCESS_TOKEN); } - // for simualting vrey slow networks + // for simulating vrey slow networks // return new Promise((resolve) => { // const random = 3000 + Math.random() * 2000; // setTimeout(resolve, Math.floor(random)); diff --git a/interface/src/api/system.ts b/interface/src/api/system.ts index 0b550c307..6585a0b85 100644 --- a/interface/src/api/system.ts +++ b/interface/src/api/system.ts @@ -15,7 +15,6 @@ export const readLogSettings = () => alovaInstance.Get(`/rest/logSettings`); export const updateLogSettings = (data: LogSettings) => alovaInstance.Post('/rest/logSettings', data); -export const fetchLog = () => alovaInstance.Post('/rest/fetchLog'); export const fetchLogES = () => alovaInstance.Get('/es/log'); // Get versions from github diff --git a/interface/src/app/settings/DownloadUpload.tsx b/interface/src/app/settings/DownloadUpload.tsx index c2365e51a..11dc3f45a 100644 --- a/interface/src/app/settings/DownloadUpload.tsx +++ b/interface/src/app/settings/DownloadUpload.tsx @@ -143,7 +143,6 @@ const DownloadUpload = () => { if (!latestVersion || !latestDevVersion) { return ''; } - console.log('getBinURL', useDevVersion, latestDevVersion, latestVersion); const filename = 'EMS-ESP-' + (useDevVersion ? latestDevVersion : latestVersion).replaceAll('.', '_') + diff --git a/interface/src/app/status/SystemLog.tsx b/interface/src/app/status/SystemLog.tsx index 436bbb323..13c0235c6 100644 --- a/interface/src/app/status/SystemLog.tsx +++ b/interface/src/app/status/SystemLog.tsx @@ -6,12 +6,7 @@ import WarningIcon from '@mui/icons-material/Warning'; import { Box, Button, Checkbox, MenuItem, TextField, styled } from '@mui/material'; import Grid from '@mui/material/Grid2'; -import { - fetchLog, - fetchLogES, - readLogSettings, - updateLogSettings -} from 'api/system'; +import { fetchLogES, readLogSettings, updateLogSettings } from 'api/system'; import { useRequest, useSSE } from 'alova/client'; import { @@ -86,7 +81,7 @@ const SystemLog = () => { }); const [logEntries, setLogEntries] = useState([]); - const [lastIndex, setLastIndex] = useState(0); + const [autoscroll, setAutoscroll] = useState(true); const updateFormValue = updateValueDirty( origData, @@ -95,28 +90,18 @@ const SystemLog = () => { updateDataValue ); - // eslint-disable-next-line @typescript-eslint/unbound-method - const { onMessage, onError } = useSSE(fetchLogES, { - // withCredentials: true, + useSSE(fetchLogES, { immediate: true, interceptByGlobalResponded: false - }); - - onMessage((message: { id: number; data: string }) => { - const rawData = message.data; - const logentry = JSON.parse(rawData) as LogEntry; - if (logentry.i > lastIndex) { - setLastIndex(logentry.i); + }) + .onMessage((message: { id: number; data: string }) => { + const rawData = message.data; + const logentry = JSON.parse(rawData) as LogEntry; setLogEntries((log) => [...log, logentry]); - } - }); - - onError(() => { - toast.error('No connection to Log server'); - }); - - // called on page load to reset pointer and fetch all log entries - useRequest(fetchLog()); + }) + .onError(() => { + toast.error('No connection to Log service'); + }); const paddedLevelLabel = (level: LogLevel) => { const label = levelLabel(level); @@ -157,7 +142,7 @@ const SystemLog = () => { // handle scrolling const ref = useRef(null); useEffect(() => { - if (logEntries.length) { + if (logEntries.length && autoscroll) { ref.current?.scrollIntoView({ behavior: 'smooth', block: 'end' @@ -173,12 +158,12 @@ const SystemLog = () => { return ( <> - + { {data.psram && ( - + { } label={LL.COMPACT()} /> + setAutoscroll(!autoscroll)} + name="autoscroll" + /> + } + label={LL.AUTO_SCROLL()} + />