diff --git a/src/api/services/precomputed/precomputed.js b/src/api/services/precomputed/precomputed.js index df1a8a9ac3..2291e0f606 100644 --- a/src/api/services/precomputed/precomputed.js +++ b/src/api/services/precomputed/precomputed.js @@ -1,3 +1,5 @@ +//TODO - Precomputing Task will be coded in next card + import ezs from '@ezs/core'; import progress from '../progress'; import localConfig from '../../../../config.json'; @@ -44,20 +46,19 @@ export const getPrecomputedDataPreview = async ctx => { throw new Error(`Missing parameters`); } - const commands = null; const excerptLines = await ctx.dataset.getExcerpt( - sourceColumns ? { [sourceColumns]: { $ne: null } } : {}, + sourceColumns && sourceColumns.length + ? { [sourceColumns[0]]: { $ne: null } } + : {}, ); let result = []; try { for (let index = 0; index < excerptLines.length; index += BATCH_SIZE) { - let values = await processEzsEnrichment( - excerptLines.slice(index, index + BATCH_SIZE), - commands, - ctx, - true, - ); - result.push(...values.map(v => v.value)); + const entry = {}; + sourceColumns.map(column => { + entry[column] = excerptLines[index][column]; + }); + result.push(entry); } } catch (error) { const logger = getLogger(ctx.tenant); diff --git a/src/api/workers/precomputer.js b/src/api/workers/precomputer.js index 482d5d1964..26b7d012f6 100644 --- a/src/api/workers/precomputer.js +++ b/src/api/workers/precomputer.js @@ -1,3 +1,5 @@ +//TODO - Precomputing Task will be coded in next card + import { CancelWorkerError } from '.'; import { startEnrichment, diff --git a/src/app/js/admin/precomputed/PrecomputedPreview.js b/src/app/js/admin/precomputed/PrecomputedPreview.js index bcd2ffb5cb..ee425dddbe 100644 --- a/src/app/js/admin/precomputed/PrecomputedPreview.js +++ b/src/app/js/admin/precomputed/PrecomputedPreview.js @@ -31,7 +31,9 @@ const PrecomputedPreview = ({ lines, sourceColumns, p: polyglot }) => { - {sourceColumns} + + {sourceColumns && sourceColumns.join(' | ')} + {lines.length > 0 && @@ -47,7 +49,7 @@ const PrecomputedPreview = ({ lines, sourceColumns, p: polyglot }) => { }} title={JSON.stringify(line)} > - {JSON.stringify(line)} + {Object.values(line).join(' | ')} ))}