diff --git a/packages/scenes/src/variables/interpolation/formatRegistry.test.ts b/packages/scenes/src/variables/interpolation/formatRegistry.test.ts index c5bb43dc6..e76cd1754 100644 --- a/packages/scenes/src/variables/interpolation/formatRegistry.test.ts +++ b/packages/scenes/src/variables/interpolation/formatRegistry.test.ts @@ -26,6 +26,10 @@ describe('formatRegistry', () => { expect(formatValue(VariableFormatID.Glob, ['AA', 'BB', 'C.*'])).toBe('{AA,BB,C.*}'); expect(formatValue(VariableFormatID.Text, 'v', 'display text')).toBe('display text'); + expect(formatValue(VariableFormatID.Text, ['test', 'test2'])).toBe('test + test2'); + + expect(formatValue(VariableFormatID.TextUpper, 'test')).toBe('TEST'); + expect(formatValue(VariableFormatID.TextUpper, ['test', 'test2'])).toBe('TEST + TEST2'); expect(formatValue(VariableFormatID.Raw, [12, 13])).toBe('12,13'); expect(formatValue(VariableFormatID.Raw, '#Ƴ ̇¹"Ä1"#!"#!½')).toBe('#Ƴ ̇¹"Ä1"#!"#!½'); diff --git a/packages/scenes/src/variables/interpolation/formatRegistry.ts b/packages/scenes/src/variables/interpolation/formatRegistry.ts index 6b6f74411..624f79562 100644 --- a/packages/scenes/src/variables/interpolation/formatRegistry.ts +++ b/packages/scenes/src/variables/interpolation/formatRegistry.ts @@ -274,6 +274,18 @@ export const formatRegistry = new Registry(() => { return String(value); }, }, + { + id: VariableFormatID.TextUpper, + name: 'Text Uppercase', + description: 'Format variables in their uppercase text representation. Example in multi-variable scenario a + b + c => A + B + C.', + formatter: (value, _args, variable) => { + if (variable.getValueText) { + return variable.getValueText().toUpperCase(); + } + + return String(value); + }, + }, { id: VariableFormatID.QueryParam, name: 'Query parameter',