Compare commits

...
12 Commits
Author SHA1 Message Date
Stefan Dej 855959a1f9 chore(type): fix type for build
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-09-08 23:24:57 +02:00
Stefan Dej 4d38b019be chore: increment version number to V2.0.1
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-09-08 23:21:25 +02:00
Stefan Dej 2cf4d8ba58 hotfix(gcodefiles): fix printed files filter
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-09-08 20:47:49 +02:00
Stefan Dej 62afec1934 hotfix(store): fix error of migrate drv_status in store
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-09-07 23:58:40 +02:00
Stefan Dej 5f40c54160 hotfix(webcam): add leading zero to FPS output below 10 (only adaptive mjpegstreamer)
Closes: #348
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-09-07 21:34:18 +02:00
Stefan Dej 3c570cadfe hotfix(console): autofocus input field after click on a command
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-09-04 22:46:40 +02:00
Stefan Dej 4f42092159 hotfix(theme): fix mainBackground image #349 (#351)
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-09-04 13:46:46 +02:00
Stefan Dej b2f6e7dc08 hotfix(gcodefiles): fix typo in error message (#350)
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-09-04 12:18:41 +02:00
Stefan Dej 005ed8814b bugfix(webcam): display the wrong webcam if you connect to a remote printer with relativ webcam url (#345)
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-08-31 21:33:31 +02:00
Stefan Dej 41b21aa66e hotfix: printerfarm panel (#344)
* bugfix(printerfarm): fix store theme files in farm printer

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* feature(printerfarm): display dynamic mainsail-logo in printerfarm panel

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* bugfix(printerfarm): fix image/webcam height to 3:2 ratio

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* bugfix(printerfarm): disable webcam if printer is not connected

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* bugfix(printerfarm): change button to "reconnect" when printer is not connected

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* bugfix(controlpanel): align center for bar control buttons

Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-08-31 20:03:47 +02:00
Stefan Dej f482b57c71 Revert "feature: gcodeviewer (#322)" (#341)
This reverts commit 673fd9f879.
2021-08-29 01:20:51 +02:00
Juan Rosario 673fd9f879 feature: gcodeviewer (#322)
* Initial implementation of GCode Viewer in Mainsail

* Revert files.vue

* Reupdate files.vue

* Fix router

* Add render quality and force line mode settings

* Cache off canvas

Dynamically create and cache the canvas element so it does not have to reload and to keep current item loaded. Saves time on reload. Will need to test when vue watches are applied.

* Loading progress indicator

* Turn off loading progress after changing render quality.

* Failed render check.

* Added a live tracking button

* Work on settings

* Hide the loading required button earlier

* Added more settings.

* min and max feed coloring settings

* Set ZClipPlane for WebGL1 viewers

* Bed and Delta

* Force line rendering is saved

Addressed an issue where watchers could try to fire on  a viewer that is not initialized

* Move loading progress bar

* Multiple UI Updates

Add Progress Color setting and persistence
Add z clip control - enabled when not tracking
Move loading progress bar into canvas area

* Update to package 1.0.6

* Pulled latest

* Update to @sindarius/gcodeviewer 2.0.4

Setting extruder colors directly was removed and instead has been replaced with configuring tools. This opens up the ability to set a nozzle size as well for tool changer type systems that could have multiple nozzle sizes.

* Set tracking position to 0 when starting tracking.

* A timeout is needed to reset the visual

* Created forceRedraw to deal with a timing issue when starting tracking.

* Update to 2.0.6 package
2021-08-29 01:17:51 +02:00
18 changed files with 122 additions and 69 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "mainsail",
"version": "2.0.0",
"version": "2.0.1",
"private": true,
"decription": "a klipper web interface",
"author": {
+11 -1
View File
@@ -23,7 +23,7 @@
<the-sidebar></the-sidebar>
<the-topbar></the-topbar>
<v-main id="content" :style="{ background: mainBackground }">
<v-main id="content" :style="mainStyle">
<v-container fluid id="page-container" class="container px-3 px-sm-6 py-sm-6 mx-auto">
<router-view></router-view>
</v-container>
@@ -71,6 +71,16 @@ export default class App extends Mixins(BaseMixin) {
return this.$store.getters["files/getMainBackground"]
}
get mainStyle() {
let style = ''
if (this.mainBackground !== null) {
style = 'background-image: url('+this.mainBackground+');'
}
return style
}
get customStylesheet () {
return this.$store.getters["files/getCustomStylesheet"]
}
+4
View File
@@ -8,6 +8,10 @@ export default class BaseMixin extends Vue {
return this.$store.getters['socket/getUrl']
}
get hostUrl(): boolean {
return this.$store.getters['socket/getHostUrl']
}
get remoteMode() {
return this.$store.state.socket.remoteMode
}
+3 -3
View File
@@ -208,7 +208,7 @@
</v-row>
<v-row no-gutters class="mt-2">
<v-col class="text-center">
<v-btn-toggle dense no-gutters class="row no-gutters" style="flex-wrap: nowrap; width: 100%;" >
<v-btn-toggle dense no-gutters class="row no-gutters justify-center" style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="doSendMove('X-'+steps, feedrateXY)" class="btnMinWidthAuto col" v-for="steps of stepsXYsorted" v-bind:key="'x-'+steps"><span class="body-2">–{{ steps }}</span></v-btn>
<v-btn @click="doHomeX" :color="homedAxes.includes('x') ? 'primary' : 'warning'" :loading="loadings.includes('homeX')" class="font-weight-bold btnHomeAxis">{{ $t('Panels.ControlPanel.X') }}</v-btn>
<v-btn @click="doSendMove('X+'+steps, feedrateXY)" class="btnMinWidthAuto col" v-for="steps of stepsXYsortedReverse" v-bind:key="'x+'+steps"><span class="body-2">+{{ steps }}</span></v-btn>
@@ -217,7 +217,7 @@
</v-row>
<v-row no-gutters class="mt-3">
<v-col class="text-center">
<v-btn-toggle dense no-gutters class="row no-gutters" style="flex-wrap: nowrap; width: 100%;" >
<v-btn-toggle dense no-gutters class="row no-gutters justify-center" style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="doSendMove('Y-'+steps, feedrateXY)" class="btnMinWidthAuto col" v-for="steps of stepsXYsorted" v-bind:key="'y-'+steps"><span class="body-2">–{{ steps }}</span></v-btn>
<v-btn @click="doHomeY" :color="homedAxes.includes('y') ? 'primary' : 'warning'" :loading="loadings.includes('homeY')" class="font-weight-bold btnHomeAxis">{{ $t('Panels.ControlPanel.Y') }}</v-btn>
<v-btn @click="doSendMove('Y+'+steps, feedrateXY)" class="btnMinWidthAuto col" v-for="steps of stepsXYsortedReverse" v-bind:key="'y+'+steps"><span class="body-2">+{{ steps }}</span></v-btn>
@@ -226,7 +226,7 @@
</v-row>
<v-row no-gutters class="mt-3">
<v-col class="text-center">
<v-btn-toggle dense no-gutters class="row no-gutters" style="flex-wrap: nowrap; width: 100%;" >
<v-btn-toggle dense no-gutters class="row no-gutters justify-center" style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="doSendMove('Z-'+steps, feedrateZ)" class="btnMinWidthAuto col" v-for="steps of stepsZsorted" v-bind:key="'z-'+steps"><span class="body-2">–{{ steps }}</span></v-btn>
<v-btn @click="doHomeZ" :color="homedAxes.includes('z') ? 'primary' : 'warning'" :loading="loadings.includes('homeZ')" class="font-weight-bold btnHomeAxis">{{ $t('Panels.ControlPanel.Z') }}</v-btn>
<v-btn @click="doSendMove('Z+'+steps, feedrateZ)" class="btnMinWidthAuto col" v-for="steps of stepsZsortedReverse" v-bind:key="'z+'+steps"><span class="body-2">+{{ steps }}</span></v-btn>
+35 -8
View File
@@ -31,7 +31,7 @@
<span class="subheading"><v-icon left>mdi-printer-3d</v-icon>{{ printer_name }}</span>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-item-group v-if="this.printer_webcams.length">
<v-item-group v-if="printer.socket.isConnected && this.printer_webcams.length">
<v-menu :offset-y="true" title="Webcam">
<template v-slot:activator="{ on, attrs }">
<v-btn small class="px-2 minwidth-0" color="grey darken-3" v-bind="attrs" v-on="on">
@@ -64,11 +64,12 @@
<template v-slot:default="{ hover }">
<div>
<v-img
height="200px"
:height="imageHeight"
:src="printer_image"
class="d-flex align-end"
ref="imageDiv"
>
<div v-if="currentCamName !== 'off' && currentWebcam" class="webcamContainer">
<div v-if="printer.socket.isConnected && currentCamName !== 'off' && currentWebcam" class="webcamContainer">
<template v-if="'service' in currentWebcam && currentWebcam.service === 'mjpegstreamer'">
<webcam-mjpegstreamer :cam-settings="currentWebcam"></webcam-mjpegstreamer>
</template>
@@ -79,7 +80,12 @@
<v-card-title class="white--text py-2" style="background-color: rgba(0,0,0,0.3); backdrop-filter: blur(3px);">
<v-row>
<v-col class="col-auto pr-0 d-flex align-center" style="width: 58px">
<img class="my-auto" :src="printer_logo" style="width: 100%;" />
<template v-if="printer_logo">
<img :src="printer_logo" style="width: 100%;" class="my-auto" alt="Logo" />
</template>
<template v-else>
<mainsail-logo :color="printerLogoColor" style="width: 100%;" class="my-auto"></mainsail-logo>
</template>
</v-col>
<v-col class="col" style="width: 100px">
<h3 class="font-weight-regular">{{ printer_status }}</h3>
@@ -100,7 +106,7 @@
</v-card-text>
<v-fade-transition>
<v-overlay v-if="hover" absolute :z-index="4" >
<v-btn color="primary" @click="clickPrinter">{{ $t("Panels.FarmPrinterPanel.SwitchToPrinter") }}</v-btn>
<v-btn color="primary" @click="clickPrinter">{{ printer.socket.isConnected ? $t("Panels.FarmPrinterPanel.SwitchToPrinter") : $t("Panels.FarmPrinterPanel.ReconnectToPrinter") }}</v-btn>
</v-overlay>
</v-fade-transition>
</div>
@@ -110,23 +116,25 @@
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import {Component, Mixins, Prop, Ref, Vue} from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { FarmPrinterState } from '@/store/farm/printer/types'
import Mjpegstreamer from "@/components/webcams/Mjpegstreamer.vue"
import MjpegstreamerAdaptive from "@/components/webcams/MjpegstreamerAdaptive.vue"
import MainsailLogo from "@/components/ui/MainsailLogo.vue";
@Component({
components: {
"webcam-mjpegstreamer": Mjpegstreamer,
"webcam-mjpegstreamer-adaptive": MjpegstreamerAdaptive,
"mainsail-logo": MainsailLogo
}
})
export default class FarmPrinterPanel extends Mixins(BaseMixin) {
private imageHeight = 200;
@Prop({ type: Object, required: true }) printer!: FarmPrinterState
@Ref() readonly imageDiv!: Vue
get printerUrl() {
const thisUrl = window.location.href.split("/")
@@ -170,6 +178,10 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin) {
return this.$store.getters["farm/"+this.printer._namespace+"/getLogo"]
}
get printerLogoColor() {
return this.$store.getters["farm/"+this.printer._namespace+"/getLogoColor"]
}
get printer_position() {
return this.$store.getters["farm/"+this.printer._namespace+"/getPosition"]
}
@@ -196,5 +208,20 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin) {
this.$store.dispatch("farm/"+this.printer._namespace+"/reconnect")
}
mounted() {
window.addEventListener("resize", this.resize)
this.resize()
}
beforeDestroy() {
window.addEventListener("resize", this.resize)
}
resize() {
if (this.imageDiv?.$el?.clientWidth) {
this.imageHeight = Math.round(this.imageDiv.$el.clientWidth / 3 * 2)
} else this.imageHeight = 200
}
}
</script>
+5 -1
View File
@@ -138,7 +138,11 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
}
commandClick(msg: string): void {
this.gcode = msg;
this.gcode = msg
this.$nextTick(() => {
this.$refs.gcodeCommandField.focus()
})
}
doSend(cmd: KeyboardEvent) {
+1 -3
View File
@@ -35,9 +35,7 @@ export default class Mjpegstreamer extends Mixins(BaseMixin) {
get url() {
const baseUrl = this.camSettings.url
const hostUrl = new URL(this.printerUrl === undefined ? document.URL : this.printerUrl)
const url = new URL(baseUrl, hostUrl.origin)
const url = new URL(baseUrl, this.printerUrl === undefined ? this.hostUrl.toString() : this.printerUrl)
url.searchParams.append('bypassCache', this.refresh.toString())
return decodeURIComponent(url.toString())
@@ -16,7 +16,7 @@
<v-progress-circular indeterminate color="primary"></v-progress-circular>
</div>
<canvas ref="mjpegstreamerAdaptive" width="600" height="400" :style="webcamStyle" :class="'webcamImage '+(isLoaded ? '' : 'hiddenWebcam')"></canvas>
<span class="webcamFpsOutput" v-if="isLoaded && showFps">{{ $t('Panels.WebcamPanel.FPS')}}: {{ currentFPS }}</span>
<span class="webcamFpsOutput" v-if="isLoaded && showFps">{{ $t('Panels.WebcamPanel.FPS')}}: {{ fpsOutput }}</span>
</div>
</template>
@@ -57,6 +57,10 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
return ""
}
get fpsOutput() {
return (this.currentFPS < 10) ? '0'+this.currentFPS.toString() : this.currentFPS
}
visibilityChanged(isVisible: boolean) {
this.isVisible = isVisible
if (isVisible) this.refreshFrame()
@@ -95,15 +99,13 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
async setFrame() {
const baseUrl = this.camSettings.url
const hostUrl = new URL(this.printerUrl === undefined ? document.URL : this.printerUrl)
const url = new URL(baseUrl, hostUrl.origin)
const url = new URL(baseUrl, this.printerUrl === undefined ? this.hostUrl.toString() : this.printerUrl)
url.searchParams.append('bypassCache', this.refresh.toString())
url.searchParams.set('action', 'snapshot')
this.request_start_time = performance.now()
this.currentFPS = Math.round(1000 / this.time)
this.currentFPS = (this.time > 0) ? Math.round(1000 / this.time) : 0
let canvas = this.$refs.mjpegstreamerAdaptive
if (canvas) {
+1 -3
View File
@@ -32,9 +32,7 @@ export default class Uv4lMjpeg extends Mixins(BaseMixin) {
get url() {
const baseUrl = this.camSettings.url
const hostUrl = new URL(this.printerUrl === null ? document.URL : this.printerUrl)
const url = new URL(baseUrl, hostUrl.origin)
const url = new URL(baseUrl, this.printerUrl === null ? this.hostUrl.toString() : this.printerUrl)
return decodeURIComponent(url.toString())
}
+2 -1
View File
@@ -254,7 +254,8 @@
},
"FarmPrinterPanel": {
"WebcamOff": "Off",
"SwitchToPrinter": "Switch to Printer"
"SwitchToPrinter": "Switch to Printer",
"ReconnectToPrinter": "Reconnect"
},
"KlippyStatePanel": {
"KlippyState": "Klippy-State",
+4
View File
@@ -133,6 +133,10 @@ export default class PageConsole extends Mixins(BaseMixin) {
commandClick(msg: string): void {
this.gcode = msg
this.$nextTick(() => {
this.$refs.gcodeCommandField.focus()
})
}
doSend(cmd: KeyboardEvent): void {
+15 -34
View File
@@ -501,7 +501,7 @@ export default class PageFiles extends Mixins(BaseMixin) {
}
private input_rules = [
(value: string) => value.indexOf(" ") === -1 || 'Name contain spaces!'
(value: string) => value.indexOf(" ") === -1 || 'Name contains spaces!'
]
get headers() {
@@ -797,11 +797,11 @@ export default class PageFiles extends Mixins(BaseMixin) {
}
created() {
this.$socket.emit('server.files.get_directory', { path: this.currentPath }, { action: 'files/getDirectory' })
this.loadPath()
}
loadPath() {
this.$socket.emit('server.files.get_directory', { path: this.currentPath }, { action: 'files/getDirectory' })
let dirArray = this.currentPath.split("/")
this.files = findDirectory(this.filetree, dirArray)
if (this.files !== null) {
@@ -809,46 +809,27 @@ export default class PageFiles extends Mixins(BaseMixin) {
this.files = this.files.filter(file => file.filename !== "thumbs" && file.filename.substr(0, 1) !== ".")
}
if (!this.showPrintedFiles) {
this.files = this.files.filter(file => this.$store.getters["server/history/getPrintStatus"]({
filename: (this.currentPath+"/"+file.filename).substr(7),
modified: file.modified.getTime()
}) !== 'completed')
this.files = this.files.filter(file => {
if (file.isDirectory) return true
else {
return (this.$store.getters["server/history/getPrintStatusByFilename"](
(this.currentPath+"/"+file.filename).substr(7),
file.modified.getTime()
) !== 'completed')
}
})
}
}
}
@Watch('filetree', { deep: true })
filetreeChanged(newVal: FileStateFile[]) {
let dirArray = this.currentPath.split("/");
this.files = findDirectory(newVal, dirArray);
if (this.files?.length && !this.showHiddenFiles) {
this.files = this.files.filter(file => file.filename !== "thumbs" && file.filename.substr(0, 1) !== ".");
}
if (this.files?.length && !this.showPrintedFiles) {
this.files = this.files.filter(file => this.$store.getters["server/history/getPrintStatus"]({
filename: (this.currentPath+"/"+file.filename).substr(7),
modified: new Date(file.modified).getTime()
}) !== 'completed')
}
filetreeChanged() {
this.loadPath()
}
@Watch('currentPath')
currentPathChanged(newVal: string) {
let dirArray = newVal.split("/");
this.files = findDirectory(this.filetree, dirArray);
if (this.files?.length && !this.showHiddenFiles) {
this.files = this.files.filter(file => file.filename !== "thumbs" && file.filename.substr(0, 1) !== ".");
}
if (this.files?.length && !this.showPrintedFiles) {
this.files = this.files.filter(file => this.$store.getters["server/history/getPrintStatus"]({
filename: (this.currentPath+"/"+file.filename).substr(7),
modified: new Date(file.modified).getTime()
}) !== 'completed')
}
currentPathChanged() {
this.loadPath()
}
formatPrintTime(totalSeconds: number) {
+7 -3
View File
@@ -1,4 +1,4 @@
import { themeDir } from "@/store/variables"
import {defaultLogoColor, themeDir} from '@/store/variables'
import {convertName} from "@/plugins/helpers"
import {GetterTree} from "vuex";
import {FarmPrinterState} from "@/store/farm/printer/types";
@@ -35,6 +35,10 @@ export const getters: GetterTree<FarmPrinterState, any> = {
return state.socket.port !== 80 ? state.socket.hostname+':'+state.socket.port : state.socket.hostname
},
getLogoColor: (state) => {
return state.data.gui?.theme?.logo ?? defaultLogoColor
},
getStatus: (state, getters) => {
if (!state.socket.isConnected) {
return state.socket.isConnecting ? "Connecting..." : "Disconnected"
@@ -97,9 +101,9 @@ export const getters: GetterTree<FarmPrinterState, any> = {
getLogo: (state, getters) => {
const acceptName = "sidebar-logo"
const acceptExtensions = ['gif', 'jpg', 'png', 'gif']
const acceptExtensions = ['gif', 'jpg', 'png', 'gif', 'svg']
return getters["getThemeFileUrl"](acceptName, acceptExtensions) ?? '/img/logo.svg'
return getters["getThemeFileUrl"](acceptName, acceptExtensions)
},
getPosition: state => {
+2 -4
View File
@@ -57,10 +57,8 @@ export const mutations: MutationTree<FarmPrinterState> = {
setConfigDir(state, payload) {
Object.values(payload).forEach((file: any) => {
if ("filename" in file) {
if (file.filename.startsWith(".theme/")) {
state.theme_files.push(file.filename)
}
if (file.path?.startsWith(".theme/")) {
state.theme_files.push(file.path)
}
})
},
+1 -1
View File
@@ -35,7 +35,7 @@ export const getters: GetterTree<FileState, any> = {
const acceptName = "main-background"
const acceptExtensions = ['jpg', 'jpeg', 'png', 'gif', 'svg']
return getters['getThemeFileUrl'](acceptName, acceptExtensions) ?? 'transparent'
return getters['getThemeFileUrl'](acceptName, acceptExtensions)
},
getCustomStylesheet: (state, getters) => {
+7 -1
View File
@@ -24,7 +24,13 @@ export const mutations: MutationTree<PrinterState> = {
Object.keys(payload).forEach((key: string) => {
const value = payload[key]
if (typeof value === 'object' && !Array.isArray(value) && key in currentState && value !== null) {
if (
typeof value === 'object' &&
!Array.isArray(value) &&
key in currentState &&
value !== null &&
currentState[key] !== null
) {
setDataDeep(currentState[key], value)
} else if (key === "temperature") {
const newValue = Math.round(value * 10) / 10
+12
View File
@@ -168,6 +168,18 @@ export const getters: GetterTree<ServerHistoryState, any> = {
return ""
},
getPrintStatusByFilename: (state) => (filename: string, modified: number) => {
if (state.jobs.length) {
const job = state.jobs.find((job) => {
return job.filename === filename && Math.round(job.metadata?.modified*1000) === modified
})
return job?.status ?? ""
}
return ""
},
getPrintStatusChipColor: () => (status: string) => {
switch(status) {
case 'in_progress': return 'blue accent-3' //'blue-grey darken-1'
+4
View File
@@ -8,6 +8,10 @@ export const getters: GetterTree<SocketState, RootState> = {
return "//" + state.hostname + (state.port !== 80 ? ":"+state.port : "")
},
getHostUrl: (state) => {
return (state.protocol === 'wss' ? 'https' : 'http')+"://" + state.hostname + '/'
},
getWebsocketUrl: (state, getters) => {
return state.protocol + ":" + getters['getUrl'] + "/websocket"
},