Chore: some type fixes (#69860)

* some type fixes

* restore empty object

* undo 1 fix for now

* commit betterer update

* explicitly type slug and uid as string | undefined
This commit is contained in:
Ashley Harrison
2023-06-20 17:13:49 +01:00
committed by GitHub
parent c07d3c7bdd
commit 13e3308959
17 changed files with 91 additions and 141 deletions

View File

@@ -1,4 +1,4 @@
import { DataSourcePluginMeta, DataSourceSettings, locationUtil } from '@grafana/data';
import { DataSourcePluginMeta, DataSourceSettings, locationUtil, TestDataSourceResponse } from '@grafana/data';
import {
config,
DataSourceWithBackend,
@@ -79,14 +79,8 @@ const parseHealthCheckError = (errorResponse: any): parseDataSourceSaveResponse
return { message, details };
};
const parseHealthCheckSuccess = (response: any): parseDataSourceSaveResponse => {
let message: string | undefined;
let status: string;
let details: { message?: string; verboseMessage?: string };
status = response.status;
message = response.message;
details = response.details;
const parseHealthCheckSuccess = (response: TestDataSourceResponse): parseDataSourceSaveResponse => {
const { details, message, status } = response;
return { status, message, details };
};
@@ -282,7 +276,7 @@ export function updateDataSource(dataSource: DataSourceSettings) {
) => {
try {
await api.updateDataSource(dataSource);
} catch (err: any) {
} catch (err) {
const formattedError = parseHealthCheckError(err);
dispatch(testDataSourceFailed(formattedError));