From 6e75c5d182c20b3c95ed5dd74c7100813ad67904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Farkas?= Date: Mon, 11 Sep 2023 09:48:55 +0200 Subject: [PATCH] postgres/sql: fix imports (#74535) * postgres/sql: fix imports * nicer import Co-authored-by: Adam Yeats <16296989+adamyeats@users.noreply.github.com> --------- Co-authored-by: Adam Yeats <16296989+adamyeats@users.noreply.github.com> --- public/app/features/plugins/sql/ResponseParser.ts | 3 ++- public/app/features/plugins/sql/datasource/SqlDatasource.ts | 4 ++-- .../postgres/configuration/ConfigurationEditor.tsx | 2 +- .../postgres/configuration/useAutoDetectFeatures.ts | 5 ++--- public/app/plugins/datasource/postgres/datasource.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/public/app/features/plugins/sql/ResponseParser.ts b/public/app/features/plugins/sql/ResponseParser.ts index 3c6589d3124..5684f02079d 100644 --- a/public/app/features/plugins/sql/ResponseParser.ts +++ b/public/app/features/plugins/sql/ResponseParser.ts @@ -1,7 +1,8 @@ import { uniqBy } from 'lodash'; import { DataFrame, MetricFindValue } from '@grafana/data'; -import { ResponseParser as ResponseParserType } from 'app/features/plugins/sql/types'; + +import type { ResponseParser as ResponseParserType } from './types'; export class ResponseParser implements ResponseParserType { transformMetricFindResponse(frame: DataFrame): MetricFindValue[] { diff --git a/public/app/features/plugins/sql/datasource/SqlDatasource.ts b/public/app/features/plugins/sql/datasource/SqlDatasource.ts index 66589d99029..37a53bd855a 100644 --- a/public/app/features/plugins/sql/datasource/SqlDatasource.ts +++ b/public/app/features/plugins/sql/datasource/SqlDatasource.ts @@ -14,6 +14,7 @@ import { CoreApp, getSearchFilterScopedVar, LegacyMetricFindQueryOptions, + VariableWithMultiSupport, } from '@grafana/data'; import { EditorMode } from '@grafana/experimental'; import { @@ -22,13 +23,12 @@ import { FetchResponse, getBackendSrv, getTemplateSrv, + toDataQueryResponse, TemplateSrv, reportInteraction, } from '@grafana/runtime'; -import { toDataQueryResponse } from '@grafana/runtime/src/utils/queryResponse'; import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv'; -import { VariableWithMultiSupport } from '../../../variables/types'; import { ResponseParser } from '../ResponseParser'; import { SqlQueryEditor } from '../components/QueryEditor'; import { MACRO_NAMES } from '../constants'; diff --git a/public/app/plugins/datasource/postgres/configuration/ConfigurationEditor.tsx b/public/app/plugins/datasource/postgres/configuration/ConfigurationEditor.tsx index fd29a5b5c73..253ed18d71e 100644 --- a/public/app/plugins/datasource/postgres/configuration/ConfigurationEditor.tsx +++ b/public/app/plugins/datasource/postgres/configuration/ConfigurationEditor.tsx @@ -8,6 +8,7 @@ import { updateDatasourcePluginJsonDataOption, updateDatasourcePluginResetOption, } from '@grafana/data'; +import { config } from '@grafana/runtime'; import { Alert, InlineSwitch, @@ -19,7 +20,6 @@ import { SecretInput, Link, } from '@grafana/ui'; -import { config } from 'app/core/config'; import { ConnectionLimits } from 'app/features/plugins/sql/components/configuration/ConnectionLimits'; import { TLSSecretsConfig } from 'app/features/plugins/sql/components/configuration/TLSSecretsConfig'; import { useMigrateDatabaseFields } from 'app/features/plugins/sql/components/configuration/useMigrateDatabaseFields'; diff --git a/public/app/plugins/datasource/postgres/configuration/useAutoDetectFeatures.ts b/public/app/plugins/datasource/postgres/configuration/useAutoDetectFeatures.ts index 99ad7378fbc..4613d65b72b 100644 --- a/public/app/plugins/datasource/postgres/configuration/useAutoDetectFeatures.ts +++ b/public/app/plugins/datasource/postgres/configuration/useAutoDetectFeatures.ts @@ -8,8 +8,7 @@ import { updateDatasourcePluginJsonDataOption, updateDatasourcePluginOption, } from '@grafana/data'; -import { getBackendSrv } from '@grafana/runtime'; -import { getDatasourceSrv } from 'app/features/plugins/datasource_srv'; +import { getBackendSrv, getDataSourceSrv } from '@grafana/runtime'; import { PostgresDatasource } from '../datasource'; import { PostgresOptions, PostgresTLSModes, SecureJsonData } from '../types'; @@ -38,7 +37,7 @@ export function useAutoDetectFeatures({ props, setVersionOptions }: Options) { // This is needed or else we get an error when we try to save the datasource. updateDatasourcePluginOption({ options, onOptionsChange }, 'version', result.datasource.version); } else { - const datasource = await getDatasourceSrv().loadDatasource(options.name); + const datasource = await getDataSourceSrv().get(options.name); if (datasource instanceof PostgresDatasource) { const version = await datasource.getVersion(); diff --git a/public/app/plugins/datasource/postgres/datasource.ts b/public/app/plugins/datasource/postgres/datasource.ts index 597a4fede83..173c17fd7d8 100644 --- a/public/app/plugins/datasource/postgres/datasource.ts +++ b/public/app/plugins/datasource/postgres/datasource.ts @@ -1,9 +1,9 @@ import { DataSourceInstanceSettings, ScopedVars } from '@grafana/data'; import { LanguageDefinition } from '@grafana/experimental'; +import { TemplateSrv } from '@grafana/runtime'; import { SqlDatasource } from 'app/features/plugins/sql/datasource/SqlDatasource'; import { DB, SQLQuery, SQLSelectableValue } from 'app/features/plugins/sql/types'; import { formatSQL } from 'app/features/plugins/sql/utils/formatSQL'; -import { TemplateSrv } from 'app/features/templating/template_srv'; import { PostgresQueryModel } from './PostgresQueryModel'; import { getSchema, getTimescaleDBVersion, getVersion, showTables } from './postgresMetaQuery';