From 8fc6502a89702437a846604aecc7f0b24b529489 Mon Sep 17 00:00:00 2001 From: hamou Date: Tue, 26 Nov 2024 11:19:49 +0100 Subject: [PATCH] Fix fetching visualisation fields --- src/app/services/visualize.service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/services/visualize.service.ts b/src/app/services/visualize.service.ts index c83d3639..7cbb8454 100644 --- a/src/app/services/visualize.service.ts +++ b/src/app/services/visualize.service.ts @@ -73,7 +73,13 @@ export class VisualizeService { public getVisuFields(urlTemplate): string[] { if (urlTemplate.indexOf('{') >= 0) { - const fields = urlTemplate.split(/[{}]/).filter(v => v.length > 0); + /** Fetch all elements between {} in the template. */ + const regex = new RegExp(/{([^}]+)}/g); + const fields = []; + let match; + while ((match = regex.exec(urlTemplate)) !== null) { + fields.push(match[1]); + } if (fields) { return fields .filter(f => f !== 'x')