Skip to content

Commit

Permalink
feat(history): add support for Moonraker sensor history_fields (#1884)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored May 25, 2024
1 parent 5cfef22 commit 8bccd7e
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 470 deletions.
170 changes: 0 additions & 170 deletions src/components/dialogs/HistoryDetailsDialog.vue

This file was deleted.

16 changes: 16 additions & 0 deletions src/components/dialogs/HistoryListPanelDetailsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ export default class HistoryListPanelDetailsDialog extends Mixins(BaseMixin) {
},
]
if ('auxiliary_data' in this.job) {
this.job.auxiliary_data?.forEach((data) => {
let value = data.value.toString()
if (!Array.isArray(data.value)) {
value = `${Math.round(data.value * 1000) / 1000} ${data.units}`
}
if (value === '') value = '--'
entries.push({
name: data.description,
value,
exists: true,
})
})
}
return entries.filter((entry) => entry.exists)
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/panels/History/HistoryListEntryJob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
//@ts-ignore
let value = col.value in item ? item[col.value] : null
if (value === null) value = col.value in item.metadata ? item.metadata[col.value] : null
if (col.value.startsWith('history_field_')) {
const fieldName = col.value.replace('history_field_', '')
const field = item.auxiliary_data?.find((field: any) => field.name === fieldName)
if (field && !Array.isArray(field.value)) return `${Math.round(field.value * 1000) / 1000} ${field.units}`
}
if (value === null) return '--'
if (col.value === 'slicer') value += '<br />' + item.metadata.slicer_version
Expand Down
Loading

0 comments on commit 8bccd7e

Please sign in to comment.