Merge branch 'master' into feature/history

This commit is contained in:
Stefan Dej 2021-03-16 00:51:09 +01:00
commit 45f726159b
6 changed files with 67 additions and 27 deletions

View File

@ -28,6 +28,9 @@
<v-list-item class="minheight30" link @click="doServiceRestartMoonraker()">
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>Moonraker</v-list-item-title>
</v-list-item>
<v-list-item class="minheight30" v-if="boolWebcam" link @click="doServiceRestartWebcam()">
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>Webcam</v-list-item-title>
</v-list-item>
<div v-if="countPowerDevices">
<v-divider class="mt-0"></v-divider>
<v-subheader class="pt-2" style="height: auto;">Power Devices</v-subheader>
@ -70,6 +73,11 @@ export default {
return this.$store.getters["server/power/count"]
}
},
boolWebcam: {
get() {
return this.$store.state.gui.dashboard.boolWebcam || this.$store.state.gui.webcam.bool
}
}
},
methods: {
changeSwitch(device, value) {
@ -97,6 +105,10 @@ export default {
this.showMenu = false
this.$socket.sendObj('machine.services.restart', { service: "moonraker" })
},
doServiceRestartWebcam: function() {
this.showMenu = false
this.$socket.sendObj('machine.services.restart', { service: "webcamd" })
},
doHostReboot: function() {
this.showMenu = false
this.$socket.sendObj('machine.reboot', { })

View File

@ -31,6 +31,21 @@
</v-switch>
</v-col>
</v-row>
<v-row>
<v-col class="py-2">
<v-switch v-model="displayZOffsetStandby" hide-details class="mt-0">
<template v-slot:label>
Display Z-Offset-Panel
<v-tooltip right>
<template v-slot:activator="{ on, attrs }">
<v-icon class="text--secondary ml-2" v-bind="attrs" v-on="on">mdi mdi-information</v-icon>
</template>
<span>Shows the Z-Offset panel permanently.</span>
</v-tooltip>
</template>
</v-switch>
</v-col>
</v-row>
<v-row>
<v-col class="text-center">
<v-btn @click="dialogResetMainsail=true" >factory reset</v-btn>
@ -102,6 +117,14 @@
return this.$store.dispatch('gui/setSettings', { general: { displayCancelPrint: displayCancelPrint } });
}
},
displayZOffsetStandby: {
get() {
return this.$store.state.gui.general.displayZOffsetStandby;
},
set(displayZOffsetStandby) {
return this.$store.dispatch('gui/setSettings', { general: { displayZOffsetStandby: displayZOffsetStandby } });
}
},
},
methods: {
resetMainsail() {

View File

@ -3,7 +3,7 @@
</style>
<template>
<v-card v-if="(['printing', 'paused'].includes(printer_state))">
<v-card v-if="(['printing', 'paused'].includes(printer_state)) || (displayZOffsetStandby && ['standby', 'complete'].includes(printer_state))">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon class="mdi mdi-arrow-collapse-vertical" left></v-icon>Z Baby Stepping</span>
@ -53,6 +53,7 @@
homing_origin: state => state.printer.gcode_move.homing_origin,
printer_state: state => state.printer.print_stats.state,
homed_axis: state => state.printer.toolhead.homed_axes,
displayZOffsetStandby: state => state.gui.general.displayZOffsetStandby,
}),
},
methods: {

View File

@ -149,14 +149,14 @@
>
<td class="pr-0 text-center" style="width: 32px;">
<v-icon v-if="item.isDirectory">mdi-folder</v-icon>
<v-icon v-if="!item.isDirectory && !(existsSmallThumbnail(item))">mdi-file</v-icon>
<v-tooltip v-if="!item.isDirectory && existsSmallThumbnail(item) && existsBigThumbnail(item)" top>
<v-icon v-if="!item.isDirectory && !(getSmallThumbnail(item))">mdi-file</v-icon>
<v-tooltip v-if="!item.isDirectory && getSmallThumbnail(item) && getBigThumbnail(item)" top>
<template v-slot:activator="{ on, attrs }">
<img :src="'data:image/gif;base64,'+getSmallThumbnail(item)" width="32" height="32" v-bind="attrs" v-on="on" />
<img :src="getSmallThumbnail(item)" width="32" height="32" v-bind="attrs" v-on="on" />
</template>
<span><img :src="'data:image/gif;base64,'+getBigThumbnail(item)" width="250" /></span>
<span><img :src="getBigThumbnail(item)" width="250" /></span>
</v-tooltip>
<img v-if="!item.isDirectory && existsSmallThumbnail(item) && !existsBigThumbnail(item)" :src="'data:image/gif;base64,'+getSmallThumbnail(item)" width="32" height="32" />
<img v-if="!item.isDirectory && getSmallThumbnail(item) && !getBigThumbnail(item)" :src="getSmallThumbnail(item)" width="32" height="32" />
</td>
<td class=" ">{{ item.filename }}</td>
<td class="text-no-wrap text-right" v-if="headers.filter(header => header.value === 'size')[0].visible">{{ item.isDirectory ? '--' : formatFilesize(item.size) }}</td>
@ -212,8 +212,8 @@
<v-card>
<v-img
contain
v-if="existsBigThumbnail(dialogPrintFile.item)"
:src="'data:image/gif;base64,'+getBigThumbnail(dialogPrintFile.item)"
v-if="getBigThumbnail(dialogPrintFile.item)"
:src="getBigThumbnail(dialogPrintFile.item)"
></v-img>
<v-card-title class="headline">Start Job</v-card-title>
<v-card-text>Do you want to start {{ dialogPrintFile.item.filename }}?</v-card-text>
@ -421,6 +421,11 @@
get: function() {
return this.$store.getters["files/getDiskUsage"](this.currentPath)
}
},
basicUrl: {
get: function() {
return this.$store.getters["socket/getUrl"]
}
}
},
created() {
@ -790,43 +795,36 @@
this.$store.dispatch("gui/setGcodefilesMetadata", {name: name, value: value});
}
},
existsSmallThumbnail(item) {
return (
getSmallThumbnail(item) {
if (
'thumbnails' in item &&
item.thumbnails !== undefined &&
item.thumbnails.findIndex(thumb => thumb.width >= 32 && thumb.width <= 64 && thumb.height >= 32 && thumb.height <= 64) !== -1
)
},
getSmallThumbnail(item) {
if (this.existsSmallThumbnail(item)) {
item.thumbnails.length
) {
const thumbnail = item.thumbnails.find(thumb =>
thumb.width >= 32 && thumb.width <= 64 &&
thumb.height >= 32 && thumb.height <= 64
)
if (thumbnail) return thumbnail.data
if (thumbnail && 'relative_path' in thumbnail) return this.basicUrl+"/server/files/"+this.currentPath+"/"+thumbnail.relative_path
}
return ""
},
existsBigThumbnail(item) {
return (
getBigThumbnail(item) {
if (
'thumbnails' in item &&
item.thumbnails !== undefined &&
item.thumbnails.findIndex(thumb => thumb.width >= 300 && thumb.width <= 400) !== -1
)
},
getBigThumbnail(item) {
if (this.existsBigThumbnail(item)) {
item.thumbnails.length) {
const thumbnail = item.thumbnails.find(thumb => thumb.width >= 300 && thumb.width <= 400)
if (thumbnail) return thumbnail.data
if (thumbnail && 'relative_path' in thumbnail) return this.basicUrl+"/server/files/"+this.currentPath+"/"+thumbnail.relative_path
}
return ""
},
getThumbnailWidth(item) {
if (this.existsBigThumbnail(item)) {
if (this.getBigThumbnail(item)) {
const thumbnail = item.thumbnails.find(thumb => thumb.width >= 300 && thumb.width <= 400)
if (thumbnail) return thumbnail.width

View File

@ -31,7 +31,12 @@ export default {
updateSettings({ commit }, payload) {
const keyName = payload.keyName
let newState = payload.newVal
if ('value' in payload && keyName in payload.value && typeof payload.value[keyName] !== "string") {
if (
'value' in payload &&
keyName in payload.value &&
typeof payload.value[keyName] !== "string" &&
!Array.isArray(payload.value[keyName])
) {
newState = objectAssignDeep(payload.value[keyName], newState)
}

View File

@ -6,7 +6,8 @@ export function getDefaultState() {
return {
general: {
printername: "",
displayCancelPrint: false
displayCancelPrint: false,
displayZOffsetStandby: false,
},
dashboard: {
boolWebcam: false,