Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Sep 15, 2024
2 parents ba890dc + 2a49060 commit 2ec134a
Showing 1 changed file with 16 additions and 22 deletions.
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>

0 comments on commit 2ec134a

Please sign in to comment.