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

View File

@ -31,6 +31,21 @@
</v-switch> </v-switch>
</v-col> </v-col>
</v-row> </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-row>
<v-col class="text-center"> <v-col class="text-center">
<v-btn @click="dialogResetMainsail=true" >factory reset</v-btn> <v-btn @click="dialogResetMainsail=true" >factory reset</v-btn>
@ -102,6 +117,14 @@
return this.$store.dispatch('gui/setSettings', { general: { displayCancelPrint: displayCancelPrint } }); 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: { methods: {
resetMainsail() { resetMainsail() {

View File

@ -3,7 +3,7 @@
</style> </style>
<template> <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 flat dense >
<v-toolbar-title> <v-toolbar-title>
<span class="subheading"><v-icon class="mdi mdi-arrow-collapse-vertical" left></v-icon>Z Baby Stepping</span> <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, homing_origin: state => state.printer.gcode_move.homing_origin,
printer_state: state => state.printer.print_stats.state, printer_state: state => state.printer.print_stats.state,
homed_axis: state => state.printer.toolhead.homed_axes, homed_axis: state => state.printer.toolhead.homed_axes,
displayZOffsetStandby: state => state.gui.general.displayZOffsetStandby,
}), }),
}, },
methods: { methods: {

View File

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

View File

@ -31,7 +31,12 @@ export default {
updateSettings({ commit }, payload) { updateSettings({ commit }, payload) {
const keyName = payload.keyName const keyName = payload.keyName
let newState = payload.newVal 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) newState = objectAssignDeep(payload.value[keyName], newState)
} }

View File

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