diff --git a/src/components/panels/HistoryListPanel.vue b/src/components/panels/HistoryListPanel.vue
index 67a02d9f..b91bc893 100644
--- a/src/components/panels/HistoryListPanel.vue
+++ b/src/components/panels/HistoryListPanel.vue
@@ -1,8 +1,10 @@
-
@@ -35,6 +37,12 @@
mdi-delete
+
+ mdi-database-export-outline
+
= 0 ? ',' : '.'
+ const csvSeperator = decimalSeparator === ',' ? ';' : ','
+
+ const content: string[][] = []
+ const row: string[] = []
+
+ row.push('filename')
+ row.push('status')
+ this.tableFields.forEach((col) => {
+ row.push(col.value)
+ })
+
+ content.push(row)
+
+ if (this.jobs.length) {
+ this.jobs.forEach((job: ServerHistoryStateJob) => {
+ const row: string[] = []
+
+ let filename = job.filename
+ if (filename.includes(csvSeperator)) filename = '"' + filename + '"'
+ row.push(filename)
+ row.push(job.status)
+
+ this.tableFields.forEach((col) => {
+ row.push(this.outputValue(col, job, false, csvSeperator))
+ })
+
+ if (this.headers.find((header) => header.value === 'slicer')?.visible) {
+ let slicerString = 'slicer' in job.metadata && job.metadata.slicer ? job.metadata.slicer : '--'
+ if ('slicer_version' in job.metadata && job.metadata.slicer_version)
+ slicerString += ' ' + job.metadata.slicer_version
+ row.push(slicerString)
+ }
+
+ content.push(row)
+ })
+ }
+
+ const csvContent = 'data:text/csv;charset=utf-8,' + content.map((e) => e.join(csvSeperator)).join('\n')
+ const link = document.createElement('a')
+ link.setAttribute('href', encodeURI(csvContent))
+ link.setAttribute('download', 'print_history.csv')
+ document.body.appendChild(link)
+
+ link.click()
+ link.remove()
+ }
+
getStatusIcon(status: string) {
return this.$store.getters['server/history/getPrintStatusChipIcon'](status)
}
@@ -834,11 +896,33 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
return this.$store.getters['server/history/getPrintStatusChipColor'](status)
}
- outputValue(col: any, item: any) {
+ outputValue(col: any, item: any, format: boolean = true, escapeChar: string | null = null) {
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 (value > 0) {
+ if (!format) {
+ switch (col.outputType) {
+ case 'date':
+ return this.formatDate(value)
+
+ case 'time':
+ return value.toFixed()
+
+ default:
+ switch (typeof value) {
+ case 'number':
+ return value.toLocaleString()
+
+ case 'string':
+ if (escapeChar !== null && value.includes(escapeChar)) value = '"' + value + '"'
+
+ return value
+
+ default:
+ return value
+ }
+ }
+ } else if (value > 0) {
switch (col.outputType) {
case 'filesize':
return formatFilesize(value)
diff --git a/src/locales/en.json b/src/locales/en.json
index 7da43cad..5781d153 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -279,6 +279,7 @@
"PrinttimeAvg": "Printtime AVG",
"PrintHistory": "Print History",
"TitleRefreshHistory": "Refresh History",
+ "TitleExportHistory": "Export History",
"TitleSettings": "Settings",
"Search": "search",
"Jobs": "Jobs",