diff --git a/ui/src/ifql/components/BodyBuilder.tsx b/ui/src/ifql/components/BodyBuilder.tsx index dc327f0975..3904c9a2e3 100644 --- a/ui/src/ifql/components/BodyBuilder.tsx +++ b/ui/src/ifql/components/BodyBuilder.tsx @@ -22,7 +22,9 @@ class BodyBuilder extends PureComponent { if (d.funcs) { return (
-
{d.name}
+
+ {d.name} +
{ return (
-
{b.source}
+
+ {this.colorVariableSyntax(b.source)} +
) }) @@ -55,6 +59,28 @@ class BodyBuilder extends PureComponent { return
{_.flatten(bodybuilder)}
} + private colorVariableSyntax = (varString: string) => { + const split = varString.split('=') + const varName = split[0].substring(0, split[0].length - 1) + const varValue = split[1].substring(1) + + const valueIsString = varValue.endsWith('"') + + return ( + <> + {varName} + {' = '} + + {varValue} + + + ) + } + private get funcNames() { return this.props.suggestions.map(f => f.name) } diff --git a/ui/src/style/components/time-machine/ifql-builder.scss b/ui/src/style/components/time-machine/ifql-builder.scss index bdb0ba17d1..7731e73cd9 100644 --- a/ui/src/style/components/time-machine/ifql-builder.scss +++ b/ui/src/style/components/time-machine/ifql-builder.scss @@ -37,14 +37,23 @@ $ifql-arg-min-width: 120px; } } -.variable-name { +.variable-string { @extend %ifql-node; - color: $c-laser; + color: $g11-sidewalk; line-height: $ifql-node-height; white-space: nowrap; background-color: $g3-castle; @include no-user-select(); } +.variable-name { + color: $c-pool; +} +.variable-value--string { + color: $c-honeydew +} +.variable-value--number { + color: $c-neutrino; +} .func-node { @extend %ifql-node;