Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fetching visualisation fields #911

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/app/services/visualize.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
const matches = [...urlTemplate.matchAll(regex)];
if (!!matches) {
matches.filter(m => !!m && Array.isArray(m) && m.length > 1).forEach(m => fields.push(m[1]));
}
if (fields) {
return fields
.filter(f => f !== 'x')
Expand Down
Loading