mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DataLinks: Removes getDataSourceSettingsByUid from applyFieldOverrides (#29447)
* DataLinks: Removes getDataSourceSettingsByUid from applyFieldOverrides and data linking code * Fixed test * Fixed a few tests * Fixed unit tests * Removed old getDataSourceSettingsByUid from interface, still there for runtime backward compatability
This commit is contained in:
@@ -41,10 +41,10 @@ describe('createSpanLinkFactory', () => {
|
||||
} as DataSourceInstanceSettings,
|
||||
];
|
||||
},
|
||||
getDataSourceSettingsByUid(uid: string): DataSourceInstanceSettings | undefined {
|
||||
getInstanceSettings(uid: string): DataSourceInstanceSettings | undefined {
|
||||
if (uid === 'lokiUid') {
|
||||
return {
|
||||
name: 'Loki1',
|
||||
name: 'loki1',
|
||||
} as any;
|
||||
}
|
||||
return undefined;
|
||||
@@ -82,7 +82,7 @@ describe('createSpanLinkFactory', () => {
|
||||
} as any);
|
||||
|
||||
expect(linkDef.href).toBe(
|
||||
`/explore?left={"range":{"from":"20201014T000000","to":"20201014T010006"},"datasource":"Loki1","queries":[{"expr":"{cluster=\\"cluster1\\", hostname=\\"hostname1\\"}","refId":""}]}`
|
||||
`/explore?left={"range":{"from":"20201014T000000","to":"20201014T010006"},"datasource":"loki1","queries":[{"expr":"{cluster=\\"cluster1\\", hostname=\\"hostname1\\"}","refId":""}]}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,17 +34,24 @@ export function createSpanLinkFactory(splitOpenFn: (options: { datasourceUid: st
|
||||
url: '',
|
||||
internal: {
|
||||
datasourceUid: lokiDs.uid,
|
||||
datasourceName: lokiDs.name,
|
||||
query: {
|
||||
expr: getLokiQueryFromSpan(span),
|
||||
refId: '',
|
||||
},
|
||||
},
|
||||
};
|
||||
const link = mapInternalLinkToExplore(dataLink, {}, getTimeRangeFromSpan(span), {} as Field, {
|
||||
|
||||
const link = mapInternalLinkToExplore({
|
||||
link: dataLink,
|
||||
internalLink: dataLink.internal!,
|
||||
scopedVars: {},
|
||||
range: getTimeRangeFromSpan(span),
|
||||
field: {} as Field,
|
||||
onClickFn: splitOpenFn,
|
||||
replaceVariables: getTemplateSrv().replace.bind(getTemplateSrv()),
|
||||
getDataSourceSettingsByUid: getDataSourceSrv().getDataSourceSettingsByUid.bind(getDataSourceSrv()),
|
||||
});
|
||||
|
||||
return {
|
||||
href: link.href,
|
||||
onClick: link.onClick,
|
||||
|
||||
Reference in New Issue
Block a user