hotfix(gcodefiles): fix printed files filter
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
parent
62afec1934
commit
2cf4d8ba58
@ -797,11 +797,11 @@ export default class PageFiles extends Mixins(BaseMixin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
this.$socket.emit('server.files.get_directory', { path: this.currentPath }, { action: 'files/getDirectory' })
|
||||||
this.loadPath()
|
this.loadPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
loadPath() {
|
loadPath() {
|
||||||
this.$socket.emit('server.files.get_directory', { path: this.currentPath }, { action: 'files/getDirectory' })
|
|
||||||
let dirArray = this.currentPath.split("/")
|
let dirArray = this.currentPath.split("/")
|
||||||
this.files = findDirectory(this.filetree, dirArray)
|
this.files = findDirectory(this.filetree, dirArray)
|
||||||
if (this.files !== null) {
|
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) !== ".")
|
this.files = this.files.filter(file => file.filename !== "thumbs" && file.filename.substr(0, 1) !== ".")
|
||||||
}
|
}
|
||||||
if (!this.showPrintedFiles) {
|
if (!this.showPrintedFiles) {
|
||||||
this.files = this.files.filter(file => this.$store.getters["server/history/getPrintStatus"]({
|
this.files = this.files.filter(file => {
|
||||||
filename: (this.currentPath+"/"+file.filename).substr(7),
|
if (file.isDirectory) return true
|
||||||
modified: file.modified.getTime()
|
else {
|
||||||
}) !== 'completed')
|
return (this.$store.getters["server/history/getPrintStatusByFilename"](
|
||||||
|
(this.currentPath+"/"+file.filename).substr(7),
|
||||||
|
file.modified.getTime()
|
||||||
|
) !== 'completed')
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Watch('filetree', { deep: true })
|
@Watch('filetree', { deep: true })
|
||||||
filetreeChanged(newVal: FileStateFile[]) {
|
filetreeChanged() {
|
||||||
let dirArray = this.currentPath.split("/");
|
this.loadPath()
|
||||||
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')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Watch('currentPath')
|
@Watch('currentPath')
|
||||||
currentPathChanged(newVal: string) {
|
currentPathChanged() {
|
||||||
let dirArray = newVal.split("/");
|
this.loadPath()
|
||||||
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')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
formatPrintTime(totalSeconds: number) {
|
formatPrintTime(totalSeconds: number) {
|
||||||
|
@ -168,6 +168,18 @@ export const getters: GetterTree<ServerHistoryState, any> = {
|
|||||||
return ""
|
return ""
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPrintStatusByFilename: (state) => (filename: string, modified: number) => {
|
||||||
|
if (state.jobs.length) {
|
||||||
|
const job = state.jobs.find((job) => {
|
||||||
|
return job.filename === filename && parseInt(job.metadata?.modified*1000) === modified
|
||||||
|
})
|
||||||
|
|
||||||
|
return job?.status ?? ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
},
|
||||||
|
|
||||||
getPrintStatusChipColor: () => (status: string) => {
|
getPrintStatusChipColor: () => (status: string) => {
|
||||||
switch(status) {
|
switch(status) {
|
||||||
case 'in_progress': return 'blue accent-3' //'blue-grey darken-1'
|
case 'in_progress': return 'blue accent-3' //'blue-grey darken-1'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user