mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Datasource Plugins: Allow tracking for configuration usage (#72650)
Datasource Plugins: Allow tracking for configuration usage
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
import { DataSourcePluginMeta, DataSourceSettings, locationUtil, TestDataSourceResponse } from '@grafana/data';
|
||||
import {
|
||||
DataSourcePluginMeta,
|
||||
DataSourceSettings,
|
||||
locationUtil,
|
||||
TestDataSourceResponse,
|
||||
DataSourceTestSucceeded,
|
||||
DataSourceTestFailed,
|
||||
} from '@grafana/data';
|
||||
import {
|
||||
config,
|
||||
DataSourceSrv,
|
||||
DataSourceWithBackend,
|
||||
getDataSourceSrv,
|
||||
HealthCheckError,
|
||||
HealthCheckResultDetails,
|
||||
isFetchError,
|
||||
locationService,
|
||||
} from '@grafana/runtime';
|
||||
import { updateNavIndex } from 'app/core/actions';
|
||||
import { contextSrv } from 'app/core/core';
|
||||
import { appEvents, contextSrv } from 'app/core/core';
|
||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||
import { ROUTES as CONNECTIONS_ROUTES } from 'app/features/connections/constants';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
@@ -53,7 +60,7 @@ export interface InitDataSourceSettingDependencies {
|
||||
}
|
||||
|
||||
export interface TestDataSourceDependencies {
|
||||
getDatasourceSrv: typeof getDataSourceSrv;
|
||||
getDatasourceSrv: () => Pick<DataSourceSrv, 'get'>;
|
||||
getBackendSrv: typeof getBackendSrv;
|
||||
}
|
||||
|
||||
@@ -150,6 +157,7 @@ export const testDataSource = (
|
||||
success: true,
|
||||
path: editLink,
|
||||
});
|
||||
appEvents.publish(new DataSourceTestSucceeded());
|
||||
} catch (err) {
|
||||
const formattedError = parseHealthCheckError(err);
|
||||
|
||||
@@ -161,6 +169,7 @@ export const testDataSource = (
|
||||
success: false,
|
||||
path: editLink,
|
||||
});
|
||||
appEvents.publish(new DataSourceTestFailed());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user