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F,MAAMC,EAAMJ,EAAkB,QAAQ,EAAIF,EAAaE,EAAkB,QAAQ,EACjF,GAAII,EAAM,EAAG,CACXJ,EAAkB,QAAQ,EAAI,EAC9BA,EAAkB,QAAQ,EAAI,EAC9BE,EAAkB,CAAE,GAAGF,EAAkB,OAAQ,CAAC,EAClD,KACF,CACA,MAAMK,EAAMF,EAAQ,QAAQ,SAASC,CAAG,EACpCC,GACF,WAAqB,sBAA8BA,CAAG,CAAC,CAE7D,CACF,CACF,CAAC,EAED,MAAO,IAAM9M,EAAI,YAAY,CAC/B,EAAG,CAACf,EAAgBsN,CAAU,CAAC,EAExBG,EACT,C","sources":["webpack://grafana/./public/app/core/components/PluginHelp/PluginHelp.tsx","webpack://grafana/./public/app/features/datasources/hooks.ts","webpack://grafana/./public/app/features/datasources/components/picker/AddNewDataSourceButton.tsx","webpack://grafana/./public/app/features/datasources/components/picker/DataSourceCard.tsx","webpack://grafana/./public/app/features/datasources/components/picker/utils.ts","webpack://grafana/./public/app/features/datasources/components/picker/BuiltInDataSourceList.tsx","webpack://grafana/./public/app/features/datasources/components/picker/DataSourceList.tsx","webpack://grafana/./public/app/features/datasources/components/picker/DataSourceModal.tsx","webpack://grafana/./public/app/features/datasources/components/picker/DataSourceLogo.tsx","webpack://grafana/./public/app/features/datasources/components/picker/popperModifiers.ts","webpack://grafana/./public/app/features/datasources/components/picker/DataSourceDropdown.tsx","webpack://grafana/./public/app/features/datasources/components/picker/DataSourcePicker.tsx","webpack://grafana/./public/app/features/query/state/updateQueries.ts","webpack://grafana/./public/app/features/query/components/QueryGroupOptions.tsx","webpack://grafana/./public/app/features/query/components/QueryGroup.tsx","webpack://grafana/./public/app/features/search/hooks/useSearchKeyboardSelection.ts"],"sourcesContent":["import React from 'react';\nimport { useAsync } from 'react-use';\n\nimport { renderMarkdown } from '@grafana/data';\nimport { getBackendSrv } from '@grafana/runtime';\nimport { LoadingPlaceholder } from '@grafana/ui';\n\ninterface Props {\n pluginId: string;\n}\n\nexport function PluginHelp({ pluginId }: Props) {\n const { value, loading, error } = useAsync(async () => {\n return getBackendSrv().get(`/api/plugins/${pluginId}/markdown/query_help`);\n }, []);\n\n const renderedMarkdown = renderMarkdown(value);\n\n if (loading) {\n return ;\n }\n\n if (error) {\n return

An error occurred when loading help.

;\n }\n\n if (value === '') {\n return

No query help could be found.

;\n }\n\n return
;\n}\n","import React, { useCallback, useEffect, useRef } from 'react';\nimport { useLocalStorage } from 'react-use';\nimport { Observable } from 'rxjs';\n\nimport { DataSourceInstanceSettings, DataSourceRef } from '@grafana/data';\nimport { GetDataSourceListFilters, getDataSourceSrv } from '@grafana/runtime';\n\nexport const LOCAL_STORAGE_KEY = 'grafana.features.datasources.components.picker.DataSourceDropDown.history';\n\n/**\n * Stores the uid of the last 5 data sources selected by the user. The last UID is the one most recently used.\n */\nexport function useRecentlyUsedDataSources(): [string[], (ds: DataSourceInstanceSettings) => void] {\n const [value = [], setStorage] = useLocalStorage(LOCAL_STORAGE_KEY, []);\n\n const pushRecentlyUsedDataSource = useCallback(\n (ds: DataSourceInstanceSettings) => {\n if (ds.meta.builtIn) {\n // Prevent storing the built in datasources (-- Grafana --, -- Mixed --, -- Dashboard --)\n return;\n }\n if (value.includes(ds.uid)) {\n // Prevent storing multiple copies of the same data source, put it at the front of the array instead.\n value.splice(\n value.findIndex((dsUid) => ds.uid === dsUid),\n 1\n );\n setStorage([...value, ds.uid]);\n } else {\n setStorage([...value, ds.uid].slice(1, 6));\n }\n },\n [value, setStorage]\n );\n\n return [value, pushRecentlyUsedDataSource];\n}\n\nexport function useDatasources(filters: GetDataSourceListFilters) {\n const dataSourceSrv = getDataSourceSrv();\n const dataSources = dataSourceSrv.getList(filters);\n\n return dataSources;\n}\n\nexport function useDatasource(dataSource: string | DataSourceRef | DataSourceInstanceSettings | null | undefined) {\n const dataSourceSrv = getDataSourceSrv();\n\n if (typeof dataSource === 'string') {\n return dataSourceSrv.getInstanceSettings(dataSource);\n }\n\n return dataSourceSrv.getInstanceSettings(dataSource);\n}\n\nexport interface KeybaordNavigatableListProps {\n keyboardEvents?: Observable;\n containerRef: React.RefObject;\n}\n\n/**\n * Allows navigating lists of elements where the data-role attribute is set to \"keyboardSelectableItem\"\n * @param props\n */\nexport function useKeyboardNavigatableList(props: KeybaordNavigatableListProps): [Record, string] {\n const { keyboardEvents, containerRef } = props;\n const selectedIndex = useRef(0);\n\n const attributeName = 'data-role';\n const roleName = 'keyboardSelectableItem';\n const navigatableItemProps = { ...{ [attributeName]: roleName } };\n const querySelectorNavigatableElements = `[${attributeName}=\"${roleName}\"`;\n\n const selectedAttributeName = 'data-selectedItem';\n const selectedItemCssSelector = `[${selectedAttributeName}=\"true\"]`;\n\n const selectItem = useCallback(\n (index: number) => {\n const listItems = containerRef?.current?.querySelectorAll(\n querySelectorNavigatableElements\n );\n const selectedItem = listItems?.item(index % listItems?.length);\n\n listItems?.forEach((li) => li.setAttribute(selectedAttributeName, 'false'));\n\n if (selectedItem) {\n selectedItem.scrollIntoView({ block: 'center' });\n selectedItem.setAttribute(selectedAttributeName, 'true');\n }\n },\n [containerRef, querySelectorNavigatableElements]\n );\n\n const clickSelectedElement = useCallback(() => {\n containerRef?.current\n ?.querySelector(selectedItemCssSelector)\n ?.querySelector('button') // This is a bit weird. The main use for this would be to select card items, however the root of the card component does not have the click event handler, instead it's attached to a button inside it.\n ?.click();\n }, [containerRef, selectedItemCssSelector]);\n\n useEffect(() => {\n if (!keyboardEvents) {\n return;\n }\n const sub = keyboardEvents.subscribe({\n next: (keyEvent) => {\n switch (keyEvent?.code) {\n case 'ArrowDown': {\n selectItem(++selectedIndex.current);\n keyEvent.preventDefault();\n break;\n }\n case 'ArrowUp':\n selectedIndex.current = selectedIndex.current > 0 ? selectedIndex.current - 1 : selectedIndex.current;\n selectItem(selectedIndex.current);\n keyEvent.preventDefault();\n break;\n case 'Enter':\n clickSelectedElement();\n break;\n }\n },\n });\n return () => sub.unsubscribe();\n }, [keyboardEvents, selectItem, clickSelectedElement]);\n\n useEffect(() => {\n // This observer is used to keep track of the number of items in the list\n // that can change dinamically (e.g. when filtering a dropdown list)\n const listObserver = new MutationObserver((mutations) => {\n const listHasChanged = mutations.some(\n (mutation) =>\n (mutation.addedNodes && mutation.addedNodes.length > 0) ||\n (mutation.removedNodes && mutation.removedNodes.length > 0)\n );\n\n listHasChanged && selectItem(0);\n });\n\n if (containerRef.current) {\n listObserver.observe(containerRef.current, {\n childList: true,\n });\n }\n\n return () => {\n listObserver.disconnect();\n };\n }, [containerRef, querySelectorNavigatableElements, selectItem]);\n\n return [navigatableItemProps, selectedItemCssSelector];\n}\n","import React from 'react';\n\nimport { LinkButton, ButtonVariant } from '@grafana/ui';\nimport { config } from 'app/core/config';\nimport { contextSrv } from 'app/core/core';\nimport { ROUTES as CONNECTIONS_ROUTES } from 'app/features/connections/constants';\nimport { DATASOURCES_ROUTES } from 'app/features/datasources/constants';\nimport { AccessControlAction } from 'app/types';\n\ninterface AddNewDataSourceButtonProps {\n onClick?: () => void;\n variant?: ButtonVariant;\n}\n\nexport function AddNewDataSourceButton({ variant, onClick }: AddNewDataSourceButtonProps) {\n const hasCreateRights = contextSrv.hasPermission(AccessControlAction.DataSourcesCreate);\n const newDataSourceURL = config.featureToggles.dataConnectionsConsole\n ? CONNECTIONS_ROUTES.DataSourcesNew\n : DATASOURCES_ROUTES.New;\n\n return (\n \n Configure a new data source\n \n );\n}\n","import { css, cx } from '@emotion/css';\nimport React from 'react';\n\nimport { DataSourceInstanceSettings, GrafanaTheme2 } from '@grafana/data';\nimport { Card, TagList, useStyles2 } from '@grafana/ui';\n\ninterface DataSourceCardProps {\n ds: DataSourceInstanceSettings;\n onClick: () => void;\n selected: boolean;\n description?: string;\n}\n\nexport function DataSourceCard({ ds, onClick, selected, description, ...htmlProps }: DataSourceCardProps) {\n const styles = useStyles2(getStyles);\n\n return (\n \n \n
\n \n {ds.name} {ds.isDefault ? : null}\n \n {description || ds.meta.name}\n
\n
\n \n {`${ds.meta.name}\n \n \n );\n}\n\n// Get styles for the component\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n card: css`\n cursor: pointer;\n background-color: ${theme.colors.background.primary};\n border-bottom: 1px solid ${theme.colors.border.weak};\n // Move to list component\n margin-bottom: 0;\n border-radius: 0;\n padding: ${theme.spacing(1)};\n `,\n heading: css`\n width: 100%;\n overflow: hidden;\n // This is needed to enable ellipsis when text overlfows\n > button {\n width: 100%;\n }\n `,\n headingContent: css`\n color: ${theme.colors.text.secondary};\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n display: flex;\n justify-content: space-between;\n `,\n logo: css`\n width: 32px;\n height: 32px;\n padding: ${theme.spacing(0, 1)};\n display: flex;\n align-items: center;\n\n > img {\n max-height: 100%;\n min-width: 24px;\n }\n `,\n name: css`\n color: ${theme.colors.text.primary};\n display: flex;\n gap: ${theme.spacing(2)};\n `,\n type: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n display: flex;\n align-items: center;\n `,\n separator: css`\n margin: 0 ${theme.spacing(1)};\n color: ${theme.colors.border.weak};\n `,\n selected: css`\n background-color: ${theme.colors.background.secondary};\n `,\n meta: css`\n display: block;\n overflow-wrap: unset;\n white-space: nowrap;\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n `,\n };\n}\n","import { DataSourceInstanceSettings, DataSourceJsonData, DataSourceRef } from '@grafana/data';\n\nexport function isDataSourceMatch(\n ds: DataSourceInstanceSettings | undefined,\n current: string | DataSourceInstanceSettings | DataSourceRef | null | undefined\n): boolean {\n if (!ds) {\n return false;\n }\n if (!current) {\n return false;\n }\n if (typeof current === 'string') {\n return ds.uid === current;\n }\n return ds.uid === current.uid;\n}\n\nexport function dataSourceLabel(\n dataSource: DataSourceInstanceSettings | string | DataSourceRef | null | undefined\n) {\n if (!dataSource) {\n return undefined;\n }\n\n if (typeof dataSource === 'string') {\n return `${dataSource} - not found`;\n }\n\n if ('name' in dataSource) {\n return dataSource.name;\n }\n\n if (dataSource.uid) {\n return `${dataSource.uid} - not found`;\n }\n\n return undefined;\n}\n\nexport function getDataSourceCompareFn(\n current: DataSourceRef | DataSourceInstanceSettings | string | null | undefined,\n recentlyUsedDataSources: string[],\n dataSourceVariablesIDs: string[]\n) {\n const cmpDataSources = (a: DataSourceInstanceSettings, b: DataSourceInstanceSettings) => {\n // Sort the current ds before everything else.\n if (current && isDataSourceMatch(a, current)) {\n return -1;\n } else if (current && isDataSourceMatch(b, current)) {\n return 1;\n }\n\n // Sort recently used data sources by latest used, but after current.\n const aIndex = recentlyUsedDataSources.indexOf(a.uid);\n const bIndex = recentlyUsedDataSources.indexOf(b.uid);\n if (aIndex > -1 && aIndex > bIndex) {\n return -1;\n }\n if (bIndex > -1 && bIndex > aIndex) {\n return 1;\n }\n\n // Sort variables before the rest. Variables sorted alphabetically by name.\n const aIsVariable = dataSourceVariablesIDs.includes(a.uid);\n const bIsVariable = dataSourceVariablesIDs.includes(b.uid);\n if (aIsVariable && !bIsVariable) {\n return -1;\n } else if (bIsVariable && !aIsVariable) {\n return 1;\n } else if (bIsVariable && aIsVariable) {\n return a.name < b.name ? -1 : 1;\n }\n\n // Sort built in DataSources to the bottom and alphabetically by name.\n if (a.meta.builtIn && !b.meta.builtIn) {\n return 1;\n } else if (b.meta.builtIn && !a.meta.builtIn) {\n return -1;\n } else if (a.meta.builtIn && b.meta.builtIn) {\n return a.name < b.name ? -1 : 1;\n }\n\n // Sort the rest alphabetically by name.\n return a.name < b.name ? -1 : 1;\n };\n\n return cmpDataSources;\n}\n\n/**\n * Given a data source and a search term, returns true if the data source matches the search term.\n * Useful to filter data sources by name containing an string.\n * @param ds\n * @param searchTerm\n * @returns\n */\nexport function matchDataSourceWithSearch(ds: DataSourceInstanceSettings, searchTerm = '') {\n return ds.name.toLowerCase().includes(searchTerm.toLowerCase());\n}\n","import React from 'react';\n\nimport { DataSourceInstanceSettings } from '@grafana/data';\nimport { DataSourceRef } from '@grafana/schema';\n\nimport { useDatasources } from '../../hooks';\n\nimport { DataSourceCard } from './DataSourceCard';\nimport { isDataSourceMatch } from './utils';\n\nconst CUSTOM_DESCRIPTIONS_BY_UID: Record = {\n grafana: 'Discover visualizations using mock data',\n '-- Mixed --': 'Use multiple data sources',\n '-- Dashboard --': 'Reuse query results from other visualizations',\n};\n\ninterface BuiltInDataSourceListProps {\n className?: string;\n current: DataSourceRef | string | null | undefined;\n onChange: (ds: DataSourceInstanceSettings) => void;\n\n // DS filters\n filter?: (ds: DataSourceInstanceSettings) => boolean;\n tracing?: boolean;\n mixed?: boolean;\n dashboard?: boolean;\n metrics?: boolean;\n type?: string | string[];\n annotations?: boolean;\n variables?: boolean;\n alerting?: boolean;\n pluginId?: string;\n logs?: boolean;\n}\n\nexport function BuiltInDataSourceList({\n className,\n current,\n onChange,\n tracing,\n dashboard,\n mixed,\n metrics,\n type,\n annotations,\n variables,\n alerting,\n pluginId,\n logs,\n filter,\n}: BuiltInDataSourceListProps) {\n const grafanaDataSources = useDatasources({\n tracing,\n dashboard,\n mixed,\n metrics,\n type,\n annotations,\n variables,\n alerting,\n pluginId,\n logs,\n });\n\n const filteredResults = grafanaDataSources.filter((ds) => (filter ? filter?.(ds) : true) && !!ds.meta.builtIn);\n\n return (\n
\n {filteredResults.map((ds) => {\n return (\n onChange(ds)}\n />\n );\n })}\n
\n );\n}\n","import { css, cx } from '@emotion/css';\nimport React, { useRef } from 'react';\nimport { Observable } from 'rxjs';\n\nimport { DataSourceInstanceSettings, DataSourceRef, GrafanaTheme2 } from '@grafana/data';\nimport { getTemplateSrv } from '@grafana/runtime';\nimport { useStyles2, useTheme2 } from '@grafana/ui';\n\nimport { useDatasources, useKeyboardNavigatableList, useRecentlyUsedDataSources } from '../../hooks';\n\nimport { AddNewDataSourceButton } from './AddNewDataSourceButton';\nimport { DataSourceCard } from './DataSourceCard';\nimport { getDataSourceCompareFn, isDataSourceMatch } from './utils';\n\n/**\n * Component props description for the {@link DataSourceList}\n *\n * @internal\n */\nexport interface DataSourceListProps {\n className?: string;\n onChange: (ds: DataSourceInstanceSettings) => void;\n current: DataSourceRef | DataSourceInstanceSettings | string | null | undefined;\n /** Would be nicer if these parameters were part of a filtering object */\n tracing?: boolean;\n mixed?: boolean;\n dashboard?: boolean;\n metrics?: boolean;\n type?: string | string[];\n annotations?: boolean;\n variables?: boolean;\n alerting?: boolean;\n pluginId?: string;\n /** If true,we show only DSs with logs; and if true, pluginId shouldnt be passed in */\n logs?: boolean;\n width?: number;\n keyboardEvents?: Observable;\n inputId?: string;\n filter?: (dataSource: DataSourceInstanceSettings) => boolean;\n onClear?: () => void;\n onClickEmptyStateCTA?: () => void;\n enableKeyboardNavigation?: boolean;\n}\n\nexport function DataSourceList(props: DataSourceListProps) {\n const containerRef = useRef(null);\n\n const [navigatableProps, selectedItemCssSelector] = useKeyboardNavigatableList({\n keyboardEvents: props.keyboardEvents,\n containerRef: containerRef,\n });\n\n const theme = useTheme2();\n const styles = getStyles(theme, selectedItemCssSelector);\n\n const { className, current, onChange, enableKeyboardNavigation, onClickEmptyStateCTA } = props;\n const dataSources = useDatasources({\n alerting: props.alerting,\n annotations: props.annotations,\n dashboard: props.dashboard,\n logs: props.logs,\n metrics: props.metrics,\n mixed: props.mixed,\n pluginId: props.pluginId,\n tracing: props.tracing,\n type: props.type,\n variables: props.variables,\n });\n\n const [recentlyUsedDataSources, pushRecentlyUsedDataSource] = useRecentlyUsedDataSources();\n const filteredDataSources = props.filter ? dataSources.filter(props.filter) : dataSources;\n\n return (\n
\n {filteredDataSources.length === 0 && (\n \n )}\n {filteredDataSources\n .sort(getDataSourceCompareFn(current, recentlyUsedDataSources, getDataSourceVariableIDs()))\n .map((ds) => (\n {\n pushRecentlyUsedDataSource(ds);\n onChange(ds);\n }}\n selected={isDataSourceMatch(ds, current)}\n {...(enableKeyboardNavigation ? navigatableProps : {})}\n />\n ))}\n
\n );\n}\n\nfunction EmptyState({ className, onClickCTA }: { className?: string; onClickCTA?: () => void }) {\n const styles = useStyles2(getEmptyStateStyles);\n return (\n
\n

No data sources found

\n \n
\n );\n}\n\nfunction getEmptyStateStyles(theme: GrafanaTheme2) {\n return {\n container: css`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n `,\n message: css`\n margin-bottom: ${theme.spacing(3)};\n `,\n };\n}\n\nfunction getDataSourceVariableIDs() {\n const templateSrv = getTemplateSrv();\n /** Unforunately there is no easy way to identify data sources that are variables. The uid of the data source will be the name of the variable in a templating syntax $([name]) **/\n return templateSrv\n .getVariables()\n .filter((v) => v.type === 'datasource')\n .map((v) => `\\${${v.id}}`);\n}\n\nfunction getStyles(theme: GrafanaTheme2, selectedItemCssSelector: string) {\n return {\n container: css`\n display: flex;\n flex-direction: column;\n ${selectedItemCssSelector} {\n background-color: ${theme.colors.background.secondary};\n }\n `,\n emptyState: css`\n height: 100%;\n flex: 1;\n `,\n };\n}\n","import { css } from '@emotion/css';\nimport { once } from 'lodash';\nimport React, { useState } from 'react';\n\nimport { DataSourceInstanceSettings, DataSourceRef, GrafanaTheme2 } from '@grafana/data';\nimport { config, reportInteraction } from '@grafana/runtime';\nimport { DataQuery } from '@grafana/schema';\nimport {\n Modal,\n FileDropzone,\n FileDropzoneDefaultChildren,\n CustomScrollbar,\n useStyles2,\n Input,\n Icon,\n} from '@grafana/ui';\nimport * as DFImport from 'app/features/dataframe-import';\nimport { GrafanaQuery } from 'app/plugins/datasource/grafana/types';\nimport { getFileDropToQueryHandler } from 'app/plugins/datasource/grafana/utils';\n\nimport { useDatasource } from '../../hooks';\n\nimport { AddNewDataSourceButton } from './AddNewDataSourceButton';\nimport { BuiltInDataSourceList } from './BuiltInDataSourceList';\nimport { DataSourceList } from './DataSourceList';\nimport { matchDataSourceWithSearch } from './utils';\n\nconst INTERACTION_EVENT_NAME = 'dashboards_dspickermodal_clicked';\nconst INTERACTION_ITEM = {\n SELECT_DS: 'select_ds',\n UPLOAD_FILE: 'upload_file',\n CONFIG_NEW_DS: 'config_new_ds',\n CONFIG_NEW_DS_EMPTY_STATE: 'config_new_ds_empty_state',\n SEARCH: 'search',\n DISMISS: 'dismiss',\n};\n\nexport interface DataSourceModalProps {\n onChange: (ds: DataSourceInstanceSettings, defaultQueries?: DataQuery[] | GrafanaQuery[]) => void;\n current: DataSourceRef | string | null | undefined;\n onDismiss: () => void;\n recentlyUsed?: string[];\n reportedInteractionFrom?: string;\n\n // DS filters\n filter?: (ds: DataSourceInstanceSettings) => boolean;\n tracing?: boolean;\n mixed?: boolean;\n dashboard?: boolean;\n metrics?: boolean;\n type?: string | string[];\n annotations?: boolean;\n variables?: boolean;\n alerting?: boolean;\n pluginId?: string;\n logs?: boolean;\n uploadFile?: boolean;\n}\n\nexport function DataSourceModal({\n tracing,\n dashboard,\n mixed,\n metrics,\n type,\n annotations,\n variables,\n alerting,\n pluginId,\n logs,\n uploadFile,\n filter,\n onChange,\n current,\n onDismiss,\n reportedInteractionFrom,\n}: DataSourceModalProps) {\n const styles = useStyles2(getDataSourceModalStyles);\n const [search, setSearch] = useState('');\n const analyticsInteractionSrc = reportedInteractionFrom || 'modal';\n\n const onDismissModal = () => {\n onDismiss();\n reportInteraction(INTERACTION_EVENT_NAME, { item: INTERACTION_ITEM.DISMISS, src: analyticsInteractionSrc });\n };\n const onChangeDataSource = (ds: DataSourceInstanceSettings) => {\n onChange(ds);\n reportInteraction(INTERACTION_EVENT_NAME, {\n item: INTERACTION_ITEM.SELECT_DS,\n ds_type: ds.type,\n src: analyticsInteractionSrc,\n });\n };\n // Memoizing to keep once() cached so it avoids reporting multiple times\n const reportSearchUsageOnce = React.useMemo(\n () =>\n once(() => {\n reportInteraction(INTERACTION_EVENT_NAME, { item: 'search', src: analyticsInteractionSrc });\n }),\n [analyticsInteractionSrc]\n );\n\n const grafanaDS = useDatasource('-- Grafana --');\n\n const onFileDrop = getFileDropToQueryHandler((query, fileRejections) => {\n if (!grafanaDS) {\n return;\n }\n onChange(grafanaDS, [query]);\n\n reportInteraction(INTERACTION_EVENT_NAME, {\n item: INTERACTION_ITEM.UPLOAD_FILE,\n src: analyticsInteractionSrc,\n });\n\n if (fileRejections.length < 1) {\n onDismiss();\n }\n });\n\n // Built-in data sources used twice because of mobile layout adjustments\n // In movile the list is appended to the bottom of the DS list\n const BuiltInList = ({ className }: { className?: string }) => {\n return (\n \n );\n };\n\n return (\n \n
\n }\n placeholder=\"Search data source\"\n onChange={(e) => {\n setSearch(e.currentTarget.value);\n reportSearchUsageOnce();\n }}\n />\n \n \n reportInteraction(INTERACTION_EVENT_NAME, {\n item: INTERACTION_ITEM.CONFIG_NEW_DS_EMPTY_STATE,\n src: analyticsInteractionSrc,\n })\n }\n filter={(ds) => (filter ? filter?.(ds) : true) && matchDataSourceWithSearch(ds, search) && !ds.meta.builtIn}\n variables={variables}\n tracing={tracing}\n metrics={metrics}\n type={type}\n annotations={annotations}\n alerting={alerting}\n pluginId={pluginId}\n logs={logs}\n dashboard={dashboard}\n mixed={mixed}\n />\n \n \n
\n
\n
\n \n \n \n {uploadFile && config.featureToggles.editPanelCSVDragAndDrop && (\n undefined}\n options={{\n maxSize: DFImport.maxFileSize,\n multiple: false,\n accept: DFImport.acceptedFiles,\n onDrop: onFileDrop,\n }}\n >\n \n \n )}\n
\n
\n Open a new tab and configure a data source\n {\n reportInteraction(INTERACTION_EVENT_NAME, {\n item: INTERACTION_ITEM.CONFIG_NEW_DS,\n src: analyticsInteractionSrc,\n });\n onDismiss();\n }}\n />\n
\n
\n \n );\n}\n\nfunction getDataSourceModalStyles(theme: GrafanaTheme2) {\n return {\n modal: css`\n width: 80%;\n height: 80%;\n max-width: 1200px;\n max-height: 900px;\n\n ${theme.breakpoints.down('md')} {\n width: 100%;\n }\n `,\n modalContent: css`\n display: flex;\n flex-direction: row;\n height: 100%;\n\n ${theme.breakpoints.down('md')} {\n flex-direction: column;\n }\n `,\n leftColumn: css`\n display: flex;\n flex-direction: column;\n width: 50%;\n height: 100%;\n padding-right: ${theme.spacing(4)};\n border-right: 1px solid ${theme.colors.border.weak};\n\n ${theme.breakpoints.down('md')} {\n width: 100%;\n border-right: 0;\n padding-right: 0;\n flex: 1;\n overflow-y: auto;\n }\n `,\n rightColumn: css`\n display: flex;\n flex-direction: column;\n width: 50%;\n height: 100%;\n justify-items: space-evenly;\n align-items: stretch;\n padding-left: ${theme.spacing(4)};\n\n ${theme.breakpoints.down('md')} {\n width: 100%;\n padding-left: 0;\n flex: 0;\n }\n `,\n builtInDataSources: css`\n flex: 1 1;\n margin-bottom: ${theme.spacing(4)};\n\n ${theme.breakpoints.down('md')} {\n flex: 0;\n }\n `,\n builtInDataSourcesList: css`\n ${theme.breakpoints.down('md')} {\n display: none;\n margin-bottom: 0;\n }\n\n margin-bottom: ${theme.spacing(4)};\n `,\n appendBuiltInDataSourcesList: css`\n ${theme.breakpoints.up('md')} {\n display: none;\n }\n `,\n newDSSection: css`\n display: flex;\n flex-direction: row;\n width: 100%;\n justify-content: space-between;\n align-items: center;\n `,\n newDSDescription: css`\n flex: 1 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${theme.colors.text.secondary};\n `,\n searchInput: css`\n width: 100%;\n min-height: 32px;\n margin-bottom: ${theme.spacing(1)};\n `,\n };\n}\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { DataSourceInstanceSettings, DataSourceJsonData, GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\n\nexport interface DataSourceLogoProps {\n dataSource: DataSourceInstanceSettings | undefined;\n}\n\nexport function DataSourceLogo(props: DataSourceLogoProps) {\n const { dataSource } = props;\n const styles = useStyles2(getStyles);\n\n if (!dataSource) {\n return DataSourceLogoPlaceHolder();\n }\n\n return (\n \n );\n}\n\nexport function DataSourceLogoPlaceHolder() {\n const styles = useStyles2(getStyles);\n return
;\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n pickerDSLogo: css`\n height: 20px;\n width: 20px;\n `,\n };\n}\n","import { detectOverflow, Modifier, ModifierArguments } from '@popperjs/core';\n\nconst MODAL_MARGIN = 20;\nconst FLIP_THRESHOLD = 200;\n\nexport const maxSize: Modifier<'maxSize', {}> = {\n name: 'maxSize',\n enabled: true,\n phase: 'main',\n requires: ['offset', 'preventOverflow', 'flip'],\n fn({ state, name, options }: ModifierArguments<{}>) {\n const overflow = detectOverflow(state, options);\n const { x, y } = state.modifiersData.preventOverflow || { x: 0, y: 0 };\n const { width, height } = state.rects.popper;\n const [basePlacement] = state.placement.split('-');\n\n const widthProp = basePlacement === 'left' ? 'left' : 'right';\n const heightProp = basePlacement === 'top' ? 'top' : 'bottom';\n\n state.modifiersData[name] = {\n width: width - overflow[widthProp] - x,\n height: height - overflow[heightProp] - y,\n };\n },\n};\n\nexport const applyMaxSize: Modifier<'applyMaxSize', {}> = {\n name: 'applyMaxSize',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['maxSize'],\n fn({ state }: ModifierArguments<{}>) {\n const { height, width } = state.modifiersData.maxSize;\n\n if (!state.styles.popper.maxHeight) {\n state.styles.popper.maxHeight = `${height - MODAL_MARGIN}px`;\n }\n if (!state.styles.popper.minHeight) {\n state.styles.popper.minHeight = `${FLIP_THRESHOLD}px`;\n }\n\n if (!state.styles.popper.maxWidth) {\n state.styles.popper.maxWidth = width;\n }\n },\n};\n","import { css } from '@emotion/css';\nimport { useDialog } from '@react-aria/dialog';\nimport { useOverlay } from '@react-aria/overlays';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { usePopper } from 'react-popper';\nimport { Observable } from 'rxjs';\n\nimport { DataSourceInstanceSettings, GrafanaTheme2 } from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { reportInteraction } from '@grafana/runtime';\nimport { DataQuery, DataSourceRef } from '@grafana/schema';\nimport { Button, CustomScrollbar, Icon, Input, ModalsController, Portal, useStyles2 } from '@grafana/ui';\nimport config from 'app/core/config';\nimport { useKeyNavigationListener } from 'app/features/search/hooks/useSearchKeyboardSelection';\nimport { defaultFileUploadQuery, GrafanaQuery } from 'app/plugins/datasource/grafana/types';\n\nimport { useDatasource } from '../../hooks';\n\nimport { DataSourceList } from './DataSourceList';\nimport { DataSourceLogo, DataSourceLogoPlaceHolder } from './DataSourceLogo';\nimport { DataSourceModal } from './DataSourceModal';\nimport { applyMaxSize, maxSize } from './popperModifiers';\nimport { dataSourceLabel, matchDataSourceWithSearch } from './utils';\n\nconst INTERACTION_EVENT_NAME = 'dashboards_dspicker_clicked';\nconst INTERACTION_ITEM = {\n OPEN_DROPDOWN: 'open_dspicker',\n SELECT_DS: 'select_ds',\n ADD_FILE: 'add_file',\n OPEN_ADVANCED_DS_PICKER: 'open_advanced_ds_picker',\n CONFIG_NEW_DS_EMPTY_STATE: 'config_new_ds_empty_state',\n};\n\nexport interface DataSourceDropdownProps {\n onChange: (ds: DataSourceInstanceSettings, defaultQueries?: DataQuery[] | GrafanaQuery[]) => void;\n current?: DataSourceInstanceSettings | string | DataSourceRef | null;\n recentlyUsed?: string[];\n hideTextValue?: boolean;\n width?: number;\n inputId?: string;\n noDefault?: boolean;\n disabled?: boolean;\n placeholder?: string;\n\n // DS filters\n tracing?: boolean;\n mixed?: boolean;\n dashboard?: boolean;\n metrics?: boolean;\n type?: string | string[];\n annotations?: boolean;\n variables?: boolean;\n alerting?: boolean;\n pluginId?: string;\n logs?: boolean;\n uploadFile?: boolean;\n filter?: (ds: DataSourceInstanceSettings) => boolean;\n}\n\nexport function DataSourceDropdown(props: DataSourceDropdownProps) {\n const {\n current,\n onChange,\n hideTextValue = false,\n width,\n inputId,\n noDefault = false,\n disabled = false,\n placeholder = 'Select data source',\n ...restProps\n } = props;\n\n const [isOpen, setOpen] = useState(false);\n const [inputHasFocus, setInputHasFocus] = useState(false);\n const [markerElement, setMarkerElement] = useState();\n const [selectorElement, setSelectorElement] = useState();\n const [filterTerm, setFilterTerm] = useState('');\n const openDropdown = () => {\n reportInteraction(INTERACTION_EVENT_NAME, { item: INTERACTION_ITEM.OPEN_DROPDOWN });\n setOpen(true);\n markerElement?.focus();\n };\n const currentDataSourceInstanceSettings = useDatasource(current);\n const currentValue = Boolean(!current && noDefault) ? undefined : currentDataSourceInstanceSettings;\n const prefixIcon =\n filterTerm && isOpen ? : ;\n\n const { onKeyDown, keyboardEvents } = useKeyNavigationListener();\n\n useEffect(() => {\n const sub = keyboardEvents.subscribe({\n next: (keyEvent) => {\n switch (keyEvent?.code) {\n case 'ArrowDown': {\n openDropdown();\n keyEvent.preventDefault();\n break;\n }\n case 'ArrowUp':\n openDropdown();\n keyEvent.preventDefault();\n break;\n case 'Escape':\n onClose();\n markerElement?.focus();\n keyEvent.preventDefault();\n }\n },\n });\n return () => sub.unsubscribe();\n });\n const grafanaDS = useDatasource('-- Grafana --');\n\n const onClickAddCSV = () => {\n if (!grafanaDS) {\n return;\n }\n\n onChange(grafanaDS, [defaultFileUploadQuery]);\n };\n\n const popper = usePopper(markerElement, selectorElement, {\n placement: 'bottom-start',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 4],\n },\n },\n maxSize,\n applyMaxSize,\n ],\n });\n\n const onClose = useCallback(() => {\n setFilterTerm('');\n setOpen(false);\n }, [setOpen]);\n\n const ref = useRef(null);\n const { overlayProps, underlayProps } = useOverlay(\n {\n onClose: onClose,\n isDismissable: true,\n isOpen,\n shouldCloseOnInteractOutside: (element) => {\n return markerElement ? !markerElement.isSameNode(element) : false;\n },\n },\n ref\n );\n const { dialogProps } = useDialog({}, ref);\n\n const styles = useStyles2((theme: GrafanaTheme2) => getStylesDropdown(theme, props));\n\n return (\n
\n {/* This clickable div is just extending the clickable area on the input element to include the prefix and suffix. */}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}\n
\n }\n placeholder={hideTextValue ? '' : dataSourceLabel(currentValue) || placeholder}\n onClick={openDropdown}\n onFocus={() => {\n setInputHasFocus(true);\n }}\n onBlur={() => {\n setInputHasFocus(false);\n onClose();\n }}\n onKeyDown={onKeyDown}\n value={filterTerm}\n onChange={(e) => {\n openDropdown();\n setFilterTerm(e.currentTarget.value);\n }}\n ref={setMarkerElement}\n disabled={disabled}\n >\n
\n {isOpen ? (\n \n
\n {\n e.preventDefault(); /** Need to prevent default here to stop onMouseDown to trigger onBlur of the input element */\n }}\n >\n {\n onClose();\n onChange(ds, defaultQueries);\n }}\n onClose={onClose}\n current={currentValue}\n style={popper.styles.popper}\n ref={setSelectorElement}\n onClickAddCSV={onClickAddCSV}\n {...restProps}\n onDismiss={onClose}\n {...popper.attributes.popper}\n />\n
\n
\n ) : null}\n
\n );\n}\n\nfunction getStylesDropdown(theme: GrafanaTheme2, props: DataSourceDropdownProps) {\n return {\n container: css`\n position: relative;\n cursor: ${props.disabled ? 'not-allowed' : 'pointer'};\n width: ${theme.spacing(props.width || 'auto')};\n `,\n trigger: css`\n cursor: pointer;\n ${props.disabled && `pointer-events: none;`}\n `,\n input: css`\n input::placeholder {\n color: ${props.disabled ? theme.colors.action.disabledText : theme.colors.text.primary};\n }\n `,\n };\n}\n\nexport interface PickerContentProps extends DataSourceDropdownProps {\n onClickAddCSV?: () => void;\n keyboardEvents: Observable;\n style: React.CSSProperties;\n filterTerm?: string;\n onClose: () => void;\n onDismiss: () => void;\n}\n\nconst PickerContent = React.forwardRef((props, ref) => {\n const { filterTerm, onChange, onClose, onClickAddCSV, current, filter, uploadFile } = props;\n const changeCallback = useCallback(\n (ds: DataSourceInstanceSettings) => {\n onChange(ds);\n reportInteraction(INTERACTION_EVENT_NAME, { item: INTERACTION_ITEM.SELECT_DS, ds_type: ds.type });\n },\n [onChange]\n );\n\n const clickAddCSVCallback = useCallback(() => {\n onClickAddCSV?.();\n onClose();\n reportInteraction(INTERACTION_EVENT_NAME, { item: INTERACTION_ITEM.ADD_FILE });\n }, [onClickAddCSV, onClose]);\n\n const styles = useStyles2(getStylesPickerContent);\n\n return (\n
\n \n (filter ? filter?.(ds) : true) && matchDataSourceWithSearch(ds, filterTerm)}\n onClickEmptyStateCTA={() =>\n reportInteraction(INTERACTION_EVENT_NAME, {\n item: INTERACTION_ITEM.CONFIG_NEW_DS_EMPTY_STATE,\n })\n }\n >\n \n
\n \n {({ showModal, hideModal }) => (\n {\n onClose();\n showModal(DataSourceModal, {\n reportedInteractionFrom: 'ds_picker',\n tracing: props.tracing,\n dashboard: props.dashboard,\n mixed: props.mixed,\n metrics: props.metrics,\n type: props.type,\n annotations: props.annotations,\n variables: props.variables,\n alerting: props.alerting,\n pluginId: props.pluginId,\n logs: props.logs,\n filter: props.filter,\n uploadFile: props.uploadFile,\n current: props.current,\n onDismiss: hideModal,\n onChange: (ds, defaultQueries) => {\n onChange(ds, defaultQueries);\n hideModal();\n },\n });\n reportInteraction(INTERACTION_EVENT_NAME, { item: INTERACTION_ITEM.OPEN_ADVANCED_DS_PICKER });\n }}\n >\n Open advanced data source picker\n \n \n )}\n \n {uploadFile && config.featureToggles.editPanelCSVDragAndDrop && (\n \n )}\n
\n
\n );\n});\nPickerContent.displayName = 'PickerContent';\n\nfunction getStylesPickerContent(theme: GrafanaTheme2) {\n return {\n container: css`\n display: flex;\n flex-direction: column;\n max-width: 480px;\n background: ${theme.colors.background.primary};\n box-shadow: ${theme.shadows.z3};\n `,\n picker: css`\n background: ${theme.colors.background.secondary};\n `,\n dataSourceList: css`\n flex: 1;\n `,\n footer: css`\n flex: 0;\n display: flex;\n flex-direction: row-reverse;\n justify-content: space-between;\n padding: ${theme.spacing(1.5)};\n border-top: 1px solid ${theme.colors.border.weak};\n background-color: ${theme.colors.background.secondary};\n `,\n };\n}\n","import React from 'react';\n\nimport {\n DataSourcePicker as DeprecatedDataSourcePicker,\n DataSourcePickerProps as DeprecatedDataSourcePickerProps,\n} from '@grafana/runtime';\nimport { config } from 'app/core/config';\n\nimport { DataSourceDropdown, DataSourceDropdownProps } from './DataSourceDropdown';\n\ntype DataSourcePickerProps = DeprecatedDataSourcePickerProps | DataSourceDropdownProps;\n\n/**\n * DataSourcePicker is a wrapper around the old DataSourcePicker and the new one.\n * Depending on the feature toggle, it will render the old or the new one.\n * Feature toggle: advancedDataSourcePicker\n */\nexport function DataSourcePicker(props: DataSourcePickerProps) {\n return !config.featureToggles.advancedDataSourcePicker ? (\n \n ) : (\n \n );\n}\n","import { CoreApp, DataQuery, DataSourceApi, hasQueryExportSupport, hasQueryImportSupport } from '@grafana/data';\nimport { isExpressionReference } from '@grafana/runtime/src/utils/DataSourceWithBackend';\n\nexport async function updateQueries(\n nextDS: DataSourceApi,\n nextDSUidOrVariableExpression: string,\n queries: DataQuery[],\n currentDS?: DataSourceApi\n): Promise {\n let nextQueries = queries;\n const datasource = { type: nextDS.type, uid: nextDSUidOrVariableExpression };\n const DEFAULT_QUERY = { ...nextDS?.getDefaultQuery?.(CoreApp.PanelEditor), datasource, refId: 'A' };\n\n // we are changing data source type\n if (currentDS?.meta.id !== nextDS.meta.id) {\n // If changing to mixed do nothing\n if (nextDS.meta.mixed) {\n return queries;\n }\n // when both data sources support abstract queries\n else if (hasQueryExportSupport(currentDS) && hasQueryImportSupport(nextDS)) {\n const abstractQueries = await currentDS.exportToAbstractQueries(queries);\n nextQueries = await nextDS.importFromAbstractQueries(abstractQueries);\n }\n // when datasource supports query import\n else if (currentDS && nextDS.importQueries) {\n nextQueries = await nextDS.importQueries(queries, currentDS);\n }\n // Otherwise clear queries\n else {\n return [DEFAULT_QUERY];\n }\n }\n\n if (nextQueries.length === 0) {\n return [DEFAULT_QUERY];\n }\n\n // Set data source on all queries except expression queries\n return nextQueries.map((query) => {\n if (!isExpressionReference(query.datasource) && !nextDS.meta.mixed) {\n query.datasource = datasource;\n }\n return query;\n });\n}\n","import { css } from '@emotion/css';\nimport React, { PureComponent, ChangeEvent, FocusEvent } from 'react';\n\nimport { rangeUtil, PanelData, DataSourceApi } from '@grafana/data';\nimport { Switch, Input, InlineField, InlineFormLabel, stylesFactory } from '@grafana/ui';\nimport { QueryOperationRow } from 'app/core/components/QueryOperationRow/QueryOperationRow';\nimport { config } from 'app/core/config';\nimport { QueryGroupOptions } from 'app/types';\n\ninterface Props {\n options: QueryGroupOptions;\n dataSource: DataSourceApi;\n data: PanelData;\n onChange: (options: QueryGroupOptions) => void;\n}\n\ninterface State {\n timeRangeFrom: string;\n timeRangeShift: string;\n timeRangeHide: boolean;\n isOpen: boolean;\n relativeTimeIsValid: boolean;\n timeShiftIsValid: boolean;\n}\n\nexport class QueryGroupOptionsEditor extends PureComponent {\n constructor(props: Props) {\n super(props);\n\n const { options } = props;\n\n this.state = {\n timeRangeFrom: options.timeRange?.from || '',\n timeRangeShift: options.timeRange?.shift || '',\n timeRangeHide: options.timeRange?.hide ?? false,\n isOpen: false,\n relativeTimeIsValid: true,\n timeShiftIsValid: true,\n };\n }\n\n onRelativeTimeChange = (event: ChangeEvent) => {\n this.setState({\n timeRangeFrom: event.target.value,\n });\n };\n\n onTimeShiftChange = (event: ChangeEvent) => {\n this.setState({\n timeRangeShift: event.target.value,\n });\n };\n\n onOverrideTime = (event: FocusEvent) => {\n const { options, onChange } = this.props;\n\n const newValue = emptyToNull(event.target.value);\n const isValid = timeRangeValidation(newValue);\n\n if (isValid && options.timeRange?.from !== newValue) {\n onChange({\n ...options,\n timeRange: {\n ...(options.timeRange ?? {}),\n from: newValue,\n },\n });\n }\n\n this.setState({ relativeTimeIsValid: isValid });\n };\n\n onTimeShift = (event: FocusEvent) => {\n const { options, onChange } = this.props;\n\n const newValue = emptyToNull(event.target.value);\n const isValid = timeRangeValidation(newValue);\n\n if (isValid && options.timeRange?.shift !== newValue) {\n onChange({\n ...options,\n timeRange: {\n ...(options.timeRange ?? {}),\n shift: newValue,\n },\n });\n }\n\n this.setState({ timeShiftIsValid: isValid });\n };\n\n onToggleTimeOverride = () => {\n const { onChange, options } = this.props;\n\n this.setState({ timeRangeHide: !this.state.timeRangeHide }, () => {\n onChange({\n ...options,\n timeRange: {\n ...(options.timeRange ?? {}),\n hide: this.state.timeRangeHide,\n },\n });\n });\n };\n\n onCacheTimeoutBlur = (event: ChangeEvent) => {\n const { options, onChange } = this.props;\n onChange({\n ...options,\n cacheTimeout: emptyToNull(event.target.value),\n });\n };\n\n onQueryCachingTTLBlur = (event: ChangeEvent) => {\n const { options, onChange } = this.props;\n\n let ttl: number | null = parseInt(event.target.value, 10);\n\n if (isNaN(ttl) || ttl === 0) {\n ttl = null;\n }\n\n onChange({\n ...options,\n queryCachingTTL: ttl,\n });\n };\n\n onMaxDataPointsBlur = (event: ChangeEvent) => {\n const { options, onChange } = this.props;\n\n let maxDataPoints: number | null = parseInt(event.target.value as string, 10);\n\n if (isNaN(maxDataPoints) || maxDataPoints === 0) {\n maxDataPoints = null;\n }\n\n if (maxDataPoints !== options.maxDataPoints) {\n onChange({\n ...options,\n maxDataPoints,\n });\n }\n };\n\n onMinIntervalBlur = (event: ChangeEvent) => {\n const { options, onChange } = this.props;\n const minInterval = emptyToNull(event.target.value);\n if (minInterval !== options.minInterval) {\n onChange({\n ...options,\n minInterval,\n });\n }\n };\n\n renderCacheTimeoutOption() {\n const { dataSource, options } = this.props;\n\n const tooltip = `If your time series store has a query cache this option can override the default cache timeout. Specify a\n numeric value in seconds.`;\n\n if (!dataSource.meta.queryOptions?.cacheTimeout) {\n return null;\n }\n\n return (\n
\n
\n \n Cache timeout\n \n \n
\n
\n );\n }\n\n renderQueryCachingTTLOption() {\n const { dataSource, options } = this.props;\n\n const tooltip = `Cache time-to-live: How long results from this queries in this panel will be cached, in milliseconds. Defaults to the TTL in the caching configuration for this datasource.`;\n\n if (!dataSource.cachingConfig?.enabled) {\n return null;\n }\n\n return (\n
\n
\n \n Cache TTL\n \n \n
\n
\n );\n }\n\n renderMaxDataPointsOption() {\n const { data, options } = this.props;\n const realMd = data.request?.maxDataPoints;\n const value = options.maxDataPoints ?? '';\n const isAuto = value === '';\n\n return (\n
\n
\n \n The maximum data points per series. Used directly by some data sources and used in calculation of auto\n interval. With streaming data this value is used for the rolling buffer.\n \n }\n >\n Max data points\n \n \n {isAuto && (\n <>\n
=
\n
Width of panel
\n \n )}\n
\n
\n );\n }\n\n renderIntervalOption() {\n const { data, dataSource, options } = this.props;\n const realInterval = data.request?.interval;\n const minIntervalOnDs = dataSource.interval ?? 'No limit';\n\n return (\n <>\n
\n
\n \n A lower limit for the interval. Recommended to be set to write frequency, for example 1m{' '}\n if your data is written every minute. Default value can be set in data source settings for most data\n sources.\n \n }\n >\n Min interval\n \n \n
\n
\n
\n
\n \n The evaluated interval that is sent to data source and is used in $__interval and{' '}\n $__interval_ms\n \n }\n >\n Interval\n \n {realInterval}\n
=
\n
Time range / max data points
\n
\n
\n \n );\n }\n\n onOpenOptions = () => {\n this.setState({ isOpen: true });\n };\n\n onCloseOptions = () => {\n this.setState({ isOpen: false });\n };\n\n renderCollapsedText(styles: StylesType): React.ReactNode | undefined {\n const { data, options } = this.props;\n const { isOpen } = this.state;\n\n if (isOpen) {\n return undefined;\n }\n\n let mdDesc = options.maxDataPoints ?? '';\n if (mdDesc === '' && data.request) {\n mdDesc = `auto = ${data.request.maxDataPoints}`;\n }\n\n let intervalDesc = options.minInterval;\n if (data.request) {\n intervalDesc = `${data.request.interval}`;\n }\n\n return (\n <>\n {
MD = {mdDesc}
}\n {
Interval = {intervalDesc}
}\n \n );\n }\n\n render() {\n const { timeRangeHide: hideTimeOverride, relativeTimeIsValid, timeShiftIsValid } = this.state;\n const { timeRangeFrom: relativeTime, timeRangeShift: timeShift, isOpen } = this.state;\n const styles = getStyles();\n\n return (\n \n {this.renderMaxDataPointsOption()}\n {this.renderIntervalOption()}\n {this.renderCacheTimeoutOption()}\n {this.renderQueryCachingTTLOption()}\n\n
\n Relative time\n \n
\n\n
\n Time shift\n \n
\n {(timeShift || relativeTime) && (\n
\n \n \n \n
\n )}\n \n );\n }\n}\n\nconst timeRangeValidation = (value: string | null) => {\n if (!value) {\n return true;\n }\n\n return rangeUtil.isValidTimeSpan(value);\n};\n\nconst emptyToNull = (value: string) => {\n return value === '' ? null : value;\n};\n\nconst getStyles = stylesFactory(() => {\n const { theme } = config;\n\n return {\n collapsedText: css`\n margin-left: ${theme.spacing.md};\n font-size: ${theme.typography.size.sm};\n color: ${theme.colors.textWeak};\n `,\n };\n});\n\ntype StylesType = ReturnType;\n","import { css } from '@emotion/css';\nimport React, { PureComponent } from 'react';\nimport { Unsubscribable } from 'rxjs';\n\nimport {\n CoreApp,\n DataSourceApi,\n DataSourceInstanceSettings,\n getDefaultTimeRange,\n LoadingState,\n PanelData,\n} from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { getDataSourceSrv, locationService } from '@grafana/runtime';\nimport { DataQuery } from '@grafana/schema';\nimport { Button, CustomScrollbar, HorizontalGroup, InlineFormLabel, Modal, stylesFactory } from '@grafana/ui';\nimport { PluginHelp } from 'app/core/components/PluginHelp/PluginHelp';\nimport config from 'app/core/config';\nimport { backendSrv } from 'app/core/services/backend_srv';\nimport { addQuery, queryIsEmpty } from 'app/core/utils/query';\nimport { DataSourceModal } from 'app/features/datasources/components/picker/DataSourceModal';\nimport { DataSourcePicker } from 'app/features/datasources/components/picker/DataSourcePicker';\nimport { dataSource as expressionDatasource } from 'app/features/expressions/ExpressionDatasource';\nimport { DashboardQueryEditor, isSharedDashboardQuery } from 'app/plugins/datasource/dashboard';\nimport { GrafanaQuery } from 'app/plugins/datasource/grafana/types';\nimport { QueryGroupOptions } from 'app/types';\n\nimport { PanelQueryRunner } from '../state/PanelQueryRunner';\nimport { updateQueries } from '../state/updateQueries';\n\nimport { GroupActionComponents } from './QueryActionComponent';\nimport { QueryEditorRows } from './QueryEditorRows';\nimport { QueryGroupOptionsEditor } from './QueryGroupOptions';\n\nexport interface Props {\n queryRunner: PanelQueryRunner;\n options: QueryGroupOptions;\n onOpenQueryInspector?: () => void;\n onRunQueries: () => void;\n onOptionsChange: (options: QueryGroupOptions) => void;\n}\n\ninterface State {\n dataSource?: DataSourceApi;\n dsSettings?: DataSourceInstanceSettings;\n queries: DataQuery[];\n helpContent: React.ReactNode;\n isLoadingHelp: boolean;\n isPickerOpen: boolean;\n isAddingMixed: boolean;\n isDataSourceModalOpen: boolean;\n data: PanelData;\n isHelpOpen: boolean;\n defaultDataSource?: DataSourceApi;\n scrollElement?: HTMLDivElement;\n}\n\nexport class QueryGroup extends PureComponent {\n backendSrv = backendSrv;\n dataSourceSrv = getDataSourceSrv();\n querySubscription: Unsubscribable | null = null;\n\n state: State = {\n isDataSourceModalOpen: !!locationService.getSearchObject().firstPanel,\n isLoadingHelp: false,\n helpContent: null,\n isPickerOpen: false,\n isAddingMixed: false,\n isHelpOpen: false,\n queries: [],\n data: {\n state: LoadingState.NotStarted,\n series: [],\n timeRange: getDefaultTimeRange(),\n },\n };\n\n async componentDidMount() {\n const { options, queryRunner } = this.props;\n\n this.querySubscription = queryRunner.getData({ withTransforms: false, withFieldConfig: false }).subscribe({\n next: (data: PanelData) => this.onPanelDataUpdate(data),\n });\n\n this.setNewQueriesAndDatasource(options);\n\n // Clean up the first panel flag since the modal is now open\n if (!!locationService.getSearchObject().firstPanel) {\n locationService.partial({ firstPanel: null }, true);\n }\n }\n\n componentWillUnmount() {\n if (this.querySubscription) {\n this.querySubscription.unsubscribe();\n this.querySubscription = null;\n }\n }\n\n async componentDidUpdate() {\n const { options } = this.props;\n\n const currentDS = await getDataSourceSrv().get(options.dataSource);\n if (this.state.dataSource && currentDS.uid !== this.state.dataSource?.uid) {\n this.setNewQueriesAndDatasource(options);\n }\n }\n\n async setNewQueriesAndDatasource(options: QueryGroupOptions) {\n try {\n const ds = await this.dataSourceSrv.get(options.dataSource);\n const dsSettings = this.dataSourceSrv.getInstanceSettings(options.dataSource);\n\n const defaultDataSource = await this.dataSourceSrv.get();\n const datasource = ds.getRef();\n const queries = options.queries.map((q) => ({\n ...(queryIsEmpty(q) && ds?.getDefaultQuery?.(CoreApp.PanelEditor)),\n datasource,\n ...q,\n }));\n\n this.setState({\n queries,\n dataSource: ds,\n dsSettings,\n defaultDataSource,\n });\n } catch (error) {\n console.log('failed to load data source', error);\n }\n }\n\n onPanelDataUpdate(data: PanelData) {\n this.setState({ data });\n }\n\n onChangeDataSource = async (\n newSettings: DataSourceInstanceSettings,\n defaultQueries?: DataQuery[] | GrafanaQuery[]\n ) => {\n const { dsSettings } = this.state;\n const currentDS = dsSettings ? await getDataSourceSrv().get(dsSettings.uid) : undefined;\n const nextDS = await getDataSourceSrv().get(newSettings.uid);\n\n // We need to pass in newSettings.uid as well here as that can be a variable expression and we want to store that in the query model not the current ds variable value\n const queries = defaultQueries || (await updateQueries(nextDS, newSettings.uid, this.state.queries, currentDS));\n\n const dataSource = await this.dataSourceSrv.get(newSettings.name);\n this.onChange({\n queries,\n dataSource: {\n name: newSettings.name,\n uid: newSettings.uid,\n type: newSettings.meta.id,\n default: newSettings.isDefault,\n },\n });\n\n this.setState({\n queries,\n dataSource: dataSource,\n dsSettings: newSettings,\n });\n\n if (defaultQueries) {\n this.props.onRunQueries();\n }\n };\n\n onAddQueryClick = () => {\n const { queries } = this.state;\n this.onQueriesChange(addQuery(queries, this.newQuery()));\n this.onScrollBottom();\n };\n\n newQuery(): Partial {\n const { dsSettings, defaultDataSource } = this.state;\n\n const ds = !dsSettings?.meta.mixed ? dsSettings : defaultDataSource;\n\n return {\n ...this.state.dataSource?.getDefaultQuery?.(CoreApp.PanelEditor),\n datasource: { uid: ds?.uid, type: ds?.type },\n };\n }\n\n onChange(changedProps: Partial) {\n this.props.onOptionsChange({\n ...this.props.options,\n ...changedProps,\n });\n }\n\n onAddExpressionClick = () => {\n this.onQueriesChange(addQuery(this.state.queries, expressionDatasource.newQuery()));\n this.onScrollBottom();\n };\n\n onScrollBottom = () => {\n setTimeout(() => {\n if (this.state.scrollElement) {\n this.state.scrollElement.scrollTo({ top: 10000 });\n }\n }, 20);\n };\n\n onUpdateAndRun = (options: QueryGroupOptions) => {\n this.props.onOptionsChange(options);\n this.props.onRunQueries();\n };\n\n renderTopSection(styles: QueriesTabStyles) {\n const { onOpenQueryInspector, options } = this.props;\n const { dataSource, data } = this.state;\n\n return (\n
\n
\n \n Data source\n \n
{this.renderDataSourcePickerWithPrompt()}
\n {dataSource && (\n <>\n
\n \n
\n
\n \n
\n {onOpenQueryInspector && (\n
\n \n Query inspector\n \n
\n )}\n \n )}\n
\n
\n );\n }\n\n onOpenHelp = () => {\n this.setState({ isHelpOpen: true });\n };\n\n onCloseHelp = () => {\n this.setState({ isHelpOpen: false });\n };\n\n onCloseDataSourceModal = () => {\n this.setState({ isDataSourceModalOpen: false });\n };\n\n renderMixedPicker = () => {\n return (\n \n );\n };\n\n renderDataSourcePickerWithPrompt = () => {\n const { isDataSourceModalOpen } = this.state;\n\n const commonProps = {\n metrics: true,\n mixed: true,\n dashboard: true,\n variables: true,\n current: this.props.options.dataSource,\n uploadFile: true,\n onChange: async (ds: DataSourceInstanceSettings, defaultQueries?: DataQuery[] | GrafanaQuery[]) => {\n await this.onChangeDataSource(ds, defaultQueries);\n this.onCloseDataSourceModal();\n },\n };\n\n return (\n <>\n {isDataSourceModalOpen && config.featureToggles.advancedDataSourcePicker && (\n \n )}\n \n \n );\n };\n\n onAddMixedQuery = (datasource: any) => {\n this.onAddQuery({ datasource: datasource.name });\n this.setState({ isAddingMixed: false });\n };\n\n onMixedPickerBlur = () => {\n this.setState({ isAddingMixed: false });\n };\n\n onAddQuery = (query: Partial) => {\n const { dsSettings, queries } = this.state;\n this.onQueriesChange(addQuery(queries, query, { type: dsSettings?.type, uid: dsSettings?.uid }));\n this.onScrollBottom();\n };\n\n onQueriesChange = (queries: DataQuery[] | GrafanaQuery[]) => {\n this.onChange({ queries });\n this.setState({ queries });\n };\n\n renderQueries(dsSettings: DataSourceInstanceSettings) {\n const { onRunQueries } = this.props;\n const { data, queries } = this.state;\n if (isSharedDashboardQuery(dsSettings.name)) {\n return (\n \n );\n }\n\n return (\n
\n \n
\n );\n }\n\n isExpressionsSupported(dsSettings: DataSourceInstanceSettings): boolean {\n return (dsSettings.meta.alerting || dsSettings.meta.mixed) === true;\n }\n\n renderExtraActions() {\n return GroupActionComponents.getAllExtraRenderAction()\n .map((action, index) =>\n action({\n onAddQuery: this.onAddQuery,\n onChangeDataSource: this.onChangeDataSource,\n key: index,\n })\n )\n .filter(Boolean);\n }\n\n renderAddQueryRow(dsSettings: DataSourceInstanceSettings, styles: QueriesTabStyles) {\n const { isAddingMixed } = this.state;\n const showAddButton = !(isAddingMixed || isSharedDashboardQuery(dsSettings.name));\n\n return (\n \n {showAddButton && (\n \n Query\n \n )}\n {config.expressionsEnabled && this.isExpressionsSupported(dsSettings) && (\n \n Expression \n \n )}\n {this.renderExtraActions()}\n \n );\n }\n\n setScrollRef = (scrollElement: HTMLDivElement): void => {\n this.setState({ scrollElement });\n };\n\n render() {\n const { isHelpOpen, dsSettings } = this.state;\n const styles = getStyles();\n\n return (\n \n
\n {this.renderTopSection(styles)}\n {dsSettings && (\n <>\n
{this.renderQueries(dsSettings)}
\n {this.renderAddQueryRow(dsSettings, styles)}\n {isHelpOpen && (\n \n \n \n )}\n \n )}\n
\n
\n );\n }\n}\n\nconst getStyles = stylesFactory(() => {\n const { theme } = config;\n\n return {\n innerWrapper: css`\n display: flex;\n flex-direction: column;\n padding: ${theme.spacing.md};\n `,\n dataSourceRow: css`\n display: flex;\n margin-bottom: ${theme.spacing.md};\n `,\n dataSourceRowItem: css`\n margin-right: ${theme.spacing.inlineFormMargin};\n `,\n dataSourceRowItemOptions: css`\n flex-grow: 1;\n margin-right: ${theme.spacing.inlineFormMargin};\n `,\n queriesWrapper: css`\n padding-bottom: 16px;\n `,\n expressionWrapper: css``,\n expressionButton: css`\n margin-right: ${theme.spacing.sm};\n `,\n };\n});\n\ntype QueriesTabStyles = ReturnType;\n","import { useEffect, useRef, useState } from 'react';\nimport { Observable, Subject } from 'rxjs';\n\nimport { Field, locationUtil } from '@grafana/data';\nimport { locationService } from '@grafana/runtime';\n\nimport { QueryResponse } from '../service';\n\nexport function useKeyNavigationListener() {\n const eventsRef = useRef(new Subject());\n return {\n keyboardEvents: eventsRef.current,\n onKeyDown: (e: React.KeyboardEvent) => {\n switch (e.code) {\n case 'ArrowDown':\n case 'ArrowUp':\n case 'ArrowLeft':\n case 'ArrowRight':\n case 'Enter':\n eventsRef.current.next(e);\n default:\n // ignore\n }\n },\n };\n}\n\ninterface ItemSelection {\n x: number;\n y: number;\n}\n\nexport function useSearchKeyboardNavigation(\n keyboardEvents: Observable,\n numColumns: number,\n response: QueryResponse\n): ItemSelection {\n const highlightIndexRef = useRef({ x: 0, y: -1 });\n const [highlightIndex, setHighlightIndex] = useState({ x: 0, y: -1 });\n const urlsRef = useRef();\n\n // Clear selection when the search results change\n useEffect(() => {\n urlsRef.current = response.view.fields.url;\n highlightIndexRef.current.x = 0;\n highlightIndexRef.current.y = -1;\n setHighlightIndex({ ...highlightIndexRef.current });\n }, [response]);\n\n useEffect(() => {\n const sub = keyboardEvents.subscribe({\n next: (keyEvent) => {\n switch (keyEvent?.code) {\n case 'ArrowDown': {\n highlightIndexRef.current.y++;\n setHighlightIndex({ ...highlightIndexRef.current });\n break;\n }\n case 'ArrowUp':\n highlightIndexRef.current.y = Math.max(0, highlightIndexRef.current.y - 1);\n setHighlightIndex({ ...highlightIndexRef.current });\n break;\n case 'ArrowRight': {\n if (numColumns > 0) {\n highlightIndexRef.current.x = Math.min(numColumns, highlightIndexRef.current.x + 1);\n setHighlightIndex({ ...highlightIndexRef.current });\n }\n break;\n }\n case 'ArrowLeft': {\n if (numColumns > 0) {\n highlightIndexRef.current.x = Math.max(0, highlightIndexRef.current.x - 1);\n setHighlightIndex({ ...highlightIndexRef.current });\n }\n break;\n }\n case 'Enter':\n if (!urlsRef.current) {\n break;\n }\n const idx = highlightIndexRef.current.x * numColumns + highlightIndexRef.current.y;\n if (idx < 0) {\n highlightIndexRef.current.x = 0;\n highlightIndexRef.current.y = 0;\n setHighlightIndex({ ...highlightIndexRef.current });\n break;\n }\n const url = urlsRef.current.values?.[idx] as string;\n if (url) {\n locationService.push(locationUtil.stripBaseFromUrl(url));\n }\n }\n },\n });\n\n return () => sub.unsubscribe();\n }, [keyboardEvents, numColumns]);\n\n return highlightIndex;\n}\n"],"names":["PluginHelp","pluginId","value","loading","error","useAsync","renderedMarkdown","LoadingPlaceholder","LOCAL_STORAGE_KEY","useRecentlyUsedDataSources","setStorage","useLocalStorage","pushRecentlyUsedDataSource","ds","dsUid","useDatasources","filters","useDatasource","dataSource","dataSourceSrv","useKeyboardNavigatableList","props","keyboardEvents","containerRef","selectedIndex","attributeName","roleName","navigatableItemProps","querySelectorNavigatableElements","selectedAttributeName","selectedItemCssSelector","selectItem","index","listItems","selectedItem","li","clickSelectedElement","sub","keyEvent","listObserver","mutations","mutation","AddNewDataSourceButton","variant","onClick","hasCreateRights","newDataSourceURL","config","DataSourceCard","selected","description","htmlProps","styles","getStyles","Card","TagList","theme","isDataSourceMatch","current","dataSourceLabel","getDataSourceCompareFn","recentlyUsedDataSources","dataSourceVariablesIDs","a","b","aIndex","bIndex","aIsVariable","bIsVariable","matchDataSourceWithSearch","searchTerm","CUSTOM_DESCRIPTIONS_BY_UID","BuiltInDataSourceList","className","onChange","tracing","dashboard","mixed","metrics","type","annotations","variables","alerting","logs","filter","filteredResults","DataSourceList","navigatableProps","enableKeyboardNavigation","onClickEmptyStateCTA","dataSources","filteredDataSources","EmptyState","getDataSourceVariableIDs","onClickCTA","getEmptyStateStyles","v","INTERACTION_EVENT_NAME","INTERACTION_ITEM","DataSourceModal","uploadFile","onDismiss","reportedInteractionFrom","getDataSourceModalStyles","search","setSearch","analyticsInteractionSrc","onDismissModal","onChangeDataSource","reportSearchUsageOnce","grafanaDS","onFileDrop","query","fileRejections","BuiltInList","Modal","Input","Icon","e","CustomScrollbar","FileDropzone","DataSourceLogo","DataSourceLogoPlaceHolder","MODAL_MARGIN","FLIP_THRESHOLD","maxSize","state","name","options","overflow","detectOverflow","x","y","width","height","basePlacement","widthProp","heightProp","applyMaxSize","DataSourceDropdown","hideTextValue","inputId","noDefault","disabled","placeholder","restProps","isOpen","setOpen","inputHasFocus","setInputHasFocus","markerElement","setMarkerElement","selectorElement","setSelectorElement","filterTerm","setFilterTerm","openDropdown","currentDataSourceInstanceSettings","currentValue","prefixIcon","onKeyDown","onClose","onClickAddCSV","popper","usePopper","ref","overlayProps","underlayProps","element","dialogProps","getStylesDropdown","selectors","Portal","PickerContent","defaultQueries","changeCallback","clickAddCSVCallback","getStylesPickerContent","showModal","hideModal","Button","updateQueries","nextDS","nextDSUidOrVariableExpression","queries","currentDS","nextQueries","datasource","DEFAULT_QUERY","abstractQueries","QueryGroupOptionsEditor","event","newValue","emptyToNull","isValid","timeRangeValidation","ttl","maxDataPoints","minInterval","tooltip","data","realMd","isAuto","realInterval","minIntervalOnDs","mdDesc","intervalDesc","hideTimeOverride","relativeTimeIsValid","timeShiftIsValid","relativeTime","timeShift","QueryOperationRow","InlineField","Switch","stylesFactory","QueryGroup","newSettings","dsSettings","isDataSourceModalOpen","commonProps","scrollElement","queryRunner","defaultDataSource","q","changedProps","onOpenQueryInspector","onRunQueries","QueryEditorRows","action","isAddingMixed","showAddButton","isHelpOpen","useKeyNavigationListener","eventsRef","useSearchKeyboardNavigation","numColumns","response","highlightIndexRef","highlightIndex","setHighlightIndex","urlsRef","idx","url"],"sourceRoot":""}