diff --git a/public/app/features/alerting/unified/PanelAlertTabContent.test.tsx b/public/app/features/alerting/unified/PanelAlertTabContent.test.tsx index f76a4f86fe7..bf10c1bc7b4 100644 --- a/public/app/features/alerting/unified/PanelAlertTabContent.test.tsx +++ b/public/app/features/alerting/unified/PanelAlertTabContent.test.tsx @@ -25,6 +25,7 @@ import { PrometheusDatasource } from 'app/plugins/datasource/prometheus/datasour import { DataSourceApi } from '@grafana/data'; import { getDatasourceSrv } from 'app/features/plugins/datasource_srv'; import { PromOptions } from 'app/plugins/datasource/prometheus/types'; +import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend'; jest.mock('./api/prometheus'); jest.mock('./api/ruler'); @@ -308,7 +309,7 @@ describe('PanelAlertTabContent', () => { hide: false, type: 'classic_conditions', datasource: { - type: 'grafana-expression', + type: ExpressionDatasourceRef.type, uid: '-100', }, conditions: [ diff --git a/public/app/features/alerting/unified/components/rule-editor/util.test.ts b/public/app/features/alerting/unified/components/rule-editor/util.test.ts index 28aedeaf091..7b62497f9c8 100644 --- a/public/app/features/alerting/unified/components/rule-editor/util.test.ts +++ b/public/app/features/alerting/unified/components/rule-editor/util.test.ts @@ -1,6 +1,7 @@ import { ClassicCondition, ExpressionQuery } from 'app/features/expressions/types'; import { AlertQuery } from 'app/types/unified-alerting-dto'; import { queriesWithUpdatedReferences, updateMathExpressionRefs } from './util'; +import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend'; describe('rule-editor', () => { const dataSource: AlertQuery = { @@ -23,10 +24,7 @@ describe('rule-editor', () => { model: { refId: 'B', type: 'classic_conditions', - datasource: { - uid: '-100', - type: 'grafana-expression', - }, + datasource: ExpressionDatasourceRef, conditions: [ { type: 'query', @@ -56,10 +54,7 @@ describe('rule-editor', () => { model: { refId: 'B', type: 'math', - datasource: { - uid: '-100', - type: 'grafana-expression', - }, + datasource: ExpressionDatasourceRef, conditions: [], expression: 'abs($A) + $A', }, @@ -72,10 +67,7 @@ describe('rule-editor', () => { model: { refId: 'B', type: 'reduce', - datasource: { - uid: '-100', - type: 'grafana-expression', - }, + datasource: ExpressionDatasourceRef, conditions: [], reducer: 'mean', expression: 'A', diff --git a/public/app/features/alerting/unified/utils/rule-form.ts b/public/app/features/alerting/unified/utils/rule-form.ts index de408a6b372..bf9326f252e 100644 --- a/public/app/features/alerting/unified/utils/rule-form.ts +++ b/public/app/features/alerting/unified/utils/rule-form.ts @@ -30,6 +30,7 @@ import { isGrafanaRulesSource } from './datasource'; import { arrayToRecord, recordToArray } from './misc'; import { isAlertingRulerRule, isGrafanaRulerRule, isRecordingRulerRule } from './rules'; import { parseInterval } from './time'; +import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend'; export const getDefaultFormValues = (): RuleFormValues => Object.freeze({ @@ -192,7 +193,7 @@ const getDefaultExpression = (refId: string): AlertQuery => { type: ExpressionQueryType.classic, datasource: { uid: ExpressionDatasourceUID, - type: 'grafana-expression', + type: ExpressionDatasourceRef.type, }, conditions: [ { diff --git a/public/app/features/expressions/ExpressionDatasource.ts b/public/app/features/expressions/ExpressionDatasource.ts index 2349eec0dc9..cfc5be8e385 100644 --- a/public/app/features/expressions/ExpressionDatasource.ts +++ b/public/app/features/expressions/ExpressionDatasource.ts @@ -36,7 +36,7 @@ export const instanceSettings: DataSourceInstanceSettings = { id: -100, uid: ExpressionDatasourceUID, name: ExpressionDatasourceRef.type, - type: 'grafana-expression', + type: ExpressionDatasourceRef.type, access: 'proxy', meta: { baseUrl: '',