From a8aad31836b18a3e3ba09bede6cfb8cf3108d372 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:18:56 +0100 Subject: [PATCH 1/9] build(deps): bump tj-actions/changed-files from 23 to 41 (#1727) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 23 to 41. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v23...v41) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/auto-analyze.yml | 2 +- .github/workflows/check_locale.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-analyze.yml b/.github/workflows/auto-analyze.yml index a68e27837..6f0c1e736 100644 --- a/.github/workflows/auto-analyze.yml +++ b/.github/workflows/auto-analyze.yml @@ -19,7 +19,7 @@ jobs: - name: Check package.json was changed id: changed-file-package-json - uses: tj-actions/changed-files@v23 + uses: tj-actions/changed-files@v41 with: sha: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/check_locale.yml b/.github/workflows/check_locale.yml index 58f8b4b80..389ae7aa9 100644 --- a/.github/workflows/check_locale.yml +++ b/.github/workflows/check_locale.yml @@ -28,7 +28,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v23 + uses: tj-actions/changed-files@v41 with: sha: ${{ github.event.pull_request.head.sha }} files: 'src/locales/*.json' From 35c59dfeebdee8ad768ebe2427f4b439e4ffd20c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Jan 2024 07:40:54 +0100 Subject: [PATCH 2/9] build(deps): bump follow-redirects from 1.15.3 to 1.15.4 (#1742) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.3 to 1.15.4. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.3...v1.15.4) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index dbc5c6d17..3b37bde6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6118,9 +6118,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "funding": [ { "type": "individual", From e932cb92b0358cb6c40b1b78f21a8a93cac91bb1 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 13 Jan 2024 00:23:37 +0100 Subject: [PATCH 3/9] chore: update github issue bot text (#1743) Signed-off-by: Stefan Dej --- .github/label-actions.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/label-actions.yml b/.github/label-actions.yml index 20f85fd45..0e1b962a8 100644 --- a/.github/label-actions.yml +++ b/.github/label-actions.yml @@ -1,6 +1,6 @@ # Configuration for Label Actions - https://github.com/dessant/label-actions -not on Github: +not an Issue: issues: comment: | Ahoi! @@ -9,10 +9,12 @@ not on Github: Many helpful people will not see your message here and you are unlikely to get a useful response. - We use github to handle bugreports, feature requests and - planning new releases. + We use the Github Issue-Tracker only for development related + topics. Like feature requests, bug reports etc. To get help + please us our Discord-Server or Github Discussions: - Please use our Discord-Server for help: [discord.gg/mainsail](https://discord.gg/mainsail) + - [discord.gg/mainsail](https://discord.gg/mainsail) + - [GitHub Discussions](https://github.com/orgs/mainsail-crew/discussions) This ticket will be automatically closed. From 4ae21da04603684293fdb4e52d453bc4d79f0793 Mon Sep 17 00:00:00 2001 From: FOG_Yamato Date: Sun, 14 Jan 2024 10:12:01 +0200 Subject: [PATCH 4/9] fix: incorrect scaling of images in dialogImage (#1746) This fixes the squishing of big images in the config file preview window. Scales image down while preserving the original aspect ratio. Signed-off-by: Simion Balanuta --- src/components/panels/Machine/ConfigFilesPanel.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/panels/Machine/ConfigFilesPanel.vue b/src/components/panels/Machine/ConfigFilesPanel.vue index 23e2c8085..b289778ad 100644 --- a/src/components/panels/Machine/ConfigFilesPanel.vue +++ b/src/components/panels/Machine/ConfigFilesPanel.vue @@ -260,7 +260,7 @@ image
From 8da01c16910cb4da075bc6217e077b8eb1525626 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 Jan 2024 07:56:13 +0100 Subject: [PATCH 5/9] build(deps-dev): bump vite from 4.4.12 to 4.5.2 (#1751) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.4.12 to 4.5.2. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v4.5.2/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.5.2/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3b37bde6d..b6136ad33 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,7 +79,7 @@ "start-server-and-test": "^2.0.0", "typescript": "^4.5.5", "unplugin-vue-components": "^0.22.12", - "vite": "^4.4.12", + "vite": "^4.5.2", "vite-plugin-checker": "^0.6.0", "vite-plugin-package-version": "^1.0.2", "vite-plugin-pwa": "^0.16.4", @@ -9593,9 +9593,9 @@ } }, "node_modules/vite": { - "version": "4.4.12", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.12.tgz", - "integrity": "sha512-KtPlUbWfxzGVul8Nut8Gw2Qe8sBzWY+8QVc5SL8iRFnpnrcoCaNlzO40c1R6hPmcdTwIPEDkq0Y9+27a5tVbdQ==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", + "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", "dev": true, "dependencies": { "esbuild": "^0.18.10", diff --git a/package.json b/package.json index f88d311a1..1a750f4a2 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "start-server-and-test": "^2.0.0", "typescript": "^4.5.5", "unplugin-vue-components": "^0.22.12", - "vite": "^4.4.12", + "vite": "^4.5.2", "vite-plugin-checker": "^0.6.0", "vite-plugin-package-version": "^1.0.2", "vite-plugin-pwa": "^0.16.4", From 3ed9a9bb25ea0a03ea281d38b3a766a30d6d033c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 20 Jan 2024 21:31:38 +0100 Subject: [PATCH 6/9] chore: fix typo in bot text (#1748) Signed-off-by: Stefan Dej --- .github/label-actions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/label-actions.yml b/.github/label-actions.yml index 0e1b962a8..47540368c 100644 --- a/.github/label-actions.yml +++ b/.github/label-actions.yml @@ -10,8 +10,8 @@ not an Issue: unlikely to get a useful response. We use the Github Issue-Tracker only for development related - topics. Like feature requests, bug reports etc. To get help - please us our Discord-Server or Github Discussions: + topics, like feature requests, bug reports etc. To get help, + please join our Discord-Server or ask in Github Discussions: - [discord.gg/mainsail](https://discord.gg/mainsail) - [GitHub Discussions](https://github.com/orgs/mainsail-crew/discussions) From 3a04c3648578eebd4704eef04209c9b49f46ddad Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 20 Jan 2024 21:31:58 +0100 Subject: [PATCH 7/9] fix: show extruder extra menu without load/unload macros (#1747) Signed-off-by: Stefan Dej --- src/components/panels/ExtruderControlPanel.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/panels/ExtruderControlPanel.vue b/src/components/panels/ExtruderControlPanel.vue index c2e3349aa..ddd27375f 100644 --- a/src/components/panels/ExtruderControlPanel.vue +++ b/src/components/panels/ExtruderControlPanel.vue @@ -180,7 +180,12 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin } get showFilamentMacros(): boolean { - return this.loadFilamentMacro !== undefined || this.unloadFilamentMacro !== undefined + return ( + this.loadFilamentMacro !== undefined || + this.unloadFilamentMacro !== undefined || + this.purgeFilamentMacro !== undefined || + this.cleanNozzleMacro !== undefined + ) } get showTools(): boolean { From d34aa649c8b42f3b75efa985256d8228aa0428b3 Mon Sep 17 00:00:00 2001 From: Paolo Paterna Date: Fri, 26 Jan 2024 09:44:54 +0100 Subject: [PATCH 8/9] chore(deps): Update @sindarius/gcodeviewer (#1755) Update @sindarius/gcodeviewer to latest so it works also with gcode files generated by OrcaSlicer --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index b6136ad33..011e9f425 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@codemirror/view": "^6.0.3", "@jaames/iro": "^5.5.2", "@lezer/highlight": "^1.0.0", - "@sindarius/gcodeviewer": "^3.2.2", + "@sindarius/gcodeviewer": "^3.7.6", "@uiw/codemirror-theme-vscode": "^4.19.11", "axios": "^1.6.0", "codemirror": "^6.0.1", diff --git a/package.json b/package.json index 1a750f4a2..c2c31dfc2 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@codemirror/view": "^6.0.3", "@jaames/iro": "^5.5.2", "@lezer/highlight": "^1.0.0", - "@sindarius/gcodeviewer": "^3.2.2", + "@sindarius/gcodeviewer": "^3.7.6", "@uiw/codemirror-theme-vscode": "^4.19.11", "axios": "^1.6.0", "codemirror": "^6.0.1", From 65a62cb89024b653347612d747a9fcfb4d62a4e3 Mon Sep 17 00:00:00 2001 From: Nathan Regner Date: Fri, 26 Jan 2024 03:45:31 -0700 Subject: [PATCH 9/9] perf: batch gcode file metadata requests (#1737) this results in fewer re-renders of the table, significantly reducing load time Signed-off-by: Nathan Regner --- src/components/panels/GcodefilesPanel.vue | 9 +- src/components/panels/Status/Gcodefiles.vue | 10 +- src/plugins/webSocketClient.ts | 137 +++++++++++++------- src/store/files/actions.ts | 34 +++-- 4 files changed, 124 insertions(+), 66 deletions(-) diff --git a/src/components/panels/GcodefilesPanel.vue b/src/components/panels/GcodefilesPanel.vue index bd903e684..052a61bde 100644 --- a/src/components/panels/GcodefilesPanel.vue +++ b/src/components/panels/GcodefilesPanel.vue @@ -1235,11 +1235,12 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) { refreshMetadata(data: FileStateGcodefile[]) { const items = data.filter((file) => !file.isDirectory && !file.metadataRequested && !file.metadataPulled) - items.forEach((file: FileStateGcodefile) => { - this.$store.dispatch('files/requestMetadata', { + this.$store.dispatch( + 'files/requestMetadata', + items.map((file: FileStateGcodefile) => ({ filename: 'gcodes' + this.currentPath + '/' + file.filename, - }) - }) + })) + ) } clickRow(item: FileStateGcodefile, force = false) { diff --git a/src/components/panels/Status/Gcodefiles.vue b/src/components/panels/Status/Gcodefiles.vue index b65a32e48..6ddcb7a66 100644 --- a/src/components/panels/Status/Gcodefiles.vue +++ b/src/components/panels/Status/Gcodefiles.vue @@ -343,12 +343,12 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixi const requestItems = gcodes.filter( (file: FileStateGcodefile) => !file.metadataRequested && !file.metadataPulled ) - requestItems.forEach((file: FileStateGcodefile) => { - this.$store.dispatch('files/requestMetadata', { + this.$store.dispatch( + 'files/requestMetadata', + requestItems.map((file: FileStateGcodefile) => ({ filename: 'gcodes/' + file.filename, - }) - }) - + })) + ) return gcodes } diff --git a/src/plugins/webSocketClient.ts b/src/plugins/webSocketClient.ts index 2fdb3e0ad..ffaee7b48 100644 --- a/src/plugins/webSocketClient.ts +++ b/src/plugins/webSocketClient.ts @@ -10,6 +10,7 @@ export class WebSocketClient { reconnectInterval = 1000 reconnects = 0 keepAliveTimeout = 1000 + messageId: number = 0 timerId: number | null = null store: Store | null = null waits: Wait[] = [] @@ -25,6 +26,54 @@ export class WebSocketClient { this.url = url } + handleMessage(data: any) { + const wait = this.getWaitById(data.id) + + // report error messages + if (data.error?.message) { + // only report errors, if not disconnected and no init component + if (data.error?.message !== 'Klippy Disconnected' && !wait?.action?.startsWith('server/')) { + window.console.error(`Response Error: ${data.error.message} (${wait?.action ?? 'no action'})`) + } + + if (wait?.id) { + const modulename = wait.action?.split('/')[1] ?? null + + if (modulename && wait.action?.startsWith('server/') && initableServerComponents.includes(modulename)) { + const component = wait.action.replace('server/', '').split('/')[0] + window.console.error(`init server component ${component} failed`) + this.store?.dispatch('server/addFailedInitComponent', component) + this.store?.dispatch('socket/removeInitComponent', `server/${component}/`) + } + + this.removeWaitById(wait.id) + } + + return + } + + // pass it to socket/onMessage, if no wait exists + if (!wait) { + this.store?.dispatch('socket/onMessage', data) + return + } + + // pass result to action + if (wait?.action) { + let result = data.result + if (result === 'ok') result = { result: result } + if (typeof result === 'string') result = { result: result } + + const preload = {} + if (wait.actionPayload) Object.assign(preload, wait.actionPayload) + Object.assign(preload, { requestParams: wait.params }) + Object.assign(preload, result) + this.store?.dispatch(wait.action, preload) + } + + this.removeWaitById(wait.id) + } + async connect() { this.store?.dispatch('socket/setData', { isConnecting: true, @@ -58,55 +107,13 @@ export class WebSocketClient { if (this.store === null) return const data = JSON.parse(msg.data) - const wait = this.getWaitById(data.id) - - // report error messages - if (data.error?.message) { - // only report errors, if not disconnected and no init component - if (data.error?.message !== 'Klippy Disconnected' && !wait?.action?.startsWith('server/')) { - window.console.error(`Response Error: ${data.error.message} (${wait?.action ?? 'no action'})`) - } - - if (wait?.id) { - const modulename = wait.action?.split('/')[1] ?? null - - if ( - modulename && - wait.action?.startsWith('server/') && - initableServerComponents.includes(modulename) - ) { - const component = wait.action.replace('server/', '').split('/')[0] - window.console.error(`init server component ${component} failed`) - this.store?.dispatch('server/addFailedInitComponent', component) - this.store?.dispatch('socket/removeInitComponent', `server/${component}/`) - } - - this.removeWaitById(wait.id) + if (Array.isArray(data)) { + for (const message of data) { + this.handleMessage(message) } - - return + } else { + this.handleMessage(data) } - - // pass it to socket/onMessage, if no wait exists - if (!wait) { - this.store?.dispatch('socket/onMessage', data) - return - } - - // pass result to action - if (wait?.action) { - let result = data.result - if (result === 'ok') result = { result: result } - if (typeof result === 'string') result = { result: result } - - const preload = {} - if (wait.actionPayload) Object.assign(preload, wait.actionPayload) - Object.assign(preload, { requestParams: wait.params }) - Object.assign(preload, result) - this.store?.dispatch(wait.action, preload) - } - - this.removeWaitById(wait.id) } } @@ -130,7 +137,7 @@ export class WebSocketClient { emit(method: string, params: Params, options: emitOptions = {}): void { if (this.instance?.readyState !== WebSocket.OPEN) return - const id = Math.floor(Math.random() * 10000) + 1 + const id = this.messageId++ this.waits.push({ id: id, params: params, @@ -150,6 +157,33 @@ export class WebSocketClient { }) ) } + + emitBatch(messages: BatchMessage[]): void { + if (messages.length === 0) return + if (this.instance?.readyState !== WebSocket.OPEN) return + + const body = [] + for (const { method, params, emitOptions = {} } of messages) { + const id = this.messageId++ + this.waits.push({ + id: id, + params: params, + action: emitOptions.action ?? null, + actionPayload: emitOptions.actionPayload ?? {}, + loading: emitOptions.loading ?? null, + }) + + if (emitOptions.loading) this.store?.dispatch('socket/addLoading', { name: emitOptions.loading }) + body.push({ + jsonrpc: '2.0', + method, + params, + id, + }) + } + + this.instance.send(JSON.stringify(body)) + } } export function WebSocketPlugin(Vue: typeof _Vue, options: WebSocketPluginOptions): void { @@ -169,6 +203,13 @@ export interface WebSocketClient { connect(): void close(): void emit(method: string, params: Params, emitOptions: emitOptions): void + emitBatch(messages: BatchMessage[]): void +} + +export interface BatchMessage { + method: string + params: Params + emitOptions: emitOptions } export interface Wait { diff --git a/src/store/files/actions.ts b/src/store/files/actions.ts index a67e1f114..ca0af88cf 100644 --- a/src/store/files/actions.ts +++ b/src/store/files/actions.ts @@ -11,6 +11,7 @@ import { RootState } from '@/store/types' import i18n from '@/plugins/i18n' import { hiddenDirectories, validGcodeExtensions } from '@/store/variables' import axios from 'axios' +import { BatchMessage } from '@/plugins/webSocketClient' export const actions: ActionTree = { reset({ commit }) { @@ -159,13 +160,26 @@ export const actions: ActionTree = { } }, - requestMetadata({ commit }, payload: { filename: string }) { - const rootPath = payload.filename.slice(0, payload.filename.indexOf('/')) - if (rootPath === 'gcodes') { - const requestFilename = payload.filename.slice(7) - commit('setMetadataRequested', { filename: requestFilename }) - Vue.$socket.emit('server.files.metadata', { filename: requestFilename }, { action: 'files/getMetadata' }) + requestMetadata({ commit }, payload: { filename: string }[]) { + // request file metadata in batches to reduce the number of table re-renders when responses are received + let messages: BatchMessage[] = [] + for (const { filename } of payload) { + if (messages.length >= 100) { + Vue.$socket.emitBatch(messages) + messages = [] + } + const rootPath = filename.slice(0, filename.indexOf('/')) + if (rootPath === 'gcodes') { + const requestFilename = filename.slice(7) + commit('setMetadataRequested', { filename: requestFilename }) + messages.push({ + method: 'server.files.metadata', + params: { filename: requestFilename }, + emitOptions: { action: 'files/getMetadata' }, + }) + } } + Vue.$socket.emitBatch(messages) }, getMetadata({ commit, rootState }, payload) { @@ -203,9 +217,11 @@ export const actions: ActionTree = { payload.item.root === 'gcodes' && validGcodeExtensions.includes(payload.item.path.slice(payload.item.path.lastIndexOf('.'))) ) { - await dispatch('requestMetadata', { - filename: 'gcodes/' + payload.item.path, - }) + await dispatch('requestMetadata', [ + { + filename: 'gcodes/' + payload.item.path, + }, + ]) } break