@grafana/scenes 5.22.0--canary.951.11615799721.0 → 5.22.0--canary.951.11618919744.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"AdHocFiltersVariable.js","sources":["../../../../src/variables/adhoc/AdHocFiltersVariable.tsx"],"sourcesContent":["import React from 'react';\n// @ts-expect-error Remove when 11.1.x is released\nimport { AdHocVariableFilter, GetTagResponse, GrafanaTheme2, MetricFindValue, SelectableValue } from '@grafana/data';\nimport { SceneObjectBase } from '../../core/SceneObjectBase';\nimport { SceneVariable, SceneVariableState, SceneVariableValueChangedEvent, VariableValue } from '../types';\nimport { ControlsLayout, SceneComponentProps, SceneObjectUrlValues } from '../../core/types';\nimport { DataSourceRef } from '@grafana/schema';\nimport { dataFromResponse, getQueriesForVariables, renderPrometheusLabelFilters, responseHasError } from '../utils';\nimport { patchGetAdhocFilters } from './patchGetAdhocFilters';\nimport { useStyles2 } from '@grafana/ui';\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { AdHocFilterBuilder } from './AdHocFilterBuilder';\nimport { AdHocFilterRenderer } from './AdHocFilterRenderer';\nimport { getDataSourceSrv } from '@grafana/runtime';\nimport { AdHocFiltersVariableUrlSyncHandler } from './AdHocFiltersVariableUrlSyncHandler';\nimport { css } from '@emotion/css';\nimport { getEnrichedFiltersRequest } from '../getEnrichedFiltersRequest';\nimport { AdHocFiltersComboboxRenderer } from './AdHocFiltersCombobox/AdHocFiltersComboboxRenderer';\nimport { wrapInSafeSerializableSceneObject } from '../../utils/wrapInSafeSerializableSceneObject';\n\nexport interface AdHocFilterWithLabels<T = SceneObjectUrlValues> extends AdHocVariableFilter {\n keyLabel?: string;\n valueLabels?: string[];\n meta?: T\n // this is used to externally trigger edit mode in combobox filter UI\n forceEdit?: boolean;\n}\n\nexport type AdHocControlsLayout = ControlsLayout | 'combobox';\n\nexport interface AdHocFiltersVariableState extends SceneVariableState {\n /** Optional text to display on the 'add filter' button */\n addFilterButtonText?: string;\n /** The visible filters */\n filters: AdHocFilterWithLabels[];\n /** Base filters to always apply when looking up keys*/\n baseFilters?: AdHocFilterWithLabels[];\n /** Datasource to use for getTagKeys and getTagValues and also controls which scene queries the filters should apply to */\n datasource: DataSourceRef | null;\n /** Controls if the filters can be changed */\n readOnly?: boolean;\n /**\n * @experimental\n * Controls the layout and design of the label.\n */\n layout?: AdHocControlsLayout;\n /**\n * Defaults to automatic which means filters will automatically be applied to all queries with the same data source as this AdHocFilterSet.\n * In manual mode you either have to use the filters programmatically or as a variable inside query expressions.\n */\n applyMode: 'auto' | 'manual';\n /**\n * Filter out the keys that do not match the regex.\n */\n tagKeyRegexFilter?: RegExp;\n /**\n * Extension hook for customizing the key lookup.\n * Return replace: true if you want to override the default lookup\n * Return replace: false if you want to combine the results with the default lookup\n */\n getTagKeysProvider?: getTagKeysProvider;\n /**\n * Extension hook for customizing the value lookup.\n * Return replace: true if you want to override the default lookup.\n * Return replace: false if you want to combine the results with the default lookup\n */\n getTagValuesProvider?: getTagValuesProvider;\n\n /**\n * Optionally provide an array of static keys that override getTagKeys\n */\n defaultKeys?: MetricFindValue[];\n\n /**\n * This is the expression that the filters resulted in. Defaults to\n * Prometheus / Loki compatible label filter expression\n */\n filterExpression?: string;\n\n /**\n * The default builder creates a Prometheus/Loki compatible filter expression,\n * this can be overridden to create a different expression based on the current filters.\n */\n expressionBuilder?: AdHocVariableExpressionBuilderFn;\n\n /**\n * Whether the filter supports new multi-value operators like =| and !=|\n */\n supportsMultiValueOperators?: boolean;\n\n /**\n * When querying the datasource for label names and values to determine keys and values\n * for this ad hoc filter, consider the queries in the scene and use them as a filter.\n * This queries filter can be used to ensure that only ad hoc filter options that would\n * impact the current queries are presented to the user.\n */\n useQueriesAsFilterForOptions?: boolean;\n\n /**\n * @internal state of the new filter being added\n */\n _wip?: AdHocFilterWithLabels;\n}\n\nexport type AdHocVariableExpressionBuilderFn = (filters: AdHocFilterWithLabels[]) => string;\n\nexport type getTagKeysProvider = (\n variable: AdHocFiltersVariable,\n currentKey: string | null\n) => Promise<{ replace?: boolean; values: GetTagResponse | MetricFindValue[] }>;\n\nexport type getTagValuesProvider = (\n variable: AdHocFiltersVariable,\n filter: AdHocFilterWithLabels\n) => Promise<{ replace?: boolean; values: GetTagResponse | MetricFindValue[] }>;\n\nexport type AdHocFiltersVariableCreateHelperArgs = AdHocFiltersVariableState;\n\nexport type OperatorDefinition = {\n value: string;\n description?: string;\n isMulti?: Boolean;\n};\n\nexport const OPERATORS: OperatorDefinition[] = [\n {\n value: '=',\n description: 'Equals',\n },\n {\n value: '!=',\n description: 'Not equal',\n },\n {\n value: '=|',\n description: 'One of. Use to filter on multiple values.',\n isMulti: true,\n },\n {\n value: '!=|',\n description: 'Not one of. Use to exclude multiple values.',\n isMulti: true,\n },\n {\n value: '=~',\n description: 'Matches regex',\n },\n {\n value: '!~',\n description: 'Does not match regex',\n },\n {\n value: '<',\n description: 'Less than',\n },\n {\n value: '>',\n description: 'Greater than',\n },\n];\n\nexport class AdHocFiltersVariable\n extends SceneObjectBase<AdHocFiltersVariableState>\n implements SceneVariable<AdHocFiltersVariableState>\n{\n static Component = AdHocFiltersVariableRenderer;\n\n private _scopedVars = { __sceneObject: wrapInSafeSerializableSceneObject(this) };\n private _dataSourceSrv = getDataSourceSrv();\n\n protected _urlSync = new AdHocFiltersVariableUrlSyncHandler(this);\n\n public constructor(state: Partial<AdHocFiltersVariableState>) {\n super({\n type: 'adhoc',\n name: state.name ?? 'Filters',\n filters: [],\n datasource: null,\n applyMode: 'auto',\n filterExpression: state.filterExpression ?? renderExpression(state.expressionBuilder, state.filters),\n ...state,\n });\n\n if (this.state.applyMode === 'auto') {\n patchGetAdhocFilters(this);\n }\n }\n\n public setState(update: Partial<AdHocFiltersVariableState>): void {\n let filterExpressionChanged = false;\n\n if (update.filters && update.filters !== this.state.filters && !update.filterExpression) {\n update.filterExpression = renderExpression(this.state.expressionBuilder, update.filters);\n filterExpressionChanged = update.filterExpression !== this.state.filterExpression;\n }\n\n super.setState(update);\n\n if (filterExpressionChanged) {\n this.publishEvent(new SceneVariableValueChangedEvent(this), true);\n }\n }\n\n public getValue(): VariableValue | undefined {\n return this.state.filterExpression;\n }\n\n public _updateFilter(filter: AdHocFilterWithLabels, update: Partial<AdHocFilterWithLabels>) {\n const { filters, _wip } = this.state;\n\n if (filter === _wip) {\n // If we set value we are done with this \"work in progress\" filter and we can add it\n if ('value' in update && update['value'] !== '') {\n this.setState({ filters: [...filters, { ..._wip, ...update }], _wip: undefined });\n } else {\n this.setState({ _wip: { ...filter, ...update } });\n }\n return;\n }\n\n const updatedFilters = this.state.filters.map((f) => {\n return f === filter ? { ...f, ...update } : f;\n });\n\n this.setState({ filters: updatedFilters });\n }\n\n public _removeFilter(filter: AdHocFilterWithLabels) {\n if (filter === this.state._wip) {\n this.setState({ _wip: undefined });\n return;\n }\n\n this.setState({ filters: this.state.filters.filter((f) => f !== filter) });\n }\n\n public _removeLastFilter() {\n const filterToRemove = this.state.filters.at(-1);\n\n if (filterToRemove) {\n this._removeFilter(filterToRemove);\n }\n }\n\n public _handleComboboxBackspace(filter: AdHocFilterWithLabels) {\n if (this.state.filters.length) {\n // default forceEdit last filter (when triggering from wip filter)\n let filterToForceIndex = this.state.filters.length - 1;\n\n // adjust filterToForceIndex index to -1 if backspace triggered from non wip filter\n // to avoid triggering forceEdit logic\n if (filter !== this.state._wip) {\n filterToForceIndex = -1;\n }\n\n this.setState({\n filters: this.state.filters.reduce<AdHocFilterWithLabels[]>((acc, f, index) => {\n // adjust forceEdit of preceding filter\n if (index === filterToForceIndex) {\n return [\n ...acc,\n {\n ...f,\n forceEdit: true,\n },\n ];\n }\n // remove current filter\n if (f === filter) {\n return acc;\n }\n\n return [...acc, f];\n }, []),\n });\n }\n }\n\n /**\n * Get possible keys given current filters. Do not call from plugins directly\n */\n public async _getKeys(currentKey: string | null): Promise<Array<SelectableValue<string>>> {\n const override = await this.state.getTagKeysProvider?.(this, currentKey);\n\n if (override && override.replace) {\n return dataFromResponse(override.values).map(toSelectableValue);\n }\n\n if (this.state.defaultKeys) {\n return this.state.defaultKeys.map(toSelectableValue);\n }\n\n const ds = await this._dataSourceSrv.get(this.state.datasource, this._scopedVars);\n if (!ds || !ds.getTagKeys) {\n return [];\n }\n\n const otherFilters = this.state.filters.filter((f) => f.key !== currentKey).concat(this.state.baseFilters ?? []);\n const timeRange = sceneGraph.getTimeRange(this).state.value;\n const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : undefined;\n const response = await ds.getTagKeys({\n filters: otherFilters,\n queries,\n timeRange,\n ...getEnrichedFiltersRequest(this),\n });\n\n if (responseHasError(response)) {\n // @ts-expect-error Remove when 11.1.x is released\n this.setState({ error: response.error.message });\n }\n\n let keys = dataFromResponse(response);\n if (override) {\n keys = keys.concat(dataFromResponse(override.values));\n }\n\n const tagKeyRegexFilter = this.state.tagKeyRegexFilter;\n if (tagKeyRegexFilter) {\n // @ts-expect-error Remove when 11.1.x is released\n keys = keys.filter((f) => f.text.match(tagKeyRegexFilter));\n }\n\n return keys.map(toSelectableValue);\n }\n\n /**\n * Get possible key values for a specific key given current filters. Do not call from plugins directly\n */\n public async _getValuesFor(filter: AdHocFilterWithLabels): Promise<Array<SelectableValue<string>>> {\n const override = await this.state.getTagValuesProvider?.(this, filter);\n\n if (override && override.replace) {\n return dataFromResponse(override.values).map(toSelectableValue);\n }\n\n const ds = await this._dataSourceSrv.get(this.state.datasource, this._scopedVars);\n\n if (!ds || !ds.getTagValues) {\n return [];\n }\n\n // Filter out the current filter key from the list of all filters\n const otherFilters = this.state.filters.filter((f) => f.key !== filter.key).concat(this.state.baseFilters ?? []);\n\n const timeRange = sceneGraph.getTimeRange(this).state.value;\n const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : undefined;\n\n const response = await ds.getTagValues({\n key: filter.key,\n filters: otherFilters,\n timeRange, // @ts-expect-error TODO: remove this once 11.1.x is released\n queries,\n ...getEnrichedFiltersRequest(this),\n });\n\n if (responseHasError(response)) {\n // @ts-expect-error Remove when 11.1.x is released\n this.setState({ error: response.error.message });\n }\n\n let values = dataFromResponse(response);\n if (override) {\n values = values.concat(dataFromResponse(override.values));\n }\n\n return values.map(toSelectableValue);\n }\n\n public _addWip() {\n this.setState({\n _wip: { key: '', value: '', operator: '=', condition: '' },\n });\n }\n\n public _getOperators() {\n const filteredOperators = this.state.supportsMultiValueOperators\n ? OPERATORS\n : OPERATORS.filter((operator) => !operator.isMulti);\n return filteredOperators.map<SelectableValue<string>>(({ value, description }) => ({\n label: value,\n value,\n description,\n }));\n }\n}\n\nfunction renderExpression(\n builder: AdHocVariableExpressionBuilderFn | undefined,\n filters: AdHocFilterWithLabels[] | undefined\n) {\n return (builder ?? renderPrometheusLabelFilters)(filters ?? []);\n}\n\nexport function AdHocFiltersVariableRenderer({ model }: SceneComponentProps<AdHocFiltersVariable>) {\n const { filters, readOnly, addFilterButtonText } = model.useState();\n const styles = useStyles2(getStyles);\n\n if (model.state.layout === 'combobox') {\n return <AdHocFiltersComboboxRenderer model={model} />;\n }\n\n return (\n <div className={styles.wrapper}>\n {filters.map((filter, index) => (\n <React.Fragment key={index}>\n <AdHocFilterRenderer filter={filter} model={model} />\n </React.Fragment>\n ))}\n\n {!readOnly && <AdHocFilterBuilder model={model} key=\"'builder\" addFilterButtonText={addFilterButtonText} />}\n </div>\n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n wrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'flex-end',\n columnGap: theme.spacing(2),\n rowGap: theme.spacing(1),\n }),\n});\n\nexport function toSelectableValue(input: MetricFindValue): SelectableValue<string> {\n const { text, value } = input;\n const result: SelectableValue<string> = {\n label: text,\n value: String(value ?? text),\n };\n\n if ('group' in input) {\n result.group = input.group;\n }\n\n return result;\n}\n\nexport function isFilterComplete(filter: AdHocFilterWithLabels): boolean {\n return filter.key !== '' && filter.operator !== '' && filter.value !== '';\n}\n\nexport function isMultiValueOperator(operatorValue: string): boolean {\n const operator = OPERATORS.find((o) => o.value === operatorValue);\n if (!operator) {\n // default to false if operator is not found\n return false;\n }\n return Boolean(operator.isMulti);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HO,MAAM,SAAkC,GAAA;AAAA,EAC7C;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,WAAa,EAAA,QAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,WAAa,EAAA,WAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,WAAa,EAAA,2CAAA;AAAA,IACb,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EACA;AAAA,IACE,KAAO,EAAA,KAAA;AAAA,IACP,WAAa,EAAA,6CAAA;AAAA,IACb,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EACA;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,WAAa,EAAA,eAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,WAAa,EAAA,sBAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,WAAa,EAAA,WAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,WAAa,EAAA,cAAA;AAAA,GACf;AACF,EAAA;AAEO,MAAM,6BACH,eAEV,CAAA;AAAA,EAQS,YAAY,KAA2C,EAAA;AA5KhE,IAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AA6KI,IAAM,KAAA,CAAA,cAAA,CAAA;AAAA,MACJ,IAAM,EAAA,OAAA;AAAA,MACN,IAAA,EAAA,CAAM,EAAM,GAAA,KAAA,CAAA,IAAA,KAAN,IAAc,GAAA,EAAA,GAAA,SAAA;AAAA,MACpB,SAAS,EAAC;AAAA,MACV,UAAY,EAAA,IAAA;AAAA,MACZ,SAAW,EAAA,MAAA;A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AA;AAAA,GACvB;AAEA,EAAO,OAAA,MAAA,CAAA;AACT,CAAA;AAEO,SAAS,iBAAiB,MAAwC,EAAA;AACvE,EAAA,OAAO,OAAO,GAAQ,KAAA,EAAA,IAAM,OAAO,QAAa,KAAA,EAAA,IAAM,OAAO,KAAU,KAAA,EAAA,CAAA;AACzE,CAAA;AAEO,SAAS,qBAAqB,aAAgC,EAAA;AACnE,EAAA,MAAM,WAAW,SAAU,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA,CAAA,CAAE,UAAU,aAAa,CAAA,CAAA;AAChE,EAAA,IAAI,CAAC,QAAU,EAAA;AAEb,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,OAAA,CAAQ,SAAS,OAAO,CAAA,CAAA;AACjC;;;;"}
1
+ {"version":3,"file":"AdHocFiltersVariable.js","sources":["../../../../src/variables/adhoc/AdHocFiltersVariable.tsx"],"sourcesContent":["import React from 'react';\n// @ts-expect-error Remove when 11.1.x is released\nimport { AdHocVariableFilter, GetTagResponse, GrafanaTheme2, MetricFindValue, SelectableValue } from '@grafana/data';\nimport { SceneObjectBase } from '../../core/SceneObjectBase';\nimport { SceneVariable, SceneVariableState, SceneVariableValueChangedEvent, VariableValue } from '../types';\nimport { ControlsLayout, SceneComponentProps } from '../../core/types';\nimport { DataSourceRef } from '@grafana/schema';\nimport { dataFromResponse, getQueriesForVariables, renderPrometheusLabelFilters, responseHasError } from '../utils';\nimport { patchGetAdhocFilters } from './patchGetAdhocFilters';\nimport { useStyles2 } from '@grafana/ui';\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { AdHocFilterBuilder } from './AdHocFilterBuilder';\nimport { AdHocFilterRenderer } from './AdHocFilterRenderer';\nimport { getDataSourceSrv } from '@grafana/runtime';\nimport { AdHocFiltersVariableUrlSyncHandler } from './AdHocFiltersVariableUrlSyncHandler';\nimport { css } from '@emotion/css';\nimport { getEnrichedFiltersRequest } from '../getEnrichedFiltersRequest';\nimport { AdHocFiltersComboboxRenderer } from './AdHocFiltersCombobox/AdHocFiltersComboboxRenderer';\nimport { wrapInSafeSerializableSceneObject } from '../../utils/wrapInSafeSerializableSceneObject';\n\nexport interface AdHocFilterWithLabels<T = Record<string, string>> extends AdHocVariableFilter {\n keyLabel?: string;\n valueLabels?: string[];\n meta?: T\n // this is used to externally trigger edit mode in combobox filter UI\n forceEdit?: boolean;\n}\n\nexport type AdHocControlsLayout = ControlsLayout | 'combobox';\n\nexport interface AdHocFiltersVariableState extends SceneVariableState {\n /** Optional text to display on the 'add filter' button */\n addFilterButtonText?: string;\n /** The visible filters */\n filters: AdHocFilterWithLabels[];\n /** Base filters to always apply when looking up keys*/\n baseFilters?: AdHocFilterWithLabels[];\n /** Datasource to use for getTagKeys and getTagValues and also controls which scene queries the filters should apply to */\n datasource: DataSourceRef | null;\n /** Controls if the filters can be changed */\n readOnly?: boolean;\n /**\n * @experimental\n * Controls the layout and design of the label.\n */\n layout?: AdHocControlsLayout;\n /**\n * Defaults to automatic which means filters will automatically be applied to all queries with the same data source as this AdHocFilterSet.\n * In manual mode you either have to use the filters programmatically or as a variable inside query expressions.\n */\n applyMode: 'auto' | 'manual';\n /**\n * Filter out the keys that do not match the regex.\n */\n tagKeyRegexFilter?: RegExp;\n /**\n * Extension hook for customizing the key lookup.\n * Return replace: true if you want to override the default lookup\n * Return replace: false if you want to combine the results with the default lookup\n */\n getTagKeysProvider?: getTagKeysProvider;\n /**\n * Extension hook for customizing the value lookup.\n * Return replace: true if you want to override the default lookup.\n * Return replace: false if you want to combine the results with the default lookup\n */\n getTagValuesProvider?: getTagValuesProvider;\n\n /**\n * Optionally provide an array of static keys that override getTagKeys\n */\n defaultKeys?: MetricFindValue[];\n\n /**\n * This is the expression that the filters resulted in. Defaults to\n * Prometheus / Loki compatible label filter expression\n */\n filterExpression?: string;\n\n /**\n * The default builder creates a Prometheus/Loki compatible filter expression,\n * this can be overridden to create a different expression based on the current filters.\n */\n expressionBuilder?: AdHocVariableExpressionBuilderFn;\n\n /**\n * Whether the filter supports new multi-value operators like =| and !=|\n */\n supportsMultiValueOperators?: boolean;\n\n /**\n * When querying the datasource for label names and values to determine keys and values\n * for this ad hoc filter, consider the queries in the scene and use them as a filter.\n * This queries filter can be used to ensure that only ad hoc filter options that would\n * impact the current queries are presented to the user.\n */\n useQueriesAsFilterForOptions?: boolean;\n\n /**\n * @internal state of the new filter being added\n */\n _wip?: AdHocFilterWithLabels;\n}\n\nexport type AdHocVariableExpressionBuilderFn = (filters: AdHocFilterWithLabels[]) => string;\n\nexport type getTagKeysProvider = (\n variable: AdHocFiltersVariable,\n currentKey: string | null\n) => Promise<{ replace?: boolean; values: GetTagResponse | MetricFindValue[] }>;\n\nexport type getTagValuesProvider = (\n variable: AdHocFiltersVariable,\n filter: AdHocFilterWithLabels\n) => Promise<{ replace?: boolean; values: GetTagResponse | MetricFindValue[] }>;\n\nexport type AdHocFiltersVariableCreateHelperArgs = AdHocFiltersVariableState;\n\nexport type OperatorDefinition = {\n value: string;\n description?: string;\n isMulti?: Boolean;\n};\n\nexport const OPERATORS: OperatorDefinition[] = [\n {\n value: '=',\n description: 'Equals',\n },\n {\n value: '!=',\n description: 'Not equal',\n },\n {\n value: '=|',\n description: 'One of. Use to filter on multiple values.',\n isMulti: true,\n },\n {\n value: '!=|',\n description: 'Not one of. Use to exclude multiple values.',\n isMulti: true,\n },\n {\n value: '=~',\n description: 'Matches regex',\n },\n {\n value: '!~',\n description: 'Does not match regex',\n },\n {\n value: '<',\n description: 'Less than',\n },\n {\n value: '>',\n description: 'Greater than',\n },\n];\n\nexport class AdHocFiltersVariable\n extends SceneObjectBase<AdHocFiltersVariableState>\n implements SceneVariable<AdHocFiltersVariableState>\n{\n static Component = AdHocFiltersVariableRenderer;\n\n private _scopedVars = { __sceneObject: wrapInSafeSerializableSceneObject(this) };\n private _dataSourceSrv = getDataSourceSrv();\n\n protected _urlSync = new AdHocFiltersVariableUrlSyncHandler(this);\n\n public constructor(state: Partial<AdHocFiltersVariableState>) {\n super({\n type: 'adhoc',\n name: state.name ?? 'Filters',\n filters: [],\n datasource: null,\n applyMode: 'auto',\n filterExpression: state.filterExpression ?? renderExpression(state.expressionBuilder, state.filters),\n ...state,\n });\n\n if (this.state.applyMode === 'auto') {\n patchGetAdhocFilters(this);\n }\n }\n\n public setState(update: Partial<AdHocFiltersVariableState>): void {\n let filterExpressionChanged = false;\n\n if (update.filters && update.filters !== this.state.filters && !update.filterExpression) {\n update.filterExpression = renderExpression(this.state.expressionBuilder, update.filters);\n filterExpressionChanged = update.filterExpression !== this.state.filterExpression;\n }\n\n super.setState(update);\n\n if (filterExpressionChanged) {\n this.publishEvent(new SceneVariableValueChangedEvent(this), true);\n }\n }\n\n public getValue(): VariableValue | undefined {\n return this.state.filterExpression;\n }\n\n public _updateFilter(filter: AdHocFilterWithLabels, update: Partial<AdHocFilterWithLabels>) {\n const { filters, _wip } = this.state;\n\n if (filter === _wip) {\n // If we set value we are done with this \"work in progress\" filter and we can add it\n if ('value' in update && update['value'] !== '') {\n this.setState({ filters: [...filters, { ..._wip, ...update }], _wip: undefined });\n } else {\n this.setState({ _wip: { ...filter, ...update } });\n }\n return;\n }\n\n const updatedFilters = this.state.filters.map((f) => {\n return f === filter ? { ...f, ...update } : f;\n });\n\n this.setState({ filters: updatedFilters });\n }\n\n public _removeFilter(filter: AdHocFilterWithLabels) {\n if (filter === this.state._wip) {\n this.setState({ _wip: undefined });\n return;\n }\n\n this.setState({ filters: this.state.filters.filter((f) => f !== filter) });\n }\n\n public _removeLastFilter() {\n const filterToRemove = this.state.filters.at(-1);\n\n if (filterToRemove) {\n this._removeFilter(filterToRemove);\n }\n }\n\n public _handleComboboxBackspace(filter: AdHocFilterWithLabels) {\n if (this.state.filters.length) {\n // default forceEdit last filter (when triggering from wip filter)\n let filterToForceIndex = this.state.filters.length - 1;\n\n // adjust filterToForceIndex index to -1 if backspace triggered from non wip filter\n // to avoid triggering forceEdit logic\n if (filter !== this.state._wip) {\n filterToForceIndex = -1;\n }\n\n this.setState({\n filters: this.state.filters.reduce<AdHocFilterWithLabels[]>((acc, f, index) => {\n // adjust forceEdit of preceding filter\n if (index === filterToForceIndex) {\n return [\n ...acc,\n {\n ...f,\n forceEdit: true,\n },\n ];\n }\n // remove current filter\n if (f === filter) {\n return acc;\n }\n\n return [...acc, f];\n }, []),\n });\n }\n }\n\n /**\n * Get possible keys given current filters. Do not call from plugins directly\n */\n public async _getKeys(currentKey: string | null): Promise<Array<SelectableValue<string>>> {\n const override = await this.state.getTagKeysProvider?.(this, currentKey);\n\n if (override && override.replace) {\n return dataFromResponse(override.values).map(toSelectableValue);\n }\n\n if (this.state.defaultKeys) {\n return this.state.defaultKeys.map(toSelectableValue);\n }\n\n const ds = await this._dataSourceSrv.get(this.state.datasource, this._scopedVars);\n if (!ds || !ds.getTagKeys) {\n return [];\n }\n\n const otherFilters = this.state.filters.filter((f) => f.key !== currentKey).concat(this.state.baseFilters ?? []);\n const timeRange = sceneGraph.getTimeRange(this).state.value;\n const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : undefined;\n const response = await ds.getTagKeys({\n filters: otherFilters,\n queries,\n timeRange,\n ...getEnrichedFiltersRequest(this),\n });\n\n if (responseHasError(response)) {\n // @ts-expect-error Remove when 11.1.x is released\n this.setState({ error: response.error.message });\n }\n\n let keys = dataFromResponse(response);\n if (override) {\n keys = keys.concat(dataFromResponse(override.values));\n }\n\n const tagKeyRegexFilter = this.state.tagKeyRegexFilter;\n if (tagKeyRegexFilter) {\n // @ts-expect-error Remove when 11.1.x is released\n keys = keys.filter((f) => f.text.match(tagKeyRegexFilter));\n }\n\n return keys.map(toSelectableValue);\n }\n\n /**\n * Get possible key values for a specific key given current filters. Do not call from plugins directly\n */\n public async _getValuesFor(filter: AdHocFilterWithLabels): Promise<Array<SelectableValue<string>>> {\n const override = await this.state.getTagValuesProvider?.(this, filter);\n\n if (override && override.replace) {\n return dataFromResponse(override.values).map(toSelectableValue);\n }\n\n const ds = await this._dataSourceSrv.get(this.state.datasource, this._scopedVars);\n\n if (!ds || !ds.getTagValues) {\n return [];\n }\n\n // Filter out the current filter key from the list of all filters\n const otherFilters = this.state.filters.filter((f) => f.key !== filter.key).concat(this.state.baseFilters ?? []);\n\n const timeRange = sceneGraph.getTimeRange(this).state.value;\n const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : undefined;\n\n const response = await ds.getTagValues({\n key: filter.key,\n filters: otherFilters,\n timeRange, // @ts-expect-error TODO: remove this once 11.1.x is released\n queries,\n ...getEnrichedFiltersRequest(this),\n });\n\n if (responseHasError(response)) {\n // @ts-expect-error Remove when 11.1.x is released\n this.setState({ error: response.error.message });\n }\n\n let values = dataFromResponse(response);\n if (override) {\n values = values.concat(dataFromResponse(override.values));\n }\n\n return values.map(toSelectableValue);\n }\n\n public _addWip() {\n this.setState({\n _wip: { key: '', value: '', operator: '=', condition: '' },\n });\n }\n\n public _getOperators() {\n const filteredOperators = this.state.supportsMultiValueOperators\n ? OPERATORS\n : OPERATORS.filter((operator) => !operator.isMulti);\n return filteredOperators.map<SelectableValue<string>>(({ value, description }) => ({\n label: value,\n value,\n description,\n }));\n }\n}\n\nfunction renderExpression(\n builder: AdHocVariableExpressionBuilderFn | undefined,\n filters: AdHocFilterWithLabels[] | undefined\n) {\n return (builder ?? renderPrometheusLabelFilters)(filters ?? []);\n}\n\nexport function AdHocFiltersVariableRenderer({ model }: SceneComponentProps<AdHocFiltersVariable>) {\n const { filters, readOnly, addFilterButtonText } = model.useState();\n const styles = useStyles2(getStyles);\n\n if (model.state.layout === 'combobox') {\n return <AdHocFiltersComboboxRenderer model={model} />;\n }\n\n return (\n <div className={styles.wrapper}>\n {filters.map((filter, index) => (\n <React.Fragment key={index}>\n <AdHocFilterRenderer filter={filter} model={model} />\n </React.Fragment>\n ))}\n\n {!readOnly && <AdHocFilterBuilder model={model} key=\"'builder\" addFilterButtonText={addFilterButtonText} />}\n </div>\n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n wrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'flex-end',\n columnGap: theme.spacing(2),\n rowGap: theme.spacing(1),\n }),\n});\n\nexport function toSelectableValue(input: MetricFindValue): SelectableValue<string> {\n const { text, value } = input;\n const result: SelectableValue<string> = {\n label: text,\n value: String(value ?? text),\n };\n\n if ('group' in input) {\n result.group = input.group;\n }\n\n return result;\n}\n\nexport function isFilterComplete(filter: AdHocFilterWithLabels): boolean {\n return filter.key !== '' && filter.operator !== '' && filter.value !== '';\n}\n\nexport function isMultiValueOperator(operatorValue: string): boolean {\n const operator = OPERATORS.find((o) => o.value === operatorValue);\n if (!operator) {\n // default to false if operator is not found\n return false;\n }\n return Boolean(operator.isMulti);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HO,MAAM,SAAkC,GAAA;AAAA,EAC7C;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,WAAa,EAAA,QAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,WAAa,EAAA,WAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,WAAa,EAAA,2CAAA;AAAA,IACb,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EACA;AAAA,IACE,KAAO,EAAA,KAAA;AAAA,IACP,WAAa,EAAA,6CAAA;AAAA,IACb,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EACA;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,WAAa,EAAA,eAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,WAAa,EAAA,sBAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,WAAa,EAAA,WAAA;AAAA,GACf;AAAA,EACA;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,WAAa,EAAA,cAAA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;AACH,CAAA,CAAA,CAAA;AAEO,SAAS,kBAAkB,KAAiD,EAAA;AACjF,EAAM,MAAA,EAAE,IAAM,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AACxB,EAAA,MAAM,MAAkC,GAAA;AAAA,IACtC,KAAO,EAAA,IAAA;AAAA,IACP,KAAA,EAAO,MAAO,CAAA,KAAA,IAAA,IAAA,GAAA,KAAA,GAAS,IAAI,CAAA;AAAA,GAC7B,CAAA;AAEA,EAAA,IAAI,WAAW,KAAO,EAAA;AACpB,IAAA,MAAA,CAAO,QAAQ,KAAM,CAAA,KAAA,CAAA;AAAA,GACvB;AAEA,EAAO,OAAA,MAAA,CAAA;AACT,CAAA;AAEO,SAAS,iBAAiB,MAAwC,EAAA;AACvE,EAAA,OAAO,OAAO,GAAQ,KAAA,EAAA,IAAM,OAAO,QAAa,KAAA,EAAA,IAAM,OAAO,KAAU,KAAA,EAAA,CAAA;AACzE,CAAA;AAEO,SAAS,qBAAqB,aAAgC,EAAA;AACnE,EAAA,MAAM,WAAW,SAAU,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA,CAAA,CAAE,UAAU,aAAa,CAAA,CAAA;AAChE,EAAA,IAAI,CAAC,QAAU,EAAA;AAEb,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,OAAA,CAAQ,SAAS,OAAO,CAAA,CAAA;AACjC;;;;"}
package/dist/index.d.ts CHANGED
@@ -531,7 +531,7 @@ declare class AdHocFiltersVariableUrlSyncHandler implements SceneObjectUrlSyncHa
531
531
  updateFromUrl(values: SceneObjectUrlValues): void;
532
532
  }
533
533
 
534
- interface AdHocFilterWithLabels<T = SceneObjectUrlValues> extends AdHocVariableFilter {
534
+ interface AdHocFilterWithLabels<T = Record<string, string>> extends AdHocVariableFilter {
535
535
  keyLabel?: string;
536
536
  valueLabels?: string[];
537
537
  meta?: T;