diff --git a/package-lock.json b/package-lock.json index cc060d99e..5f3be9aa0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,7 +81,7 @@ "start-server-and-test": "^2.0.5", "typescript": "^4.5.5", "unplugin-vue-components": "^0.22.12", - "vite": "^4.5.3", + "vite": "^4.5.5", "vite-plugin-checker": "^0.6.0", "vite-plugin-package-version": "^1.0.2", "vite-plugin-pwa": "^0.16.4", @@ -9600,9 +9600,9 @@ } }, "node_modules/vite": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz", - "integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==", + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.5.tgz", + "integrity": "sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==", "dev": true, "dependencies": { "esbuild": "^0.18.10", diff --git a/package.json b/package.json index c97fef7c1..1a97707ef 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "start-server-and-test": "^2.0.5", "typescript": "^4.5.5", "unplugin-vue-components": "^0.22.12", - "vite": "^4.5.3", + "vite": "^4.5.5", "vite-plugin-checker": "^0.6.0", "vite-plugin-package-version": "^1.0.2", "vite-plugin-pwa": "^0.16.4", diff --git a/src/components/TheEditor.vue b/src/components/TheEditor.vue index 215ed1ccd..8a14bd2b3 100644 --- a/src/components/TheEditor.vue +++ b/src/components/TheEditor.vue @@ -60,6 +60,7 @@ :name="filename" :file-extension="fileExtension" class="codemirror" + :class="{ withSidebar: fileStructureSidebar }" @lineChange="lineChanges" />
@@ -188,8 +190,10 @@ export default class TheEditor extends Mixins(BaseMixin) { dialogConfirmChange = false dialogDevices = false fileStructureSidebar = true + treeviewItemKeyProp = 'line' as const structureActive: number[] = [] structureOpen: number[] = [] + structureActiveChangedBySidebar: boolean = false formatFilesize = formatFilesize @@ -424,8 +428,23 @@ export default class TheEditor extends Mixins(BaseMixin) { this.fileStructureSidebar = !this.fileStructureSidebar } - activeChanges(key: any) { - this.editor?.gotoLine(key) + // Relies on event bubbling to flip the flag before treeview active change is handled + activeChangesItemClick() { + this.structureActiveChangedBySidebar = true + } + + activeChanges(activeItems: Array) { + if (!this.structureActiveChangedBySidebar) { + return + } + + this.structureActiveChangedBySidebar = false + + if (!activeItems.length) { + return + } + + this.editor?.gotoLine(activeItems[0]) } lineChanges(line: number) { @@ -506,10 +525,14 @@ export default class TheEditor extends Mixins(BaseMixin) { } @media screen and (min-width: 960px) { - .codemirror { + .codemirror:not(.withSidebar) { + width: 100%; + } + .codemirror.withSidebar { width: calc(100% - 300px); } } + .structure-sidebar { width: 300px; overflow-y: auto; diff --git a/src/components/panels/Extruder/EstimatedExtrusionOutput.vue b/src/components/panels/Extruder/EstimatedExtrusionOutput.vue index 2ce18edae..bce476324 100644 --- a/src/components/panels/Extruder/EstimatedExtrusionOutput.vue +++ b/src/components/panels/Extruder/EstimatedExtrusionOutput.vue @@ -16,10 +16,10 @@
- {{ $t('Panels.ToolheadControlPanel.SpeedFactor') }}: {{ speed_factor * 100 }} % + {{ $t('Panels.ToolheadControlPanel.SpeedFactor') }}: {{ speedFactorOutput }} %
- {{ $t('Panels.ExtruderControlPanel.ExtrusionFactor') }}: {{ extrudeFactor * 100 }} % + {{ $t('Panels.ExtruderControlPanel.ExtrusionFactor') }}: {{ extrudeFactorOutput }} %
@@ -64,5 +64,13 @@ export default class PressureAdvanceSettings extends Mixins(BaseMixin, ExtruderM get showTooltip() { return this.speed_factor !== 1 || this.extrudeFactor !== 1 } + + get speedFactorOutput() { + return (this.speed_factor * 100).toFixed(0) + } + + get extrudeFactorOutput() { + return (this.extrudeFactor * 100).toFixed(0) + } } diff --git a/src/components/panels/History/HistoryListEntryJob.vue b/src/components/panels/History/HistoryListEntryJob.vue index aa8da85d9..d6444cfc4 100644 --- a/src/components/panels/History/HistoryListEntryJob.vue +++ b/src/components/panels/History/HistoryListEntryJob.vue @@ -134,6 +134,7 @@ import { Component, Mixins, Prop } from 'vue-property-decorator' import HistoryListPanelDetailsDialog from '@/components/dialogs/HistoryListPanelDetailsDialog.vue' import Panel from '@/components/ui/Panel.vue' import BaseMixin from '@/components/mixins/base' +import { FileStateFileThumbnail } from '@/store/files/types' import { ServerHistoryStateJob } from '@/store/server/history/types' import { thumbnailBigMin, thumbnailSmallMax, thumbnailSmallMin } from '@/store/variables' import { @@ -187,40 +188,22 @@ export default class HistoryListPanel extends Mixins(BaseMixin) { if ((this.item.metadata?.thumbnails?.length ?? 0) < 1) return false const thumbnail = this.item.metadata?.thumbnails?.find( - (thumb: any) => + (thumb) => thumb.width >= thumbnailSmallMin && thumb.width <= thumbnailSmallMax && thumb.height >= thumbnailSmallMin && thumb.height <= thumbnailSmallMax ) - let relative_url = '' - if (this.item.filename.lastIndexOf('/') !== -1) { - relative_url = this.item.filename.substring(0, this.item.filename.lastIndexOf('/')) - } - - if ((thumbnail?.relative_path ?? null) === null) return false - - return `${this.apiUrl}/server/files/gcodes/${encodeURI(relative_url + thumbnail?.relative_path)}?timestamp=${ - this.item.metadata.modified - }` + return thumbnail ? this.createThumbnailUrl(thumbnail) : false } get bigThumbnail() { if ((this.item.metadata?.thumbnails?.length ?? 0) < 1) return false - const thumbnail = this.item.metadata?.thumbnails?.find((thumb: any) => thumb.width >= thumbnailBigMin) - - let relative_url = '' - if (this.item.filename.lastIndexOf('/') !== -1) { - relative_url = this.item.filename.substring(0, this.item.filename.lastIndexOf('/') + 1) - } - - if ((thumbnail?.relative_path ?? null) === null) return false + const thumbnail = this.item.metadata?.thumbnails?.find((thumb) => thumb.width >= thumbnailBigMin) - return `${this.apiUrl}/server/files/gcodes/${encodeURI(relative_url + thumbnail?.relative_path)}?timestamp=${ - this.item.metadata.modified - }` + return thumbnail ? this.createThumbnailUrl(thumbnail) : false } get statusIcon() { @@ -331,5 +314,16 @@ export default class HistoryListPanel extends Mixins(BaseMixin) { return value } } + + createThumbnailUrl(thumbnail: FileStateFileThumbnail) { + let relative_url = '' + if (this.item.filename.lastIndexOf('/') !== -1) { + relative_url = this.item.filename.substring(0, this.item.filename.lastIndexOf('/') + 1) + } + + return `${this.apiUrl}/server/files/gcodes/${encodeURI(relative_url + thumbnail.relative_path)}?timestamp=${ + this.item.metadata.modified + }` + } } diff --git a/src/components/webcams/WebcamWrapperItem.vue b/src/components/webcams/WebcamWrapperItem.vue index 00d4a9078..caf299a05 100644 --- a/src/components/webcams/WebcamWrapperItem.vue +++ b/src/components/webcams/WebcamWrapperItem.vue @@ -19,7 +19,7 @@