mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard scenes: fix textbox value only set to first character of default value (#86595)
Dashboard scene: fix textbox value only set to first character in default value
This commit is contained in:
parent
357276da01
commit
dccad4e081
@ -392,9 +392,20 @@ export function createSceneVariableFromVariableModel(variable: TypedVariableMode
|
|||||||
hide: variable.hide,
|
hide: variable.hide,
|
||||||
});
|
});
|
||||||
} else if (variable.type === 'textbox') {
|
} else if (variable.type === 'textbox') {
|
||||||
|
let val;
|
||||||
|
if (!variable?.current?.value) {
|
||||||
|
val = variable.query;
|
||||||
|
} else {
|
||||||
|
if (typeof variable.current.value === 'string') {
|
||||||
|
val = variable.current.value;
|
||||||
|
} else {
|
||||||
|
val = variable.current.value[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new TextBoxVariable({
|
return new TextBoxVariable({
|
||||||
...commonProperties,
|
...commonProperties,
|
||||||
value: variable?.current?.value?.[0] ?? variable.query,
|
value: val,
|
||||||
skipUrlSync: variable.skipUrlSync,
|
skipUrlSync: variable.skipUrlSync,
|
||||||
hide: variable.hide,
|
hide: variable.hide,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user