Skip to content

Commit

Permalink
Merge branch 'develop' into feat/print-status-types
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored Sep 23, 2024
2 parents 59b07e1 + 6caeca5 commit ba65281
Show file tree
Hide file tree
Showing 9 changed files with 308 additions and 178 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
33 changes: 28 additions & 5 deletions src/components/TheEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,23 @@
:name="filename"
:file-extension="fileExtension"
class="codemirror"
:class="{ withSidebar: fileStructureSidebar }"
@lineChange="lineChanges" />
<div v-if="fileStructureSidebar" class="d-none d-md-flex structure-sidebar">
<v-treeview
activatable
dense
:active="structureActive"
:open="structureOpen"
item-key="line"
:item-key="treeviewItemKeyProp"
:items="configFileStructure"
class="w-100"
@update:active="activeChanges">
<template #label="{ item }">
<div
class="cursor-pointer _structure-sidebar-item"
:class="item.type == 'item' ? 'ͼp' : 'ͼt'">
:class="item.type == 'item' ? 'ͼp' : 'ͼt'"
@click="activeChangesItemClick">
{{ item.name }}
</div>
</template>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<ConfigFileSection[typeof this.treeviewItemKeyProp]>) {
if (!this.structureActiveChangedBySidebar) {
return
}
this.structureActiveChangedBySidebar = false
if (!activeItems.length) {
return
}
this.editor?.gotoLine(activeItems[0])
}
lineChanges(line: number) {
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 10 additions & 2 deletions src/components/panels/Extruder/EstimatedExtrusionOutput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
</template>
<span>
<div v-if="speed_factor !== 1">
{{ $t('Panels.ToolheadControlPanel.SpeedFactor') }}: {{ speed_factor * 100 }} %
{{ $t('Panels.ToolheadControlPanel.SpeedFactor') }}: {{ speedFactorOutput }} %
</div>
<div v-if="extrudeFactor !== 1">
{{ $t('Panels.ExtruderControlPanel.ExtrusionFactor') }}: {{ extrudeFactor * 100 }} %
{{ $t('Panels.ExtruderControlPanel.ExtrusionFactor') }}: {{ extrudeFactorOutput }} %
</div>
</span>
</v-tooltip>
Expand Down Expand Up @@ -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)
}
}
</script>
38 changes: 16 additions & 22 deletions src/components/panels/History/HistoryListEntryJob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
}`
}
}
</script>
2 changes: 1 addition & 1 deletion src/components/webcams/WebcamWrapperItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<j-muxer-stream-async :cam-settings="webcam" :printer-url="printerUrl" />
</template>
<template v-else-if="service === 'webrtc-camerastreamer'">
<webrtc-camera-streamer-async :cam-settings="webcam" :printer-url="printerUrl" />
<webrtc-camera-streamer-async :cam-settings="webcam" :printer-url="printerUrl" :page="page" />
</template>
<template v-else-if="service === 'webrtc-janus'">
<janus-streamer-async :cam-settings="webcam" :printer-url="printerUrl" />
Expand Down
Loading

0 comments on commit ba65281

Please sign in to comment.