Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(history): add support for Moonraker sensor history_fields #1884

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading