Enhancement: custom field sorting (#8494)

This commit is contained in:
shamoon
2024-12-30 10:18:34 -08:00
committed by GitHub
parent e44cfef662
commit 4e3d25c714
10 changed files with 522 additions and 25 deletions

View File

@@ -307,18 +307,23 @@ export class DocumentListViewService {
activeListViewState.currentPage = 1
this.reload()
} else {
console.log(error)
this.selectionData = null
let errorMessage
if (
typeof error.error !== 'string' &&
typeof error.error === 'object' &&
Object.keys(error.error).length > 0
) {
// e.g. { archive_serial_number: Array<string> }
errorMessage = Object.keys(error.error)
.map((fieldName) => {
const fieldNameBase = fieldName.split('__')[0]
const fieldError: Array<string> = error.error[fieldName]
return `${
this.sortFields.find((f) => f.field == fieldName)?.name
this.sortFields.find(
(f) => f.field?.split('__')[0] == fieldNameBase
)?.name ?? fieldNameBase
}: ${fieldError[0]}`
})
.join(', ')