File tree Expand file tree Collapse file tree 1 file changed +1
-26
lines changed
Expand file tree Collapse file tree 1 file changed +1
-26
lines changed Original file line number Diff line number Diff line change 1- import React , { useState } from 'react' ;
1+ import React from 'react' ;
22import { css } from 'emotion' ;
33import { Button , stylesFactory , useTheme } from '@grafana/ui' ;
44import {
55 GrafanaTheme ,
66 VariableOrigin ,
77 DataLinkBuiltInVars ,
8- DataSourceSelectItem ,
98} from '@grafana/data' ;
109import { DataLinkConfig } from './types' ;
1110import { DataLink } from './DataLink' ;
@@ -26,33 +25,9 @@ type Props = {
2625} ;
2726export 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 >
You can’t perform that action at this time.
0 commit comments