Dashboards: Don't store options when saving a dashboard with Query/Custom variables (#114540)
This commit is contained in:
@@ -312,18 +312,7 @@ export const handyTestingSchema: Spec = {
|
||||
label: 'Custom Variable',
|
||||
multi: true,
|
||||
name: 'customVar',
|
||||
options: [
|
||||
{
|
||||
selected: true,
|
||||
text: 'option1',
|
||||
value: 'option1',
|
||||
},
|
||||
{
|
||||
selected: false,
|
||||
text: 'option2',
|
||||
value: 'option2',
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
query: 'option1, option2',
|
||||
skipUrlSync: false,
|
||||
allowCustomValue: true,
|
||||
|
||||
+1
-12
@@ -194,18 +194,7 @@ exports[`transformSceneToSaveModelSchemaV2 should transform scene to save model
|
||||
"label": "Custom Variable",
|
||||
"multi": true,
|
||||
"name": "customVar",
|
||||
"options": [
|
||||
{
|
||||
"selected": true,
|
||||
"text": "option1",
|
||||
"value": "option1",
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "option2",
|
||||
"value": "option2",
|
||||
},
|
||||
],
|
||||
"options": [],
|
||||
"query": "option1, option2",
|
||||
"skipUrlSync": false,
|
||||
},
|
||||
|
||||
+2
-34
@@ -371,23 +371,7 @@ describe('sceneVariablesSetToVariables', () => {
|
||||
"label": "test-label",
|
||||
"multi": true,
|
||||
"name": "test",
|
||||
"options": [
|
||||
{
|
||||
"selected": true,
|
||||
"text": "test",
|
||||
"value": "test",
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "test1",
|
||||
"value": "test1",
|
||||
},
|
||||
{
|
||||
"selected": true,
|
||||
"text": "test2",
|
||||
"value": "test2",
|
||||
},
|
||||
],
|
||||
"options": [],
|
||||
"query": "test,test1,test2",
|
||||
"type": "custom",
|
||||
}
|
||||
@@ -1161,23 +1145,7 @@ describe('sceneVariablesSetToVariables', () => {
|
||||
"label": "test-label",
|
||||
"multi": true,
|
||||
"name": "test",
|
||||
"options": [
|
||||
{
|
||||
"selected": true,
|
||||
"text": "test",
|
||||
"value": "test",
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "test1",
|
||||
"value": "test1",
|
||||
},
|
||||
{
|
||||
"selected": true,
|
||||
"text": "test2",
|
||||
"value": "test2",
|
||||
},
|
||||
],
|
||||
"options": [],
|
||||
"query": "test,test1,test2",
|
||||
"skipUrlSync": false,
|
||||
},
|
||||
|
||||
@@ -66,9 +66,7 @@ export function sceneVariablesSetToVariables(set: SceneVariables, keepQueryOptio
|
||||
|
||||
if (sceneUtils.isQueryVariable(variable)) {
|
||||
let options: VariableOption[] = [];
|
||||
// Not sure if we actually have to still support this option given
|
||||
// that it's not exposed in the UI
|
||||
if (transformVariableRefreshToEnum(variable.state.refresh) === 'never' || keepQueryOptions) {
|
||||
if (keepQueryOptions) {
|
||||
options = variableValueOptionsToVariableOptions(variable.state);
|
||||
}
|
||||
variables.push({
|
||||
@@ -106,7 +104,7 @@ export function sceneVariablesSetToVariables(set: SceneVariables, keepQueryOptio
|
||||
// @ts-expect-error
|
||||
value: variable.state.value,
|
||||
},
|
||||
options: variableValueOptionsToVariableOptions(variable.state),
|
||||
options: [],
|
||||
query: variable.state.query,
|
||||
multi: variable.state.isMulti,
|
||||
allValue: variable.state.allValue,
|
||||
@@ -319,9 +317,7 @@ export function sceneVariablesSetToSchemaV2Variables(
|
||||
|
||||
// Query variable
|
||||
if (sceneUtils.isQueryVariable(variable)) {
|
||||
// Not sure if we actually have to still support this option given
|
||||
// that it's not exposed in the UI
|
||||
if (transformVariableRefreshToEnum(variable.state.refresh) === 'never' || keepQueryOptions) {
|
||||
if (keepQueryOptions) {
|
||||
options = variableValueOptionsToVariableOptions(variable.state);
|
||||
}
|
||||
const query = variable.state.query;
|
||||
@@ -385,13 +381,12 @@ export function sceneVariablesSetToSchemaV2Variables(
|
||||
|
||||
// Custom variable
|
||||
} else if (sceneUtils.isCustomVariable(variable)) {
|
||||
options = variableValueOptionsToVariableOptions(variable.state);
|
||||
const customVariable: CustomVariableKind = {
|
||||
kind: 'CustomVariable',
|
||||
spec: {
|
||||
...commonProperties,
|
||||
current: currentVariableOption,
|
||||
options,
|
||||
options: [],
|
||||
query: variable.state.query,
|
||||
multi: variable.state.isMulti || false,
|
||||
allValue: variable.state.allValue,
|
||||
|
||||
Reference in New Issue
Block a user