Skip to content

Commit e7cc1c6

Browse files
Merge pull request #47 from grafana/fix_datalink
remove unused datasources from DataLinks
2 parents 9d4abb6 + ab1ea5e commit e7cc1c6

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

src/components/DataLinks/DataLinks.tsx

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import React, { useState } from 'react';
1+
import React from 'react';
22
import { css } from 'emotion';
33
import { Button, stylesFactory, useTheme } from '@grafana/ui';
44
import {
55
GrafanaTheme,
66
VariableOrigin,
77
DataLinkBuiltInVars,
8-
DataSourceSelectItem,
98
} from '@grafana/data';
109
import { DataLinkConfig } from './types';
1110
import { DataLink } from './DataLink';
@@ -26,33 +25,9 @@ type Props = {
2625
};
2726
export const DataLinks = (props: Props) => {
2827
const { value, onChange } = props;
29-
const [datasources, setDatasources] = useState<DataSourceSelectItem[]>([]);
3028
const theme = useTheme();
3129
const styles = getStyles(theme);
3230

33-
if (!datasources?.length) {
34-
fetch('/api/datasources').then(async (resp: Response) => {
35-
const restDS = (await resp.json()) as any[];
36-
const newDS: DataSourceSelectItem[] = restDS.map((ds) => {
37-
return ({
38-
name: ds.name,
39-
value: ds.type,
40-
meta: {
41-
id: ds.id,
42-
info: {
43-
logos: {
44-
small: ds.typeLogoUrl,
45-
},
46-
},
47-
},
48-
sort: '',
49-
} as unknown) as DataSourceSelectItem;
50-
});
51-
52-
setDatasources(newDS);
53-
});
54-
}
55-
5631
return (
5732
<>
5833
<h3 className='page-heading'>Data links</h3>

0 commit comments

Comments
 (0)