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

Add support for JSON functions in dashboard import #107

Merged
merged 1 commit into from Apr 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion init/src/metabase/dashboards.ts
Expand Up @@ -456,7 +456,9 @@ export class Dashboards {
JSON.parse(handlebars.compile(template)({})),
(key, value) => {
return key === 'query' && isString(value)
? value.replace(/<</g, '{{').replace(/>>/g, '}}')
// ->> and #>> must not be replaced
// https://www.postgresql.org/docs/9.4/functions-json.html
? value.replace(/<</g, '{{').replace(/[^-#]>>/g, '}}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should use some other chars?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, but that should be a different PR that will also add tests

: value;
}
)
Expand Down