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components/SearchEditor.tsx","webpack://grafana/./public/app/plugins/datasource/grafana/components/QueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/grafana/components/AnnotationQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/grafana/datasource.ts","webpack://grafana/./public/app/plugins/datasource/grafana/module.ts"],"sourcesContent":["import React, { useEffect, useState } from 'react';\n\nimport { InlineField, Input, InlineFieldRow, CodeEditor } from '@grafana/ui';\nimport { SearchQuery } from 'app/features/search/service';\n\ninterface Props {\n value: SearchQuery;\n onChange: (value: SearchQuery) => void;\n}\n\nexport default function SearchEditor({ value, onChange }: Props) {\n const [json, setJSON] = useState('');\n const [query, setQuery] = useState(value.query ?? '');\n\n useEffect(() => {\n const emptySearchQuery: SearchQuery = {\n query: '*',\n location: '', // general, etc\n ds_uid: '',\n sort: '',\n tags: [],\n kind: [],\n explain: false,\n facet: [{ field: 'kind' }, { field: 'tags' }],\n from: 0,\n limit: 20,\n };\n\n setJSON(JSON.stringify({ ...emptySearchQuery, ...value }, null, 2));\n }, [value]);\n\n const handleSearchBlur = (e: React.FocusEvent) => {\n if (query !== value.query) {\n onChange({ ...value, query });\n }\n };\n\n const handleSearchEnterKey = (e: React.KeyboardEvent) => {\n if (e.key !== 'Enter') {\n return;\n }\n handleSearchBlur(e as any);\n };\n\n const onSaveSearchJSON = (rawSearchJSON: string) => {\n try {\n const searchQuery = JSON.parse(rawSearchJSON) as SearchQuery;\n onChange(searchQuery);\n setQuery(searchQuery.query ?? '');\n } catch (ex) {\n console.log('UNABLE TO parse search', rawSearchJSON, ex);\n }\n };\n\n return (\n <>\n \n \n setQuery(e.currentTarget.value)}\n onKeyDown={handleSearchEnterKey}\n onBlur={handleSearchBlur}\n spellCheck={false}\n />\n \n \n \n \n );\n}\n","import React, { PureComponent } from 'react';\n\nimport {\n QueryEditorProps,\n SelectableValue,\n dataFrameFromJSON,\n rangeUtil,\n DataQueryRequest,\n DataFrame,\n} from '@grafana/data';\nimport { config, getBackendSrv, getDataSourceSrv } from '@grafana/runtime';\nimport { InlineField, Select, Alert, Input, InlineFieldRow } from '@grafana/ui';\nimport { hasAlphaPanels } from 'app/core/config';\nimport { SearchQuery } from 'app/features/search/service';\n\nimport { GrafanaDatasource } from '../datasource';\nimport { defaultQuery, GrafanaQuery, GrafanaQueryType } from '../types';\n\nimport SearchEditor from './SearchEditor';\n\ntype Props = QueryEditorProps;\n\nconst labelWidth = 12;\n\ninterface State {\n channels: Array>;\n channelFields: Record>>;\n folders?: Array>;\n}\n\nexport class QueryEditor extends PureComponent {\n state: State = { channels: [], channelFields: {} };\n\n queryTypes: Array> = [\n {\n label: 'Random Walk',\n value: GrafanaQueryType.RandomWalk,\n description: 'Random signal within the selected time range',\n },\n {\n label: 'Live Measurements',\n value: GrafanaQueryType.LiveMeasurements,\n description: 'Stream real-time measurements from Grafana',\n },\n {\n label: 'List public files',\n value: GrafanaQueryType.List,\n description: 'Show directory listings for public resources',\n },\n ];\n\n constructor(props: Props) {\n super(props);\n\n if (config.featureToggles.panelTitleSearch && hasAlphaPanels) {\n this.queryTypes.push({\n label: 'Search',\n value: GrafanaQueryType.Search,\n description: 'Search for grafana resources',\n });\n }\n }\n\n loadChannelInfo() {\n getBackendSrv()\n .fetch({ url: 'api/live/list' })\n .subscribe({\n next: (v: any) => {\n const channelInfo = v.data?.channels as any[];\n if (channelInfo?.length) {\n const channelFields: Record>> = {};\n const channels: Array> = channelInfo.map((c) => {\n if (c.data) {\n const distinctFields = new Set();\n const frame = dataFrameFromJSON(c.data);\n for (const f of frame.fields) {\n distinctFields.add(f.name);\n }\n channelFields[c.channel] = Array.from(distinctFields).map((n) => ({\n value: n,\n label: n,\n }));\n }\n return {\n value: c.channel,\n label: c.channel + ' [' + c.minute_rate + ' msg/min]',\n };\n });\n\n this.setState({ channelFields, channels });\n }\n },\n });\n }\n\n loadFolderInfo() {\n const query: DataQueryRequest = {\n targets: [{ queryType: GrafanaQueryType.List, refId: 'A' }],\n } as any;\n\n getDataSourceSrv()\n .get('-- Grafana --')\n .then((ds) => {\n const gds = ds as GrafanaDatasource;\n gds.query(query).subscribe({\n next: (rsp) => {\n if (rsp.data.length) {\n const names = (rsp.data[0] as DataFrame).fields[0];\n const folders = names.values.toArray().map((v) => ({\n value: v,\n label: v,\n }));\n this.setState({ folders });\n }\n },\n });\n });\n }\n\n componentDidMount() {\n this.loadChannelInfo();\n }\n\n onQueryTypeChange = (sel: SelectableValue) => {\n const { onChange, query, onRunQuery } = this.props;\n onChange({ ...query, queryType: sel.value! });\n onRunQuery();\n\n // Reload the channel list\n this.loadChannelInfo();\n };\n\n onChannelChange = (sel: SelectableValue) => {\n const { onChange, query, onRunQuery } = this.props;\n onChange({ ...query, channel: sel?.value });\n onRunQuery();\n };\n\n onFieldNamesChange = (item: SelectableValue) => {\n const { onChange, query, onRunQuery } = this.props;\n let fields: string[] = [];\n if (Array.isArray(item)) {\n fields = item.map((v) => v.value);\n } else if (item.value) {\n fields = [item.value];\n }\n\n // When adding the first field, also add time (if it exists)\n if (fields.length === 1 && !query.filter?.fields?.length && query.channel) {\n const names = this.state.channelFields[query.channel] ?? [];\n const tf = names.find((f) => f.value === 'time' || f.value === 'Time');\n if (tf && tf.value && tf.value !== fields[0]) {\n fields = [tf.value, ...fields];\n }\n }\n\n onChange({\n ...query,\n filter: {\n ...query.filter,\n fields,\n },\n });\n onRunQuery();\n };\n\n checkAndUpdateValue = (key: keyof GrafanaQuery, txt: string) => {\n const { onChange, query, onRunQuery } = this.props;\n if (key === 'buffer') {\n let buffer: number | undefined;\n if (txt) {\n try {\n buffer = rangeUtil.intervalToSeconds(txt) * 1000;\n } catch (err) {\n console.warn('ERROR', err);\n }\n }\n onChange({\n ...query,\n buffer,\n });\n } else {\n onChange({\n ...query,\n [key]: txt,\n });\n }\n onRunQuery();\n };\n\n handleEnterKey = (e: React.KeyboardEvent) => {\n if (e.key !== 'Enter') {\n return;\n }\n this.checkAndUpdateValue('buffer', (e.target as any).value);\n };\n\n handleBlur = (e: React.FocusEvent) => {\n this.checkAndUpdateValue('buffer', e.target.value);\n };\n\n renderMeasurementsQuery() {\n let { channel, filter, buffer } = this.props.query;\n let { channels, channelFields } = this.state;\n let currentChannel = channels.find((c) => c.value === channel);\n if (channel && !currentChannel) {\n currentChannel = {\n value: channel,\n label: channel,\n description: `Connected to ${channel}`,\n };\n channels = [currentChannel, ...channels];\n }\n\n const distinctFields = new Set();\n const fields: Array> = channel ? channelFields[channel] ?? [] : [];\n // if (data && data.series?.length) {\n // for (const frame of data.series) {\n // for (const field of frame.fields) {\n // if (distinctFields.has(field.name) || !field.name) {\n // continue;\n // }\n // fields.push({\n // value: field.name,\n // label: field.name,\n // description: `(${getFrameDisplayName(frame)} / ${field.type})`,\n // });\n // distinctFields.add(field.name);\n // }\n // }\n // }\n if (filter?.fields) {\n for (const f of filter.fields) {\n if (!distinctFields.has(f)) {\n fields.push({\n value: f,\n label: `${f} (not loaded)`,\n description: `Configured, but not found in the query results`,\n });\n distinctFields.add(f);\n }\n }\n }\n\n let formattedTime = '';\n if (buffer) {\n formattedTime = rangeUtil.secondsToHms(buffer / 1000);\n }\n\n return (\n <>\n
\n \n `Connect to: ${input}`}\n />\n \n
\n {channel && (\n
\n \n `Field: ${input}`}\n isSearchable={true}\n isMulti={true}\n />\n \n \n \n \n
\n )}\n\n \n This supports real-time event streams in Grafana core. This feature is under heavy development. Expect the\n interfaces and structures to change as this becomes more production ready.\n \n \n );\n }\n\n onFolderChanged = (sel: SelectableValue) => {\n const { onChange, query, onRunQuery } = this.props;\n onChange({ ...query, path: sel?.value });\n onRunQuery();\n };\n\n renderListPublicFiles() {\n let { path } = this.props.query;\n let { folders } = this.state;\n if (!folders) {\n folders = [];\n this.loadFolderInfo();\n }\n const currentFolder = folders.find((f) => f.value === path);\n if (path && !currentFolder) {\n folders = [\n ...folders,\n {\n value: path,\n label: path,\n },\n ];\n }\n\n return (\n \n \n `Folder: ${input}`}\n />\n \n \n );\n }\n\n onSearchChange = (search: SearchQuery) => {\n const { query, onChange, onRunQuery } = this.props;\n\n onChange({\n ...query,\n search,\n });\n onRunQuery();\n };\n\n render() {\n const query = {\n ...defaultQuery,\n ...this.props.query,\n };\n\n const { queryType } = query;\n\n return (\n <>\n {queryType === GrafanaQueryType.Search && (\n \n Using this datasource to call the new search system is experimental, and subject to change at any time\n without notice.\n \n )}\n \n \n v.value === queryType) || this.queryTypes[0]}\n onChange={this.onQueryTypeChange}\n />\n \n \n {queryType === GrafanaQueryType.LiveMeasurements && this.renderMeasurementsQuery()}\n {queryType === GrafanaQueryType.List && this.renderListPublicFiles()}\n {queryType === GrafanaQueryType.Search && (\n \n )}\n \n );\n }\n}\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Field, FieldSet, Select, Switch } from '@grafana/ui';\nimport { TagFilter } from 'app/core/components/TagFilter/TagFilter';\nimport { getAnnotationTags } from 'app/features/annotations/api';\n\nimport { GrafanaAnnotationQuery, GrafanaAnnotationType, GrafanaQuery } from '../types';\n\nconst matchTooltipContent = 'Enabling this returns annotations that match any of the tags specified below';\n\nconst tagsTooltipContent = (\n
Specify a list of tags to match. To specify a key and value tag use `key:value` syntax.
\n);\n\nconst annotationTypes = [\n {\n label: 'Dashboard',\n value: GrafanaAnnotationType.Dashboard,\n description: 'Query for events created on this dashboard and show them in the panels where they where created',\n },\n {\n label: 'Tags',\n value: GrafanaAnnotationType.Tags,\n description: 'This will fetch any annotation events that match the tags filter',\n },\n];\n\nconst limitOptions = [10, 50, 100, 200, 300, 500, 1000, 2000].map((limit) => ({\n label: String(limit),\n value: limit,\n}));\n\ninterface Props {\n query: GrafanaQuery;\n onChange: (newValue: GrafanaAnnotationQuery) => void;\n}\n\nexport default function AnnotationQueryEditor({ query, onChange }: Props) {\n const annotationQuery = query as GrafanaAnnotationQuery;\n const { limit, matchAny, tags, type } = annotationQuery;\n const styles = getStyles();\n\n const onFilterByChange = (newValue: SelectableValue) =>\n onChange({\n ...annotationQuery,\n type: newValue.value!,\n });\n\n const onMaxLimitChange = (newValue: SelectableValue) =>\n onChange({\n ...annotationQuery,\n limit: newValue.value!,\n });\n\n const onMatchAnyChange = (newValue: React.ChangeEvent) =>\n onChange({\n ...annotationQuery,\n matchAny: newValue.target.checked,\n });\n\n const onTagsChange = (tags: string[]) =>\n onChange({\n ...annotationQuery,\n tags,\n });\n\n return (\n
\n \n \n \n \n \n \n {type === GrafanaAnnotationType.Tags && (\n <>\n \n \n \n \n \n \n \n )}\n
\n );\n}\n\nconst getStyles = () => {\n return {\n container: css`\n max-width: 600px;\n `,\n };\n};\n","import { isString } from 'lodash';\nimport { from, merge, Observable, of } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport {\n AnnotationQuery,\n AnnotationQueryRequest,\n DataFrameView,\n DataQueryRequest,\n DataQueryResponse,\n DataSourceInstanceSettings,\n DataSourceRef,\n isValidLiveChannelAddress,\n MutableDataFrame,\n parseLiveChannelAddress,\n toDataFrame,\n} from '@grafana/data';\nimport {\n DataSourceWithBackend,\n getBackendSrv,\n getGrafanaLiveSrv,\n getTemplateSrv,\n StreamingFrameOptions,\n} from '@grafana/runtime';\nimport { migrateDatasourceNameToRef } from 'app/features/dashboard/state/DashboardMigrator';\n\nimport { getDashboardSrv } from '../../../features/dashboard/services/DashboardSrv';\n\nimport AnnotationQueryEditor from './components/AnnotationQueryEditor';\nimport { GrafanaAnnotationQuery, GrafanaAnnotationType, GrafanaQuery, GrafanaQueryType } from './types';\n\nlet counter = 100;\n\nexport class GrafanaDatasource extends DataSourceWithBackend {\n constructor(instanceSettings: DataSourceInstanceSettings) {\n super(instanceSettings);\n this.annotations = {\n QueryEditor: AnnotationQueryEditor,\n prepareAnnotation(json: any): AnnotationQuery {\n // Previously, these properties lived outside of target\n // This should handle migrating them\n json.target = json.target ?? {\n type: json.type ?? GrafanaAnnotationType.Dashboard,\n limit: json.limit ?? 100,\n tags: json.tags ?? [],\n matchAny: json.matchAny ?? false,\n }; // using spread syntax caused an infinite loop in StandardAnnotationQueryEditor\n return json;\n },\n prepareQuery(anno: AnnotationQuery): GrafanaQuery {\n let datasource: DataSourceRef | undefined | null = undefined;\n if (isString(anno.datasource)) {\n const ref = migrateDatasourceNameToRef(anno.datasource, { returnDefaultAsNull: false });\n if (ref) {\n datasource = ref;\n }\n } else {\n datasource = anno.datasource as DataSourceRef;\n }\n\n return { ...anno, refId: anno.name, queryType: GrafanaQueryType.Annotations, datasource };\n },\n };\n }\n\n query(request: DataQueryRequest): Observable {\n const results: Array> = [];\n const targets: GrafanaQuery[] = [];\n const templateSrv = getTemplateSrv();\n for (const target of request.targets) {\n if (target.queryType === GrafanaQueryType.Annotations) {\n return from(\n this.getAnnotations({\n range: request.range,\n rangeRaw: request.range.raw,\n annotation: target as unknown as AnnotationQuery,\n dashboard: getDashboardSrv().getCurrent(),\n })\n );\n }\n if (target.hide) {\n continue;\n }\n if (target.queryType === GrafanaQueryType.LiveMeasurements) {\n let channel = templateSrv.replace(target.channel, request.scopedVars);\n const { filter } = target;\n\n // Help migrate pre-release channel paths saved in dashboards\n // NOTE: this should be removed before V8 is released\n if (channel && channel.startsWith('telegraf/')) {\n channel = 'stream/' + channel;\n target.channel = channel; // mutate the current query object so it is saved with `stream/` prefix\n }\n\n const addr = parseLiveChannelAddress(channel);\n if (!isValidLiveChannelAddress(addr)) {\n continue;\n }\n const buffer: Partial = {\n maxLength: request.maxDataPoints ?? 500,\n };\n if (target.buffer) {\n buffer.maxDelta = target.buffer;\n buffer.maxLength = buffer.maxLength! * 2; //??\n } else if (request.rangeRaw?.to === 'now') {\n buffer.maxDelta = request.range.to.valueOf() - request.range.from.valueOf();\n }\n\n results.push(\n getGrafanaLiveSrv().getDataStream({\n key: `${request.requestId}.${counter++}`,\n addr: addr!,\n filter,\n buffer,\n })\n );\n } else {\n if (!target.queryType) {\n target.queryType = GrafanaQueryType.RandomWalk;\n }\n targets.push(target);\n }\n }\n\n if (targets.length) {\n results.push(\n super.query({\n ...request,\n targets,\n })\n );\n }\n\n if (results.length) {\n // With a single query just return the results\n if (results.length === 1) {\n return results[0];\n }\n return merge(...results);\n }\n return of(); // nothing\n }\n\n listFiles(path: string): Observable> {\n return this.query({\n targets: [\n {\n refId: 'A',\n queryType: GrafanaQueryType.List,\n path,\n },\n ],\n } as any).pipe(\n map((v) => {\n const frame = v.data[0] ?? new MutableDataFrame();\n return new DataFrameView(frame);\n })\n );\n }\n\n metricFindQuery(options: any) {\n return Promise.resolve([]);\n }\n\n async getAnnotations(options: AnnotationQueryRequest): Promise {\n const templateSrv = getTemplateSrv();\n const annotation = options.annotation as unknown as AnnotationQuery;\n const target = annotation.target!;\n const params: any = {\n from: options.range.from.valueOf(),\n to: options.range.to.valueOf(),\n limit: target.limit,\n tags: target.tags,\n matchAny: target.matchAny,\n };\n\n if (target.type === GrafanaAnnotationType.Dashboard) {\n // if no dashboard id yet return\n if (!options.dashboard.id) {\n return Promise.resolve({ data: [] });\n }\n // filter by dashboard id\n params.dashboardId = options.dashboard.id;\n // remove tags filter if any\n delete params.tags;\n } else {\n // require at least one tag\n if (!Array.isArray(target.tags) || target.tags.length === 0) {\n return Promise.resolve({ data: [] });\n }\n const delimiter = '__delimiter__';\n const tags = [];\n for (const t of params.tags) {\n const renderedValues = templateSrv.replace(t, {}, (value: any) => {\n if (typeof value === 'string') {\n return value;\n }\n\n return value.join(delimiter);\n });\n for (const tt of renderedValues.split(delimiter)) {\n tags.push(tt);\n }\n }\n params.tags = tags;\n }\n\n const annotations = await getBackendSrv().get(\n '/api/annotations',\n params,\n `grafana-data-source-annotations-${annotation.name}-${options.dashboard?.id}`\n );\n return { data: [toDataFrame(annotations)] };\n }\n\n testDatasource() {\n return Promise.resolve();\n }\n}\n\nexport interface FileElement {\n name: string;\n ['media-type']: string;\n}\n","import { DataSourcePlugin } from '@grafana/data';\n\nimport { QueryEditor } from './components/QueryEditor';\nimport { GrafanaDatasource } from './datasource';\nimport { GrafanaQuery } from './types';\n\nexport const plugin = new DataSourcePlugin(GrafanaDatasource).setQueryEditor(\n QueryEditor\n);\n"],"names":["SearchEditor","value","onChange","json","setJSON","useState","query","setQuery","useEffect","JSON","stringify","location","ds_uid","sort","tags","kind","explain","facet","field","from","limit","handleSearchBlur","e","onSaveSearchJSON","rawSearchJSON","searchQuery","parse","ex","console","log","InlineFieldRow","InlineField","label","grow","labelWidth","Input","placeholder","currentTarget","onKeyDown","key","onBlur","spellCheck","CodeEditor","height","language","onSave","showMiniMap","showLineNumbers","QueryEditor","PureComponent","constructor","props","super","channels","channelFields","GrafanaQueryType","description","sel","onRunQuery","this","queryType","loadChannelInfo","channel","item","fields","Array","isArray","map","v","length","filter","tf","state","find","f","txt","buffer","rangeUtil","err","warn","checkAndUpdateValue","target","path","search","config","hasAlphaPanels","queryTypes","push","getBackendSrv","fetch","url","subscribe","next","channelInfo","data","c","distinctFields","Set","frame","dataFrameFromJSON","add","name","n","minute_rate","setState","loadFolderInfo","targets","refId","getDataSourceSrv","get","then","ds","rsp","folders","values","toArray","componentDidMount","renderMeasurementsQuery","currentChannel","has","formattedTime","className","Select","options","onChannelChange","allowCustomValue","backspaceRemovesValue","isClearable","noOptionsMessage","formatCreateLabel","input","onFieldNamesChange","isSearchable","isMulti","width","defaultValue","handleEnterKey","handleBlur","Alert","title","severity","renderListPublicFiles","currentFolder","onFolderChanged","render","defaultQuery","onQueryTypeChange","onSearchChange","tagsTooltipContent","annotationTypes","GrafanaAnnotationType","limitOptions","String","AnnotationQueryEditor","annotationQuery","matchAny","type","styles","getStyles","FieldSet","container","Field","inputId","newValue","Switch","id","checked","TagFilter","tagOptions","getAnnotationTags","css","counter","GrafanaDatasource","DataSourceWithBackend","instanceSettings","annotations","prepareAnnotation","prepareQuery","anno","datasource","isString","ref","migrateDatasourceNameToRef","returnDefaultAsNull","request","results","templateSrv","getTemplateSrv","getAnnotations","range","rangeRaw","raw","annotation","dashboard","getDashboardSrv","getCurrent","hide","replace","scopedVars","startsWith","addr","parseLiveChannelAddress","isValidLiveChannelAddress","maxLength","maxDataPoints","maxDelta","to","valueOf","getGrafanaLiveSrv","getDataStream","requestId","merge","of","listFiles","pipe","MutableDataFrame","DataFrameView","metricFindQuery","Promise","resolve","params","dashboardId","delimiter","t","renderedValues","join","tt","split","toDataFrame","testDatasource","plugin","DataSourcePlugin","setQueryEditor"],"sourceRoot":""}