Skip to content

Commit 1efb21e

Browse files
committed
feat: add error handling props and column labels mapping for improved data display
1 parent 1804a0d commit 1efb21e

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

custom/VisionAction.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
:tableColumnsIndexes="tableColumnsIndexes"
6666
:selected="selected"
6767
:oldData="oldData"
68+
:isError="isError"
69+
:errorMessage="errorMessage"
6870
:isAiResponseReceivedAnalizeImage="isAiResponseReceivedAnalizeImage"
6971
:isAiResponseReceivedAnalizeNoImage="isAiResponseReceivedAnalizeNoImage"
7072
:isAiResponseReceivedImage="isAiResponseReceivedImage"
@@ -147,13 +149,8 @@ const props = defineProps<{
147149
meta: any,
148150
resource: AdminForthResourceCommon,
149151
adminUser: AdminUser,
150-
updateList: {
151-
type: Function,
152-
required: true
153-
},
154-
clearCheckboxes: {
155-
type: Function
156-
}
152+
updateList: () => any,
153+
clearCheckboxes?: () => any,
157154
}>();
158155
159156
defineExpose({
@@ -326,6 +323,13 @@ function fillCarouselSaveImages() {
326323
327324
328325
function formatLabel(str) {
326+
const labelsMap = props.meta?.columnLabels || {};
327+
let labelFromMeta = labelsMap[str];
328+
if (!labelFromMeta) {
329+
const match = Object.keys(labelsMap).find(k => k.toLowerCase() === String(str).toLowerCase());
330+
if (match) labelFromMeta = labelsMap[match];
331+
}
332+
if (labelFromMeta) return labelFromMeta;
329333
return str
330334
.split('_')
331335
.map(word => word.charAt(0).toUpperCase() + word.slice(1))

index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
533533
};
534534

535535
const primaryKeyColumn = this.resourceConfig.columns.find((col) => col.primaryKey);
536+
// Map of column technical names to their display labels from resource config
537+
const columnLabels: Record<string, string> = Object.fromEntries(
538+
(this.resourceConfig.columns || []).map((c: any) => [c.name, c.label || c.name])
539+
);
536540

537541
const pageInjection = {
538542
file: this.componentPath('VisionAction.vue'),
@@ -541,6 +545,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
541545
outputFields: outputFields,
542546
actionName: this.options.actionName,
543547
columnEnums: columnEnums,
548+
columnLabels: columnLabels,
544549
outputImageFields: outputImageFields,
545550
outputFieldsForAnalizeFromImages: outputFieldsForAnalizeFromImages,
546551
outputPlainFields: outputPlainFields,

0 commit comments

Comments
 (0)