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0U,EAA3C,KAAkDjH,GAA+B,EAC3G,OAAIzN,EAAWqL,QAEX,gBAAK3a,UAAU,wBAAf,UACE,SAACqK,EAAD,CAAiBhF,MAAOA,EAAOhF,SAAUA,EAAUiK,WAAYA,EAAYgF,WAAYA,OAM3F,iBAAKtP,WAAW+L,EAAAA,EAAAA,KAAI,CAAEwb,QAAS,SAA/B,WACE,gBAAKvnB,WAAW+L,EAAAA,EAAAA,KAAI,CAAEyb,SAAU,IAAhC,SACGniB,EAAMiE,UACL,SAACuE,GAAD,CAAmBxI,MAAOA,EAAOhF,SAAUA,EAAUiK,WAAYA,KAEjE,SAAC,GAAD,CAAsBjF,MAAOA,EAAOhF,SAAUA,EAAUiK,WAAYA,EAAYgF,WAAYA,OAGhG,SAAChD,EAAD,CACEC,MAAK,UAAElH,EAAMiE,gBAAR,SACLjJ,SAAWpC,IACToC,EAAS,OAAD,UAAMgF,EAAN,CAAaA,MAAO4E,EAAc5E,GAAQiE,SAAUrL,KAC5DqM,aDvBPmd,uBAAuBP,IACvBQ,uBAAuBhN,IACvBiN,mBAAmBvkB,I,+CEhBP,SAASwK,EAAYnO,GAChC,IAAImoB,GAAM,IAAAC,UAIV,OAHA,IAAAlb,YAAU,WACNib,EAAIzE,QAAU1jB,KAEXmoB,EAAIzE","sources":["webpack://grafana/./public/app/plugins/datasource/influxdb/types.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/InfluxCheatSheet.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/InfluxStartPage.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/query_part.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/influx_query_model.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/queryUtils.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/FluxQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/QueryEditorModeSwitcher.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/constants.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/useShadowedState.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/RawInfluxQLEditor.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/query_builder.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/influxQLMetadataQuery.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/styles.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/unwrap.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/FormatAsSection.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Seg.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/toSelectableValue.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/FromSection.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/InputSection.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/OrderByTimeSection.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/AddButton.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/PartListSection.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/tagUtils.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/TagsSection.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/partListUtils.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Editor.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/components/VariableQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/influxdb/influx_series.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/response_parser.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/datasource.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/module.ts","webpack://grafana/./public/app/plugins/datasource/influxdb/components/QueryEditor.tsx","webpack://grafana/./.yarn/__virtual__/react-use-virtual-cea8e826dc/3/opt/drone/yarncache/react-use-npm-17.4.0-0ef4521544-0889da919b.zip/node_modules/react-use/esm/usePrevious.js"],"sourcesContent":["import { DataQuery, DataSourceJsonData } from '@grafana/data';\n\nexport enum InfluxVersion {\n InfluxQL = 'InfluxQL',\n Flux = 'Flux',\n}\n\nexport interface InfluxOptions extends DataSourceJsonData {\n version?: InfluxVersion;\n\n timeInterval?: string;\n httpMode?: string;\n\n // With Flux\n organization?: string;\n defaultBucket?: string;\n maxSeries?: number;\n}\n\nexport interface InfluxSecureJsonData {\n // For Flux\n token?: string;\n\n // In 1x a different password can be sent than then HTTP auth\n password?: string;\n}\n\nexport interface InfluxQueryPart {\n type: string;\n params?: Array;\n // FIXME: `interval` does not seem to be used.\n // check all the influxdb parts (query-generation etc.),\n // if it is really so, and if yes, remove it\n interval?: string;\n}\n\nexport interface InfluxQueryTag {\n key: string;\n operator?: string;\n condition?: string;\n value: string;\n}\n\nexport type ResultFormat = 'time_series' | 'table' | 'logs';\n\nexport interface InfluxQuery extends DataQuery {\n policy?: string;\n measurement?: string;\n resultFormat?: ResultFormat;\n orderByTime?: string;\n tags?: InfluxQueryTag[];\n groupBy?: InfluxQueryPart[];\n select?: InfluxQueryPart[][];\n limit?: string | number;\n slimit?: string | number;\n tz?: string;\n // NOTE: `fill` is not used in the query-editor anymore, and is removed\n // if any change happens in the query-editor. the query-generation still\n // supports it for now.\n fill?: string;\n rawQuery?: boolean;\n query?: string;\n alias?: string;\n}\n","import { uniqueId } from 'lodash';\nimport React, { PureComponent } from 'react';\n\nimport {\n DataSourcePluginOptionsEditorProps,\n SelectableValue,\n onUpdateDatasourceOption,\n updateDatasourcePluginResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceSecureJsonDataOption,\n updateDatasourcePluginJsonDataOption,\n} from '@grafana/data';\nimport { Alert, DataSourceHttpSettings, InfoBox, InlineField, InlineFormLabel, LegacyForms, Select } from '@grafana/ui';\n\nconst { Input, SecretFormField } = LegacyForms;\nimport { InfluxOptions, InfluxSecureJsonData, InfluxVersion } from '../types';\n\nconst httpModes = [\n { label: 'GET', value: 'GET' },\n { label: 'POST', value: 'POST' },\n] as SelectableValue[];\n\nconst versions = [\n {\n label: 'InfluxQL',\n value: InfluxVersion.InfluxQL,\n description: 'The InfluxDB SQL-like query language.',\n },\n {\n label: 'Flux',\n value: InfluxVersion.Flux,\n description: 'Advanced data scripting and query language. Supported in InfluxDB 2.x and 1.8+',\n },\n] as Array>;\n\nexport type Props = DataSourcePluginOptionsEditorProps;\ntype State = {\n maxSeries: string | undefined;\n};\n\nexport class ConfigEditor extends PureComponent {\n state = {\n maxSeries: '',\n };\n\n htmlPrefix: string;\n\n constructor(props: Props) {\n super(props);\n this.state.maxSeries = props.options.jsonData.maxSeries?.toString() || '';\n this.htmlPrefix = uniqueId('influxdb-config');\n }\n\n // 1x\n onResetPassword = () => {\n updateDatasourcePluginResetOption(this.props, 'password');\n };\n\n // 2x\n onResetToken = () => {\n updateDatasourcePluginResetOption(this.props, 'token');\n };\n\n onVersionChanged = (selected: SelectableValue) => {\n const { options, onOptionsChange } = this.props;\n\n const copy: any = {\n ...options,\n jsonData: {\n ...options.jsonData,\n version: selected.value,\n },\n };\n if (selected.value === InfluxVersion.Flux) {\n copy.access = 'proxy';\n copy.basicAuth = true;\n copy.jsonData.httpMode = 'POST';\n\n // Remove old 1x configs\n delete copy.user;\n delete copy.database;\n }\n\n onOptionsChange(copy);\n };\n\n renderInflux2x() {\n const { options } = this.props;\n const { secureJsonFields } = options;\n const secureJsonData = (options.secureJsonData || {}) as InfluxSecureJsonData;\n const { htmlPrefix } = this;\n\n return (\n <>\n
\n
\n \n Organization\n \n
\n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n Default Bucket\n
\n \n
\n
\n
\n\n
\n
\n \n Min time interval\n \n
\n \n
\n
\n
\n \n );\n }\n\n renderInflux1x() {\n const { options } = this.props;\n const { secureJsonFields } = options;\n const secureJsonData = (options.secureJsonData || {}) as InfluxSecureJsonData;\n const { htmlPrefix } = this;\n\n return (\n <>\n \n
Database Access
\n

\n Setting the database for this datasource does not deny access to other databases. The InfluxDB query syntax\n allows switching the database in the query. For example:\n SHOW MEASUREMENTS ON _internal or\n SELECT * FROM "_internal".."database" LIMIT 10\n
\n
\n To support data isolation and security, make sure appropriate permissions are configured in InfluxDB.\n

\n
\n
\n
\n \n Database\n \n
\n \n
\n
\n
\n
\n
\n \n User\n \n
\n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n \n HTTP Method\n \n httpMode.value === options.jsonData.httpMode)}\n options={httpModes}\n defaultValue={options.jsonData.httpMode}\n onChange={onUpdateDatasourceJsonDataOptionSelect(this.props, 'httpMode')}\n />\n
\n
\n\n
\n
\n \n Min time interval\n \n
\n \n
\n
\n
\n \n );\n }\n\n render() {\n const { options, onOptionsChange } = this.props;\n\n return (\n <>\n

Query Language

\n
\n
\n
\n \n
\n
\n
\n\n {options.jsonData.version === InfluxVersion.Flux && (\n \n
Support for Flux in Grafana is currently in beta
\n

\n Please report any issues to:
\n \n https://github.com/grafana/grafana/issues\n \n

\n
\n )}\n\n {options.access === 'direct' && (\n \n Browser access mode in the InfluxDB datasource is deprecated and will be removed in a future release.\n \n )}\n\n \n\n
\n
\n

InfluxDB Details

\n
\n {options.jsonData.version === InfluxVersion.Flux ? this.renderInflux2x() : this.renderInflux1x()}\n
\n \n {\n // We duplicate this state so that we allow to write freely inside the input. We don't have\n // any influence over saving so this seems to be only way to do this.\n this.setState({ maxSeries: event.currentTarget.value });\n const val = parseInt(event.currentTarget.value, 10);\n updateDatasourcePluginJsonDataOption(this.props, 'maxSeries', Number.isFinite(val) ? val : undefined);\n }}\n />\n \n
\n
\n \n );\n }\n}\n\nexport default ConfigEditor;\n","import React from 'react';\n\nconst CHEAT_SHEET_ITEMS = [\n {\n title: 'Getting started',\n label:\n 'Start by selecting a measurement and field from the dropdown above. You can then use the tag selector to further narrow your search.',\n },\n];\n\nconst InfluxCheatSheet = (props: any) => (\n
\n

InfluxDB Cheat Sheet

\n {CHEAT_SHEET_ITEMS.map((item) => (\n
\n
{item.title}
\n
{item.label}
\n
\n ))}\n
\n);\n\nexport default InfluxCheatSheet;\n","import React, { PureComponent } from 'react';\n\nimport { QueryEditorHelpProps } from '@grafana/data';\n\nimport InfluxCheatSheet from './InfluxCheatSheet';\n\nexport default class InfluxStartPage extends PureComponent {\n render() {\n return ;\n }\n}\n","import { map, clone } from 'lodash';\n\nimport { QueryPartDef, QueryPart, functionRenderer, suffixRenderer } from 'app/features/alerting/state/query_part';\n\nconst index: any[] = [];\nconst categories: any = {\n Aggregations: [],\n Selectors: [],\n Transformations: [],\n Predictors: [],\n Math: [],\n Aliasing: [],\n Fields: [],\n};\n\nfunction createPart(part: any): any {\n const def = index[part.type];\n if (!def) {\n throw { message: 'Could not find query part ' + part.type };\n }\n\n return new QueryPart(part, def);\n}\n\nfunction register(options: any) {\n index[options.type] = new QueryPartDef(options);\n options.category.push(index[options.type]);\n}\n\nconst groupByTimeFunctions: any[] = [];\n\nfunction aliasRenderer(part: { params: string[] }, innerExpr: string) {\n return innerExpr + ' AS ' + '\"' + part.params[0] + '\"';\n}\n\nfunction fieldRenderer(part: { params: string[] }, innerExpr: any) {\n if (part.params[0] === '*') {\n return '*';\n }\n return '\"' + part.params[0] + '\"';\n}\n\nfunction replaceAggregationAddStrategy(selectParts: any[], partModel: { def: { type: string } }) {\n // look for existing aggregation\n for (let i = 0; i < selectParts.length; i++) {\n const part = selectParts[i];\n if (part.def.category === categories.Aggregations) {\n if (part.def.type === partModel.def.type) {\n return;\n }\n // count distinct is allowed\n if (part.def.type === 'count' && partModel.def.type === 'distinct') {\n break;\n }\n // remove next aggregation if distinct was replaced\n if (part.def.type === 'distinct') {\n const morePartsAvailable = selectParts.length >= i + 2;\n if (partModel.def.type !== 'count' && morePartsAvailable) {\n const nextPart = selectParts[i + 1];\n if (nextPart.def.category === categories.Aggregations) {\n selectParts.splice(i + 1, 1);\n }\n } else if (partModel.def.type === 'count') {\n if (!morePartsAvailable || selectParts[i + 1].def.type !== 'count') {\n selectParts.splice(i + 1, 0, partModel);\n }\n return;\n }\n }\n selectParts[i] = partModel;\n return;\n }\n if (part.def.category === categories.Selectors) {\n selectParts[i] = partModel;\n return;\n }\n }\n\n selectParts.splice(1, 0, partModel);\n}\n\nfunction addTransformationStrategy(selectParts: any[], partModel: any) {\n let i;\n // look for index to add transformation\n for (i = 0; i < selectParts.length; i++) {\n const part = selectParts[i];\n if (part.def.category === categories.Math || part.def.category === categories.Aliasing) {\n break;\n }\n }\n\n selectParts.splice(i, 0, partModel);\n}\n\nfunction addMathStrategy(selectParts: any[], partModel: any) {\n const partCount = selectParts.length;\n if (partCount > 0) {\n // if last is math, replace it\n if (selectParts[partCount - 1].def.type === 'math') {\n selectParts[partCount - 1] = partModel;\n return;\n }\n // if next to last is math, replace it\n if (partCount > 1 && selectParts[partCount - 2].def.type === 'math') {\n selectParts[partCount - 2] = partModel;\n return;\n } else if (selectParts[partCount - 1].def.type === 'alias') {\n // if last is alias add it before\n selectParts.splice(partCount - 1, 0, partModel);\n return;\n }\n }\n selectParts.push(partModel);\n}\n\nfunction addAliasStrategy(selectParts: any[], partModel: any) {\n const partCount = selectParts.length;\n if (partCount > 0) {\n // if last is alias, replace it\n if (selectParts[partCount - 1].def.type === 'alias') {\n selectParts[partCount - 1] = partModel;\n return;\n }\n }\n selectParts.push(partModel);\n}\n\nfunction addFieldStrategy(selectParts: any, partModel: any, query: { selectModels: any[][] }) {\n // copy all parts\n const parts = map(selectParts, (part: any) => {\n return createPart({ type: part.def.type, params: clone(part.params) });\n });\n\n query.selectModels.push(parts);\n}\n\nregister({\n type: 'field',\n addStrategy: addFieldStrategy,\n category: categories.Fields,\n params: [{ type: 'field', dynamicLookup: true }],\n defaultParams: ['value'],\n renderer: fieldRenderer,\n});\n\n// Aggregations\nregister({\n type: 'count',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Aggregations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'distinct',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Aggregations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'integral',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Aggregations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'mean',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Aggregations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'median',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Aggregations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'mode',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Aggregations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'sum',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Aggregations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\n// transformations\n\nregister({\n type: 'derivative',\n addStrategy: addTransformationStrategy,\n category: categories.Transformations,\n params: [\n {\n name: 'duration',\n type: 'interval',\n options: ['1s', '10s', '1m', '5m', '10m', '15m', '1h'],\n },\n ],\n defaultParams: ['10s'],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'spread',\n addStrategy: addTransformationStrategy,\n category: categories.Transformations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'non_negative_derivative',\n addStrategy: addTransformationStrategy,\n category: categories.Transformations,\n params: [\n {\n name: 'duration',\n type: 'interval',\n options: ['1s', '10s', '1m', '5m', '10m', '15m', '1h'],\n },\n ],\n defaultParams: ['10s'],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'difference',\n addStrategy: addTransformationStrategy,\n category: categories.Transformations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'non_negative_difference',\n addStrategy: addTransformationStrategy,\n category: categories.Transformations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'moving_average',\n addStrategy: addTransformationStrategy,\n category: categories.Transformations,\n params: [{ name: 'window', type: 'int', options: [5, 10, 20, 30, 40] }],\n defaultParams: [10],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'cumulative_sum',\n addStrategy: addTransformationStrategy,\n category: categories.Transformations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'stddev',\n addStrategy: addTransformationStrategy,\n category: categories.Transformations,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'time',\n category: groupByTimeFunctions,\n params: [\n {\n name: 'interval',\n type: 'time',\n options: ['$__interval', '1s', '10s', '1m', '5m', '10m', '15m', '1h'],\n },\n ],\n defaultParams: ['$__interval'],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'fill',\n category: groupByTimeFunctions,\n params: [\n {\n name: 'fill',\n type: 'string',\n options: ['none', 'null', '0', 'previous', 'linear'],\n },\n ],\n defaultParams: ['null'],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'elapsed',\n addStrategy: addTransformationStrategy,\n category: categories.Transformations,\n params: [\n {\n name: 'duration',\n type: 'interval',\n options: ['1s', '10s', '1m', '5m', '10m', '15m', '1h'],\n },\n ],\n defaultParams: ['10s'],\n renderer: functionRenderer,\n});\n\n// predictions\nregister({\n type: 'holt_winters',\n addStrategy: addTransformationStrategy,\n category: categories.Predictors,\n params: [\n { name: 'number', type: 'int', options: [5, 10, 20, 30, 40] },\n { name: 'season', type: 'int', options: [0, 1, 2, 5, 10] },\n ],\n defaultParams: [10, 2],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'holt_winters_with_fit',\n addStrategy: addTransformationStrategy,\n category: categories.Predictors,\n params: [\n { name: 'number', type: 'int', options: [5, 10, 20, 30, 40] },\n { name: 'season', type: 'int', options: [0, 1, 2, 5, 10] },\n ],\n defaultParams: [10, 2],\n renderer: functionRenderer,\n});\n\n// Selectors\nregister({\n type: 'bottom',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Selectors,\n params: [{ name: 'count', type: 'int' }],\n defaultParams: [3],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'first',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Selectors,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'last',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Selectors,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'max',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Selectors,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'min',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Selectors,\n params: [],\n defaultParams: [],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'percentile',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Selectors,\n params: [{ name: 'nth', type: 'int' }],\n defaultParams: [95],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'top',\n addStrategy: replaceAggregationAddStrategy,\n category: categories.Selectors,\n params: [{ name: 'count', type: 'int' }],\n defaultParams: [3],\n renderer: functionRenderer,\n});\n\nregister({\n type: 'tag',\n category: groupByTimeFunctions,\n params: [{ name: 'tag', type: 'string', dynamicLookup: true }],\n defaultParams: ['tag'],\n renderer: fieldRenderer,\n});\n\nregister({\n type: 'math',\n addStrategy: addMathStrategy,\n category: categories.Math,\n params: [{ name: 'expr', type: 'string' }],\n defaultParams: [' / 100'],\n renderer: suffixRenderer,\n});\n\nregister({\n type: 'alias',\n addStrategy: addAliasStrategy,\n category: categories.Aliasing,\n params: [{ name: 'name', type: 'string', quote: 'double' }],\n defaultParams: ['alias'],\n renderMode: 'suffix',\n renderer: aliasRenderer,\n});\n\nexport default {\n create: createPart,\n getCategories: () => {\n return categories;\n },\n replaceAggregationAdd: replaceAggregationAddStrategy,\n};\n","import { map, find, filter, indexOf } from 'lodash';\n\nimport { ScopedVars } from '@grafana/data';\nimport { TemplateSrv } from '@grafana/runtime';\nimport kbn from 'app/core/utils/kbn';\n\nimport queryPart from './query_part';\nimport { InfluxQuery, InfluxQueryTag } from './types';\n\nexport default class InfluxQueryModel {\n target: InfluxQuery;\n selectModels: any[] = [];\n queryBuilder: any;\n groupByParts: any;\n templateSrv: any;\n scopedVars: any;\n refId?: string;\n\n /** @ngInject */\n constructor(target: InfluxQuery, templateSrv?: TemplateSrv, scopedVars?: ScopedVars) {\n this.target = target;\n this.templateSrv = templateSrv;\n this.scopedVars = scopedVars;\n\n target.policy = target.policy || 'default';\n target.resultFormat = target.resultFormat || 'time_series';\n target.orderByTime = target.orderByTime || 'ASC';\n target.tags = target.tags || [];\n target.groupBy = target.groupBy || [\n { type: 'time', params: ['$__interval'] },\n { type: 'fill', params: ['null'] },\n ];\n target.select = target.select || [\n [\n { type: 'field', params: ['value'] },\n { type: 'mean', params: [] },\n ],\n ];\n\n this.updateProjection();\n }\n\n updateProjection() {\n this.selectModels = map(this.target.select, (parts: any) => {\n return map(parts, queryPart.create);\n });\n this.groupByParts = map(this.target.groupBy, queryPart.create);\n }\n\n updatePersistedParts() {\n this.target.select = map(this.selectModels, (selectParts) => {\n return map(selectParts, (part: any) => {\n return { type: part.def.type, params: part.params };\n });\n });\n }\n\n hasGroupByTime() {\n return find(this.target.groupBy, (g: any) => g.type === 'time');\n }\n\n hasFill() {\n return find(this.target.groupBy, (g: any) => g.type === 'fill');\n }\n\n addGroupBy(value: string) {\n let stringParts = value.match(/^(\\w+)\\((.*)\\)$/);\n\n if (!stringParts || !this.target.groupBy) {\n return;\n }\n\n const typePart = stringParts[1];\n const arg = stringParts[2];\n const partModel = queryPart.create({ type: typePart, params: [arg] });\n const partCount = this.target.groupBy.length;\n\n if (partCount === 0) {\n this.target.groupBy.push(partModel.part);\n } else if (typePart === 'time') {\n this.target.groupBy.splice(0, 0, partModel.part);\n } else if (typePart === 'tag') {\n if (this.target.groupBy[partCount - 1].type === 'fill') {\n this.target.groupBy.splice(partCount - 1, 0, partModel.part);\n } else {\n this.target.groupBy.push(partModel.part);\n }\n } else {\n this.target.groupBy.push(partModel.part);\n }\n\n this.updateProjection();\n }\n\n removeGroupByPart(part: { def: { type: string } }, index: number) {\n const categories = queryPart.getCategories();\n\n if (part.def.type === 'time') {\n // remove fill\n this.target.groupBy = filter(this.target.groupBy, (g: any) => g.type !== 'fill');\n // remove aggregations\n this.target.select = map(this.target.select, (s: any) => {\n return filter(s, (part: any) => {\n const partModel = queryPart.create(part);\n if (partModel.def.category === categories.Aggregations) {\n return false;\n }\n if (partModel.def.category === categories.Selectors) {\n return false;\n }\n return true;\n });\n });\n }\n\n this.target.groupBy!.splice(index, 1);\n this.updateProjection();\n }\n\n removeSelect(index: number) {\n this.target.select!.splice(index, 1);\n this.updateProjection();\n }\n\n removeSelectPart(selectParts: any[], part: any) {\n // if we remove the field remove the whole statement\n if (part.def.type === 'field') {\n if (this.selectModels.length > 1) {\n const modelsIndex = indexOf(this.selectModels, selectParts);\n this.selectModels.splice(modelsIndex, 1);\n }\n } else {\n const partIndex = indexOf(selectParts, part);\n selectParts.splice(partIndex, 1);\n }\n\n this.updatePersistedParts();\n }\n\n addSelectPart(selectParts: any[], type: string) {\n const partModel = queryPart.create({ type: type });\n partModel.def.addStrategy(selectParts, partModel, this);\n this.updatePersistedParts();\n }\n\n private renderTagCondition(tag: InfluxQueryTag, index: number, interpolate?: boolean) {\n // FIXME: merge this function with query_builder/renderTagCondition\n let str = '';\n let operator = tag.operator;\n let value = tag.value;\n if (index > 0) {\n str = (tag.condition || 'AND') + ' ';\n }\n\n if (!operator) {\n if (/^\\/.*\\/$/.test(value)) {\n operator = '=~';\n } else {\n operator = '=';\n }\n }\n\n // quote value unless regex\n if (operator !== '=~' && operator !== '!~') {\n if (interpolate) {\n value = this.templateSrv.replace(value, this.scopedVars);\n }\n if (operator !== '>' && operator !== '<') {\n value = \"'\" + value.replace(/\\\\/g, '\\\\\\\\').replace(/\\'/g, \"\\\\'\") + \"'\";\n }\n } else if (interpolate) {\n value = this.templateSrv.replace(value, this.scopedVars, 'regex');\n }\n\n return str + '\"' + tag.key + '\" ' + operator + ' ' + value;\n }\n\n getMeasurementAndPolicy(interpolate: any) {\n let policy = this.target.policy;\n let measurement = this.target.measurement || 'measurement';\n\n if (!measurement.match('^/.*/$')) {\n measurement = '\"' + measurement + '\"';\n } else if (interpolate) {\n measurement = this.templateSrv.replace(measurement, this.scopedVars, 'regex');\n }\n\n if (policy !== 'default') {\n policy = '\"' + this.target.policy + '\".';\n } else {\n policy = '';\n }\n\n return policy + measurement;\n }\n\n interpolateQueryStr(value: any[], variable: { multi: any; includeAll: any }, defaultFormatFn: any) {\n // if no multi or include all do not regexEscape\n if (!variable.multi && !variable.includeAll) {\n return value;\n }\n\n if (typeof value === 'string') {\n return kbn.regexEscape(value);\n }\n\n const escapedValues = map(value, kbn.regexEscape);\n return '(' + escapedValues.join('|') + ')';\n }\n\n render(interpolate?: boolean) {\n const target = this.target;\n\n if (target.rawQuery) {\n if (interpolate) {\n return this.templateSrv.replace(target.query, this.scopedVars, this.interpolateQueryStr);\n } else {\n return target.query;\n }\n }\n\n let query = 'SELECT ';\n let i, y;\n for (i = 0; i < this.selectModels.length; i++) {\n const parts = this.selectModels[i];\n let selectText = '';\n for (y = 0; y < parts.length; y++) {\n const part = parts[y];\n selectText = part.render(selectText);\n }\n\n if (i > 0) {\n query += ', ';\n }\n query += selectText;\n }\n\n query += ' FROM ' + this.getMeasurementAndPolicy(interpolate) + ' WHERE ';\n const conditions = map(target.tags, (tag, index) => {\n return this.renderTagCondition(tag, index, interpolate);\n });\n\n if (conditions.length > 0) {\n query += '(' + conditions.join(' ') + ') AND ';\n }\n\n query += '$timeFilter';\n\n let groupBySection = '';\n for (i = 0; i < this.groupByParts.length; i++) {\n const part = this.groupByParts[i];\n if (i > 0) {\n // for some reason fill has no separator\n groupBySection += part.def.type === 'fill' ? ' ' : ', ';\n }\n groupBySection += part.render('');\n }\n\n if (groupBySection.length) {\n query += ' GROUP BY ' + groupBySection;\n }\n\n if (target.fill) {\n query += ' fill(' + target.fill + ')';\n }\n\n if (target.orderByTime === 'DESC') {\n query += ' ORDER BY time DESC';\n }\n\n if (target.limit) {\n query += ' LIMIT ' + target.limit;\n }\n\n if (target.slimit) {\n query += ' SLIMIT ' + target.slimit;\n }\n\n if (target.tz) {\n query += \" tz('\" + target.tz + \"')\";\n }\n\n return query;\n }\n\n renderAdhocFilters(filters: any[]) {\n const conditions = map(filters, (tag, index) => {\n return this.renderTagCondition(tag, index, true);\n });\n return conditions.join(' ');\n }\n}\n","import { cloneDeep } from 'lodash';\n\nimport InfluxQueryModel from './influx_query_model';\nimport { InfluxQuery } from './types';\n\n// FIXME: these functions are a beginning of a refactoring of influx_query_model.ts\n// into a simpler approach with full typescript types.\n// later we should be able to migrate the unit-tests\n// that relate to these functions here, and then perhaps even move the implementation\n// to this place\n\nexport function buildRawQuery(query: InfluxQuery): string {\n const queryCopy = cloneDeep(query); // the query-model mutates the query\n const model = new InfluxQueryModel(queryCopy);\n return model.render(false);\n}\n\nexport function normalizeQuery(query: InfluxQuery): InfluxQuery {\n // we return the original query if there is no need to update it\n if (\n query.policy !== undefined &&\n query.resultFormat !== undefined &&\n query.orderByTime !== undefined &&\n query.tags !== undefined &&\n query.groupBy !== undefined &&\n query.select !== undefined\n ) {\n return query;\n }\n\n // FIXME: we should move the whole normalizeQuery logic here,\n // and then have influxQueryModel call this function,\n // to concentrate the whole logic here\n\n const queryCopy = cloneDeep(query); // the query-model mutates the query\n return new InfluxQueryModel(queryCopy).target;\n}\n\nexport function addNewSelectPart(query: InfluxQuery, type: string, index: number): InfluxQuery {\n const queryCopy = cloneDeep(query); // the query-model mutates the query\n const model = new InfluxQueryModel(queryCopy);\n model.addSelectPart(model.selectModels[index], type);\n return model.target;\n}\n\nexport function removeSelectPart(query: InfluxQuery, partIndex: number, index: number): InfluxQuery {\n const queryCopy = cloneDeep(query); // the query-model mutates the query\n const model = new InfluxQueryModel(queryCopy);\n const selectModel = model.selectModels[index];\n model.removeSelectPart(selectModel, selectModel[partIndex]);\n return model.target;\n}\n\nexport function changeSelectPart(\n query: InfluxQuery,\n listIndex: number,\n partIndex: number,\n newParams: string[]\n): InfluxQuery {\n // we need to make shallow copy of `query.select` down to `query.select[listIndex][partIndex]`\n const newSel = [...(query.select ?? [])];\n newSel[listIndex] = [...newSel[listIndex]];\n newSel[listIndex][partIndex] = {\n ...newSel[listIndex][partIndex],\n params: newParams,\n };\n return { ...query, select: newSel };\n}\n\nexport function addNewGroupByPart(query: InfluxQuery, type: string): InfluxQuery {\n const queryCopy = cloneDeep(query); // the query-model mutates the query\n const model = new InfluxQueryModel(queryCopy);\n model.addGroupBy(type);\n return model.target;\n}\n\nexport function removeGroupByPart(query: InfluxQuery, partIndex: number): InfluxQuery {\n const queryCopy = cloneDeep(query); // the query-model mutates the query\n const model = new InfluxQueryModel(queryCopy);\n model.removeGroupByPart(model.groupByParts[partIndex], partIndex);\n return model.target;\n}\n\nexport function changeGroupByPart(query: InfluxQuery, partIndex: number, newParams: string[]): InfluxQuery {\n // we need to make shallow copy of `query.groupBy` down to `query.groupBy[partIndex]`\n const newGroupBy = [...(query.groupBy ?? [])];\n newGroupBy[partIndex] = {\n ...newGroupBy[partIndex],\n params: newParams,\n };\n return { ...query, groupBy: newGroupBy };\n}\n","import { cx, css } from '@emotion/css';\nimport React, { PureComponent } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { getTemplateSrv } from '@grafana/runtime';\nimport {\n InlineFormLabel,\n LinkButton,\n Segment,\n CodeEditor,\n MonacoEditor,\n CodeEditorSuggestionItem,\n CodeEditorSuggestionItemKind,\n} from '@grafana/ui';\n\nimport InfluxDatasource from '../datasource';\nimport { InfluxQuery } from '../types';\n\ntype Props = {\n onChange: (query: InfluxQuery) => void;\n onRunQuery: () => void;\n query: InfluxQuery;\n // `datasource` is not used internally, but this component is used at some places\n // directly, where the `datasource` prop has to exist. later, when the whole\n // query-editor gets converted to react we can stop using this component directly\n // and then we can probably remove the datasource attribute.\n datasource: InfluxDatasource;\n};\n\nconst samples: Array> = [\n { label: 'Show buckets', description: 'List the available buckets (table)', value: 'buckets()' },\n {\n label: 'Simple query',\n description: 'filter by measurement and field',\n value: `from(bucket: \"db/rp\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) =>\n r._measurement == \"example-measurement\" and\n r._field == \"example-field\"\n )`,\n },\n {\n label: 'Grouped Query',\n description: 'Group by (min/max/sum/median)',\n value: `// v.windowPeriod is a variable referring to the current optimized window period (currently: $interval)\nfrom(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"measurement1\" or r[\"_measurement\"] =~ /^.*?regex.*$/)\n |> filter(fn: (r) => r[\"_field\"] == \"field2\" or r[\"_field\"] =~ /^.*?regex.*$/)\n |> aggregateWindow(every: v.windowPeriod, fn: mean|median|max|count|derivative|sum)\n |> yield(name: \"some-name\")`,\n },\n {\n label: 'Filter by value',\n description: 'Results between a min/max',\n value: `// v.bucket, v.timeRangeStart, and v.timeRange stop are all variables supported by the flux plugin and influxdb\nfrom(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_value\"] >= 10 and r[\"_value\"] <= 20)`,\n },\n {\n label: 'Schema Exploration: (measurements)',\n description: 'Get a list of measurement using flux',\n value: `import \"influxdata/influxdb/v1\"\nv1.measurements(bucket: v.bucket)`,\n },\n {\n label: 'Schema Exploration: (fields)',\n description: 'Return every possible key in a single table',\n value: `from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> keys()\n |> keep(columns: [\"_value\"])\n |> group()\n |> distinct()`,\n },\n {\n label: 'Schema Exploration: (tag keys)',\n description: 'Get a list of tag keys using flux',\n value: `import \"influxdata/influxdb/v1\"\nv1.tagKeys(bucket: v.bucket)`,\n },\n {\n label: 'Schema Exploration: (tag values)',\n description: 'Get a list of tag values using flux',\n value: `import \"influxdata/influxdb/v1\"\nv1.tagValues(\n bucket: v.bucket,\n tag: \"host\",\n predicate: (r) => true,\n start: -1d\n)`,\n },\n];\n\nexport class FluxQueryEditor extends PureComponent {\n onFluxQueryChange = (query: string) => {\n this.props.onChange({ ...this.props.query, query });\n this.props.onRunQuery();\n };\n\n onSampleChange = (val: SelectableValue) => {\n this.props.onChange({\n ...this.props.query,\n query: val.value!,\n });\n\n // Angular HACK: Since the target does not actually change!\n this.forceUpdate();\n this.props.onRunQuery();\n };\n\n getSuggestions = (): CodeEditorSuggestionItem[] => {\n const sugs: CodeEditorSuggestionItem[] = [\n {\n label: 'v.timeRangeStart',\n kind: CodeEditorSuggestionItemKind.Property,\n detail: 'The start time',\n },\n {\n label: 'v.timeRangeStop',\n kind: CodeEditorSuggestionItemKind.Property,\n detail: 'The stop time',\n },\n {\n label: 'v.windowPeriod',\n kind: CodeEditorSuggestionItemKind.Property,\n detail: 'based on max data points',\n },\n {\n label: 'v.defaultBucket',\n kind: CodeEditorSuggestionItemKind.Property,\n detail: 'bucket configured in the datsource',\n },\n {\n label: 'v.organization',\n kind: CodeEditorSuggestionItemKind.Property,\n detail: 'org configured for the datsource',\n },\n ];\n\n const templateSrv = getTemplateSrv();\n templateSrv.getVariables().forEach((variable) => {\n const label = '${' + variable.name + '}';\n let val = templateSrv.replace(label);\n if (val === label) {\n val = '';\n }\n sugs.push({\n label,\n kind: CodeEditorSuggestionItemKind.Text,\n detail: `(Template Variable) ${val}`,\n });\n });\n\n return sugs;\n };\n\n // For some reason in angular, when this component gets re-mounted, the width\n // is not set properly. This forces the layout shortly after mount so that it\n // displays OK. Note: this is not an issue when used directly in react\n editorDidMountCallbackHack = (editor: MonacoEditor) => {\n setTimeout(() => editor.layout(), 100);\n };\n\n render() {\n const { query } = this.props;\n\n const helpTooltip = (\n
\n Type: ctrl+space to show template variable suggestions
\n Many queries can be copied from Chronograf\n
\n );\n\n return (\n <>\n \n \n \n Flux language syntax\n \n \n
\n
\n
\n \n Help\n \n \n \n );\n }\n}\n","import React, { useEffect, useState } from 'react';\n\nimport { Button, ConfirmModal } from '@grafana/ui';\n\ntype Props = {\n isRaw: boolean;\n onChange: (newIsRaw: boolean) => void;\n};\n\nexport const QueryEditorModeSwitcher = ({ isRaw, onChange }: Props): JSX.Element => {\n const [isModalOpen, setModalOpen] = useState(false);\n\n useEffect(() => {\n // if the isRaw changes, we hide the modal\n setModalOpen(false);\n }, [isRaw]);\n\n if (isRaw) {\n return (\n <>\n {\n // we show the are-you-sure modal\n setModalOpen(true);\n }}\n >\n {\n onChange(false);\n }}\n onDismiss={() => {\n setModalOpen(false);\n }}\n />\n \n );\n } else {\n return (\n {\n onChange(true);\n }}\n >\n );\n }\n};\n","import { SelectableValue } from '@grafana/data';\n\nimport { ResultFormat } from '../types';\n\nexport const RESULT_FORMATS: Array> = [\n { label: 'Time series', value: 'time_series' },\n { label: 'Table', value: 'table' },\n { label: 'Logs', value: 'logs' },\n];\n\nexport const DEFAULT_RESULT_FORMAT: ResultFormat = 'time_series';\n","import { useState, useEffect } from 'react';\nimport { usePrevious } from 'react-use';\n\nexport function useShadowedState(outsideVal: T): [T, (newVal: T) => void] {\n const [currentVal, setCurrentVal] = useState(outsideVal);\n const prevOutsideVal = usePrevious(outsideVal);\n\n useEffect(() => {\n const isOutsideValChanged = prevOutsideVal !== outsideVal;\n // if the value changes from the outside, we accept it into the state\n // (we only set it if it is different from the current value)\n if (isOutsideValChanged && currentVal !== outsideVal) {\n setCurrentVal(outsideVal);\n }\n }, [outsideVal, currentVal, prevOutsideVal]);\n\n return [currentVal, setCurrentVal];\n}\n","import React from 'react';\n\nimport { TextArea, InlineFormLabel, Input, Select, HorizontalGroup } from '@grafana/ui';\n\nimport { InfluxQuery } from '../types';\n\nimport { RESULT_FORMATS, DEFAULT_RESULT_FORMAT } from './constants';\nimport { useShadowedState } from './useShadowedState';\nimport { useUniqueId } from './useUniqueId';\n\ntype Props = {\n query: InfluxQuery;\n onChange: (query: InfluxQuery) => void;\n onRunQuery: () => void;\n};\n\n// we handle 3 fields: \"query\", \"alias\", \"resultFormat\"\n// \"resultFormat\" changes are applied immediately\n// \"query\" and \"alias\" changes only happen on onblur\nexport const RawInfluxQLEditor = ({ query, onChange, onRunQuery }: Props): JSX.Element => {\n const [currentQuery, setCurrentQuery] = useShadowedState(query.query);\n const [currentAlias, setCurrentAlias] = useShadowedState(query.alias);\n const aliasElementId = useUniqueId();\n const selectElementId = useUniqueId();\n\n const resultFormat = query.resultFormat ?? DEFAULT_RESULT_FORMAT;\n\n const applyDelayedChangesAndRunQuery = () => {\n onChange({\n ...query,\n query: currentQuery,\n alias: currentAlias,\n resultFormat,\n });\n onRunQuery();\n };\n\n return (\n
\n {\n setCurrentQuery(e.currentTarget.value);\n }}\n value={currentQuery ?? ''}\n />\n \n Format as\n {\n onChange({ ...query, resultFormat: v.value });\n onRunQuery();\n }}\n value={resultFormat}\n options={RESULT_FORMATS}\n />\n Alias by\n {\n setCurrentAlias(e.currentTarget.value);\n }}\n value={currentAlias ?? ''}\n />\n \n
\n );\n};\n","import { reduce } from 'lodash';\n\nimport kbn from 'app/core/utils/kbn';\n\nfunction renderTagCondition(tag: { operator: any; value: string; condition: any; key: string }, index: number) {\n // FIXME: merge this function with influx_query_model/renderTagCondition\n let str = '';\n let operator = tag.operator;\n let value = tag.value;\n if (index > 0) {\n str = (tag.condition || 'AND') + ' ';\n }\n\n if (!operator) {\n if (/^\\/.*\\/$/.test(tag.value)) {\n operator = '=~';\n } else {\n operator = '=';\n }\n }\n\n // quote value unless regex or number, or if empty-string\n if (value === '' || (operator !== '=~' && operator !== '!~' && isNaN(+value))) {\n value = \"'\" + value.replace(/\\\\/g, '\\\\\\\\').replace(/\\'/g, \"\\\\'\") + \"'\";\n }\n\n return str + '\"' + tag.key + '\" ' + operator + ' ' + value;\n}\n\nexport class InfluxQueryBuilder {\n constructor(private target: { measurement: any; tags: any; policy?: any }, private database?: string) {}\n\n buildExploreQuery(type: string, withKey?: string, withMeasurementFilter?: string): string {\n let query = '';\n let measurement;\n let policy;\n\n if (type === 'TAG_KEYS') {\n query = 'SHOW TAG KEYS';\n measurement = this.target.measurement;\n policy = this.target.policy;\n } else if (type === 'TAG_VALUES') {\n query = 'SHOW TAG VALUES';\n measurement = this.target.measurement;\n policy = this.target.policy;\n } else if (type === 'MEASUREMENTS') {\n query = 'SHOW MEASUREMENTS';\n if (withMeasurementFilter) {\n // we do a case-insensitive regex-based lookup\n query += ' WITH MEASUREMENT =~ /(?i)' + kbn.regexEscape(withMeasurementFilter) + '/';\n }\n } else if (type === 'FIELDS') {\n measurement = this.target.measurement;\n policy = this.target.policy;\n\n if (!measurement.match('^/.*/')) {\n measurement = '\"' + measurement + '\"';\n\n if (policy && policy !== 'default') {\n policy = '\"' + policy + '\"';\n measurement = policy + '.' + measurement;\n }\n }\n\n return 'SHOW FIELD KEYS FROM ' + measurement;\n } else if (type === 'RETENTION POLICIES') {\n query = 'SHOW RETENTION POLICIES on \"' + this.database + '\"';\n return query;\n }\n\n if (measurement) {\n if (!measurement.match('^/.*/') && !measurement.match(/^merge\\(.*\\)/)) {\n measurement = '\"' + measurement + '\"';\n }\n\n if (policy && policy !== 'default') {\n policy = '\"' + policy + '\"';\n measurement = policy + '.' + measurement;\n }\n\n query += ' FROM ' + measurement;\n }\n\n if (withKey) {\n query += ' WITH KEY = \"' + withKey + '\"';\n }\n\n if (this.target.tags && this.target.tags.length > 0) {\n const whereConditions = reduce(\n this.target.tags,\n (memo, tag) => {\n // do not add a condition for the key we want to explore for\n if (tag.key === withKey) {\n return memo;\n }\n\n // value operators not supported in these types of queries\n if (tag.operator === '>' || tag.operator === '<') {\n return memo;\n }\n\n memo.push(renderTagCondition(tag, memo.length));\n return memo;\n },\n [] as string[]\n );\n\n if (whereConditions.length > 0) {\n query += ' WHERE ' + whereConditions.join(' ');\n }\n }\n\n if (type === 'MEASUREMENTS') {\n query += ' LIMIT 100';\n //Solve issue #2524 by limiting the number of measurements returned\n //LIMIT must be after WITH MEASUREMENT and WHERE clauses\n //This also could be used for TAG KEYS and TAG VALUES, if desired\n }\n\n return query;\n }\n}\n","import InfluxDatasource from './datasource';\nimport { InfluxQueryBuilder } from './query_builder';\nimport { InfluxQueryTag } from './types';\n\nconst runExploreQuery = (\n type: string,\n withKey: string | undefined,\n withMeasurementFilter: string | undefined,\n target: { measurement: string | undefined; tags: InfluxQueryTag[]; policy: string | undefined },\n datasource: InfluxDatasource\n): Promise> => {\n const builder = new InfluxQueryBuilder(target, datasource.database);\n const q = builder.buildExploreQuery(type, withKey, withMeasurementFilter);\n return datasource.metricFindQuery(q);\n};\n\nexport async function getAllPolicies(datasource: InfluxDatasource): Promise {\n const target = { tags: [], measurement: undefined, policy: undefined };\n const data = await runExploreQuery('RETENTION POLICIES', undefined, undefined, target, datasource);\n return data.map((item) => item.text);\n}\n\nexport async function getAllMeasurementsForTags(\n measurementFilter: string | undefined,\n tags: InfluxQueryTag[],\n datasource: InfluxDatasource\n): Promise {\n const target = { tags, measurement: undefined, policy: undefined };\n const data = await runExploreQuery('MEASUREMENTS', undefined, measurementFilter, target, datasource);\n return data.map((item) => item.text);\n}\n\nexport async function getTagKeysForMeasurementAndTags(\n measurement: string | undefined,\n policy: string | undefined,\n tags: InfluxQueryTag[],\n datasource: InfluxDatasource\n): Promise {\n const target = { tags, measurement, policy };\n const data = await runExploreQuery('TAG_KEYS', undefined, undefined, target, datasource);\n return data.map((item) => item.text);\n}\n\nexport async function getTagValues(\n tagKey: string,\n measurement: string | undefined,\n policy: string | undefined,\n tags: InfluxQueryTag[],\n datasource: InfluxDatasource\n): Promise {\n const target = { tags, measurement, policy };\n const data = await runExploreQuery('TAG_VALUES', tagKey, undefined, target, datasource);\n return data.map((item) => item.text);\n}\n\nexport async function getFieldKeysForMeasurement(\n measurement: string,\n policy: string | undefined,\n datasource: InfluxDatasource\n): Promise {\n const target = { tags: [], measurement, policy };\n const data = await runExploreQuery('FIELDS', undefined, undefined, target, datasource);\n return data.map((item) => item.text);\n}\n","import { css } from '@emotion/css';\n\nexport const paddingRightClass = css({\n paddingRight: '4px',\n});\n","export function unwrap(value: T | null | undefined): T {\n if (value == null) {\n throw new Error('value must not be nullish');\n }\n return value;\n}\n","import { cx } from '@emotion/css';\nimport React from 'react';\n\nimport { Select } from '@grafana/ui';\n\nimport { ResultFormat } from '../../types';\nimport { RESULT_FORMATS } from '../constants';\n\nimport { paddingRightClass } from './styles';\nimport { unwrap } from './unwrap';\n\ntype Props = {\n inputId?: string;\n format: ResultFormat;\n onChange: (newFormat: ResultFormat) => void;\n};\n\nconst className = cx('width-8', paddingRightClass);\n\nexport const FormatAsSection = ({ format, inputId, onChange }: Props): JSX.Element => {\n return (\n \n inputId={inputId}\n className={className}\n onChange={(v) => {\n onChange(unwrap(v.value));\n }}\n value={format}\n options={RESULT_FORMATS}\n />\n );\n};\n","import { cx, css } from '@emotion/css';\nimport debouncePromise from 'debounce-promise';\nimport React, { useState, useEffect } from 'react';\nimport { useAsyncFn } from 'react-use';\n\nimport { SelectableValue } from '@grafana/data';\nimport { InlineLabel, Select, AsyncSelect, Input } from '@grafana/ui';\n\nimport { useShadowedState } from '../useShadowedState';\n\n// this file is a simpler version of `grafana-ui / SegmentAsync.tsx`\n// with some changes:\n// 1. click-outside does not select the value. i think it's better to be explicit here.\n// 2. we set a min-width on the select-element to handle cases where the `value`\n// is very short, like \"x\", and then you click on it and the select opens,\n// and it tries to be as short as \"x\" and it does not work well.\n\n// NOTE: maybe these changes could be migrated into the SegmentAsync later\n\ntype SelVal = SelectableValue;\n\n// when allowCustomValue is true, there is no way to enforce the selectableValue\n// enum-type, so i just go with `string`\n\ntype LoadOptions = (filter: string) => Promise;\n\ntype Props = {\n value: string;\n buttonClassName?: string;\n loadOptions?: LoadOptions;\n // if filterByLoadOptions is false,\n // loadOptions is only executed once,\n // when the select-box opens,\n // and as you write, the list gets filtered\n // by the select-box.\n // if filterByLoadOptions is true,\n // as you write the loadOptions is executed again and again,\n // and it is relied on to filter the results.\n filterByLoadOptions?: boolean;\n onChange: (v: SelVal) => void;\n allowCustomValue?: boolean;\n};\n\nconst selectClass = css({\n minWidth: '160px',\n});\n\ntype SelProps = {\n loadOptions: LoadOptions;\n filterByLoadOptions?: boolean;\n onClose: () => void;\n onChange: (v: SelVal) => void;\n allowCustomValue?: boolean;\n};\n\ntype SelReloadProps = {\n loadOptions: (filter: string) => Promise;\n onClose: () => void;\n onChange: (v: SelVal) => void;\n allowCustomValue?: boolean;\n};\n\n// when a custom value is written into a select-box,\n// by default the new value is prefixed with \"Create:\",\n// and that sounds confusing because here we do not create\n// anything. we change this to just be the entered string.\nconst formatCreateLabel = (v: string) => v;\n\nconst SelReload = ({ loadOptions, allowCustomValue, onChange, onClose }: SelReloadProps): JSX.Element => {\n // here we rely on the fact that writing text into the \n // does not cause a re-render of the current react component.\n // this way there is only a single render-call,\n // so there is only a single `debouncedLoadOptions`.\n // if we want ot make this \"re-render safe,\n // we will have to put the debounced call into an useRef,\n // and probably have an useEffect\n const debouncedLoadOptions = debouncePromise(loadOptions, 1000, { leading: true });\n return (\n
\n \n
\n );\n};\n\ntype SelSingleLoadProps = {\n loadOptions: (filter: string) => Promise;\n onClose: () => void;\n onChange: (v: SelVal) => void;\n allowCustomValue?: boolean;\n};\n\nconst SelSingleLoad = ({ loadOptions, allowCustomValue, onChange, onClose }: SelSingleLoadProps): JSX.Element => {\n const [loadState, doLoad] = useAsyncFn(loadOptions, [loadOptions]);\n\n useEffect(() => {\n doLoad('');\n }, [doLoad, loadOptions]);\n\n return (\n
\n \n
\n );\n};\n\nconst Sel = ({ loadOptions, filterByLoadOptions, allowCustomValue, onChange, onClose }: SelProps): JSX.Element => {\n // unfortunately and have somewhat different behavior,\n // so the simplest approach was to just create two separate wrapper-components\n return filterByLoadOptions ? (\n \n ) : (\n \n );\n};\n\ntype InpProps = {\n initialValue: string;\n onChange: (newVal: string) => void;\n onClose: () => void;\n};\n\nconst Inp = ({ initialValue, onChange, onClose }: InpProps): JSX.Element => {\n const [currentValue, setCurrentValue] = useShadowedState(initialValue);\n\n return (\n {\n if (e.key === 'Enter') {\n onChange(currentValue);\n }\n }}\n onChange={(e) => {\n setCurrentValue(e.currentTarget.value);\n }}\n value={currentValue}\n />\n );\n};\n\nconst defaultButtonClass = css({\n width: 'auto',\n cursor: 'pointer',\n});\n\nexport const Seg = ({\n value,\n buttonClassName,\n loadOptions,\n filterByLoadOptions,\n allowCustomValue,\n onChange,\n}: Props): JSX.Element => {\n const [isOpen, setOpen] = useState(false);\n if (!isOpen) {\n const className = cx(defaultButtonClass, buttonClassName);\n return (\n {\n setOpen(true);\n }}\n >\n {value}\n \n );\n } else {\n if (loadOptions !== undefined) {\n return (\n {\n setOpen(false);\n onChange(v);\n }}\n onClose={() => {\n setOpen(false);\n }}\n />\n );\n } else {\n return (\n {\n setOpen(false);\n }}\n onChange={(v) => {\n setOpen(false);\n onChange({ value: v, label: v });\n }}\n />\n );\n }\n }\n};\n","import { SelectableValue } from '@grafana/data';\n\nexport function toSelectableValue(t: T): SelectableValue {\n return { label: t, value: t };\n}\n","import React from 'react';\n\nimport { Seg } from './Seg';\nimport { toSelectableValue } from './toSelectableValue';\n\nconst DEFAULT_POLICY = 'default';\n\n// we use the value \"default\" as a magic-value, it means\n// we use the default retention-policy.\n// unfortunately, IF the user has a retention-policy named \"default\",\n// and it is not the default-retention-policy in influxdb,\n// bad things will happen.\n// https://github.com/grafana/grafana/issues/4347 :-(\n// FIXME: we could maybe at least detect here that problem-is-happening,\n// and show an error message or something.\n// unfortunately, currently the ResponseParser does not return the\n// is-default info for the retention-policies, so that should change first.\n\ntype Props = {\n onChange: (policy: string | undefined, measurement: string | undefined) => void;\n policy: string | undefined;\n measurement: string | undefined;\n getPolicyOptions: () => Promise;\n getMeasurementOptions: (filter: string) => Promise;\n};\n\nexport const FromSection = ({\n policy,\n measurement,\n onChange,\n getPolicyOptions,\n getMeasurementOptions,\n}: Props): JSX.Element => {\n const handlePolicyLoadOptions = async () => {\n const allPolicies = await getPolicyOptions();\n // if `default` does not exist in the list of policies, we add it\n const allPoliciesWithDefault = allPolicies.some((p) => p === 'default')\n ? allPolicies\n : [DEFAULT_POLICY, ...allPolicies];\n\n return allPoliciesWithDefault.map(toSelectableValue);\n };\n\n const handleMeasurementLoadOptions = async (filter: string) => {\n const allMeasurements = await getMeasurementOptions(filter);\n return allMeasurements.map(toSelectableValue);\n };\n\n return (\n <>\n {\n onChange(v.value, measurement);\n }}\n />\n {\n onChange(policy, v.value);\n }}\n />\n \n );\n};\n","import { cx } from '@emotion/css';\nimport React from 'react';\n\nimport { Input } from '@grafana/ui';\n\nimport { useShadowedState } from '../useShadowedState';\n\nimport { paddingRightClass } from './styles';\n\ntype Props = {\n value: string | undefined;\n onChange: (value: string | undefined) => void;\n isWide?: boolean;\n placeholder?: string;\n};\n\nexport const InputSection = ({ value, onChange, isWide, placeholder }: Props): JSX.Element => {\n const [currentValue, setCurrentValue] = useShadowedState(value);\n\n const onBlur = () => {\n // we send empty-string as undefined\n const newValue = currentValue === '' ? undefined : currentValue;\n onChange(newValue);\n };\n\n return (\n <>\n {\n setCurrentValue(e.currentTarget.value);\n }}\n value={currentValue ?? ''}\n />\n \n );\n};\n","import { cx } from '@emotion/css';\nimport React from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Select } from '@grafana/ui';\n\nimport { paddingRightClass } from './styles';\nimport { unwrap } from './unwrap';\n\ntype Mode = 'ASC' | 'DESC';\n\nconst OPTIONS: Array> = [\n { label: 'ascending', value: 'ASC' },\n { label: 'descending', value: 'DESC' },\n];\n\nconst className = cx('width-9', paddingRightClass);\n\ntype Props = {\n value: Mode;\n onChange: (value: Mode) => void;\n inputId?: string;\n};\n\nexport const OrderByTimeSection = ({ value, onChange, inputId }: Props): JSX.Element => {\n return (\n <>\n \n inputId={inputId}\n className={className}\n onChange={(v) => {\n onChange(unwrap(v.value));\n }}\n value={value}\n options={OPTIONS}\n />\n \n );\n};\n","import React from 'react';\n\nimport { SelectableValue } from '@grafana/data';\n\nimport { Seg } from './Seg';\nimport { unwrap } from './unwrap';\n\ntype Props = {\n loadOptions: () => Promise;\n allowCustomValue?: boolean;\n onAdd: (v: string) => void;\n};\n\nexport const AddButton = ({ loadOptions, allowCustomValue, onAdd }: Props): JSX.Element => {\n return (\n {\n onAdd(unwrap(v.value));\n }}\n />\n );\n};\n","import { cx, css } from '@emotion/css';\nimport React, { useMemo } from 'react';\n\nimport { SelectableValue, GrafanaTheme2 } from '@grafana/data';\nimport { MenuItem, WithContextMenu, MenuGroup, useTheme2 } from '@grafana/ui';\n\nimport { AddButton } from './AddButton';\nimport { Seg } from './Seg';\nimport { toSelectableValue } from './toSelectableValue';\nimport { unwrap } from './unwrap';\n\nexport type PartParams = Array<{\n value: string;\n options: (() => Promise) | null;\n}>;\n\ntype Props = {\n parts: Array<{\n name: string;\n params: PartParams;\n }>;\n getNewPartOptions: () => Promise;\n onChange: (partIndex: number, paramValues: string[]) => void;\n onRemovePart: (index: number) => void;\n onAddNewPart: (type: string) => void;\n};\n\nconst renderRemovableNameMenuItems = (onClick: () => void) => {\n return (\n \n \n \n );\n};\n\nconst noRightMarginPaddingClass = css({\n paddingRight: '0',\n marginRight: '0',\n});\n\nconst RemovableName = ({ name, onRemove }: { name: string; onRemove: () => void }) => {\n return (\n renderRemovableNameMenuItems(onRemove)}>\n {({ openMenu }) => (\n \n )}\n \n );\n};\n\ntype PartProps = {\n name: string;\n params: PartParams;\n onRemove: () => void;\n onChange: (paramValues: string[]) => void;\n};\n\nconst noHorizMarginPaddingClass = css({\n paddingLeft: '0',\n paddingRight: '0',\n marginLeft: '0',\n marginRight: '0',\n});\n\nconst getPartClass = (theme: GrafanaTheme2) => {\n return cx(\n 'gf-form-label',\n css({\n paddingLeft: '0',\n // gf-form-label class makes certain css attributes incorrect\n // for the selectbox-dropdown, so we have to \"reset\" them back\n lineHeight: theme.typography.body.lineHeight,\n fontSize: theme.typography.body.fontSize,\n })\n );\n};\n\nconst Part = ({ name, params, onChange, onRemove }: PartProps): JSX.Element => {\n const theme = useTheme2();\n const partClass = useMemo(() => getPartClass(theme), [theme]);\n\n const onParamChange = (par: string, i: number) => {\n const newParams = params.map((p) => p.value);\n newParams[i] = par;\n onChange(newParams);\n };\n return (\n
\n (\n {params.map((p, i) => {\n const { value, options } = p;\n const isLast = i === params.length - 1;\n const loadOptions =\n options !== null ? () => options().then((items) => items.map(toSelectableValue)) : undefined;\n return (\n \n {\n onParamChange(unwrap(v.value), i);\n }}\n />\n {!isLast && ','}\n \n );\n })}\n )\n
\n );\n};\n\nexport const PartListSection = ({\n parts,\n getNewPartOptions,\n onAddNewPart,\n onRemovePart,\n onChange,\n}: Props): JSX.Element => {\n return (\n <>\n {parts.map((part, index) => (\n {\n onRemovePart(index);\n }}\n onChange={(pars) => {\n onChange(index, pars);\n }}\n />\n ))}\n \n \n );\n};\n","import { InfluxQueryTag } from '../../types';\n\nfunction isRegex(text: string): boolean {\n return /^\\/.*\\/$/.test(text);\n}\n\n// FIXME: sync these to the query-string-generation-code\n// probably it's in influx_query_model.ts\nexport function getOperator(tag: InfluxQueryTag): string {\n return tag.operator ?? (isRegex(tag.value) ? '=~' : '=');\n}\n\n// FIXME: sync these to the query-string-generation-code\n// probably it's in influx_query_model.ts\nexport function getCondition(tag: InfluxQueryTag, isFirst: boolean): string | undefined {\n return isFirst ? undefined : tag.condition ?? 'AND';\n}\n\nexport function adjustOperatorIfNeeded(currentOperator: string, newTagValue: string): string {\n const isCurrentOperatorRegex = currentOperator === '=~' || currentOperator === '!~';\n const isNewTagValueRegex = isRegex(newTagValue);\n\n if (isNewTagValueRegex) {\n return isCurrentOperatorRegex ? currentOperator : '=~';\n } else {\n return isCurrentOperatorRegex ? '=' : currentOperator;\n }\n}\n","import React from 'react';\n\nimport { SelectableValue } from '@grafana/data';\n\nimport { InfluxQueryTag } from '../../types';\n\nimport { AddButton } from './AddButton';\nimport { Seg } from './Seg';\nimport { adjustOperatorIfNeeded, getCondition, getOperator } from './tagUtils';\nimport { toSelectableValue } from './toSelectableValue';\n\ntype KnownOperator = '=' | '!=' | '<>' | '<' | '>' | '=~' | '!~';\nconst knownOperators: KnownOperator[] = ['=', '!=', '<>', '<', '>', '=~', '!~'];\n\ntype KnownCondition = 'AND' | 'OR';\nconst knownConditions: KnownCondition[] = ['AND', 'OR'];\n\nconst operatorOptions: Array> = knownOperators.map(toSelectableValue);\nconst condititonOptions: Array> = knownConditions.map(toSelectableValue);\n\ntype Props = {\n tags: InfluxQueryTag[];\n onChange: (tags: InfluxQueryTag[]) => void;\n getTagKeyOptions: () => Promise;\n getTagValueOptions: (key: string) => Promise;\n};\n\ntype TagProps = {\n tag: InfluxQueryTag;\n isFirst: boolean;\n onRemove: () => void;\n onChange: (tag: InfluxQueryTag) => void;\n getTagKeyOptions: () => Promise;\n getTagValueOptions: (key: string) => Promise;\n};\n\nconst loadConditionOptions = () => Promise.resolve(condititonOptions);\n\nconst loadOperatorOptions = () => Promise.resolve(operatorOptions);\n\nconst Tag = ({ tag, isFirst, onRemove, onChange, getTagKeyOptions, getTagValueOptions }: TagProps): JSX.Element => {\n const operator = getOperator(tag);\n const condition = getCondition(tag, isFirst);\n\n const getTagKeySegmentOptions = () => {\n return getTagKeyOptions()\n .catch((err) => {\n // in this UI element we add a special item to the list of options,\n // that is used to remove the element.\n // this causes a problem: if `getTagKeyOptions` fails with an error,\n // the remove-filter option is never added to the list,\n // and the UI element can not be removed.\n // to avoid it, we catch any potential errors coming from `getTagKeyOptions`,\n // log the error, and pretend that the list of options is an empty list.\n // this way the remove-item option can always be added to the list.\n console.error(err);\n return [];\n })\n .then((tags) => [{ label: '-- remove filter --', value: undefined }, ...tags.map(toSelectableValue)]);\n };\n\n const getTagValueSegmentOptions = () => {\n return getTagValueOptions(tag.key).then((tags) => tags.map(toSelectableValue));\n };\n\n return (\n
\n {condition != null && (\n {\n onChange({ ...tag, condition: v.value });\n }}\n />\n )}\n {\n const { value } = v;\n if (value === undefined) {\n onRemove();\n } else {\n onChange({ ...tag, key: value ?? '' });\n }\n }}\n />\n {\n onChange({ ...tag, operator: op.value });\n }}\n />\n {\n const value = v.value ?? '';\n onChange({ ...tag, value, operator: adjustOperatorIfNeeded(operator, value) });\n }}\n />\n
\n );\n};\n\nexport const TagsSection = ({ tags, onChange, getTagKeyOptions, getTagValueOptions }: Props): JSX.Element => {\n const onTagChange = (newTag: InfluxQueryTag, index: number) => {\n const newTags = tags.map((tag, i) => {\n return index === i ? newTag : tag;\n });\n onChange(newTags);\n };\n\n const onTagRemove = (index: number) => {\n const newTags = tags.filter((t, i) => i !== index);\n onChange(newTags);\n };\n\n const getTagKeySegmentOptions = () => {\n return getTagKeyOptions().then((tags) => tags.map(toSelectableValue));\n };\n\n const addNewTag = (tagKey: string, isFirst: boolean) => {\n const minimalTag: InfluxQueryTag = {\n key: tagKey,\n value: 'select tag value',\n };\n\n const newTag: InfluxQueryTag = {\n key: minimalTag.key,\n value: minimalTag.value,\n operator: getOperator(minimalTag),\n condition: getCondition(minimalTag, isFirst),\n };\n\n onChange([...tags, newTag]);\n };\n\n return (\n <>\n {tags.map((t, i) => (\n {\n onTagChange(newT, i);\n }}\n onRemove={() => {\n onTagRemove(i);\n }}\n getTagKeyOptions={getTagKeyOptions}\n getTagValueOptions={getTagValueOptions}\n />\n ))}\n {\n addNewTag(v, tags.length === 0);\n }}\n />\n \n );\n};\n","import { SelectableValue } from '@grafana/data';\nimport { QueryPartDef } from 'app/features/alerting/state/query_part';\n\nimport InfluxQueryModel from '../../influx_query_model';\nimport queryPart from '../../query_part';\nimport { InfluxQuery, InfluxQueryPart } from '../../types';\n\nimport { PartParams } from './PartListSection';\nimport { toSelectableValue } from './toSelectableValue';\nimport { unwrap } from './unwrap';\n\ntype Categories = Record;\n\nexport function getNewSelectPartOptions(): SelectableValue[] {\n const categories: Categories = queryPart.getCategories();\n const options: SelectableValue[] = [];\n\n const keys = Object.keys(categories);\n\n keys.forEach((key) => {\n const children: SelectableValue[] = categories[key].map((x) => toSelectableValue(x.type));\n\n options.push({\n label: key,\n options: children,\n });\n });\n\n return options;\n}\n\nexport async function getNewGroupByPartOptions(\n query: InfluxQuery,\n getTagKeys: () => Promise\n): Promise>> {\n const tagKeys = await getTagKeys();\n const queryCopy = { ...query }; // the query-model mutates the query\n const model = new InfluxQueryModel(queryCopy);\n const options: Array> = [];\n if (!model.hasFill()) {\n options.push(toSelectableValue('fill(null)'));\n }\n if (!model.hasGroupByTime()) {\n options.push(toSelectableValue('time($interval)'));\n }\n tagKeys.forEach((key) => {\n options.push(toSelectableValue(`tag(${key})`));\n });\n return options;\n}\n\ntype Part = {\n name: string;\n params: PartParams;\n};\n\nfunction getPartParams(part: InfluxQueryPart, dynamicParamOptions: Map Promise>): PartParams {\n // NOTE: the way the system is constructed,\n // there always can only be one possible dynamic-lookup\n // field. in case of select it is the field,\n // in case of group-by it is the tag\n const def = queryPart.create(part).def;\n\n // we switch the numbers to strings, it will work that way too,\n // and it makes the code simpler\n const paramValues = (part.params ?? []).map((p) => p.toString());\n\n if (paramValues.length !== def.params.length) {\n throw new Error('Invalid query-segment');\n }\n\n return paramValues.map((val, index) => {\n const defParam = def.params[index];\n if (defParam.dynamicLookup) {\n return {\n value: val,\n options: unwrap(dynamicParamOptions.get(`${def.type}_${index}`)),\n };\n }\n\n if (defParam.options != null) {\n return {\n value: val,\n options: () => Promise.resolve(defParam.options),\n };\n }\n\n return {\n value: val,\n options: null,\n };\n });\n}\n\nexport function makePartList(\n queryParts: InfluxQueryPart[],\n dynamicParamOptions: Map Promise>\n): Part[] {\n return queryParts.map((qp) => {\n return {\n name: qp.type,\n params: getPartParams(qp, dynamicParamOptions),\n };\n });\n}\n","import { css } from '@emotion/css';\nimport React, { useMemo } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { getTemplateSrv } from '@grafana/runtime';\nimport { InlineLabel, SegmentSection, useStyles2 } from '@grafana/ui';\n\nimport InfluxDatasource from '../../datasource';\nimport {\n getAllMeasurementsForTags,\n getAllPolicies,\n getFieldKeysForMeasurement,\n getTagKeysForMeasurementAndTags,\n getTagValues,\n} from '../../influxQLMetadataQuery';\nimport {\n normalizeQuery,\n addNewSelectPart,\n removeSelectPart,\n addNewGroupByPart,\n removeGroupByPart,\n changeSelectPart,\n changeGroupByPart,\n} from '../../queryUtils';\nimport { InfluxQuery, InfluxQueryTag } from '../../types';\nimport { DEFAULT_RESULT_FORMAT } from '../constants';\nimport { useUniqueId } from '../useUniqueId';\n\nimport { FormatAsSection } from './FormatAsSection';\nimport { FromSection } from './FromSection';\nimport { InputSection } from './InputSection';\nimport { OrderByTimeSection } from './OrderByTimeSection';\nimport { PartListSection } from './PartListSection';\nimport { TagsSection } from './TagsSection';\nimport { getNewSelectPartOptions, getNewGroupByPartOptions, makePartList } from './partListUtils';\n\ntype Props = {\n query: InfluxQuery;\n onChange: (query: InfluxQuery) => void;\n onRunQuery: () => void;\n datasource: InfluxDatasource;\n};\n\nfunction getTemplateVariableOptions() {\n return (\n getTemplateSrv()\n .getVariables()\n // we make them regex-params, i'm not 100% sure why.\n // probably because this way multi-value variables work ok too.\n .map((v) => `/^$${v.name}$/`)\n );\n}\n\n// helper function to make it easy to call this from the widget-render-code\nfunction withTemplateVariableOptions(optionsPromise: Promise): Promise {\n return optionsPromise.then((options) => [...getTemplateVariableOptions(), ...options]);\n}\n\n// it is possible to add fields into the `InfluxQueryTag` structures, and they do work,\n// but in some cases, when we do metadata queries, we have to remove them from the queries.\nfunction filterTags(parts: InfluxQueryTag[], allTagKeys: Set): InfluxQueryTag[] {\n return parts.filter((t) => allTagKeys.has(t.key));\n}\n\nexport const Editor = (props: Props): JSX.Element => {\n const uniqueId = useUniqueId();\n const formatAsId = `influxdb-qe-format-as-${uniqueId}`;\n const orderByTimeId = `influxdb-qe-order-by${uniqueId}`;\n\n const styles = useStyles2(getStyles);\n const query = normalizeQuery(props.query);\n const { datasource } = props;\n const { measurement, policy } = query;\n\n const allTagKeys = useMemo(() => {\n return getTagKeysForMeasurementAndTags(measurement, policy, [], datasource).then((tags) => {\n return new Set(tags);\n });\n }, [measurement, policy, datasource]);\n\n const selectLists = useMemo(() => {\n const dynamicSelectPartOptions = new Map([\n [\n 'field_0',\n () => {\n return measurement !== undefined\n ? getFieldKeysForMeasurement(measurement, policy, datasource)\n : Promise.resolve([]);\n },\n ],\n ]);\n return (query.select ?? []).map((sel) => makePartList(sel, dynamicSelectPartOptions));\n }, [measurement, policy, query.select, datasource]);\n\n // the following function is not complicated enough to memoize, but it's result\n // is used in both memoized and un-memoized parts, so we have no choice\n const getTagKeys = useMemo(() => {\n return () =>\n allTagKeys.then((keys) =>\n getTagKeysForMeasurementAndTags(measurement, policy, filterTags(query.tags ?? [], keys), datasource)\n );\n }, [measurement, policy, query.tags, datasource, allTagKeys]);\n\n const groupByList = useMemo(() => {\n const dynamicGroupByPartOptions = new Map([['tag_0', getTagKeys]]);\n\n return makePartList(query.groupBy ?? [], dynamicGroupByPartOptions);\n }, [getTagKeys, query.groupBy]);\n\n const onAppliedChange = (newQuery: InfluxQuery) => {\n props.onChange(newQuery);\n props.onRunQuery();\n };\n const handleFromSectionChange = (p: string | undefined, m: string | undefined) => {\n onAppliedChange({\n ...query,\n policy: p,\n measurement: m,\n });\n };\n\n const handleTagsSectionChange = (tags: InfluxQueryTag[]) => {\n // we set empty-arrays to undefined\n onAppliedChange({\n ...query,\n tags: tags.length === 0 ? undefined : tags,\n });\n };\n\n return (\n
\n \n getAllPolicies(datasource)}\n getMeasurementOptions={(filter) =>\n withTemplateVariableOptions(\n allTagKeys.then((keys) =>\n getAllMeasurementsForTags(\n filter === '' ? undefined : filter,\n filterTags(query.tags ?? [], keys),\n datasource\n )\n )\n )\n }\n onChange={handleFromSectionChange}\n />\n \n WHERE\n \n \n withTemplateVariableOptions(\n allTagKeys.then((keys) =>\n getTagValues(key, measurement, policy, filterTags(query.tags ?? [], keys), datasource)\n )\n )\n }\n />\n \n {selectLists.map((sel, index) => (\n \n Promise.resolve(getNewSelectPartOptions())}\n onChange={(partIndex, newParams) => {\n const newQuery = changeSelectPart(query, index, partIndex, newParams);\n onAppliedChange(newQuery);\n }}\n onAddNewPart={(type) => {\n onAppliedChange(addNewSelectPart(query, type, index));\n }}\n onRemovePart={(partIndex) => {\n onAppliedChange(removeSelectPart(query, partIndex, index));\n }}\n />\n \n ))}\n \n getNewGroupByPartOptions(query, getTagKeys)}\n onChange={(partIndex, newParams) => {\n const newQuery = changeGroupByPart(query, partIndex, newParams);\n onAppliedChange(newQuery);\n }}\n onAddNewPart={(type) => {\n onAppliedChange(addNewGroupByPart(query, type));\n }}\n onRemovePart={(partIndex) => {\n onAppliedChange(removeGroupByPart(query, partIndex));\n }}\n />\n \n \n {\n onAppliedChange({ ...query, tz });\n }}\n />\n \n ORDER BY TIME\n \n {\n onAppliedChange({ ...query, orderByTime: v });\n }}\n />\n \n {/* query.fill is ignored in the query-editor, and it is deleted whenever\n query-editor changes. the influx_query_model still handles it, but the new\n approach seem to be to handle \"fill\" inside query.groupBy. so, if you\n have a panel where in the json you have query.fill, it will be applied,\n as long as you do not edit that query. */}\n \n {\n onAppliedChange({ ...query, limit });\n }}\n />\n \n SLIMIT\n \n {\n onAppliedChange({ ...query, slimit });\n }}\n />\n \n \n {\n onAppliedChange({ ...query, resultFormat: format });\n }}\n />\n {query.resultFormat !== 'table' && (\n <>\n \n ALIAS\n \n {\n onAppliedChange({ ...query, alias });\n }}\n />\n \n )}\n \n
\n );\n};\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n inlineLabel: css`\n color: ${theme.colors.primary.text};\n `,\n };\n}\n","import React, { PureComponent } from 'react';\n\nimport { InlineFormLabel, TextArea } from '@grafana/ui';\n\nimport InfluxDatasource from '../datasource';\n\nimport { FluxQueryEditor } from './FluxQueryEditor';\n\ninterface Props {\n query: string; // before flux, it was always a string\n onChange: (query?: string) => void;\n datasource: InfluxDatasource;\n}\n\nexport default class VariableQueryEditor extends PureComponent {\n onRefresh = () => {\n // noop\n };\n\n render() {\n let { query, datasource, onChange } = this.props;\n if (datasource.isFlux) {\n return (\n onChange(v.query)}\n />\n );\n }\n\n return (\n
\n Query\n
\n onChange(e.currentTarget.value)}\n />\n
\n
\n );\n }\n}\n","import { each, map, includes, flatten, keys } from 'lodash';\n\nimport { FieldType, QueryResultMeta, TimeSeries, TableData } from '@grafana/data';\nimport TableModel from 'app/core/table_model';\n\nexport default class InfluxSeries {\n refId?: string;\n series: any;\n alias: any;\n annotation: any;\n meta?: QueryResultMeta;\n\n constructor(options: { series: any; alias?: any; annotation?: any; meta?: QueryResultMeta; refId?: string }) {\n this.series = options.series;\n this.alias = options.alias;\n this.annotation = options.annotation;\n this.meta = options.meta;\n this.refId = options.refId;\n }\n\n getTimeSeries(): TimeSeries[] {\n const output: TimeSeries[] = [];\n let i, j;\n\n if (this.series.length === 0) {\n return output;\n }\n\n each(this.series, (series) => {\n const columns = series.columns.length;\n const tags = map(series.tags, (value, key) => {\n return key + ': ' + value;\n });\n\n for (j = 1; j < columns; j++) {\n let seriesName = series.name;\n const columnName = series.columns[j];\n if (columnName !== 'value') {\n seriesName = seriesName + '.' + columnName;\n }\n\n if (this.alias) {\n seriesName = this._getSeriesName(series, j);\n } else if (series.tags) {\n seriesName = seriesName + ' {' + tags.join(', ') + '}';\n }\n\n const datapoints = [];\n if (series.values) {\n for (i = 0; i < series.values.length; i++) {\n datapoints[i] = [series.values[i][j], series.values[i][0]];\n }\n }\n\n output.push({\n title: seriesName,\n target: seriesName,\n datapoints: datapoints,\n tags: series.tags,\n meta: this.meta,\n refId: this.refId,\n });\n }\n });\n\n return output;\n }\n\n _getSeriesName(series: any, index: number) {\n const regex = /\\$(\\w+)|\\[\\[([\\s\\S]+?)\\]\\]/g;\n const segments = series.name.split('.');\n\n return this.alias.replace(regex, (match: any, g1: any, g2: any) => {\n const group = g1 || g2;\n const segIndex = parseInt(group, 10);\n\n if (group === 'm' || group === 'measurement') {\n return series.name;\n }\n if (group === 'col') {\n return series.columns[index];\n }\n if (!isNaN(segIndex)) {\n return segments[segIndex] ?? match;\n }\n if (group.indexOf('tag_') !== 0) {\n return match;\n }\n\n const tag = group.replace('tag_', '');\n if (!series.tags) {\n return match;\n }\n return series.tags[tag];\n });\n }\n\n getAnnotations() {\n const list: any[] = [];\n\n each(this.series, (series) => {\n let titleCol: any = null;\n let timeCol: any = null;\n let timeEndCol: any = null;\n const tagsCol: any = [];\n let textCol: any = null;\n\n each(series.columns, (column, index) => {\n if (column === 'time') {\n timeCol = index;\n return;\n }\n if (column === 'sequence_number') {\n return;\n }\n if (column === this.annotation.titleColumn) {\n titleCol = index;\n return;\n }\n if (includes((this.annotation.tagsColumn || '').replace(' ', '').split(','), column)) {\n tagsCol.push(index);\n return;\n }\n if (column === this.annotation.textColumn) {\n textCol = index;\n return;\n }\n if (column === this.annotation.timeEndColumn) {\n timeEndCol = index;\n return;\n }\n // legacy case\n if (!titleCol && textCol !== index) {\n titleCol = index;\n }\n });\n\n each(series.values, (value) => {\n const data = {\n annotation: this.annotation,\n time: +new Date(value[timeCol]),\n title: value[titleCol],\n timeEnd: value[timeEndCol],\n // Remove empty values, then split in different tags for comma separated values\n tags: flatten(\n tagsCol\n .filter((t: any) => {\n return value[t];\n })\n .map((t: any) => {\n return value[t].split(',');\n })\n ),\n text: value[textCol],\n };\n\n list.push(data);\n });\n });\n\n return list;\n }\n\n getTable(): TableData {\n const table = new TableModel();\n let i, j;\n\n table.refId = this.refId;\n table.meta = this.meta;\n\n if (this.series.length === 0) {\n return table;\n }\n\n // the order is:\n // - first the first item from the value-array (this is often (always?) the timestamp)\n // - then all the tag-values\n // - then the rest of the value-array\n //\n // we have to keep this order both in table.columns and table.rows\n\n each(this.series, (series: any, seriesIndex: number) => {\n if (seriesIndex === 0) {\n const firstCol = series.columns[0];\n // Check the first column's name, if it is `time`, we\n // mark it as having the type time\n const firstTableCol = firstCol === 'time' ? { text: 'Time', type: FieldType.time } : { text: firstCol };\n table.columns.push(firstTableCol);\n each(keys(series.tags), (key) => {\n table.columns.push({ text: key });\n });\n for (j = 1; j < series.columns.length; j++) {\n table.columns.push({ text: series.columns[j] });\n }\n }\n\n if (series.values) {\n for (i = 0; i < series.values.length; i++) {\n const values = series.values[i];\n const reordered = [values[0]];\n if (series.tags) {\n for (const key in series.tags) {\n if (series.tags.hasOwnProperty(key)) {\n reordered.push(series.tags[key]);\n }\n }\n }\n for (j = 1; j < values.length; j++) {\n reordered.push(values[j]);\n }\n table.rows.push(reordered);\n }\n }\n });\n\n return table;\n }\n}\n","import { each, flatten, groupBy, isArray } from 'lodash';\n\nimport { AnnotationEvent, DataFrame, DataQuery, FieldType, QueryResultMeta } from '@grafana/data';\nimport { toDataQueryResponse } from '@grafana/runtime';\nimport TableModel from 'app/core/table_model';\n\nimport { InfluxQuery } from './types';\n\nexport default class ResponseParser {\n parse(query: string, results: { results: any }) {\n if (!results?.results || results.results.length === 0) {\n return [];\n }\n\n const influxResults = results.results[0];\n if (!influxResults.series) {\n return [];\n }\n\n const normalizedQuery = query.toLowerCase();\n const isValueFirst =\n normalizedQuery.indexOf('show field keys') >= 0 || normalizedQuery.indexOf('show retention policies') >= 0;\n\n const res = new Set();\n each(influxResults.series, (serie) => {\n each(serie.values, (value) => {\n if (isArray(value)) {\n // In general, there are 2 possible shapes for the returned value.\n // The first one is a two-element array,\n // where the first element is somewhat a metadata value:\n // the tag name for SHOW TAG VALUES queries,\n // the time field for SELECT queries, etc.\n // The second shape is an one-element array,\n // that is containing an immediate value.\n // For example, SHOW FIELD KEYS queries return such shape.\n // Note, pre-0.11 versions return\n // the second shape for SHOW TAG VALUES queries\n // (while the newer versions—first).\n\n if (isValueFirst) {\n addUnique(res, value[0]);\n } else if (value[1] !== undefined) {\n addUnique(res, value[1]);\n } else {\n addUnique(res, value[0]);\n }\n } else {\n addUnique(res, value);\n }\n });\n });\n\n // NOTE: it is important to keep the order of items in the parsed output\n // the same as it was in the influxdb-response.\n // we use a `Set` to collect the unique-results, and `Set` iteration\n // order is insertion-order, so this should be ok.\n return Array.from(res).map((v) => ({ text: v }));\n }\n\n getTable(dfs: DataFrame[], target: InfluxQuery, meta: QueryResultMeta): TableModel {\n let table = new TableModel();\n\n if (dfs.length > 0) {\n table.meta = {\n ...meta,\n executedQueryString: dfs[0].meta?.executedQueryString,\n };\n\n table.refId = target.refId;\n table = getTableCols(dfs, table, target);\n\n // if group by tag(s) added\n if (dfs[0].fields[1] && dfs[0].fields[1].labels) {\n let dfsByLabels: any = groupBy(dfs, (df: DataFrame) =>\n df.fields[1].labels ? Object.values(df.fields[1].labels!) : null\n );\n const labels = Object.keys(dfsByLabels);\n dfsByLabels = Object.values(dfsByLabels);\n\n for (let i = 0; i < dfsByLabels.length; i++) {\n table = getTableRows(dfsByLabels[i], table, [...labels[i].split(',')]);\n }\n } else {\n table = getTableRows(dfs, table, []);\n }\n }\n\n return table;\n }\n\n async transformAnnotationResponse(options: any, data: any, target: InfluxQuery): Promise {\n const rsp = toDataQueryResponse(data, [target] as DataQuery[]);\n\n if (rsp) {\n const table = this.getTable(rsp.data, target, {});\n const list: any[] = [];\n let titleCol: any = null;\n let timeCol: any = null;\n let timeEndCol: any = null;\n const tagsCol: any = [];\n let textCol: any = null;\n\n each(table.columns, (column, index) => {\n if (column.text.toLowerCase() === 'time') {\n timeCol = index;\n return;\n }\n if (column.text === options.annotation.titleColumn) {\n titleCol = index;\n return;\n }\n if (colContainsTag(column.text, options.annotation.tagsColumn)) {\n tagsCol.push(index);\n return;\n }\n if (column.text.includes(options.annotation.textColumn)) {\n textCol = index;\n return;\n }\n if (column.text === options.annotation.timeEndColumn) {\n timeEndCol = index;\n return;\n }\n // legacy case\n if (!titleCol && textCol !== index) {\n titleCol = index;\n }\n });\n\n each(table.rows, (value) => {\n const data = {\n annotation: options.annotation,\n time: +new Date(value[timeCol]),\n title: value[titleCol],\n timeEnd: value[timeEndCol],\n // Remove empty values, then split in different tags for comma separated values\n tags: flatten(\n tagsCol\n .filter((t: any) => {\n return value[t];\n })\n .map((t: any) => {\n return value[t].split(',');\n })\n ),\n text: value[textCol],\n };\n\n list.push(data);\n });\n\n return list;\n }\n return [];\n }\n}\n\nfunction colContainsTag(colText: string, tagsColumn: string): boolean {\n const tags = (tagsColumn || '').replace(' ', '').split(',');\n for (var tag of tags) {\n if (colText.includes(tag)) {\n return true;\n }\n }\n return false;\n}\n\nfunction getTableCols(dfs: DataFrame[], table: TableModel, target: InfluxQuery): TableModel {\n const selectedParams = getSelectedParams(target);\n\n dfs[0].fields.forEach((field) => {\n // Time col\n if (field.name === 'time') {\n table.columns.push({ text: 'Time', type: FieldType.time });\n }\n\n // Group by (label) column(s)\n else if (field.name === 'value') {\n if (field.labels) {\n Object.keys(field.labels).forEach((key) => {\n table.columns.push({ text: key });\n });\n }\n }\n });\n\n // Get cols for annotationQuery\n if (dfs[0].refId === 'metricFindQuery') {\n dfs.forEach((field) => {\n if (field.name) {\n table.columns.push({ text: field.name });\n }\n });\n }\n\n // Select (metric) column(s)\n for (let i = 0; i < selectedParams.length; i++) {\n table.columns.push({ text: selectedParams[i] });\n }\n\n return table;\n}\n\nfunction getTableRows(dfs: DataFrame[], table: TableModel, labels: string[]): TableModel {\n const values = dfs[0].fields[0].values.toArray();\n\n for (let i = 0; i < values.length; i++) {\n const time = values[i];\n const metrics = dfs.map((df: DataFrame) => {\n return df.fields[1] ? df.fields[1].values.toArray()[i] : null;\n });\n if (metrics.indexOf(null) < 0) {\n table.rows.push([time, ...labels, ...metrics]);\n }\n }\n return table;\n}\n\nexport function getSelectedParams(target: InfluxQuery): string[] {\n let allParams: string[] = [];\n target.select?.forEach((select) => {\n const selector = select.filter((x) => x.type !== 'field');\n if (selector.length > 0) {\n allParams.push(selector[0].type);\n } else {\n if (select[0] && select[0].params && select[0].params[0]) {\n allParams.push(select[0].params[0].toString());\n }\n }\n });\n\n let uniqueParams: string[] = [];\n allParams.forEach((param) => {\n uniqueParams.push(incrementName(param, param, uniqueParams, 0));\n });\n\n return uniqueParams;\n}\n\nfunction incrementName(name: string, nameIncremenet: string, params: string[], index: number): string {\n if (params.indexOf(nameIncremenet) > -1) {\n index++;\n return incrementName(name, name + '_' + index, params, index);\n }\n return nameIncremenet;\n}\n\nfunction addUnique(s: Set, value: string | number) {\n s.add(value.toString());\n}\n","import { cloneDeep, extend, groupBy, has, isString, map as _map, omit, pick, reduce } from 'lodash';\nimport { lastValueFrom, Observable, of, throwError } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\nimport {\n AnnotationEvent,\n AnnotationQueryRequest,\n ArrayVector,\n DataFrame,\n DataQueryError,\n DataQueryRequest,\n DataQueryResponse,\n DataSourceInstanceSettings,\n dateMath,\n FieldType,\n MetricFindValue,\n QueryResultMeta,\n ScopedVars,\n TIME_SERIES_TIME_FIELD_NAME,\n TIME_SERIES_VALUE_FIELD_NAME,\n TimeSeries,\n} from '@grafana/data';\nimport {\n BackendDataSourceResponse,\n DataSourceWithBackend,\n FetchResponse,\n frameToMetricFindValue,\n getBackendSrv,\n} from '@grafana/runtime';\nimport config from 'app/core/config';\nimport { getTemplateSrv, TemplateSrv } from 'app/features/templating/template_srv';\n\nimport { FluxQueryEditor } from './components/FluxQueryEditor';\nimport InfluxQueryModel from './influx_query_model';\nimport InfluxSeries from './influx_series';\nimport { buildRawQuery } from './queryUtils';\nimport { InfluxQueryBuilder } from './query_builder';\nimport ResponseParser from './response_parser';\nimport { InfluxOptions, InfluxQuery, InfluxVersion } from './types';\n\n// we detect the field type based on the value-array\nfunction getFieldType(values: unknown[]): FieldType {\n // the values-array may contain a lot of nulls.\n // we need the first not-null item\n const firstNotNull = values.find((v) => v !== null);\n\n if (firstNotNull === undefined) {\n // we could not find any not-null values\n return FieldType.number;\n }\n\n const valueType = typeof firstNotNull;\n\n switch (valueType) {\n case 'string':\n return FieldType.string;\n case 'boolean':\n return FieldType.boolean;\n case 'number':\n return FieldType.number;\n default:\n // this should never happen, influxql values\n // can only be numbers, strings and booleans.\n throw new Error(`InfluxQL: invalid value type ${valueType}`);\n }\n}\n\n// this conversion function is specialized to work with the timeseries\n// data returned by InfluxDatasource.getTimeSeries()\nfunction timeSeriesToDataFrame(timeSeries: TimeSeries): DataFrame {\n const times: number[] = [];\n const values: unknown[] = [];\n\n // the data we process here is not correctly typed.\n // the typescript types say every data-point is number|null,\n // but in fact it can be string or boolean too.\n\n const points = timeSeries.datapoints;\n for (const point of points) {\n values.push(point[0]);\n times.push(point[1] as number);\n }\n\n const timeField = {\n name: TIME_SERIES_TIME_FIELD_NAME,\n type: FieldType.time,\n config: {},\n values: new ArrayVector(times),\n };\n\n const valueField = {\n name: TIME_SERIES_VALUE_FIELD_NAME,\n type: getFieldType(values),\n config: {\n displayNameFromDS: timeSeries.title,\n },\n values: new ArrayVector(values),\n labels: timeSeries.tags,\n };\n\n const fields = [timeField, valueField];\n\n return {\n name: timeSeries.target,\n refId: timeSeries.refId,\n meta: timeSeries.meta,\n fields,\n length: values.length,\n };\n}\n\nexport default class InfluxDatasource extends DataSourceWithBackend {\n type: string;\n urls: string[];\n username: string;\n password: string;\n name: string;\n database: any;\n basicAuth: any;\n withCredentials: any;\n access: 'direct' | 'proxy';\n interval: any;\n responseParser: any;\n httpMode: string;\n isFlux: boolean;\n\n constructor(\n instanceSettings: DataSourceInstanceSettings,\n private readonly templateSrv: TemplateSrv = getTemplateSrv()\n ) {\n super(instanceSettings);\n\n this.type = 'influxdb';\n this.urls = (instanceSettings.url ?? '').split(',').map((url) => {\n return url.trim();\n });\n\n this.username = instanceSettings.username ?? '';\n this.password = instanceSettings.password ?? '';\n this.name = instanceSettings.name;\n this.database = instanceSettings.database;\n this.basicAuth = instanceSettings.basicAuth;\n this.withCredentials = instanceSettings.withCredentials;\n this.access = instanceSettings.access;\n const settingsData = instanceSettings.jsonData || ({} as InfluxOptions);\n this.interval = settingsData.timeInterval;\n this.httpMode = settingsData.httpMode || 'GET';\n this.responseParser = new ResponseParser();\n this.isFlux = settingsData.version === InfluxVersion.Flux;\n\n if (this.isFlux) {\n // When flux, use an annotation processor rather than the `annotationQuery` lifecycle\n this.annotations = {\n QueryEditor: FluxQueryEditor,\n };\n }\n }\n\n query(request: DataQueryRequest): Observable {\n // for not-flux queries we call `this.classicQuery`, and that\n // handles the is-hidden situation.\n // for the flux-case, we do the filtering here\n const filteredRequest = {\n ...request,\n targets: request.targets.filter((t) => t.hide !== true),\n };\n\n if (this.isFlux) {\n return super.query(filteredRequest);\n }\n\n if (this.isMigrationToggleOnAndIsAccessProxy()) {\n return super.query(filteredRequest).pipe(\n map((res) => {\n if (res.error) {\n throw {\n message: 'InfluxDB Error: ' + res.error.message,\n res,\n };\n }\n\n const seriesList: any[] = [];\n\n const groupedFrames = groupBy(res.data, (x) => x.refId);\n if (Object.keys(groupedFrames).length > 0) {\n filteredRequest.targets.forEach((target) => {\n const filteredFrames = groupedFrames[target.refId] ?? [];\n switch (target.resultFormat) {\n case 'logs':\n case 'table':\n seriesList.push(\n this.responseParser.getTable(filteredFrames, target, {\n preferredVisualisationType: target.resultFormat,\n })\n );\n break;\n default: {\n for (let i = 0; i < filteredFrames.length; i++) {\n seriesList.push(filteredFrames[i]);\n }\n break;\n }\n }\n });\n }\n\n return { data: seriesList };\n })\n );\n }\n\n // Fallback to classic query support\n return this.classicQuery(request);\n }\n\n getQueryDisplayText(query: InfluxQuery) {\n if (this.isFlux) {\n return query.query;\n }\n return new InfluxQueryModel(query).render(false);\n }\n\n /**\n * Returns false if the query should be skipped\n */\n filterQuery(query: InfluxQuery): boolean {\n if (this.isFlux) {\n return !!query.query;\n }\n return true;\n }\n\n applyTemplateVariables(query: InfluxQuery, scopedVars: ScopedVars): Record {\n // We want to interpolate these variables on backend\n const { __interval, __interval_ms, ...rest } = scopedVars;\n\n if (this.isFlux) {\n return {\n ...query,\n query: this.templateSrv.replace(query.query ?? '', rest), // The raw query text\n };\n }\n\n if (config.featureToggles.influxdbBackendMigration && this.access === 'proxy') {\n query = this.applyVariables(query, scopedVars, rest);\n }\n\n return query;\n }\n\n /**\n * The unchanged pre 7.1 query implementation\n */\n classicQuery(options: any): Observable {\n let timeFilter = this.getTimeFilter(options);\n const scopedVars = options.scopedVars;\n const targets = cloneDeep(options.targets);\n const queryTargets: any[] = [];\n\n let i, y;\n\n let allQueries = _map(targets, (target) => {\n if (target.hide) {\n return '';\n }\n\n queryTargets.push(target);\n\n // backward compatibility\n scopedVars.interval = scopedVars.__interval;\n\n return new InfluxQueryModel(target, this.templateSrv, scopedVars).render(true);\n }).reduce((acc, current) => {\n if (current !== '') {\n acc += ';' + current;\n }\n return acc;\n });\n\n if (allQueries === '') {\n return of({ data: [] });\n }\n\n // add global adhoc filters to timeFilter\n const adhocFilters = this.templateSrv.getAdhocFilters(this.name);\n if (adhocFilters.length > 0) {\n const tmpQuery = new InfluxQueryModel({ refId: 'A' }, this.templateSrv, scopedVars);\n timeFilter += ' AND ' + tmpQuery.renderAdhocFilters(adhocFilters);\n }\n\n // replace grafana variables\n scopedVars.timeFilter = { value: timeFilter };\n\n // replace templated variables\n allQueries = this.templateSrv.replace(allQueries, scopedVars);\n\n return this._seriesQuery(allQueries, options).pipe(\n map((data: any) => {\n if (!data || !data.results) {\n return { data: [] };\n }\n\n const seriesList = [];\n for (i = 0; i < data.results.length; i++) {\n const result = data.results[i];\n if (!result || !result.series) {\n continue;\n }\n\n const target = queryTargets[i];\n let alias = target.alias;\n if (alias) {\n alias = this.templateSrv.replace(target.alias, options.scopedVars);\n }\n\n const meta: QueryResultMeta = {\n executedQueryString: data.executedQueryString,\n };\n\n const influxSeries = new InfluxSeries({\n refId: target.refId,\n series: data.results[i].series,\n alias: alias,\n meta,\n });\n\n switch (target.resultFormat) {\n case 'logs':\n meta.preferredVisualisationType = 'logs';\n case 'table': {\n seriesList.push(influxSeries.getTable());\n break;\n }\n default: {\n const timeSeries = influxSeries.getTimeSeries();\n for (y = 0; y < timeSeries.length; y++) {\n seriesList.push(timeSeriesToDataFrame(timeSeries[y]));\n }\n break;\n }\n }\n }\n\n return { data: seriesList };\n })\n );\n }\n\n async annotationQuery(options: AnnotationQueryRequest): Promise {\n if (this.isFlux) {\n return Promise.reject({\n message: 'Flux requires the standard annotation query',\n });\n }\n\n // InfluxQL puts a query string on the annotation\n if (!options.annotation.query) {\n return Promise.reject({\n message: 'Query missing in annotation definition',\n });\n }\n\n if (config.featureToggles.influxdbBackendMigration && this.access === 'proxy') {\n // We want to send our query to the backend as a raw query\n const target: InfluxQuery = {\n refId: 'metricFindQuery',\n datasource: this.getRef(),\n query: this.templateSrv.replace(options.annotation.query ?? '', undefined, 'regex'),\n rawQuery: true,\n };\n\n return lastValueFrom(\n getBackendSrv()\n .fetch({\n url: '/api/ds/query',\n method: 'POST',\n data: {\n from: options.range.from.valueOf().toString(),\n to: options.range.to.valueOf().toString(),\n queries: [target],\n },\n requestId: options.annotation.name,\n })\n .pipe(\n map(\n async (res: FetchResponse) =>\n await this.responseParser.transformAnnotationResponse(options, res, target)\n )\n )\n );\n }\n\n const timeFilter = this.getTimeFilter({ rangeRaw: options.rangeRaw, timezone: options.dashboard.timezone });\n let query = options.annotation.query.replace('$timeFilter', timeFilter);\n query = this.templateSrv.replace(query, undefined, 'regex');\n\n return lastValueFrom(this._seriesQuery(query, options)).then((data: any) => {\n if (!data || !data.results || !data.results[0]) {\n throw { message: 'No results in response from InfluxDB' };\n }\n return new InfluxSeries({\n series: data.results[0].series,\n annotation: options.annotation,\n }).getAnnotations();\n });\n }\n\n targetContainsTemplate(target: any) {\n // for flux-mode we just take target.query,\n // for influxql-mode we use InfluxQueryModel to create the text-representation\n const queryText = this.isFlux ? target.query : buildRawQuery(target);\n\n return this.templateSrv.containsTemplate(queryText);\n }\n\n interpolateVariablesInQueries(queries: InfluxQuery[], scopedVars: ScopedVars): InfluxQuery[] {\n if (!queries || queries.length === 0) {\n return [];\n }\n\n return queries.map((query) => {\n if (this.isFlux) {\n return {\n ...query,\n datasource: this.getRef(),\n query: this.templateSrv.replace(query.query ?? '', scopedVars, 'regex'), // The raw query text\n };\n }\n\n return {\n ...query,\n datasource: this.getRef(),\n ...this.applyVariables(query, scopedVars, scopedVars),\n };\n });\n }\n\n applyVariables(query: InfluxQuery, scopedVars: ScopedVars, rest: ScopedVars) {\n const expandedQuery = { ...query };\n if (query.groupBy) {\n expandedQuery.groupBy = query.groupBy.map((groupBy) => {\n return {\n ...groupBy,\n params: groupBy.params?.map((param) => {\n return this.templateSrv.replace(param.toString(), undefined, 'regex');\n }),\n };\n });\n }\n\n if (query.select) {\n expandedQuery.select = query.select.map((selects) => {\n return selects.map((select: any) => {\n return {\n ...select,\n params: select.params?.map((param: any) => {\n return this.templateSrv.replace(param.toString(), undefined, 'regex');\n }),\n };\n });\n });\n }\n\n if (query.tags) {\n expandedQuery.tags = query.tags.map((tag) => {\n return {\n ...tag,\n value: this.templateSrv.replace(tag.value, scopedVars, 'regex'),\n };\n });\n }\n\n return {\n ...expandedQuery,\n query: this.templateSrv.replace(query.query ?? '', rest, 'regex'), // The raw query text\n alias: this.templateSrv.replace(query.alias ?? '', scopedVars),\n limit: this.templateSrv.replace(query.limit?.toString() ?? '', scopedVars, 'regex'),\n measurement: this.templateSrv.replace(query.measurement ?? '', scopedVars, 'regex'),\n policy: this.templateSrv.replace(query.policy ?? '', scopedVars, 'regex'),\n slimit: this.templateSrv.replace(query.slimit?.toString() ?? '', scopedVars, 'regex'),\n tz: this.templateSrv.replace(query.tz ?? '', scopedVars),\n };\n }\n\n async metricFindQuery(query: string, options?: any): Promise {\n if (this.isFlux || this.isMigrationToggleOnAndIsAccessProxy()) {\n const target: InfluxQuery = {\n refId: 'metricFindQuery',\n query,\n rawQuery: true,\n };\n return lastValueFrom(\n super.query({\n ...options, // includes 'range'\n targets: [target],\n } as DataQueryRequest)\n ).then((rsp) => {\n if (rsp.data?.length) {\n return frameToMetricFindValue(rsp.data[0]);\n }\n return [];\n });\n }\n\n const interpolated = this.templateSrv.replace(query, undefined, 'regex');\n\n return lastValueFrom(this._seriesQuery(interpolated, options)).then((resp) => {\n return this.responseParser.parse(query, resp);\n });\n }\n\n getTagKeys(options: any = {}) {\n const queryBuilder = new InfluxQueryBuilder({ measurement: options.measurement || '', tags: [] }, this.database);\n const query = queryBuilder.buildExploreQuery('TAG_KEYS');\n return this.metricFindQuery(query, options);\n }\n\n getTagValues(options: any = {}) {\n const queryBuilder = new InfluxQueryBuilder({ measurement: options.measurement || '', tags: [] }, this.database);\n const query = queryBuilder.buildExploreQuery('TAG_VALUES', options.key);\n return this.metricFindQuery(query, options);\n }\n\n _seriesQuery(query: string, options?: any) {\n if (!query) {\n return of({ results: [] });\n }\n\n if (options && options.range) {\n const timeFilter = this.getTimeFilter({ rangeRaw: options.range, timezone: options.timezone });\n query = query.replace('$timeFilter', timeFilter);\n }\n\n return this._influxRequest(this.httpMode, '/query', { q: query, epoch: 'ms' }, options);\n }\n\n serializeParams(params: any) {\n if (!params) {\n return '';\n }\n\n return reduce(\n params,\n (memo, value, key) => {\n if (value === null || value === undefined) {\n return memo;\n }\n memo.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n return memo;\n },\n [] as string[]\n ).join('&');\n }\n\n _influxRequest(method: string, url: string, data: any, options?: any) {\n const currentUrl = this.urls.shift()!;\n this.urls.push(currentUrl);\n\n const params: any = {};\n\n if (this.username) {\n params.u = this.username;\n params.p = this.password;\n }\n\n if (options && options.database) {\n params.db = options.database;\n } else if (this.database) {\n params.db = this.database;\n }\n\n const { q } = data;\n\n if (method === 'POST' && has(data, 'q')) {\n // verb is POST and 'q' param is defined\n extend(params, omit(data, ['q']));\n data = this.serializeParams(pick(data, ['q']));\n } else if (method === 'GET' || method === 'POST') {\n // verb is GET, or POST without 'q' param\n extend(params, data);\n data = null;\n }\n\n const req: any = {\n method: method,\n url: currentUrl + url,\n params: params,\n data: data,\n precision: 'ms',\n inspect: { type: 'influxdb' },\n paramSerializer: this.serializeParams,\n };\n\n req.headers = req.headers || {};\n if (this.basicAuth || this.withCredentials) {\n req.withCredentials = true;\n }\n if (this.basicAuth) {\n req.headers.Authorization = this.basicAuth;\n }\n\n if (method === 'POST') {\n req.headers['Content-type'] = 'application/x-www-form-urlencoded';\n }\n\n return getBackendSrv()\n .fetch(req)\n .pipe(\n map((result: any) => {\n const { data } = result;\n if (data) {\n data.executedQueryString = q;\n if (data.results) {\n const errors = result.data.results.filter((elem: any) => elem.error);\n\n if (errors.length > 0) {\n throw {\n message: 'InfluxDB Error: ' + errors[0].error,\n data,\n };\n }\n }\n }\n return data;\n }),\n catchError((err) => {\n if (err.cancelled) {\n return of(err);\n }\n\n return throwError(this.handleErrors(err));\n })\n );\n }\n\n handleErrors(err: any) {\n const error: DataQueryError = {\n message:\n (err && err.status) ||\n (err && err.message) ||\n 'Unknown error during query transaction. Please check JS console logs.',\n };\n\n if ((Number.isInteger(err.status) && err.status !== 0) || err.status >= 300) {\n if (err.data && err.data.error) {\n error.message = 'InfluxDB Error: ' + err.data.error;\n error.data = err.data;\n // @ts-ignore\n error.config = err.config;\n } else {\n error.message = 'Network Error: ' + err.statusText + '(' + err.status + ')';\n error.data = err.data;\n // @ts-ignore\n error.config = err.config;\n }\n }\n\n return error;\n }\n\n getTimeFilter(options: any) {\n const from = this.getInfluxTime(options.rangeRaw.from, false, options.timezone);\n const until = this.getInfluxTime(options.rangeRaw.to, true, options.timezone);\n\n return 'time >= ' + from + ' and time <= ' + until;\n }\n\n getInfluxTime(date: any, roundUp: any, timezone: any) {\n if (isString(date)) {\n if (date === 'now') {\n return 'now()';\n }\n\n const parts = /^now-(\\d+)([dhms])$/.exec(date);\n if (parts) {\n const amount = parseInt(parts[1], 10);\n const unit = parts[2];\n return 'now() - ' + amount + unit;\n }\n date = dateMath.parse(date, roundUp, timezone);\n }\n\n return date.valueOf() + 'ms';\n }\n\n isMigrationToggleOnAndIsAccessProxy() {\n return config.featureToggles.influxdbBackendMigration && this.access === 'proxy';\n }\n}\n","import { DataSourcePlugin } from '@grafana/data';\n\nimport ConfigEditor from './components/ConfigEditor';\nimport InfluxStartPage from './components/InfluxStartPage';\nimport { QueryEditor } from './components/QueryEditor';\nimport VariableQueryEditor from './components/VariableQueryEditor';\nimport InfluxDatasource from './datasource';\n\nclass InfluxAnnotationsQueryCtrl {\n static templateUrl = 'partials/annotations.editor.html';\n}\n\nexport const plugin = new DataSourcePlugin(InfluxDatasource)\n .setConfigEditor(ConfigEditor)\n .setQueryEditor(QueryEditor)\n .setAnnotationQueryCtrl(InfluxAnnotationsQueryCtrl)\n .setVariableQueryEditor(VariableQueryEditor)\n .setQueryEditorHelp(InfluxStartPage);\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { QueryEditorProps } from '@grafana/data';\n\nimport InfluxDatasource from '../datasource';\nimport { buildRawQuery } from '../queryUtils';\nimport { InfluxOptions, InfluxQuery } from '../types';\n\nimport { FluxQueryEditor } from './FluxQueryEditor';\nimport { QueryEditorModeSwitcher } from './QueryEditorModeSwitcher';\nimport { RawInfluxQLEditor } from './RawInfluxQLEditor';\nimport { Editor as VisualInfluxQLEditor } from './VisualInfluxQLEditor/Editor';\n\ntype Props = QueryEditorProps;\n\nexport const QueryEditor = ({ query, onChange, onRunQuery, datasource, range, data }: Props): JSX.Element => {\n if (datasource.isFlux) {\n return (\n
\n \n
\n );\n }\n\n return (\n
\n
\n {query.rawQuery ? (\n \n ) : (\n \n )}\n
\n {\n onChange({ ...query, query: buildRawQuery(query), rawQuery: value });\n onRunQuery();\n }}\n />\n
\n );\n};\n","import { useEffect, useRef } from 'react';\nexport default function usePrevious(state) {\n var ref = useRef();\n useEffect(function () {\n ref.current = state;\n });\n return ref.current;\n}\n"],"names":["InfluxVersion","Input","SecretFormField","LegacyForms","httpModes","label","value","versions","InfluxQL","description","Flux","ConfigEditor","PureComponent","constructor","props","super","maxSeries","updateDatasourcePluginResetOption","this","selected","options","onOptionsChange","copy","jsonData","version","access","basicAuth","httpMode","user","database","state","toString","htmlPrefix","uniqueId","renderInflux2x","secureJsonFields","secureJsonData","className","InlineFormLabel","htmlFor","id","organization","onChange","onUpdateDatasourceJsonDataOption","isConfigured","token","labelWidth","inputWidth","onReset","onResetToken","onUpdateDatasourceSecureJsonDataOption","placeholder","defaultBucket","tooltip","timeInterval","renderInflux1x","InfoBox","onUpdateDatasourceOption","password","onResetPassword","Select","inputId","find","defaultValue","onUpdateDatasourceJsonDataOptionSelect","render","onVersionChanged","href","Alert","title","severity","DataSourceHttpSettings","showAccessOptions","dataSourceConfig","defaultUrl","InlineField","type","event","setState","currentTarget","val","parseInt","updateDatasourcePluginJsonDataOption","Number","isFinite","undefined","CHEAT_SHEET_ITEMS","map","item","InfluxStartPage","onClickExample","index","categories","Aggregations","Selectors","Transformations","Predictors","Math","Aliasing","Fields","createPart","part","def","message","QueryPart","register","QueryPartDef","category","push","groupByTimeFunctions","fieldRenderer","innerExpr","params","replaceAggregationAddStrategy","selectParts","partModel","i","length","morePartsAvailable","splice","addTransformationStrategy","addStrategy","query","parts","clone","selectModels","dynamicLookup","defaultParams","renderer","functionRenderer","name","partCount","suffixRenderer","quote","renderMode","create","getCategories","replaceAggregationAdd","InfluxQueryModel","target","templateSrv","scopedVars","policy","resultFormat","orderByTime","tags","groupBy","select","updateProjection","queryPart","groupByParts","updatePersistedParts","hasGroupByTime","g","hasFill","addGroupBy","stringParts","match","typePart","arg","removeGroupByPart","filter","s","removeSelect","removeSelectPart","modelsIndex","indexOf","partIndex","addSelectPart","renderTagCondition","tag","interpolate","str","operator","condition","test","replace","key","getMeasurementAndPolicy","measurement","interpolateQueryStr","variable","defaultFormatFn","multi","includeAll","kbn","join","rawQuery","y","selectText","conditions","groupBySection","fill","limit","slimit","tz","renderAdhocFilters","filters","buildRawQuery","queryCopy","cloneDeep","samples","FluxQueryEditor","onRunQuery","forceUpdate","sugs","kind","CodeEditorSuggestionItemKind","detail","getTemplateSrv","getVariables","forEach","editor","setTimeout","layout","helpTooltip","CodeEditor","height","language","onBlur","onFluxQueryChange","onSave","showMiniMap","showLineNumbers","getSuggestions","onEditorDidMount","editorDidMountCallbackHack","cx","css","LinkButton","icon","variant","Segment","onSampleChange","width","QueryEditorModeSwitcher","isRaw","isModalOpen","setModalOpen","useState","useEffect","Button","onClick","ConfirmModal","isOpen","body","confirmText","dismissText","onConfirm","onDismiss","RESULT_FORMATS","DEFAULT_RESULT_FORMAT","useShadowedState","outsideVal","currentVal","setCurrentVal","prevOutsideVal","usePrevious","RawInfluxQLEditor","currentQuery","setCurrentQuery","currentAlias","setCurrentAlias","alias","aliasElementId","useUniqueId","selectElementId","applyDelayedChangesAndRunQuery","TextArea","rows","spellCheck","e","HorizontalGroup","v","InfluxQueryBuilder","buildExploreQuery","withKey","withMeasurementFilter","whereConditions","reduce","memo","isNaN","runExploreQuery","datasource","q","metricFindQuery","async","getTagKeysForMeasurementAndTags","text","paddingRightClass","paddingRight","unwrap","Error","FormatAsSection","format","selectClass","minWidth","formatCreateLabel","SelReload","loadOptions","allowCustomValue","onClose","debouncedLoadOptions","debouncePromise","leading","AsyncSelect","defaultOptions","autoFocus","onCloseMenu","SelSingleLoad","loadState","doLoad","useAsyncFn","isLoading","loading","Sel","filterByLoadOptions","Inp","initialValue","currentValue","setCurrentValue","onKeyDown","defaultButtonClass","cursor","Seg","buttonClassName","setOpen","InlineLabel","as","toSelectableValue","t","FromSection","getPolicyOptions","getMeasurementOptions","allPolicies","some","p","InputSection","isWide","OPTIONS","OrderByTimeSection","AddButton","onAdd","noRightMarginPaddingClass","marginRight","RemovableName","onRemove","WithContextMenu","renderMenuItems","renderRemovableNameMenuItems","MenuGroup","MenuItem","openMenu","noHorizMarginPaddingClass","paddingLeft","marginLeft","Part","theme","useTheme2","partClass","useMemo","lineHeight","typography","fontSize","getPartClass","isLast","then","items","par","newParams","onParamChange","PartListSection","getNewPartOptions","onAddNewPart","onRemovePart","pars","isRegex","getOperator","getCondition","isFirst","adjustOperatorIfNeeded","currentOperator","newTagValue","isCurrentOperatorRegex","operatorOptions","condititonOptions","loadConditionOptions","Promise","resolve","loadOperatorOptions","Tag","getTagKeyOptions","getTagValueOptions","catch","err","console","error","op","TagsSection","newT","newTag","newTags","onTagChange","onTagRemove","tagKey","minimalTag","addNewTag","getPartParams","dynamicParamOptions","paramValues","defParam","get","makePartList","queryParts","qp","withTemplateVariableOptions","optionsPromise","filterTags","allTagKeys","has","Editor","formatAsId","orderByTimeId","styles","useStyles2","getStyles","normalizeQuery","Set","selectLists","dynamicSelectPartOptions","Map","getFieldKeysForMeasurement","sel","getTagKeys","keys","groupByList","dynamicGroupByPartOptions","onAppliedChange","newQuery","SegmentSection","getAllPolicies","measurementFilter","getAllMeasurementsForTags","m","inlineLabel","getTagValues","Object","children","x","getNewSelectPartOptions","listIndex","newSel","changeSelectPart","model","addNewSelectPart","selectModel","tagKeys","getNewGroupByPartOptions","newGroupBy","changeGroupByPart","addNewGroupByPart","colors","primary","VariableQueryEditor","isFlux","refId","onRefresh","InfluxSeries","series","annotation","meta","getTimeSeries","output","j","each","columns","seriesName","columnName","_getSeriesName","datapoints","values","segments","split","g1","g2","group","segIndex","getAnnotations","list","titleCol","timeCol","timeEndCol","tagsCol","textCol","column","titleColumn","includes","tagsColumn","textColumn","timeEndColumn","data","time","Date","timeEnd","flatten","getTable","table","TableModel","seriesIndex","firstCol","firstTableCol","FieldType","reordered","hasOwnProperty","ResponseParser","parse","results","influxResults","normalizedQuery","toLowerCase","isValueFirst","res","serie","isArray","addUnique","Array","from","dfs","executedQueryString","selectedParams","allParams","selector","uniqueParams","param","incrementName","getSelectedParams","fields","field","labels","getTableCols","dfsByLabels","df","getTableRows","rsp","toDataQueryResponse","colText","colContainsTag","toArray","metrics","nameIncremenet","add","getFieldType","firstNotNull","valueType","timeSeriesToDataFrame","timeSeries","times","points","point","TIME_SERIES_TIME_FIELD_NAME","config","ArrayVector","TIME_SERIES_VALUE_FIELD_NAME","displayNameFromDS","InfluxDatasource","DataSourceWithBackend","instanceSettings","urls","url","trim","username","withCredentials","settingsData","interval","responseParser","annotations","QueryEditor","request","filteredRequest","targets","hide","isMigrationToggleOnAndIsAccessProxy","pipe","seriesList","groupedFrames","filteredFrames","preferredVisualisationType","classicQuery","getQueryDisplayText","filterQuery","applyTemplateVariables","rest","applyVariables","timeFilter","getTimeFilter","queryTargets","allQueries","_map","__interval","acc","current","of","adhocFilters","getAdhocFilters","_seriesQuery","result","influxSeries","reject","getRef","lastValueFrom","getBackendSrv","fetch","method","range","valueOf","to","queries","requestId","transformAnnotationResponse","rangeRaw","timezone","dashboard","targetContainsTemplate","queryText","containsTemplate","interpolateVariablesInQueries","expandedQuery","selects","frameToMetricFindValue","interpolated","resp","_influxRequest","epoch","serializeParams","encodeURIComponent","currentUrl","shift","u","db","extend","omit","pick","req","precision","inspect","paramSerializer","headers","Authorization","errors","elem","catchError","cancelled","throwError","handleErrors","status","isInteger","statusText","getInfluxTime","date","roundUp","isString","exec","dateMath","InfluxAnnotationsQueryCtrl","plugin","DataSourcePlugin","setConfigEditor","setQueryEditor","display","flexGrow","setAnnotationQueryCtrl","setVariableQueryEditor","setQueryEditorHelp","ref","useRef"],"sourceRoot":""}