diff --git a/public/app/features/dashboard-scene/serialization/__snapshots__/transformSceneToSaveModel.test.ts.snap b/public/app/features/dashboard-scene/serialization/__snapshots__/transformSceneToSaveModel.test.ts.snap index ab41276f8ef..8ab27fc7a70 100644 --- a/public/app/features/dashboard-scene/serialization/__snapshots__/transformSceneToSaveModel.test.ts.snap +++ b/public/app/features/dashboard-scene/serialization/__snapshots__/transformSceneToSaveModel.test.ts.snap @@ -288,7 +288,6 @@ exports[`transformSceneToSaveModel Given a scene with rows Should transform back "templating": { "list": [ { - "allowCustomValue": true, "current": { "text": [ "A", @@ -307,7 +306,6 @@ exports[`transformSceneToSaveModel Given a scene with rows Should transform back "type": "custom", }, { - "allowCustomValue": true, "current": { "text": [ "1", @@ -558,7 +556,6 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho "templating": { "list": [ { - "allowCustomValue": true, "baseFilters": [], "datasource": { "type": "prometheus", @@ -634,7 +631,6 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho "type": "interval", }, { - "allowCustomValue": true, "current": { "text": [ "a", @@ -651,7 +647,6 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho "type": "custom", }, { - "allowCustomValue": true, "current": { "text": "gdev-testdata", "value": "PD8C576611E62080A", @@ -665,7 +660,6 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho "type": "datasource", }, { - "allowCustomValue": true, "current": { "text": "A", "value": "A", @@ -921,7 +915,6 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr "templating": { "list": [ { - "allowCustomValue": true, "baseFilters": [], "datasource": { "type": "prometheus", @@ -997,7 +990,6 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr "type": "interval", }, { - "allowCustomValue": true, "current": { "text": [ "a", @@ -1014,7 +1006,6 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr "type": "custom", }, { - "allowCustomValue": true, "current": { "text": "gdev-testdata", "value": "PD8C576611E62080A", @@ -1028,7 +1019,6 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr "type": "datasource", }, { - "allowCustomValue": true, "current": { "text": "A", "value": "A", diff --git a/public/app/features/dashboard-scene/utils/variables.test.ts b/public/app/features/dashboard-scene/utils/variables.test.ts index 5cc249ff9fe..75052189c54 100644 --- a/public/app/features/dashboard-scene/utils/variables.test.ts +++ b/public/app/features/dashboard-scene/utils/variables.test.ts @@ -501,7 +501,6 @@ describe('when creating variables objects', () => { expect(filterVarState).toEqual({ key: expect.any(String), description: 'Adhoc Description', - allowCustomValue: true, hide: 0, label: 'Adhoc Label', name: 'adhoc', @@ -674,7 +673,6 @@ describe('when creating variables objects', () => { expect(migrated).toBeInstanceOf(DataSourceVariable); expect(rest).toEqual({ allValue: 'Custom all', - allowCustomValue: true, defaultToAll: true, includeAll: true, label: undefined, @@ -717,7 +715,6 @@ describe('when creating variables objects', () => { expect(migrated).toBeInstanceOf(DataSourceVariable); expect(rest).toEqual({ allValue: 'Custom all', - allowCustomValue: true, defaultToAll: true, includeAll: true, label: undefined, diff --git a/public/app/features/dashboard-scene/utils/variables.ts b/public/app/features/dashboard-scene/utils/variables.ts index 983a217b5c4..3392aa6dfbf 100644 --- a/public/app/features/dashboard-scene/utils/variables.ts +++ b/public/app/features/dashboard-scene/utils/variables.ts @@ -138,7 +138,7 @@ export function createSceneVariableFromVariableModel(variable: TypedVariableMode filters: variable.filters ?? [], baseFilters: variable.baseFilters ?? [], defaultKeys: variable.defaultKeys, - allowCustomValue: variable.allowCustomValue ?? true, + allowCustomValue: variable.allowCustomValue, useQueriesAsFilterForOptions: true, layout: config.featureToggles.newFiltersUI ? 'combobox' : undefined, supportsMultiValueOperators: Boolean( @@ -159,7 +159,7 @@ export function createSceneVariableFromVariableModel(variable: TypedVariableMode defaultToAll: Boolean(variable.includeAll), skipUrlSync: variable.skipUrlSync, hide: variable.hide, - allowCustomValue: variable.allowCustomValue ?? true, + allowCustomValue: variable.allowCustomValue, }); } else if (variable.type === 'query') { return new QueryVariable({ @@ -179,7 +179,7 @@ export function createSceneVariableFromVariableModel(variable: TypedVariableMode skipUrlSync: variable.skipUrlSync, hide: variable.hide, definition: variable.definition, - allowCustomValue: variable.allowCustomValue ?? true, + allowCustomValue: variable.allowCustomValue, }); } else if (variable.type === 'datasource') { return new DataSourceVariable({ @@ -195,7 +195,7 @@ export function createSceneVariableFromVariableModel(variable: TypedVariableMode isMulti: variable.multi, hide: variable.hide, defaultOptionEnabled: variable.current?.value === DEFAULT_DATASOURCE && variable.current?.text === 'default', - allowCustomValue: variable.allowCustomValue ?? true, + allowCustomValue: variable.allowCustomValue, }); } else if (variable.type === 'interval') { const intervals = getIntervalsFromQueryString(variable.query); @@ -246,7 +246,7 @@ export function createSceneVariableFromVariableModel(variable: TypedVariableMode hide: variable.hide, // @ts-expect-error defaultOptions: variable.options, - allowCustomValue: variable.allowCustomValue ?? true, + allowCustomValue: variable.allowCustomValue, }); } else { throw new Error(`Scenes: Unsupported variable type ${variable.type}`);