From 09c1f1bfffaaa3fcd36b1cfd5f83d2dd5aa2cec4 Mon Sep 17 00:00:00 2001 From: Yann Amsellem Date: Mon, 20 Oct 2025 19:43:29 +0200 Subject: [PATCH] chore: retrieve url for custom tables --- src/lib/olap-engine/engine-remote.ts | 37 +++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/lib/olap-engine/engine-remote.ts b/src/lib/olap-engine/engine-remote.ts index 40034a7..ed44bde 100644 --- a/src/lib/olap-engine/engine-remote.ts +++ b/src/lib/olap-engine/engine-remote.ts @@ -49,26 +49,35 @@ export class RemoteEngine extends InternalEventEmitter implements OLAPEn private getCustomSchemaFromUrl(): Table[] { const schema = new URLSearchParams(window.location.search).get('schema'); - if (!schema) return []; + const replaces = new URLSearchParams(window.location.search).getAll('replace'); + + if (!schema || !replaces) return []; + if (!TABLE_PATTERN.test(schema)) { console.warn('Bad schema passed'); return []; } - return schema.split(';').map((raw) => { - const [name, _columns] = raw.split(':'); + return schema + .split(';') + .map((raw) => { + const [name, _columns] = raw.split(':'); + const url = replaces.find((r) => r.startsWith(`${name}:`))?.replace(`${name}:`, '') ?? ''; - return { - engine: 'custom', - name, - short: name, - url: '', - columns: _columns.split(',').map((_column) => { - const [name, type] = _column.split('='); - return { name, type }; - }) - }; - }); + if (!url) console.warn(`No URL found for ${name}: table ignored`); + + return { + engine: 'custom', + name, + short: name, + url, + columns: _columns.split(',').map((_column) => { + const [name, type] = _column.split('='); + return { name, type }; + }) + }; + }) + .filter((t) => t.url); } }