mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 09:33:34 -06:00
* Remove feature flag from registry.go * Remove usages of toggle * Refactor and cleanup Tempo's query field components * Added deprecation alert * Mark nativeSearch fields as deprecated * Also show deprecated search tab if queryType is nativeSearch * Update deprecation message to list grafana version * Fix merge conflict * Remove mention of toggle from docs
23 lines
660 B
TypeScript
23 lines
660 B
TypeScript
import { DataSourceApi } from '@grafana/data';
|
|
import { getDataSourceSrv } from '@grafana/runtime';
|
|
|
|
export const getErrorMessage = (message: string | undefined, prefix?: string) => {
|
|
const err = message ? ` (${message})` : '';
|
|
let errPrefix = prefix ? prefix : 'Error';
|
|
return `${errPrefix}${err}. Please check the server logs for more details.`;
|
|
};
|
|
|
|
export async function getDS(uid?: string): Promise<DataSourceApi | undefined> {
|
|
if (!uid) {
|
|
return undefined;
|
|
}
|
|
|
|
const dsSrv = getDataSourceSrv();
|
|
try {
|
|
return await dsSrv.get(uid);
|
|
} catch (error) {
|
|
console.error('Failed to load data source', error);
|
|
return undefined;
|
|
}
|
|
}
|