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

[v10.2.x] Templating: Json interpolation of single-value default selection does not create valid json #79503

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

grafana-delivery-bot[bot]
Copy link
Contributor

Backport 31d79c0 from #79137


Fixes an issue where, if a template variable with options doesn't have a value selected, the default value picked wasn't wrapped in an array as it would be if a user were to select it themselves.

Effectively the old value was

{
    value: option.value,
    text: option.text,
    selected: true,
}

where the new value is

{
    value: typeof option.value === 'string' ? [option.value] : option.value,
    text: typeof option.text === 'string' ? [option.text] : option.text,
    selected: true,
}

So value and text are wrapped in an array if they are plain strings.

… not create valid json (#79137)

(cherry picked from commit 31d79c0)
@ivanortegaalba ivanortegaalba enabled auto-merge (squash) December 14, 2023 10:51
@ivanortegaalba ivanortegaalba merged commit fe27d48 into v10.2.x Dec 14, 2023
22 checks passed
@ivanortegaalba ivanortegaalba deleted the backport-79137-to-v10.2.x branch December 14, 2023 10:55
@aangelisc aangelisc modified the milestones: 10.2.x, 10.2.3 Dec 18, 2023
aangelisc pushed a commit that referenced this pull request Dec 21, 2023
…ction does not create valid json (#79503)

Templating: Json interpolation of single-value default selection does not create valid json (#79137)

(cherry picked from commit 31d79c0)

Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com>
(cherry picked from commit fe27d48)
@zserge zserge modified the milestones: 10.2.x, 10.2.4 Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants