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AAYA,GAAgB,iBASvF,QAAe8B,EAAUoB","sources":["webpack://grafana/./public/app/core/components/PageActionBar/PageActionBar.tsx","webpack://grafana/./public/app/features/datasources/DataSourcesList.tsx","webpack://grafana/./public/app/features/datasources/DataSourcesListPage.tsx"],"sourcesContent":["import React, { PureComponent } from 'react';\n\nimport { LinkButton, FilterInput } from '@grafana/ui';\n\nexport interface Props {\n searchQuery: string;\n setSearchQuery: (value: string) => void;\n linkButton?: { href: string; title: string; disabled?: boolean };\n target?: string;\n placeholder?: string;\n}\n\nexport default class PageActionBar extends PureComponent<Props> {\n render() {\n const { searchQuery, linkButton, setSearchQuery, target, placeholder = 'Search by name or type' } = this.props;\n const linkProps: typeof LinkButton.defaultProps = { href: linkButton?.href, disabled: linkButton?.disabled };\n\n if (target) {\n linkProps.target = target;\n }\n\n return (\n <div className=\"page-action-bar\">\n <div className=\"gf-form gf-form--grow\">\n <FilterInput value={searchQuery} onChange={setSearchQuery} placeholder={placeholder} />\n </div>\n {linkButton && <LinkButton {...linkProps}>{linkButton.title}</LinkButton>}\n </div>\n );\n }\n}\n","// Libraries\nimport { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\n// Types\nimport { DataSourceSettings, LayoutMode } from '@grafana/data';\nimport { Card, Tag, useStyles } from '@grafana/ui';\n\nexport interface Props {\n dataSources: DataSourceSettings[];\n layoutMode: LayoutMode;\n}\n\nexport const DataSourcesList: FC<Props> = ({ dataSources, layoutMode }) => {\n const styles = useStyles(getStyles);\n\n return (\n <ul className={styles.list}>\n {dataSources.map((dataSource) => {\n return (\n <li key={dataSource.id}>\n <Card href={`datasources/edit/${dataSource.uid}`}>\n <Card.Heading>{dataSource.name}</Card.Heading>\n <Card.Figure>\n <img src={dataSource.typeLogoUrl} alt=\"\" height=\"40px\" width=\"40px\" className={styles.logo} />\n </Card.Figure>\n <Card.Meta>\n {[\n dataSource.typeName,\n dataSource.url,\n dataSource.isDefault && <Tag key=\"default-tag\" name={'default'} colorIndex={1} />,\n ]}\n </Card.Meta>\n </Card>\n </li>\n );\n })}\n </ul>\n );\n};\n\nexport default DataSourcesList;\n\nconst getStyles = () => {\n return {\n list: css({\n listStyle: 'none',\n display: 'grid',\n // gap: '8px', Add back when legacy support for old Card interface is dropped\n }),\n logo: css({\n objectFit: 'contain',\n }),\n };\n};\n","import React, { PureComponent } from 'react';\nimport { connect, ConnectedProps } from 'react-redux';\n\nimport { IconName } from '@grafana/ui';\nimport EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';\nimport Page from 'app/core/components/Page/Page';\nimport PageActionBar from 'app/core/components/PageActionBar/PageActionBar';\nimport { contextSrv } from 'app/core/core';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState, AccessControlAction } from 'app/types';\n\nimport DataSourcesList from './DataSourcesList';\nimport { loadDataSources } from './state/actions';\nimport { setDataSourcesLayoutMode, setDataSourcesSearchQuery } from './state/reducers';\nimport {\n getDataSources,\n getDataSourcesCount,\n getDataSourcesLayoutMode,\n getDataSourcesSearchQuery,\n} from './state/selectors';\n\nfunction mapStateToProps(state: StoreState) {\n return {\n navModel: getNavModel(state.navIndex, 'datasources'),\n dataSources: getDataSources(state.dataSources),\n layoutMode: getDataSourcesLayoutMode(state.dataSources),\n dataSourcesCount: getDataSourcesCount(state.dataSources),\n searchQuery: getDataSourcesSearchQuery(state.dataSources),\n hasFetched: state.dataSources.hasFetched,\n };\n}\n\nconst mapDispatchToProps = {\n loadDataSources,\n setDataSourcesSearchQuery,\n setDataSourcesLayoutMode,\n};\n\nconst connector = connect(mapStateToProps, mapDispatchToProps);\n\nexport type Props = ConnectedProps<typeof connector>;\n\nconst emptyListModel = {\n title: 'No data sources defined',\n buttonIcon: 'database' as IconName,\n buttonLink: 'datasources/new',\n buttonTitle: 'Add data source',\n proTip: 'You can also define data sources through configuration files.',\n proTipLink: 'http://docs.grafana.org/administration/provisioning/#datasources?utm_source=grafana_ds_list',\n proTipLinkTitle: 'Learn more',\n proTipTarget: '_blank',\n};\n\nexport class DataSourcesListPage extends PureComponent<Props> {\n componentDidMount() {\n this.props.loadDataSources();\n }\n\n render() {\n const { dataSources, dataSourcesCount, navModel, layoutMode, searchQuery, setDataSourcesSearchQuery, hasFetched } =\n this.props;\n\n const canCreateDataSource = contextSrv.hasPermission(AccessControlAction.DataSourcesCreate);\n\n const linkButton = {\n href: 'datasources/new',\n title: 'Add data source',\n disabled: !canCreateDataSource,\n };\n\n const emptyList = {\n ...emptyListModel,\n buttonDisabled: !canCreateDataSource,\n };\n\n return (\n <Page navModel={navModel}>\n <Page.Contents isLoading={!hasFetched}>\n <>\n {hasFetched && dataSourcesCount === 0 && <EmptyListCTA {...emptyList} />}\n {hasFetched &&\n dataSourcesCount > 0 && [\n <PageActionBar\n searchQuery={searchQuery}\n setSearchQuery={(query) => setDataSourcesSearchQuery(query)}\n linkButton={linkButton}\n key=\"action-bar\"\n />,\n <DataSourcesList dataSources={dataSources} layoutMode={layoutMode} key=\"list\" />,\n ]}\n </>\n </Page.Contents>\n </Page>\n );\n }\n}\n\nexport default connector(DataSourcesListPage);\n"],"names":["PageActionBar","PureComponent","render","searchQuery","linkButton","setSearchQuery","target","placeholder","this","props","linkProps","href","disabled","className","FilterInput","value","onChange","LinkButton","title","dataSources","layoutMode","styles","useStyles","getStyles","list","map","dataSource","Card","uid","name","src","typeLogoUrl","alt","height","width","logo","typeName","url","isDefault","Tag","colorIndex","id","css","listStyle","display","objectFit","mapDispatchToProps","loadDataSources","setDataSourcesSearchQuery","setDataSourcesLayoutMode","connector","connect","state","navModel","getNavModel","navIndex","getDataSources","getDataSourcesLayoutMode","dataSourcesCount","getDataSourcesCount","getDataSourcesSearchQuery","hasFetched","emptyListModel","buttonIcon","buttonLink","buttonTitle","proTip","proTipLink","proTipLinkTitle","proTipTarget","DataSourcesListPage","componentDidMount","canCreateDataSource","contextSrv","AccessControlAction","emptyList","buttonDisabled","Page","isLoading","EmptyListCTA","query"],"sourceRoot":""}
|