@grafana/scenes 5.26.0--canary.974.11969404553.0 → 5.26.0--canary.973.11972553033.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"VizPanel.js","sources":["../../../../src/components/VizPanel/VizPanel.tsx"],"sourcesContent":["import {\n AbsoluteTimeRange,\n FieldConfigSource,\n PanelModel,\n PanelPlugin,\n toUtc,\n getPanelOptionsWithDefaults,\n ScopedVars,\n InterpolateFunction,\n CoreApp,\n DashboardCursorSync,\n PanelData,\n compareArrayValues,\n compareDataFrameStructures,\n applyFieldOverrides,\n PluginType,\n renderMarkdown,\n PanelPluginDataSupport,\n} from '@grafana/data';\nimport { PanelContext, SeriesVisibilityChangeMode, VizLegendOptions } from '@grafana/ui';\nimport { config, getAppEvents, getPluginImportUtils } from '@grafana/runtime';\nimport { SceneObjectBase } from '../../core/SceneObjectBase';\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { DeepPartial, SceneObject, SceneObjectState } from '../../core/types';\n\nimport { VizPanelRenderer } from './VizPanelRenderer';\nimport { VizPanelMenu } from './VizPanelMenu';\nimport { VariableDependencyConfig } from '../../variables/VariableDependencyConfig';\nimport { VariableCustomFormatterFn } from '../../variables/types';\nimport { seriesVisibilityConfigFactory } from './seriesVisibilityConfigFactory';\nimport { emptyPanelData } from '../../core/SceneDataNode';\nimport { changeSeriesColorConfigFactory } from './colorSeriesConfigFactory';\nimport { loadPanelPluginSync } from './registerRuntimePanelPlugin';\nimport { getCursorSyncScope } from '../../behaviors/CursorSync';\nimport { cloneDeep, isArray, isEmpty, merge, mergeWith } from 'lodash';\nimport { UserActionEvent } from '../../core/events';\nimport { evaluateTimeRange } from '../../utils/evaluateTimeRange';\nimport { LiveNowTimer } from '../../behaviors/LiveNowTimer';\n\nexport interface VizPanelState<TOptions = {}, TFieldConfig = {}> extends SceneObjectState {\n /**\n * This is usually a plugin id that references a core plugin or an external plugin. But this can also reference a\n * runtime registered PanelPlugin registered via function registerScenePanelPlugin.\n */\n pluginId: string;\n title: string;\n description?: string;\n options: DeepPartial<TOptions>;\n fieldConfig: FieldConfigSource<DeepPartial<TFieldConfig>>;\n pluginVersion?: string;\n displayMode?: 'default' | 'transparent';\n /**\n * Only shows header on hover, absolutly positioned above the panel.\n */\n hoverHeader?: boolean;\n /**\n * Offset hoverHeader position on the y axis\n */\n hoverHeaderOffset?: number;\n /**\n * Defines a menu in the top right of the panel. The menu object is only activated when the dropdown menu itself is shown.\n * So the best way to add dynamic menu actions and links is by adding them in a behavior attached to the menu.\n */\n menu?: VizPanelMenu;\n /**\n * Defines a menu that renders panel link.\n **/\n titleItems?: React.ReactNode | SceneObject | SceneObject[];\n /**\n * Add action to the top right panel header\n */\n headerActions?: React.ReactNode | SceneObject | SceneObject[];\n /**\n * Mainly for advanced use cases that need custom handling of PanelContext callbacks.\n */\n extendPanelContext?: (vizPanel: VizPanel, context: PanelContext) => void;\n /**\n * @internal\n * Only for use from core to handle migration from old angular panels\n **/\n _UNSAFE_customMigrationHandler?: (panel: PanelModel, plugin: PanelPlugin) => void;\n /** Internal */\n _pluginLoadError?: string;\n /** Internal */\n _pluginInstanceState?: any;\n _renderCounter?: number;\n}\n\nexport class VizPanel<TOptions = {}, TFieldConfig extends {} = {}> extends SceneObjectBase<\n VizPanelState<TOptions, TFieldConfig>\n> {\n public static Component = VizPanelRenderer;\n\n protected _variableDependency = new VariableDependencyConfig(this, {\n statePaths: ['title', 'options', 'fieldConfig'],\n });\n\n // Not part of state as this is not serializable\n protected _panelContext?: PanelContext;\n private _plugin?: PanelPlugin;\n private _prevData?: PanelData;\n private _dataWithFieldConfig?: PanelData;\n private _structureRev: number = 0;\n\n public constructor(state: Partial<VizPanelState<TOptions, TFieldConfig>>) {\n super({\n options: {} as TOptions,\n fieldConfig: { defaults: {}, overrides: [] },\n title: 'Title',\n pluginId: 'timeseries',\n _renderCounter: 0,\n ...state,\n });\n\n this.addActivationHandler(() => {\n this._onActivate();\n });\n\n state.menu?.addActivationHandler(() => {\n this.publishEvent(new UserActionEvent({ origin: this, interaction: 'panel-menu-shown' }), true);\n });\n }\n\n private _onActivate() {\n if (!this._plugin) {\n this._loadPlugin(this.state.pluginId);\n }\n }\n\n public forceRender(): void {\n // Incrementing the render counter means VizRepeater and its children will also re-render\n this.setState({ _renderCounter: (this.state._renderCounter ?? 0) + 1});\n }\n\n private async _loadPlugin(pluginId: string, overwriteOptions?: DeepPartial<{}>, overwriteFieldConfig?: FieldConfigSource, isAfterPluginChange?: boolean) {\n const plugin = loadPanelPluginSync(pluginId);\n\n if (plugin) {\n this._pluginLoaded(plugin, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);\n } else {\n const { importPanelPlugin } = getPluginImportUtils();\n\n try {\n const result = await importPanelPlugin(pluginId);\n this._pluginLoaded(result, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);\n } catch (err: unknown) {\n this._pluginLoaded(getPanelPluginNotFound(pluginId));\n\n if (err instanceof Error) {\n this.setState({ _pluginLoadError: err.message });\n }\n }\n }\n }\n\n public getLegacyPanelId() {\n const panelId = parseInt(this.state.key!.replace('panel-', ''), 10);\n if (isNaN(panelId)) {\n return 0;\n }\n\n return panelId;\n }\n\n private async _pluginLoaded(plugin: PanelPlugin, overwriteOptions?: DeepPartial<{}>, overwriteFieldConfig?: FieldConfigSource, isAfterPluginChange?: boolean) {\n const { options, fieldConfig, title, pluginVersion, _UNSAFE_customMigrationHandler } = this.state;\n\n const panel: PanelModel = {\n title,\n options,\n fieldConfig,\n id: this.getLegacyPanelId(),\n type: plugin.meta.id,\n pluginVersion: pluginVersion,\n };\n\n if (overwriteOptions) {\n panel.options = overwriteOptions;\n }\n\n if (overwriteFieldConfig) {\n panel.fieldConfig = overwriteFieldConfig;\n }\n\n const currentVersion = this._getPluginVersion(plugin);\n\n _UNSAFE_customMigrationHandler?.(panel, plugin);\n\n if (plugin.onPanelMigration && currentVersion !== pluginVersion && !isAfterPluginChange) {\n // These migration handlers also mutate panel.fieldConfig to migrate fieldConfig\n panel.options = await plugin.onPanelMigration(panel);\n }\n\n const withDefaults = getPanelOptionsWithDefaults({\n plugin,\n currentOptions: panel.options,\n currentFieldConfig: panel.fieldConfig,\n isAfterPluginChange: isAfterPluginChange ?? false,\n });\n\n this._plugin = plugin;\n\n this.setState({\n options: withDefaults.options as DeepPartial<TOptions>,\n fieldConfig: withDefaults.fieldConfig,\n pluginVersion: currentVersion,\n pluginId: plugin.meta.id,\n });\n\n // Non data panels needs to be re-rendered when time range change\n if (plugin.meta.skipDataQuery) {\n const sceneTimeRange = sceneGraph.getTimeRange(this);\n this._subs.add(sceneTimeRange.subscribeToState(() => this.forceRender()));\n }\n }\n\n private _getPluginVersion(plugin: PanelPlugin): string {\n return plugin && plugin.meta.info.version ? plugin.meta.info.version : config.buildInfo.version;\n }\n\n public getPlugin(): PanelPlugin | undefined {\n return this._plugin;\n }\n\n public getPanelContext(): PanelContext {\n this._panelContext ??= this.buildPanelContext();\n\n return this._panelContext!;\n }\n\n public onTimeRangeChange = (timeRange: AbsoluteTimeRange) => {\n const sceneTimeRange = sceneGraph.getTimeRange(this);\n sceneTimeRange.onTimeRangeChange({\n raw: {\n from: toUtc(timeRange.from),\n to: toUtc(timeRange.to),\n },\n from: toUtc(timeRange.from),\n to: toUtc(timeRange.to),\n });\n };\n\n public getTimeRange = (data?: PanelData) => {\n const liveNowTimer = sceneGraph.findObject(this, (o) => o instanceof LiveNowTimer);\n const sceneTimeRange = sceneGraph.getTimeRange(this);\n if (liveNowTimer instanceof LiveNowTimer && liveNowTimer.isEnabled) {\n return evaluateTimeRange(\n sceneTimeRange.state.from,\n sceneTimeRange.state.to,\n sceneTimeRange.getTimeZone(),\n sceneTimeRange.state.fiscalYearStartMonth,\n sceneTimeRange.state.UNSAFE_nowDelay\n );\n }\n\n const plugin = this.getPlugin();\n if (plugin && !plugin.meta.skipDataQuery && data && data.timeRange) {\n return data.timeRange;\n }\n\n return sceneTimeRange.state.value;\n };\n\n public async changePluginType(pluginId: string, newOptions?: DeepPartial<{}>, newFieldConfig?: FieldConfigSource) {\n const {\n options: prevOptions,\n fieldConfig: prevFieldConfig,\n pluginId: prevPluginId,\n } = this.state;\n\n //clear field config cache to update it later\n this._dataWithFieldConfig = undefined;\n\n // If state.pluginId is already the correct plugin we don't treat this as plain user panel type change\n const isAfterPluginChange = this.state.pluginId !== pluginId; \n await this._loadPlugin(pluginId, newOptions ?? {}, newFieldConfig, isAfterPluginChange);\n\n const panel: PanelModel = {\n title: this.state.title,\n options: this.state.options,\n fieldConfig: this.state.fieldConfig,\n id: 1,\n type: pluginId,\n };\n\n // onPanelTypeChanged is mainly used by plugins to migrate from Angular to React. \n // For example, this will migrate options from 'graph' to 'timeseries' if the previous and new plugin ID matches. \n const updatedOptions = this._plugin?.onPanelTypeChanged?.(panel, prevPluginId, prevOptions, prevFieldConfig);\n\n if (updatedOptions && !isEmpty(updatedOptions)) {\n this.onOptionsChange(updatedOptions, true, true);\n }\n }\n\n public onTitleChange = (title: string) => {\n this.setState({ title });\n };\n\n public onDescriptionChange = (description: string) => {\n this.setState({ description });\n };\n\n public onDisplayModeChange = (displayMode: 'default' | 'transparent') => {\n this.setState({ displayMode });\n };\n\n public onOptionsChange = (optionsUpdate: DeepPartial<TOptions>, replace = false, isAfterPluginChange = false) => {\n const { fieldConfig, options } = this.state;\n\n // When replace is true, we want to replace the entire options object. Default will be applied.\n const nextOptions = replace\n ? optionsUpdate\n : mergeWith(cloneDeep(options), optionsUpdate, (objValue, srcValue, key, obj) => {\n if (isArray(srcValue)) {\n return srcValue;\n }\n // If customizer returns undefined, merging is handled by the method instead\n // so we need to override the value in the object instead\n if (objValue !== srcValue && typeof srcValue === 'undefined') {\n obj[key] = srcValue;\n return;\n }\n return;\n });\n\n const withDefaults = getPanelOptionsWithDefaults({\n plugin: this._plugin!,\n currentOptions: nextOptions,\n currentFieldConfig: fieldConfig,\n isAfterPluginChange: isAfterPluginChange,\n });\n\n this.setState({\n options: withDefaults.options as DeepPartial<TOptions>,\n _renderCounter: (this.state._renderCounter ?? 0) + 1,\n });\n };\n\n public onFieldConfigChange = (fieldConfigUpdate: FieldConfigSource<DeepPartial<TFieldConfig>>, replace?: boolean) => {\n const { fieldConfig, options } = this.state;\n\n // When replace is true, we want to replace the entire field config. Default will be applied.\n const nextFieldConfig = replace ? fieldConfigUpdate : merge(cloneDeep(fieldConfig), fieldConfigUpdate);\n\n const withDefaults = getPanelOptionsWithDefaults({\n plugin: this._plugin!,\n currentOptions: options,\n currentFieldConfig: nextFieldConfig,\n isAfterPluginChange: false,\n });\n\n this._dataWithFieldConfig = undefined;\n this.setState({ fieldConfig: withDefaults.fieldConfig });\n };\n\n public interpolate = ((value: string, scoped?: ScopedVars, format?: string | VariableCustomFormatterFn) => {\n return sceneGraph.interpolate(this, value, scoped, format);\n }) as InterpolateFunction;\n\n public getDescription = () => {\n this.publishEvent(new UserActionEvent({ origin: this, interaction: 'panel-description-shown' }), true);\n\n const { description } = this.state;\n if (description) {\n const markdown = this.interpolate(description);\n return renderMarkdown(markdown);\n }\n return '';\n };\n\n public clearFieldConfigCache() {\n this._dataWithFieldConfig = undefined;\n }\n\n /**\n * Called from the react render path to apply the field config to the data provided by the data provider\n */\n public applyFieldConfig(rawData?: PanelData): PanelData {\n const plugin = this._plugin;\n\n if (!plugin || plugin.meta.skipDataQuery || !rawData) {\n // TODO setup time range subscription instead\n return emptyPanelData;\n }\n\n // If the data is the same as last time, we can skip the field config apply step and just return same result as last time\n if (this._prevData === rawData && this._dataWithFieldConfig) {\n return this._dataWithFieldConfig;\n }\n\n const pluginDataSupport: PanelPluginDataSupport = plugin.dataSupport || { alertStates: false, annotations: false };\n\n const fieldConfigRegistry = plugin.fieldConfigRegistry;\n const prevFrames = this._dataWithFieldConfig?.series ?? [];\n const newFrames = applyFieldOverrides({\n data: rawData.series,\n fieldConfig: this.state.fieldConfig,\n fieldConfigRegistry,\n replaceVariables: this.interpolate,\n theme: config.theme2,\n timeZone: rawData.request?.timezone,\n });\n\n if (!compareArrayValues(newFrames, prevFrames, compareDataFrameStructures)) {\n this._structureRev++;\n }\n\n this._dataWithFieldConfig = {\n ...rawData,\n structureRev: this._structureRev,\n series: newFrames,\n };\n\n if (this._dataWithFieldConfig.annotations) {\n this._dataWithFieldConfig.annotations = applyFieldOverrides({\n data: this._dataWithFieldConfig.annotations,\n fieldConfig: {\n defaults: {},\n overrides: [],\n },\n fieldConfigRegistry,\n replaceVariables: this.interpolate,\n theme: config.theme2,\n timeZone: rawData.request?.timezone,\n });\n }\n\n if (!pluginDataSupport.alertStates) {\n this._dataWithFieldConfig.alertState = undefined;\n }\n\n if (!pluginDataSupport.annotations) {\n this._dataWithFieldConfig.annotations = undefined;\n }\n\n this._prevData = rawData;\n return this._dataWithFieldConfig;\n }\n\n public onCancelQuery = () => {\n this.publishEvent(new UserActionEvent({ origin: this, interaction: 'panel-cancel-query-clicked' }), true);\n const data = sceneGraph.getData(this);\n data.cancelQuery?.();\n };\n\n public onStatusMessageClick = () => {\n this.publishEvent(new UserActionEvent({ origin: this, interaction: 'panel-status-message-clicked' }), true);\n };\n\n /**\n * Panel context functions\n */\n private _onSeriesColorChange = (label: string, color: string) => {\n this.onFieldConfigChange(changeSeriesColorConfigFactory(label, color, this.state.fieldConfig));\n };\n\n private _onSeriesVisibilityChange = (label: string, mode: SeriesVisibilityChangeMode) => {\n if (!this._dataWithFieldConfig) {\n return;\n }\n\n this.onFieldConfigChange(\n seriesVisibilityConfigFactory(label, mode, this.state.fieldConfig, this._dataWithFieldConfig.series),\n true\n );\n };\n\n private _onInstanceStateChange = (state: any) => {\n if (this._panelContext) {\n this._panelContext = {\n ...this._panelContext,\n instanceState: state,\n };\n }\n\n this.setState({ _pluginInstanceState: state });\n };\n\n private _onToggleLegendSort = (sortKey: string) => {\n const legendOptions: VizLegendOptions = (this.state.options as any).legend;\n\n // We don't want to do anything when legend options are not available\n if (!legendOptions) {\n return;\n }\n\n let sortDesc = legendOptions.sortDesc;\n let sortBy = legendOptions.sortBy;\n if (sortKey !== sortBy) {\n sortDesc = undefined;\n }\n\n // if already sort ascending, disable sorting\n if (sortDesc === false) {\n sortBy = undefined;\n sortDesc = undefined;\n } else {\n sortDesc = !sortDesc;\n sortBy = sortKey;\n }\n\n this.onOptionsChange(\n {\n ...this.state.options,\n legend: { ...legendOptions, sortBy, sortDesc },\n } as TOptions,\n true\n );\n };\n\n private buildPanelContext(): PanelContext {\n const sync = getCursorSyncScope(this);\n\n const context = {\n eventsScope: sync ? sync.getEventsScope() : '__global_',\n eventBus: sync ? sync.getEventsBus(this) : getAppEvents(),\n app: CoreApp.Unknown,\n sync: () => {\n if (sync) {\n return sync.state.sync;\n }\n return DashboardCursorSync.Off;\n },\n onSeriesColorChange: this._onSeriesColorChange,\n onToggleSeriesVisibility: this._onSeriesVisibilityChange,\n onToggleLegendSort: this._onToggleLegendSort,\n onInstanceStateChange: this._onInstanceStateChange,\n };\n\n if (this.state.extendPanelContext) {\n this.state.extendPanelContext(this, context);\n }\n\n return context;\n }\n}\n\nfunction getPanelPluginNotFound(id: string): PanelPlugin {\n const plugin = new PanelPlugin(() => null);\n\n plugin.meta = {\n id: id,\n name: id,\n sort: 100,\n type: PluginType.panel,\n module: '',\n baseUrl: '',\n info: {\n author: {\n name: '',\n },\n description: '',\n links: [],\n logos: {\n large: '',\n small: 'public/img/grafana_icon.svg',\n },\n screenshots: [],\n updated: '',\n version: '',\n },\n };\n\n return plugin;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFO,MAAM,iBAA8D,eAEzE,CAAA;AAAA,EAcO,YAAY,KAAuD,EAAA;AAxG5E,IAAA,IAAA,EAAA,CAAA;AAyGI,IAAM,KAAA,CAAA,cAAA,CAAA;AAAA,MACJ,SAAS,EAAC;AAAA,MACV,aAAa,EAAE,QAAA,EAAU,EAAI,EAAA,SAAA,EAAW,EAAG,EAAA;AAAA,MAC3C,KAAO,EAAA,OAAA;AAAA,MACP,QAAU,EAAA,YAAA;AAAA,MACV,cAAgB,E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OAC7B;AAAA,MACA,qBAAqB,IAAK,CAAA,oBAAA;AAAA,MAC1B,0BAA0B,IAAK,CAAA,yBAAA;AAAA,MAC/B,oBAAoB,IAAK,CAAA,mBAAA;AAAA,MACzB,uBAAuB,IAAK,CAAA,sBAAA;AAAA,KAC9B,CAAA;AAEA,IAAI,IAAA,IAAA,CAAK,MAAM,kBAAoB,EAAA;AACjC,MAAK,IAAA,CAAA,KAAA,CAAM,kBAAmB,CAAA,IAAA,EAAM,OAAO,CAAA,CAAA;AAAA,KAC7C;AAEA,IAAO,OAAA,OAAA,CAAA;AAAA,GACT;AACF,CAAA;AA/ba,QAAA,CAGG,SAAY,GAAA,gBAAA,CAAA;AA8b5B,SAAS,uBAAuB,EAAyB,EAAA;AACvD,EAAA,MAAM,MAAS,GAAA,IAAI,WAAY,CAAA,MAAM,IAAI,CAAA,CAAA;AAEzC,EAAA,MAAA,CAAO,IAAO,GAAA;AAAA,IACZ,EAAA;AAAA,IACA,IAAM,EAAA,EAAA;AAAA,IACN,IAAM,EAAA,GAAA;AAAA,IACN,MAAM,UAAW,CAAA,KAAA;AAAA,IACjB,MAAQ,EAAA,EAAA;AAAA,IACR,OAAS,EAAA,EAAA;AAAA,IACT,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,EAAA;AAAA,OACR;AAAA,MACA,WAAa,EAAA,EAAA;AAAA,MACb,OAAO,EAAC;AAAA,MACR,KAAO,EAAA;AAAA,QACL,KAAO,EAAA,EAAA;AAAA,QACP,KAAO,EAAA,6BAAA;AAAA,OACT;AAAA,MACA,aAAa,EAAC;AAAA,MACd,OAAS,EAAA,EAAA;AAAA,MACT,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,GACF,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"VizPanel.js","sources":["../../../../src/components/VizPanel/VizPanel.tsx"],"sourcesContent":["import {\n AbsoluteTimeRange,\n FieldConfigSource,\n PanelModel,\n PanelPlugin,\n toUtc,\n getPanelOptionsWithDefaults,\n ScopedVars,\n InterpolateFunction,\n CoreApp,\n DashboardCursorSync,\n PanelData,\n compareArrayValues,\n compareDataFrameStructures,\n applyFieldOverrides,\n PluginType,\n renderMarkdown,\n PanelPluginDataSupport,\n} from '@grafana/data';\nimport { PanelContext, SeriesVisibilityChangeMode, VizLegendOptions } from '@grafana/ui';\nimport { config, getAppEvents, getPluginImportUtils } from '@grafana/runtime';\nimport { SceneObjectBase } from '../../core/SceneObjectBase';\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { DeepPartial, SceneObject, SceneObjectState } from '../../core/types';\n\nimport { VizPanelRenderer } from './VizPanelRenderer';\nimport { VizPanelMenu } from './VizPanelMenu';\nimport { VariableDependencyConfig } from '../../variables/VariableDependencyConfig';\nimport { VariableCustomFormatterFn } from '../../variables/types';\nimport { seriesVisibilityConfigFactory } from './seriesVisibilityConfigFactory';\nimport { emptyPanelData } from '../../core/SceneDataNode';\nimport { changeSeriesColorConfigFactory } from './colorSeriesConfigFactory';\nimport { loadPanelPluginSync } from './registerRuntimePanelPlugin';\nimport { getCursorSyncScope } from '../../behaviors/CursorSync';\nimport { cloneDeep, isArray, isEmpty, merge, mergeWith } from 'lodash';\nimport { UserActionEvent } from '../../core/events';\nimport { evaluateTimeRange } from '../../utils/evaluateTimeRange';\nimport { LiveNowTimer } from '../../behaviors/LiveNowTimer';\n\nexport interface VizPanelState<TOptions = {}, TFieldConfig = {}> extends SceneObjectState {\n /**\n * This is usually a plugin id that references a core plugin or an external plugin. But this can also reference a\n * runtime registered PanelPlugin registered via function registerScenePanelPlugin.\n */\n pluginId: string;\n title: string;\n description?: string;\n options: DeepPartial<TOptions>;\n fieldConfig: FieldConfigSource<DeepPartial<TFieldConfig>>;\n pluginVersion?: string;\n displayMode?: 'default' | 'transparent';\n /**\n * Only shows header on hover, absolutly positioned above the panel.\n */\n hoverHeader?: boolean;\n /**\n * Offset hoverHeader position on the y axis\n */\n hoverHeaderOffset?: number;\n /**\n * Only shows vizPanelMenu on hover if false, otherwise the menu is always visible in the header\n */\n showMenuAlways?: boolean\n /**\n * Defines a menu in the top right of the panel. The menu object is only activated when the dropdown menu itself is shown.\n * So the best way to add dynamic menu actions and links is by adding them in a behavior attached to the menu.\n */\n menu?: VizPanelMenu;\n /**\n * Defines a menu that renders panel link.\n **/\n titleItems?: React.ReactNode | SceneObject | SceneObject[];\n /**\n * Add action to the top right panel header\n */\n headerActions?: React.ReactNode | SceneObject | SceneObject[];\n /**\n * Mainly for advanced use cases that need custom handling of PanelContext callbacks.\n */\n extendPanelContext?: (vizPanel: VizPanel, context: PanelContext) => void;\n /**\n * @internal\n * Only for use from core to handle migration from old angular panels\n **/\n _UNSAFE_customMigrationHandler?: (panel: PanelModel, plugin: PanelPlugin) => void;\n /** Internal */\n _pluginLoadError?: string;\n /** Internal */\n _pluginInstanceState?: any;\n _renderCounter?: number;\n}\n\nexport class VizPanel<TOptions = {}, TFieldConfig extends {} = {}> extends SceneObjectBase<\n VizPanelState<TOptions, TFieldConfig>\n> {\n public static Component = VizPanelRenderer;\n\n protected _variableDependency = new VariableDependencyConfig(this, {\n statePaths: ['title', 'options', 'fieldConfig'],\n });\n\n // Not part of state as this is not serializable\n protected _panelContext?: PanelContext;\n private _plugin?: PanelPlugin;\n private _prevData?: PanelData;\n private _dataWithFieldConfig?: PanelData;\n private _structureRev: number = 0;\n\n public constructor(state: Partial<VizPanelState<TOptions, TFieldConfig>>) {\n super({\n options: {} as TOptions,\n fieldConfig: { defaults: {}, overrides: [] },\n title: 'Title',\n pluginId: 'timeseries',\n _renderCounter: 0,\n ...state,\n });\n\n this.addActivationHandler(() => {\n this._onActivate();\n });\n\n state.menu?.addActivationHandler(() => {\n this.publishEvent(new UserActionEvent({ origin: this, interaction: 'panel-menu-shown' }), true);\n });\n }\n\n private _onActivate() {\n if (!this._plugin) {\n this._loadPlugin(this.state.pluginId);\n }\n }\n\n public forceRender(): void {\n // Incrementing the render counter means VizRepeater and its children will also re-render\n this.setState({ _renderCounter: (this.state._renderCounter ?? 0) + 1});\n }\n\n private async _loadPlugin(pluginId: string, overwriteOptions?: DeepPartial<{}>, overwriteFieldConfig?: FieldConfigSource, isAfterPluginChange?: boolean) {\n const plugin = loadPanelPluginSync(pluginId);\n\n if (plugin) {\n this._pluginLoaded(plugin, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);\n } else {\n const { importPanelPlugin } = getPluginImportUtils();\n\n try {\n const result = await importPanelPlugin(pluginId);\n this._pluginLoaded(result, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);\n } catch (err: unknown) {\n this._pluginLoaded(getPanelPluginNotFound(pluginId));\n\n if (err instanceof Error) {\n this.setState({ _pluginLoadError: err.message });\n }\n }\n }\n }\n\n public getLegacyPanelId() {\n const panelId = parseInt(this.state.key!.replace('panel-', ''), 10);\n if (isNaN(panelId)) {\n return 0;\n }\n\n return panelId;\n }\n\n private async _pluginLoaded(plugin: PanelPlugin, overwriteOptions?: DeepPartial<{}>, overwriteFieldConfig?: FieldConfigSource, isAfterPluginChange?: boolean) {\n const { options, fieldConfig, title, pluginVersion, _UNSAFE_customMigrationHandler } = this.state;\n\n const panel: PanelModel = {\n title,\n options,\n fieldConfig,\n id: this.getLegacyPanelId(),\n type: plugin.meta.id,\n pluginVersion: pluginVersion,\n };\n\n if (overwriteOptions) {\n panel.options = overwriteOptions;\n }\n\n if (overwriteFieldConfig) {\n panel.fieldConfig = overwriteFieldConfig;\n }\n\n const currentVersion = this._getPluginVersion(plugin);\n\n _UNSAFE_customMigrationHandler?.(panel, plugin);\n\n if (plugin.onPanelMigration && currentVersion !== pluginVersion && !isAfterPluginChange) {\n // These migration handlers also mutate panel.fieldConfig to migrate fieldConfig\n panel.options = await plugin.onPanelMigration(panel);\n }\n\n const withDefaults = getPanelOptionsWithDefaults({\n plugin,\n currentOptions: panel.options,\n currentFieldConfig: panel.fieldConfig,\n isAfterPluginChange: isAfterPluginChange ?? false,\n });\n\n this._plugin = plugin;\n\n this.setState({\n options: withDefaults.options as DeepPartial<TOptions>,\n fieldConfig: withDefaults.fieldConfig,\n pluginVersion: currentVersion,\n pluginId: plugin.meta.id,\n });\n\n // Non data panels needs to be re-rendered when time range change\n if (plugin.meta.skipDataQuery) {\n const sceneTimeRange = sceneGraph.getTimeRange(this);\n this._subs.add(sceneTimeRange.subscribeToState(() => this.forceRender()));\n }\n }\n\n private _getPluginVersion(plugin: PanelPlugin): string {\n return plugin && plugin.meta.info.version ? plugin.meta.info.version : config.buildInfo.version;\n }\n\n public getPlugin(): PanelPlugin | undefined {\n return this._plugin;\n }\n\n public getPanelContext(): PanelContext {\n this._panelContext ??= this.buildPanelContext();\n\n return this._panelContext!;\n }\n\n public onTimeRangeChange = (timeRange: AbsoluteTimeRange) => {\n const sceneTimeRange = sceneGraph.getTimeRange(this);\n sceneTimeRange.onTimeRangeChange({\n raw: {\n from: toUtc(timeRange.from),\n to: toUtc(timeRange.to),\n },\n from: toUtc(timeRange.from),\n to: toUtc(timeRange.to),\n });\n };\n\n public getTimeRange = (data?: PanelData) => {\n const liveNowTimer = sceneGraph.findObject(this, (o) => o instanceof LiveNowTimer);\n const sceneTimeRange = sceneGraph.getTimeRange(this);\n if (liveNowTimer instanceof LiveNowTimer && liveNowTimer.isEnabled) {\n return evaluateTimeRange(\n sceneTimeRange.state.from,\n sceneTimeRange.state.to,\n sceneTimeRange.getTimeZone(),\n sceneTimeRange.state.fiscalYearStartMonth,\n sceneTimeRange.state.UNSAFE_nowDelay\n );\n }\n\n const plugin = this.getPlugin();\n if (plugin && !plugin.meta.skipDataQuery && data && data.timeRange) {\n return data.timeRange;\n }\n\n return sceneTimeRange.state.value;\n };\n\n public async changePluginType(pluginId: string, newOptions?: DeepPartial<{}>, newFieldConfig?: FieldConfigSource) {\n const {\n options: prevOptions,\n fieldConfig: prevFieldConfig,\n pluginId: prevPluginId,\n } = this.state;\n\n //clear field config cache to update it later\n this._dataWithFieldConfig = undefined;\n\n // If state.pluginId is already the correct plugin we don't treat this as plain user panel type change\n const isAfterPluginChange = this.state.pluginId !== pluginId; \n await this._loadPlugin(pluginId, newOptions ?? {}, newFieldConfig, isAfterPluginChange);\n\n const panel: PanelModel = {\n title: this.state.title,\n options: this.state.options,\n fieldConfig: this.state.fieldConfig,\n id: 1,\n type: pluginId,\n };\n\n // onPanelTypeChanged is mainly used by plugins to migrate from Angular to React. \n // For example, this will migrate options from 'graph' to 'timeseries' if the previous and new plugin ID matches. \n const updatedOptions = this._plugin?.onPanelTypeChanged?.(panel, prevPluginId, prevOptions, prevFieldConfig);\n\n if (updatedOptions && !isEmpty(updatedOptions)) {\n this.onOptionsChange(updatedOptions, true, true);\n }\n }\n\n public onTitleChange = (title: string) => {\n this.setState({ title });\n };\n\n public onDescriptionChange = (description: string) => {\n this.setState({ description });\n };\n\n public onDisplayModeChange = (displayMode: 'default' | 'transparent') => {\n this.setState({ displayMode });\n };\n\n public onOptionsChange = (optionsUpdate: DeepPartial<TOptions>, replace = false, isAfterPluginChange = false) => {\n const { fieldConfig, options } = this.state;\n\n // When replace is true, we want to replace the entire options object. Default will be applied.\n const nextOptions = replace\n ? optionsUpdate\n : mergeWith(cloneDeep(options), optionsUpdate, (objValue, srcValue, key, obj) => {\n if (isArray(srcValue)) {\n return srcValue;\n }\n // If customizer returns undefined, merging is handled by the method instead\n // so we need to override the value in the object instead\n if (objValue !== srcValue && typeof srcValue === 'undefined') {\n obj[key] = srcValue;\n return;\n }\n return;\n });\n\n const withDefaults = getPanelOptionsWithDefaults({\n plugin: this._plugin!,\n currentOptions: nextOptions,\n currentFieldConfig: fieldConfig,\n isAfterPluginChange: isAfterPluginChange,\n });\n\n this.setState({\n options: withDefaults.options as DeepPartial<TOptions>,\n _renderCounter: (this.state._renderCounter ?? 0) + 1,\n });\n };\n\n public onFieldConfigChange = (fieldConfigUpdate: FieldConfigSource<DeepPartial<TFieldConfig>>, replace?: boolean) => {\n const { fieldConfig, options } = this.state;\n\n // When replace is true, we want to replace the entire field config. Default will be applied.\n const nextFieldConfig = replace ? fieldConfigUpdate : merge(cloneDeep(fieldConfig), fieldConfigUpdate);\n\n const withDefaults = getPanelOptionsWithDefaults({\n plugin: this._plugin!,\n currentOptions: options,\n currentFieldConfig: nextFieldConfig,\n isAfterPluginChange: false,\n });\n\n this._dataWithFieldConfig = undefined;\n this.setState({ fieldConfig: withDefaults.fieldConfig });\n };\n\n public interpolate = ((value: string, scoped?: ScopedVars, format?: string | VariableCustomFormatterFn) => {\n return sceneGraph.interpolate(this, value, scoped, format);\n }) as InterpolateFunction;\n\n public getDescription = () => {\n this.publishEvent(new UserActionEvent({ origin: this, interaction: 'panel-description-shown' }), true);\n\n const { description } = this.state;\n if (description) {\n const markdown = this.interpolate(description);\n return renderMarkdown(markdown);\n }\n return '';\n };\n\n public clearFieldConfigCache() {\n this._dataWithFieldConfig = undefined;\n }\n\n /**\n * Called from the react render path to apply the field config to the data provided by the data provider\n */\n public applyFieldConfig(rawData?: PanelData): PanelData {\n const plugin = this._plugin;\n\n if (!plugin || plugin.meta.skipDataQuery || !rawData) {\n // TODO setup time range subscription instead\n return emptyPanelData;\n }\n\n // If the data is the same as last time, we can skip the field config apply step and just return same result as last time\n if (this._prevData === rawData && this._dataWithFieldConfig) {\n return this._dataWithFieldConfig;\n }\n\n const pluginDataSupport: PanelPluginDataSupport = plugin.dataSupport || { alertStates: false, annotations: false };\n\n const fieldConfigRegistry = plugin.fieldConfigRegistry;\n const prevFrames = this._dataWithFieldConfig?.series ?? [];\n const newFrames = applyFieldOverrides({\n data: rawData.series,\n fieldConfig: this.state.fieldConfig,\n fieldConfigRegistry,\n replaceVariables: this.interpolate,\n theme: config.theme2,\n timeZone: rawData.request?.timezone,\n });\n\n if (!compareArrayValues(newFrames, prevFrames, compareDataFrameStructures)) {\n this._structureRev++;\n }\n\n this._dataWithFieldConfig = {\n ...rawData,\n structureRev: this._structureRev,\n series: newFrames,\n };\n\n if (this._dataWithFieldConfig.annotations) {\n this._dataWithFieldConfig.annotations = applyFieldOverrides({\n data: this._dataWithFieldConfig.annotations,\n fieldConfig: {\n defaults: {},\n overrides: [],\n },\n fieldConfigRegistry,\n replaceVariables: this.interpolate,\n theme: config.theme2,\n timeZone: rawData.request?.timezone,\n });\n }\n\n if (!pluginDataSupport.alertStates) {\n this._dataWithFieldConfig.alertState = undefined;\n }\n\n if (!pluginDataSupport.annotations) {\n this._dataWithFieldConfig.annotations = undefined;\n }\n\n this._prevData = rawData;\n return this._dataWithFieldConfig;\n }\n\n public onCancelQuery = () => {\n this.publishEvent(new UserActionEvent({ origin: this, interaction: 'panel-cancel-query-clicked' }), true);\n const data = sceneGraph.getData(this);\n data.cancelQuery?.();\n };\n\n public onStatusMessageClick = () => {\n this.publishEvent(new UserActionEvent({ origin: this, interaction: 'panel-status-message-clicked' }), true);\n };\n\n /**\n * Panel context functions\n */\n private _onSeriesColorChange = (label: string, color: string) => {\n this.onFieldConfigChange(changeSeriesColorConfigFactory(label, color, this.state.fieldConfig));\n };\n\n private _onSeriesVisibilityChange = (label: string, mode: SeriesVisibilityChangeMode) => {\n if (!this._dataWithFieldConfig) {\n return;\n }\n\n this.onFieldConfigChange(\n seriesVisibilityConfigFactory(label, mode, this.state.fieldConfig, this._dataWithFieldConfig.series),\n true\n );\n };\n\n private _onInstanceStateChange = (state: any) => {\n if (this._panelContext) {\n this._panelContext = {\n ...this._panelContext,\n instanceState: state,\n };\n }\n\n this.setState({ _pluginInstanceState: state });\n };\n\n private _onToggleLegendSort = (sortKey: string) => {\n const legendOptions: VizLegendOptions = (this.state.options as any).legend;\n\n // We don't want to do anything when legend options are not available\n if (!legendOptions) {\n return;\n }\n\n let sortDesc = legendOptions.sortDesc;\n let sortBy = legendOptions.sortBy;\n if (sortKey !== sortBy) {\n sortDesc = undefined;\n }\n\n // if already sort ascending, disable sorting\n if (sortDesc === false) {\n sortBy = undefined;\n sortDesc = undefined;\n } else {\n sortDesc = !sortDesc;\n sortBy = sortKey;\n }\n\n this.onOptionsChange(\n {\n ...this.state.options,\n legend: { ...legendOptions, sortBy, sortDesc },\n } as TOptions,\n true\n );\n };\n\n private buildPanelContext(): PanelContext {\n const sync = getCursorSyncScope(this);\n\n const context = {\n eventsScope: sync ? sync.getEventsScope() : '__global_',\n eventBus: sync ? sync.getEventsBus(this) : getAppEvents(),\n app: CoreApp.Unknown,\n sync: () => {\n if (sync) {\n return sync.state.sync;\n }\n return DashboardCursorSync.Off;\n },\n onSeriesColorChange: this._onSeriesColorChange,\n onToggleSeriesVisibility: this._onSeriesVisibilityChange,\n onToggleLegendSort: this._onToggleLegendSort,\n onInstanceStateChange: this._onInstanceStateChange,\n };\n\n if (this.state.extendPanelContext) {\n this.state.extendPanelContext(this, context);\n }\n\n return context;\n }\n}\n\nfunction getPanelPluginNotFound(id: string): PanelPlugin {\n const plugin = new PanelPlugin(() => null);\n\n plugin.meta = {\n id: id,\n name: id,\n sort: 100,\n type: PluginType.panel,\n module: '',\n baseUrl: '',\n info: {\n author: {\n name: '',\n },\n description: '',\n links: [],\n logos: {\n large: '',\n small: 'public/img/grafana_icon.svg',\n },\n screenshots: [],\n updated: '',\n version: '',\n },\n };\n\n return plugin;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FO,MAAM,iBAA8D,eAEzE,CAAA;AAAA,EAcO,YAAY,KAAuD,EAAA;AA5G5E,IAAA,IAAA,EAAA,CAAA;AA6GI,IAAM,KAAA,CAAA,cAAA,CAAA;AAAA,MACJ,SAAS,EAAC;AAAA,MACV,aAAa,EAAE,QAAA,EAAU,EAAI,EAAA,SAAA,EAAW,EAAG,EAAA;AAAA,MAC3C,KAAO,EAAA,OAAA;AAAA,MACP,QAAU,EAAA,YAAA;AAAA,MACV,cAAgB,EAAA,CAAA;AAAA,KAAA,EACb,KACJ,CAAA,CAAA,CAAA;AAnBH,IAAU,IAAA,CAAA,mBAAA,GAAsB,IAAI,wBAAA,CAAyB,IAAM,EAAA;AAAA,MACjE,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,uBAAuB,IAAK,CAAA,sBAAA;AAAA,KAC9B,CAAA;AAEA,IAAI,IAAA,IAAA,CAAK,MAAM,kBAAoB,EAAA;AACjC,MAAK,IAAA,CAAA,KAAA,CAAM,kBAAmB,CAAA,IAAA,EAAM,OAAO,CAAA,CAAA;AAAA,KAC7C;AAEA,IAAO,OAAA,OAAA,CAAA;AAAA,GACT;AACF,CAAA;AA/ba,QAAA,CAGG,SAAY,GAAA,gBAAA,CAAA;AA8b5B,SAAS,uBAAuB,EAAyB,EAAA;AACvD,EAAA,MAAM,MAAS,GAAA,IAAI,WAAY,CAAA,MAAM,IAAI,CAAA,CAAA;AAEzC,EAAA,MAAA,CAAO,IAAO,GAAA;AAAA,IACZ,EAAA;AAAA,IACA,IAAM,EAAA,EAAA;AAAA,IACN,IAAM,EAAA,GAAA;AAAA,IACN,MAAM,UAAW,CAAA,KAAA;AAAA,IACjB,MAAQ,EAAA,EAAA;AAAA,IACR,OAAS,EAAA,EAAA;AAAA,IACT,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,EAAA;AAAA,OACR;AAAA,MACA,WAAa,EAAA,EAAA;AAAA,MACb,OAAO,EAAC;AAAA,MACR,KAAO,EAAA;AAAA,QACL,KAAO,EAAA,EAAA;AAAA,QACP,KAAO,EAAA,6BAAA;AAAA,OACT;AAAA,MACA,aAAa,EAAC;AAAA,MACd,OAAS,EAAA,EAAA;AAAA,MACT,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,GACF,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -17,6 +17,7 @@ function VizPanelRenderer({ model }) {
17
17
  _pluginLoadError,
18
18
  displayMode,
19
19
  hoverHeader,
20
+ showMenuAlways,
20
21
  hoverHeaderOffset,
21
22
  menu,
22
23
  headerActions,
@@ -138,6 +139,7 @@ function VizPanelRenderer({ model }) {
138
139
  width,
139
140
  height,
140
141
  displayMode,
142
+ showMenuAlways,
141
143
  hoverHeader,
142
144
  hoverHeaderOffset,
143
145
  titleItems: titleItemsElement,
@@ -1 +1 @@
1
- {"version":3,"file":"VizPanelRenderer.js","sources":["../../../../src/components/VizPanel/VizPanelRenderer.tsx"],"sourcesContent":["import React, { RefCallback, useCallback, useMemo } from 'react';\nimport { useMeasure } from 'react-use';\n\n// @ts-ignore\nimport { AlertState, GrafanaTheme2, PanelData, PluginContextProvider, SetPanelAttentionEvent } from '@grafana/data';\n\nimport { getAppEvents } from '@grafana/runtime';\nimport { PanelChrome, ErrorBoundaryAlert, PanelContextProvider, Tooltip, useStyles2, Icon } from '@grafana/ui';\n\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { isSceneObject, SceneComponentProps, SceneLayout, SceneObject } from '../../core/types';\n\nimport { VizPanel } from './VizPanel';\nimport { css, cx } from '@emotion/css';\nimport { debounce } from 'lodash';\n\nexport function VizPanelRenderer({ model }: SceneComponentProps<VizPanel>) {\n const {\n title,\n options,\n fieldConfig,\n _pluginLoadError,\n displayMode,\n hoverHeader,\n hoverHeaderOffset,\n menu,\n headerActions,\n titleItems,\n description,\n _renderCounter = 0,\n } = model.useState();\n const [ref, { width, height }] = useMeasure();\n const appEvents = useMemo(() => getAppEvents(), []);\n\n const setPanelAttention = useCallback(() => {\n appEvents.publish(new SetPanelAttentionEvent({ panelId: model.state.key }));\n }, [model.state.key, appEvents]);\n const debouncedMouseMove = useMemo(\n () => debounce(setPanelAttention, 100, { leading: true, trailing: false }),\n [setPanelAttention]\n );\n\n const plugin = model.getPlugin();\n\n const { dragClass, dragClassCancel } = getDragClasses(model);\n const dataObject = sceneGraph.getData(model);\n\n const rawData = dataObject.useState();\n const dataWithFieldConfig = model.applyFieldConfig(rawData.data!);\n const sceneTimeRange = sceneGraph.getTimeRange(model);\n const timeZone = sceneTimeRange.getTimeZone();\n const timeRange = model.getTimeRange(dataWithFieldConfig);\n\n // Interpolate title\n const titleInterpolated = model.interpolate(title, undefined, 'text');\n\n const alertStateStyles = useStyles2(getAlertStateStyles);\n\n if (!plugin) {\n return <div>Loading plugin panel...</div>;\n }\n\n if (!plugin.panel) {\n return <div>Panel plugin has no panel component</div>;\n }\n\n const PanelComponent = plugin.panel;\n\n // If we have a query runner on our level inform it of the container width (used to set auto max data points)\n if (dataObject && dataObject.setContainerWidth) {\n dataObject.setContainerWidth(Math.round(width));\n }\n\n let titleItemsElement: React.ReactNode[] = [];\n\n if (titleItems) {\n if (Array.isArray(titleItems)) {\n titleItemsElement = titleItemsElement.concat(\n titleItems.map((titleItem) => {\n return <titleItem.Component model={titleItem} key={`${titleItem.state.key}`} />;\n })\n );\n } else if (isSceneObject(titleItems)) {\n titleItemsElement.push(<titleItems.Component model={titleItems} />);\n } else {\n titleItemsElement.push(titleItems);\n }\n }\n\n // If we have local time range show that in panel header\n if (model.state.$timeRange) {\n titleItemsElement.push(<model.state.$timeRange.Component model={model.state.$timeRange} key={model.state.key} />);\n }\n\n if (dataWithFieldConfig.alertState) {\n titleItemsElement.push(\n <Tooltip content={dataWithFieldConfig.alertState.state ?? 'unknown'} key={`alert-states-icon-${model.state.key}`}>\n <PanelChrome.TitleItem\n className={cx({\n [alertStateStyles.ok]: dataWithFieldConfig.alertState.state === AlertState.OK,\n [alertStateStyles.pending]: dataWithFieldConfig.alertState.state === AlertState.Pending,\n [alertStateStyles.alerting]: dataWithFieldConfig.alertState.state === AlertState.Alerting,\n })}\n >\n <Icon\n name={dataWithFieldConfig.alertState.state === 'alerting' ? 'heart-break' : 'heart'}\n className=\"panel-alert-icon\"\n size=\"md\"\n />\n </PanelChrome.TitleItem>\n </Tooltip>\n );\n }\n\n let panelMenu;\n if (menu) {\n panelMenu = <menu.Component model={menu} />;\n }\n\n let actionsElement: React.ReactNode | undefined;\n\n if (headerActions) {\n if (Array.isArray(headerActions)) {\n actionsElement = (\n <>\n {headerActions.map((action) => {\n return <action.Component model={action} key={`${action.state.key}`} />;\n })}\n </>\n );\n } else if (isSceneObject(headerActions)) {\n actionsElement = <headerActions.Component model={headerActions} />;\n } else {\n actionsElement = headerActions;\n }\n }\n\n // Data is always returned. For non-data panels, empty PanelData is returned.\n const data = dataWithFieldConfig!;\n\n const isReadyToRender = dataObject.isDataReadyToDisplay ? dataObject.isDataReadyToDisplay() : true;\n\n const context = model.getPanelContext();\n const panelId = model.getLegacyPanelId();\n\n return (\n <div className={relativeWrapper}>\n <div ref={ref as RefCallback<HTMLDivElement>} className={absoluteWrapper} data-viz-panel-key={model.state.key}>\n {width > 0 && height > 0 && (\n <PanelChrome\n title={titleInterpolated}\n description={description?.trim() ? model.getDescription : undefined}\n loadingState={data.state}\n statusMessage={getChromeStatusMessage(data, _pluginLoadError)}\n statusMessageOnClick={model.onStatusMessageClick}\n width={width}\n height={height}\n displayMode={displayMode}\n hoverHeader={hoverHeader}\n hoverHeaderOffset={hoverHeaderOffset}\n titleItems={titleItemsElement}\n dragClass={dragClass}\n actions={actionsElement}\n dragClassCancel={dragClassCancel}\n padding={plugin.noPadding ? 'none' : 'md'}\n menu={panelMenu}\n onCancelQuery={model.onCancelQuery}\n // @ts-ignore\n onFocus={setPanelAttention}\n onMouseEnter={setPanelAttention}\n onMouseMove={debouncedMouseMove}\n >\n {(innerWidth, innerHeight) => (\n <>\n <ErrorBoundaryAlert dependencies={[plugin, data]}>\n <PluginContextProvider meta={plugin.meta}>\n <PanelContextProvider value={context}>\n {isReadyToRender && (\n <PanelComponent\n id={panelId}\n data={data}\n title={title}\n timeRange={timeRange}\n timeZone={timeZone}\n options={options}\n fieldConfig={fieldConfig}\n transparent={false}\n width={innerWidth}\n height={innerHeight}\n renderCounter={_renderCounter}\n replaceVariables={model.interpolate}\n onOptionsChange={model.onOptionsChange}\n onFieldConfigChange={model.onFieldConfigChange}\n onChangeTimeRange={model.onTimeRangeChange}\n eventBus={context.eventBus}\n />\n )}\n </PanelContextProvider>\n </PluginContextProvider>\n </ErrorBoundaryAlert>\n </>\n )}\n </PanelChrome>\n )}\n </div>\n </div>\n );\n}\n\nfunction getDragClasses(panel: VizPanel) {\n const parentLayout = sceneGraph.getLayout(panel);\n const isDraggable = parentLayout?.isDraggable();\n\n if (!parentLayout || !isDraggable || itemDraggingDisabled(panel, parentLayout)) {\n return { dragClass: '', dragClassCancel: '' };\n }\n\n return { dragClass: parentLayout.getDragClass?.(), dragClassCancel: parentLayout?.getDragClassCancel?.() };\n}\n\n/**\n * Walks up the parent chain until it hits the layout object, trying to find the closest SceneGridItemLike ancestor.\n * It is not always the direct parent, because the VizPanel can be wrapped in other objects.\n */\nfunction itemDraggingDisabled(item: SceneObject, layout: SceneLayout) {\n let ancestor = item.parent;\n\n while (ancestor && ancestor !== layout) {\n if ('isDraggable' in ancestor.state && ancestor.state.isDraggable === false) {\n return true;\n }\n\n ancestor = ancestor.parent;\n }\n\n return false;\n}\n\nfunction getChromeStatusMessage(data: PanelData, pluginLoadingError: string | undefined) {\n if (pluginLoadingError) {\n return pluginLoadingError;\n }\n\n let message = data.error ? data.error.message : undefined;\n\n // Handling multiple errors with a single string until we integrate VizPanel with inspector\n if (data.errors) {\n message = data.errors.map((e) => e.message).join(', ');\n }\n return message;\n}\n\nconst relativeWrapper = css({\n position: 'relative',\n width: '100%',\n height: '100%',\n});\n\n/**\n * Sadly this this absolute wrapper is needed for the panel to adopt smaller sizes.\n * The combo of useMeasure and PanelChrome makes the panel take up the width it get's but that makes it impossible to\n * Then adapt to smaller space (say resizing the browser window or undocking menu).\n */\nconst absoluteWrapper = css({\n position: 'absolute',\n width: '100%',\n height: '100%',\n});\n\nconst getAlertStateStyles = (theme: GrafanaTheme2) => {\n return {\n ok: css({\n color: theme.colors.success.text,\n }),\n pending: css({\n color: theme.colors.warning.text,\n }),\n alerting: css({\n color: theme.colors.error.text,\n }),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;AAgBgB,SAAA,gBAAA,CAAiB,EAAE,KAAA,EAAwC,EAAA;AAhB3E,EAAA,IAAA,EAAA,CAAA;AAiBE,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;A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AA,CAAC,MAAM,CAAE,CAAA,OAAO,CAAE,CAAA,IAAA,CAAK,IAAI,CAAA,CAAA;AAAA,GACvD;AACA,EAAO,OAAA,OAAA,CAAA;AACT,CAAA;AAEA,MAAM,kBAAkB,GAAI,CAAA;AAAA,EAC1B,QAAU,EAAA,UAAA;AAAA,EACV,KAAO,EAAA,MAAA;AAAA,EACP,MAAQ,EAAA,MAAA;AACV,CAAC,CAAA,CAAA;AAOD,MAAM,kBAAkB,GAAI,CAAA;AAAA,EAC1B,QAAU,EAAA,UAAA;AAAA,EACV,KAAO,EAAA,MAAA;AAAA,EACP,MAAQ,EAAA,MAAA;AACV,CAAC,CAAA,CAAA;AAED,MAAM,mBAAA,GAAsB,CAAC,KAAyB,KAAA;AACpD,EAAO,OAAA;AAAA,IACL,IAAI,GAAI,CAAA;AAAA,MACN,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,OAAQ,CAAA,IAAA;AAAA,KAC7B,CAAA;AAAA,IACD,SAAS,GAAI,CAAA;AAAA,MACX,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,OAAQ,CAAA,IAAA;AAAA,KAC7B,CAAA;AAAA,IACD,UAAU,GAAI,CAAA;AAAA,MACZ,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,KAAM,CAAA,IAAA;AAAA,KAC3B,CAAA;AAAA,GACH,CAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"VizPanelRenderer.js","sources":["../../../../src/components/VizPanel/VizPanelRenderer.tsx"],"sourcesContent":["import React, { RefCallback, useCallback, useMemo } from 'react';\nimport { useMeasure } from 'react-use';\n\n// @ts-ignore\nimport { AlertState, GrafanaTheme2, PanelData, PluginContextProvider, SetPanelAttentionEvent } from '@grafana/data';\n\nimport { getAppEvents } from '@grafana/runtime';\nimport { PanelChrome, ErrorBoundaryAlert, PanelContextProvider, Tooltip, useStyles2, Icon } from '@grafana/ui';\n\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { isSceneObject, SceneComponentProps, SceneLayout, SceneObject } from '../../core/types';\n\nimport { VizPanel } from './VizPanel';\nimport { css, cx } from '@emotion/css';\nimport { debounce } from 'lodash';\n\nexport function VizPanelRenderer({ model }: SceneComponentProps<VizPanel>) {\n const {\n title,\n options,\n fieldConfig,\n _pluginLoadError,\n displayMode,\n hoverHeader,\n showMenuAlways,\n hoverHeaderOffset,\n menu,\n headerActions,\n titleItems,\n description,\n _renderCounter = 0,\n } = model.useState();\n const [ref, { width, height }] = useMeasure();\n const appEvents = useMemo(() => getAppEvents(), []);\n\n const setPanelAttention = useCallback(() => {\n appEvents.publish(new SetPanelAttentionEvent({ panelId: model.state.key }));\n }, [model.state.key, appEvents]);\n const debouncedMouseMove = useMemo(\n () => debounce(setPanelAttention, 100, { leading: true, trailing: false }),\n [setPanelAttention]\n );\n\n const plugin = model.getPlugin();\n\n const { dragClass, dragClassCancel } = getDragClasses(model);\n const dataObject = sceneGraph.getData(model);\n\n const rawData = dataObject.useState();\n const dataWithFieldConfig = model.applyFieldConfig(rawData.data!);\n const sceneTimeRange = sceneGraph.getTimeRange(model);\n const timeZone = sceneTimeRange.getTimeZone();\n const timeRange = model.getTimeRange(dataWithFieldConfig);\n\n // Interpolate title\n const titleInterpolated = model.interpolate(title, undefined, 'text');\n\n const alertStateStyles = useStyles2(getAlertStateStyles);\n\n if (!plugin) {\n return <div>Loading plugin panel...</div>;\n }\n\n if (!plugin.panel) {\n return <div>Panel plugin has no panel component</div>;\n }\n\n const PanelComponent = plugin.panel;\n\n // If we have a query runner on our level inform it of the container width (used to set auto max data points)\n if (dataObject && dataObject.setContainerWidth) {\n dataObject.setContainerWidth(Math.round(width));\n }\n\n let titleItemsElement: React.ReactNode[] = [];\n\n if (titleItems) {\n if (Array.isArray(titleItems)) {\n titleItemsElement = titleItemsElement.concat(\n titleItems.map((titleItem) => {\n return <titleItem.Component model={titleItem} key={`${titleItem.state.key}`} />;\n })\n );\n } else if (isSceneObject(titleItems)) {\n titleItemsElement.push(<titleItems.Component model={titleItems} />);\n } else {\n titleItemsElement.push(titleItems);\n }\n }\n\n // If we have local time range show that in panel header\n if (model.state.$timeRange) {\n titleItemsElement.push(<model.state.$timeRange.Component model={model.state.$timeRange} key={model.state.key} />);\n }\n\n if (dataWithFieldConfig.alertState) {\n titleItemsElement.push(\n <Tooltip content={dataWithFieldConfig.alertState.state ?? 'unknown'} key={`alert-states-icon-${model.state.key}`}>\n <PanelChrome.TitleItem\n className={cx({\n [alertStateStyles.ok]: dataWithFieldConfig.alertState.state === AlertState.OK,\n [alertStateStyles.pending]: dataWithFieldConfig.alertState.state === AlertState.Pending,\n [alertStateStyles.alerting]: dataWithFieldConfig.alertState.state === AlertState.Alerting,\n })}\n >\n <Icon\n name={dataWithFieldConfig.alertState.state === 'alerting' ? 'heart-break' : 'heart'}\n className=\"panel-alert-icon\"\n size=\"md\"\n />\n </PanelChrome.TitleItem>\n </Tooltip>\n );\n }\n\n let panelMenu;\n if (menu) {\n panelMenu = <menu.Component model={menu} />;\n }\n\n let actionsElement: React.ReactNode | undefined;\n\n if (headerActions) {\n if (Array.isArray(headerActions)) {\n actionsElement = (\n <>\n {headerActions.map((action) => {\n return <action.Component model={action} key={`${action.state.key}`} />;\n })}\n </>\n );\n } else if (isSceneObject(headerActions)) {\n actionsElement = <headerActions.Component model={headerActions} />;\n } else {\n actionsElement = headerActions;\n }\n }\n\n // Data is always returned. For non-data panels, empty PanelData is returned.\n const data = dataWithFieldConfig!;\n\n const isReadyToRender = dataObject.isDataReadyToDisplay ? dataObject.isDataReadyToDisplay() : true;\n\n const context = model.getPanelContext();\n const panelId = model.getLegacyPanelId();\n\n return (\n <div className={relativeWrapper}>\n <div ref={ref as RefCallback<HTMLDivElement>} className={absoluteWrapper} data-viz-panel-key={model.state.key}>\n {width > 0 && height > 0 && (\n <PanelChrome\n title={titleInterpolated}\n description={description?.trim() ? model.getDescription : undefined}\n loadingState={data.state}\n statusMessage={getChromeStatusMessage(data, _pluginLoadError)}\n statusMessageOnClick={model.onStatusMessageClick}\n width={width}\n height={height}\n displayMode={displayMode}\n //@ts-expect-error Remove when 11.4 is released: https://github.com/grafana/grafana/pull/96868\n showMenuAlways={showMenuAlways}\n hoverHeader={hoverHeader}\n hoverHeaderOffset={hoverHeaderOffset}\n titleItems={titleItemsElement}\n dragClass={dragClass}\n actions={actionsElement}\n dragClassCancel={dragClassCancel}\n padding={plugin.noPadding ? 'none' : 'md'}\n menu={panelMenu}\n onCancelQuery={model.onCancelQuery}\n // @ts-ignore\n onFocus={setPanelAttention}\n onMouseEnter={setPanelAttention}\n onMouseMove={debouncedMouseMove}\n >\n {(innerWidth, innerHeight) => (\n <>\n <ErrorBoundaryAlert dependencies={[plugin, data]}>\n <PluginContextProvider meta={plugin.meta}>\n <PanelContextProvider value={context}>\n {isReadyToRender && (\n <PanelComponent\n id={panelId}\n data={data}\n title={title}\n timeRange={timeRange}\n timeZone={timeZone}\n options={options}\n fieldConfig={fieldConfig}\n transparent={false}\n width={innerWidth}\n height={innerHeight}\n renderCounter={_renderCounter}\n replaceVariables={model.interpolate}\n onOptionsChange={model.onOptionsChange}\n onFieldConfigChange={model.onFieldConfigChange}\n onChangeTimeRange={model.onTimeRangeChange}\n eventBus={context.eventBus}\n />\n )}\n </PanelContextProvider>\n </PluginContextProvider>\n </ErrorBoundaryAlert>\n </>\n )}\n </PanelChrome>\n )}\n </div>\n </div>\n );\n}\n\nfunction getDragClasses(panel: VizPanel) {\n const parentLayout = sceneGraph.getLayout(panel);\n const isDraggable = parentLayout?.isDraggable();\n\n if (!parentLayout || !isDraggable || itemDraggingDisabled(panel, parentLayout)) {\n return { dragClass: '', dragClassCancel: '' };\n }\n\n return { dragClass: parentLayout.getDragClass?.(), dragClassCancel: parentLayout?.getDragClassCancel?.() };\n}\n\n/**\n * Walks up the parent chain until it hits the layout object, trying to find the closest SceneGridItemLike ancestor.\n * It is not always the direct parent, because the VizPanel can be wrapped in other objects.\n */\nfunction itemDraggingDisabled(item: SceneObject, layout: SceneLayout) {\n let ancestor = item.parent;\n\n while (ancestor && ancestor !== layout) {\n if ('isDraggable' in ancestor.state && ancestor.state.isDraggable === false) {\n return true;\n }\n\n ancestor = ancestor.parent;\n }\n\n return false;\n}\n\nfunction getChromeStatusMessage(data: PanelData, pluginLoadingError: string | undefined) {\n if (pluginLoadingError) {\n return pluginLoadingError;\n }\n\n let message = data.error ? data.error.message : undefined;\n\n // Handling multiple errors with a single string until we integrate VizPanel with inspector\n if (data.errors) {\n message = data.errors.map((e) => e.message).join(', ');\n }\n return message;\n}\n\nconst relativeWrapper = css({\n position: 'relative',\n width: '100%',\n height: '100%',\n});\n\n/**\n * Sadly this this absolute wrapper is needed for the panel to adopt smaller sizes.\n * The combo of useMeasure and PanelChrome makes the panel take up the width it get's but that makes it impossible to\n * Then adapt to smaller space (say resizing the browser window or undocking menu).\n */\nconst absoluteWrapper = css({\n position: 'absolute',\n width: '100%',\n height: '100%',\n});\n\nconst getAlertStateStyles = (theme: GrafanaTheme2) => {\n return {\n ok: css({\n color: theme.colors.success.text,\n }),\n pending: css({\n color: theme.colors.warning.text,\n }),\n alerting: css({\n color: theme.colors.error.text,\n }),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;AAgBgB,SAAA,gBAAA,CAAiB,EAAE,KAAA,EAAwC,EAAA;AAhB3E,EAAA,IAAA,EAAA,CAAA;AAiBE,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,gBAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,iBAAA;AAAA,IACA,IAAA;AAAA,IACA,aAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAiB,GAAA,CAAA;AAAA,GACnB,GAAI,MAAM,QAAS,EAAA,CAAA;AACnB,EAAA,MAAM,CAAC,GAAK,EAAA,EAAE,OAAO,MAAO,EAAC,IAAI,UAAW,EAAA,CAAA;AAC5C,EAAA,MAAM,YAAY,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,QAAU,EAAA,UAAA;AAAA,EACV,KAAO,EAAA,MAAA;AAAA,EACP,MAAQ,EAAA,MAAA;AACV,CAAC,CAAA,CAAA;AAED,MAAM,mBAAA,GAAsB,CAAC,KAAyB,KAAA;AACpD,EAAO,OAAA;AAAA,IACL,IAAI,GAAI,CAAA;AAAA,MACN,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,OAAQ,CAAA,IAAA;AAAA,KAC7B,CAAA;AAAA,IACD,SAAS,GAAI,CAAA;AAAA,MACX,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,OAAQ,CAAA,IAAA;AAAA,KAC7B,CAAA;AAAA,IACD,UAAU,GAAI,CAAA;AAAA,MACZ,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,KAAM,CAAA,IAAA;AAAA,KAC3B,CAAA;AAAA,GACH,CAAA;AACF,CAAA;;;;"}
@@ -49,6 +49,10 @@ class VizPanelBuilder {
49
49
  this._state.hoverHeader = hoverHeader;
50
50
  return this;
51
51
  }
52
+ setShowMenuAlways(showMenuAlways) {
53
+ this._state.showMenuAlways = showMenuAlways;
54
+ return this;
55
+ }
52
56
  setMenu(menu) {
53
57
  this._state.menu = menu;
54
58
  return this;
@@ -1 +1 @@
1
- {"version":3,"file":"VizPanelBuilder.js","sources":["../../../../src/core/PanelBuilders/VizPanelBuilder.ts"],"sourcesContent":["import { VizPanel, VizPanelState } from '../../components/VizPanel/VizPanel';\nimport { DeepPartial } from '../types';\nimport { FieldConfigBuilder } from './FieldConfigBuilder';\nimport { FieldConfigOverridesBuilder } from './FieldConfigOverridesBuilder';\nimport { PanelOptionsBuilder } from './PanelOptionsBuilder';\nimport { StandardFieldConfig, StandardFieldConfigInterface } from './types';\n\nexport class VizPanelBuilder<TOptions extends {}, TFieldConfig extends {}>\n implements StandardFieldConfigInterface<StandardFieldConfig, VizPanelBuilder<TOptions, TFieldConfig>, 'set'>\n{\n private _state: VizPanelState<TOptions, TFieldConfig> = {} as VizPanelState<TOptions, TFieldConfig>;\n private _fieldConfigBuilder: FieldConfigBuilder<TFieldConfig>;\n private _panelOptionsBuilder: PanelOptionsBuilder<TOptions>;\n\n public constructor(\n pluginId: string,\n pluginVersion: string,\n defaultOptions?: () => Partial<TOptions>,\n defaultFieldConfig?: () => TFieldConfig\n ) {\n this._state.title = '';\n this._state.description = '';\n this._state.displayMode = 'default';\n this._state.hoverHeader = false;\n this._state.pluginId = pluginId;\n this._state.pluginVersion = pluginVersion;\n\n this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);\n this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);\n }\n\n /**\n * Set panel title.\n */\n public setTitle(title: VizPanelState['title']): this {\n this._state.title = title;\n return this;\n }\n\n /**\n * Set panel description.\n */\n public setDescription(description: VizPanelState['description']): this {\n this._state.description = description;\n return this;\n }\n\n /**\n * Set panel display mode.\n */\n public setDisplayMode(displayMode: VizPanelState['displayMode']): this {\n this._state.displayMode = displayMode;\n return this;\n }\n\n /**\n * Set if panel header should be shown on hover.\n */\n public setHoverHeader(hoverHeader: VizPanelState['hoverHeader']): this {\n this._state.hoverHeader = hoverHeader;\n return this;\n }\n\n /**\n * Set panel menu scene object.\n */\n public setMenu(menu: VizPanelState['menu']): this {\n this._state.menu = menu;\n return this;\n }\n\n /**\n * Set scene object or react component to use as panel header actions.\n */\n public setHeaderActions(headerActions: VizPanelState['headerActions']): this {\n this._state.headerActions = headerActions;\n return this;\n }\n\n /**\n * Set color.\n */\n public setColor(color: StandardFieldConfig['color']): this {\n this._fieldConfigBuilder.setColor(color);\n return this;\n }\n\n /**\n * Set number of decimals to show.\n */\n public setDecimals(decimals: StandardFieldConfig['decimals']): this {\n this._fieldConfigBuilder.setDecimals(decimals);\n return this;\n }\n\n /**\n * Set field display name.\n */\n public setDisplayName(displayName: StandardFieldConfig['displayName']): this {\n this._fieldConfigBuilder.setDisplayName(displayName);\n return this;\n }\n\n /**\n * Set the standard field config property filterable.\n */\n public setFilterable(filterable: StandardFieldConfig['filterable']): this {\n this._fieldConfigBuilder.setFilterable(filterable);\n return this;\n }\n\n /**\n * Set data links.\n */\n public setLinks(links: StandardFieldConfig['links']): this {\n this._fieldConfigBuilder.setLinks(links);\n return this;\n }\n\n /**\n * Set value mappings.\n */\n public setMappings(mappings: StandardFieldConfig['mappings']): this {\n this._fieldConfigBuilder.setMappings(mappings);\n return this;\n }\n\n /**\n * Set the standard field config property max.\n */\n public setMax(max: StandardFieldConfig['max']): this {\n this._fieldConfigBuilder.setMax(max);\n return this;\n }\n\n /**\n * Set the standard field config property min.\n */\n public setMin(min: StandardFieldConfig['min']): this {\n this._fieldConfigBuilder.setMin(min);\n return this;\n }\n\n /**\n * Set the standard field config property noValue.\n */\n public setNoValue(noValue: StandardFieldConfig['noValue']): this {\n this._fieldConfigBuilder.setNoValue(noValue);\n return this;\n }\n\n /**\n * Set the standard field config property thresholds.\n */\n public setThresholds(thresholds: StandardFieldConfig['thresholds']): this {\n this._fieldConfigBuilder.setThresholds(thresholds);\n return this;\n }\n\n /**\n * Set the standard field config property unit.\n */\n public setUnit(unit: StandardFieldConfig['unit']): this {\n this._fieldConfigBuilder.setUnit(unit);\n return this;\n }\n\n public setCustomFieldConfig<T extends TFieldConfig, K extends keyof T>(id: K, value: DeepPartial<T[K]>): this {\n this._fieldConfigBuilder.setCustomFieldConfig(id, value);\n return this;\n }\n\n public setOverrides(builder: (b: FieldConfigOverridesBuilder<TFieldConfig>) => void): this {\n this._fieldConfigBuilder.setOverrides(builder);\n return this;\n }\n\n /**\n * Set an individual panel option. This will merge the value with the existing options.\n */\n public setOption<T extends TOptions, K extends keyof T>(id: K, value: DeepPartial<T[K]>): this {\n this._panelOptionsBuilder.setOption(id, value);\n return this;\n }\n\n /**\n * Set data provider for the panel.\n */\n public setData(data: VizPanelState['$data']): this {\n this._state.$data = data;\n return this;\n }\n\n /**\n * Set time range for the panel.\n */\n public setTimeRange(timeRange: VizPanelState['$timeRange']): this {\n this._state.$timeRange = timeRange;\n return this;\n }\n\n /**\n * Set variables for the panel.\n */\n public setVariables(variables: VizPanelState['$variables']): this {\n this._state.$variables = variables;\n return this;\n }\n\n /**\n * Set behaviors for the panel.\n */\n public setBehaviors(behaviors: VizPanelState['$behaviors']): this {\n this._state.$behaviors = behaviors;\n return this;\n }\n\n /**\n * Makes it possible to shared config between different builders\n */\n public applyMixin(mixin: (builder: this) => void): this {\n mixin(this);\n return this;\n }\n\n /**\n * Build the panel.\n */\n public build() {\n const panel = new VizPanel<TOptions, TFieldConfig>({\n ...this._state,\n options: this._panelOptionsBuilder.build(),\n fieldConfig: this._fieldConfigBuilder.build(),\n });\n\n return panel;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOO,MAAM,eAEb,CAAA;AAAA,EAKS,WACL,CAAA,QAAA,EACA,aACA,EAAA,cAAA,EACA,kBACA,EAAA;AATF,IAAA,IAAA,CAAQ,SAAgD,EAAC,CAAA;AAUvD,IAAA,IAAA,CAAK,OAAO,KAAQ,GAAA,EAAA,CAAA;AACpB,IAAA,IAAA,CAAK,OAAO,WAAc,GAAA,EAAA,CAAA;AAC1B,IAAA,IAAA,CAAK,OAAO,WAAc,GAAA,SAAA,CAAA;AAC1B,IAAA,IAAA,CAAK,OAAO,WAAc,GAAA,KAAA,CAAA;AAC1B,IAAA,IAAA,CAAK,OAAO,QAAW,GAAA,QAAA,CAAA;AACvB,IAAA,IAAA,CAAK,OAAO,aAAgB,GAAA,aAAA,CAAA;AAE5B,IAAK,IAAA,CAAA,mBAAA,GAAsB,IAAI,kBAAA,CAAmB,kBAAkB,CAAA,CAAA;AACpE,IAAK,IAAA,CAAA,oBAAA,GAAuB,IAAI,mBAAA,CAAoB,cAAc,CAAA,CAAA;AAAA,GACpE;AAAA,EAKO,SAAS,KAAqC,EAAA;AACnD,IAAA,IAAA,CAAK,OAAO,KAAQ,GAAA,KAAA,CAAA;AACpB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,eAAe,WAA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;AAC7F,IAAK,IAAA,CAAA,oBAAA,CAAqB,SAAU,CAAA,EAAA,EAAI,KAAK,CAAA,CAAA;AAC7C,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,QAAQ,IAAoC,EAAA;AACjD,IAAA,IAAA,CAAK,OAAO,KAAQ,GAAA,IAAA,CAAA;AACpB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,aAAa,SAA8C,EAAA;AAChE,IAAA,IAAA,CAAK,OAAO,UAAa,GAAA,SAAA,CAAA;AACzB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,aAAa,SAA8C,EAAA;AAChE,IAAA,IAAA,CAAK,OAAO,UAAa,GAAA,SAAA,CAAA;AACzB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,aAAa,SAA8C,EAAA;AAChE,IAAA,IAAA,CAAK,OAAO,UAAa,GAAA,SAAA,CAAA;AACzB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,WAAW,KAAsC,EAAA;AACtD,IAAA,KAAA,CAAM,IAAI,CAAA,CAAA;AACV,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,KAAQ,GAAA;AACb,IAAA,MAAM,KAAQ,GAAA,IAAI,QAAiC,CAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAC9C,KAAK,MADyC,CAAA,EAAA;AAAA,MAEjD,OAAA,EAAS,IAAK,CAAA,oBAAA,CAAqB,KAAM,EAAA;AAAA,MACzC,WAAA,EAAa,IAAK,CAAA,mBAAA,CAAoB,KAAM,EAAA;AAAA,KAC7C,CAAA,CAAA,CAAA;AAED,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACF;;;;"}
1
+ {"version":3,"file":"VizPanelBuilder.js","sources":["../../../../src/core/PanelBuilders/VizPanelBuilder.ts"],"sourcesContent":["import { VizPanel, VizPanelState } from '../../components/VizPanel/VizPanel';\nimport { DeepPartial } from '../types';\nimport { FieldConfigBuilder } from './FieldConfigBuilder';\nimport { FieldConfigOverridesBuilder } from './FieldConfigOverridesBuilder';\nimport { PanelOptionsBuilder } from './PanelOptionsBuilder';\nimport { StandardFieldConfig, StandardFieldConfigInterface } from './types';\n\nexport class VizPanelBuilder<TOptions extends {}, TFieldConfig extends {}>\n implements StandardFieldConfigInterface<StandardFieldConfig, VizPanelBuilder<TOptions, TFieldConfig>, 'set'>\n{\n private _state: VizPanelState<TOptions, TFieldConfig> = {} as VizPanelState<TOptions, TFieldConfig>;\n private _fieldConfigBuilder: FieldConfigBuilder<TFieldConfig>;\n private _panelOptionsBuilder: PanelOptionsBuilder<TOptions>;\n\n public constructor(\n pluginId: string,\n pluginVersion: string,\n defaultOptions?: () => Partial<TOptions>,\n defaultFieldConfig?: () => TFieldConfig\n ) {\n this._state.title = '';\n this._state.description = '';\n this._state.displayMode = 'default';\n this._state.hoverHeader = false;\n this._state.pluginId = pluginId;\n this._state.pluginVersion = pluginVersion;\n\n this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);\n this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);\n }\n\n /**\n * Set panel title.\n */\n public setTitle(title: VizPanelState['title']): this {\n this._state.title = title;\n return this;\n }\n\n /**\n * Set panel description.\n */\n public setDescription(description: VizPanelState['description']): this {\n this._state.description = description;\n return this;\n }\n\n /**\n * Set panel display mode.\n */\n public setDisplayMode(displayMode: VizPanelState['displayMode']): this {\n this._state.displayMode = displayMode;\n return this;\n }\n\n /**\n * Set if panel header should be shown on hover.\n */\n public setHoverHeader(hoverHeader: VizPanelState['hoverHeader']): this {\n this._state.hoverHeader = hoverHeader;\n return this;\n }\n\n /**\n * Set if VizPanelMenu \"kebab\" icon is shown on panel hover for desktop devices. Set as false to always show menu icon.\n * @param showMenuAlways\n */\n public setShowMenuAlways(showMenuAlways: VizPanelState['showMenuAlways']): this {\n this._state.showMenuAlways = showMenuAlways;\n return this\n }\n\n /**\n * Set panel menu scene object.\n */\n public setMenu(menu: VizPanelState['menu']): this {\n this._state.menu = menu;\n return this;\n }\n\n /**\n * Set scene object or react component to use as panel header actions.\n */\n public setHeaderActions(headerActions: VizPanelState['headerActions']): this {\n this._state.headerActions = headerActions;\n return this;\n }\n\n /**\n * Set color.\n */\n public setColor(color: StandardFieldConfig['color']): this {\n this._fieldConfigBuilder.setColor(color);\n return this;\n }\n\n /**\n * Set number of decimals to show.\n */\n public setDecimals(decimals: StandardFieldConfig['decimals']): this {\n this._fieldConfigBuilder.setDecimals(decimals);\n return this;\n }\n\n /**\n * Set field display name.\n */\n public setDisplayName(displayName: StandardFieldConfig['displayName']): this {\n this._fieldConfigBuilder.setDisplayName(displayName);\n return this;\n }\n\n /**\n * Set the standard field config property filterable.\n */\n public setFilterable(filterable: StandardFieldConfig['filterable']): this {\n this._fieldConfigBuilder.setFilterable(filterable);\n return this;\n }\n\n /**\n * Set data links.\n */\n public setLinks(links: StandardFieldConfig['links']): this {\n this._fieldConfigBuilder.setLinks(links);\n return this;\n }\n\n /**\n * Set value mappings.\n */\n public setMappings(mappings: StandardFieldConfig['mappings']): this {\n this._fieldConfigBuilder.setMappings(mappings);\n return this;\n }\n\n /**\n * Set the standard field config property max.\n */\n public setMax(max: StandardFieldConfig['max']): this {\n this._fieldConfigBuilder.setMax(max);\n return this;\n }\n\n /**\n * Set the standard field config property min.\n */\n public setMin(min: StandardFieldConfig['min']): this {\n this._fieldConfigBuilder.setMin(min);\n return this;\n }\n\n /**\n * Set the standard field config property noValue.\n */\n public setNoValue(noValue: StandardFieldConfig['noValue']): this {\n this._fieldConfigBuilder.setNoValue(noValue);\n return this;\n }\n\n /**\n * Set the standard field config property thresholds.\n */\n public setThresholds(thresholds: StandardFieldConfig['thresholds']): this {\n this._fieldConfigBuilder.setThresholds(thresholds);\n return this;\n }\n\n /**\n * Set the standard field config property unit.\n */\n public setUnit(unit: StandardFieldConfig['unit']): this {\n this._fieldConfigBuilder.setUnit(unit);\n return this;\n }\n\n public setCustomFieldConfig<T extends TFieldConfig, K extends keyof T>(id: K, value: DeepPartial<T[K]>): this {\n this._fieldConfigBuilder.setCustomFieldConfig(id, value);\n return this;\n }\n\n public setOverrides(builder: (b: FieldConfigOverridesBuilder<TFieldConfig>) => void): this {\n this._fieldConfigBuilder.setOverrides(builder);\n return this;\n }\n\n /**\n * Set an individual panel option. This will merge the value with the existing options.\n */\n public setOption<T extends TOptions, K extends keyof T>(id: K, value: DeepPartial<T[K]>): this {\n this._panelOptionsBuilder.setOption(id, value);\n return this;\n }\n\n /**\n * Set data provider for the panel.\n */\n public setData(data: VizPanelState['$data']): this {\n this._state.$data = data;\n return this;\n }\n\n /**\n * Set time range for the panel.\n */\n public setTimeRange(timeRange: VizPanelState['$timeRange']): this {\n this._state.$timeRange = timeRange;\n return this;\n }\n\n /**\n * Set variables for the panel.\n */\n public setVariables(variables: VizPanelState['$variables']): this {\n this._state.$variables = variables;\n return this;\n }\n\n /**\n * Set behaviors for the panel.\n */\n public setBehaviors(behaviors: VizPanelState['$behaviors']): this {\n this._state.$behaviors = behaviors;\n return this;\n }\n\n /**\n * Makes it possible to shared config between different builders\n */\n public applyMixin(mixin: (builder: this) => void): this {\n mixin(this);\n return this;\n }\n\n /**\n * Build the panel.\n */\n public build() {\n const panel = new VizPanel<TOptions, TFieldConfig>({\n ...this._state,\n options: this._panelOptionsBuilder.build(),\n fieldConfig: this._fieldConfigBuilder.build(),\n });\n\n return panel;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOO,MAAM,eAEb,CAAA;AAAA,EAKS,WACL,CAAA,QAAA,EACA,aACA,EAAA,cAAA,EACA,kBACA,EAAA;AATF,IAAA,IAAA,CAAQ,SAAgD,EAAC,CAAA;AAUvD,IAAA,IAAA,CAAK,OAAO,KAAQ,GAAA,EAAA,CAAA;AACpB,IAAA,IAAA,CAAK,OAAO,WAAc,GAAA,EAAA,CAAA;AAC1B,IAAA,IAAA,CAAK,OAAO,WAAc,GAAA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O,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,WAAW,KAAsC,EAAA;AACtD,IAAA,KAAA,CAAM,IAAI,CAAA,CAAA;AACV,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,KAAQ,GAAA;AACb,IAAA,MAAM,KAAQ,GAAA,IAAI,QAAiC,CAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAC9C,KAAK,MADyC,CAAA,EAAA;AAAA,MAEjD,OAAA,EAAS,IAAK,CAAA,oBAAA,CAAqB,KAAM,EAAA;AAAA,MACzC,WAAA,EAAa,IAAK,CAAA,mBAAA,CAAoB,KAAM,EAAA;AAAA,KAC7C,CAAA,CAAA,CAAA;AAED,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACF;;;;"}
@@ -151,7 +151,7 @@ class GroupByVariable extends MultiValueVariable {
151
151
  }
152
152
  GroupByVariable.Component = GroupByVariableRenderer;
153
153
  function GroupByVariableRenderer({ model }) {
154
- const { value, text, key, maxVisibleValues, noValueOnClear, options, includeAll, allowCustomValue } = model.useState();
154
+ const { value, text, key, maxVisibleValues, noValueOnClear, options, includeAll } = model.useState();
155
155
  const values = useMemo(() => {
156
156
  const arrayValue = isArray(value) ? value : [value];
157
157
  const arrayText = isArray(text) ? text : [text];
@@ -194,7 +194,7 @@ function GroupByVariableRenderer({ model }) {
194
194
  id: key,
195
195
  placeholder: "Select value",
196
196
  width: "auto",
197
- allowCustomValue: allowCustomValue != null ? allowCustomValue : true,
197
+ allowCustomValue: true,
198
198
  inputValue,
199
199
  value: uncommittedValue,
200
200
  noMultiValueWrap: true,
@@ -1 +1 @@
1
- {"version":3,"file":"GroupByVariable.js","sources":["../../../../src/variables/groupby/GroupByVariable.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\n// @ts-expect-error Remove when 11.1.x is released\nimport { AdHocVariableFilter, DataSourceApi, GetTagResponse, MetricFindValue, SelectableValue } from '@grafana/data';\nimport { allActiveGroupByVariables } from './findActiveGroupByVariablesByUid';\nimport { DataSourceRef, VariableType } from '@grafana/schema';\nimport { SceneComponentProps, ControlsLayout, SceneObjectUrlSyncHandler } from '../../core/types';\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { ValidateAndUpdateResult, VariableValueOption, VariableValueSingle } from '../types';\nimport { MultiValueVariable, MultiValueVariableState, VariableGetOptionsArgs } from '../variants/MultiValueVariable';\nimport { from, lastValueFrom, map, mergeMap, Observable, of, take, tap } from 'rxjs';\nimport { getDataSource } from '../../utils/getDataSource';\nimport { InputActionMeta, MultiSelect } from '@grafana/ui';\nimport { isArray } from 'lodash';\nimport { dataFromResponse, getQueriesForVariables, handleOptionGroups, responseHasError } from '../utils';\nimport { OptionWithCheckbox } from '../components/VariableValueSelect';\nimport { GroupByVariableUrlSyncHandler } from './GroupByVariableUrlSyncHandler';\nimport { getOptionSearcher } from '../components/getOptionSearcher';\nimport { getEnrichedFiltersRequest } from '../getEnrichedFiltersRequest';\nimport { wrapInSafeSerializableSceneObject } from '../../utils/wrapInSafeSerializableSceneObject';\n\nexport interface GroupByVariableState extends MultiValueVariableState {\n /** Defaults to \"Group\" */\n name: string;\n /** The visible keys to group on */\n // TODO review this type and name (naming is hard)\n defaultOptions?: MetricFindValue[];\n /** Base filters to always apply when looking up keys */\n baseFilters?: AdHocVariableFilter[];\n /** Datasource to use for getTagKeys and also controls which scene queries the group by should apply to */\n datasource: DataSourceRef | null;\n /** Controls if the group by can be changed */\n readOnly?: boolean;\n /**\n * @experimental\n * Controls the layout and design of the label.\n * Vertical layout does not yet support operator selector.\n */\n layout?: ControlsLayout;\n /**\n * Defaults to same-datasource which means group by will automatically be applied to all queries with the same data source as this GroupBySet.\n * In manual mode no queries are re-run on changes, and you have to manually apply the filter to whatever queries you want.\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\nexport type getTagKeysProvider = (\n set: GroupByVariable,\n currentKey: string | null\n) => Promise<{ replace?: boolean; values: MetricFindValue[] | GetTagResponse }>;\n\nexport class GroupByVariable extends MultiValueVariable<GroupByVariableState> {\n static Component = GroupByVariableRenderer;\n isLazy = true;\n\n protected _urlSync: SceneObjectUrlSyncHandler = new GroupByVariableUrlSyncHandler(this);\n\n public validateAndUpdate(): Observable<ValidateAndUpdateResult> {\n return this.getValueOptions({}).pipe(\n map((options) => {\n this._updateValueGivenNewOptions(options);\n return {};\n })\n );\n }\n\n private _updateValueGivenNewOptions(options: VariableValueOption[]) {\n const { value: currentValue, text: currentText } = this.state;\n\n const stateUpdate: Partial<MultiValueVariableState> = {\n options,\n loading: false,\n value: currentValue ?? [],\n text: currentText ?? [],\n };\n\n this.setState(stateUpdate);\n }\n\n public getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]> {\n // When default dimensions are provided, return the static list\n if (this.state.defaultOptions) {\n return of(\n this.state.defaultOptions.map((o) => ({\n label: o.text,\n value: String(o.value),\n // @ts-expect-error Remove when we update to @grafana/data > 11.1.0\n group: o.group,\n }))\n );\n }\n\n this.setState({ loading: true, error: null });\n\n return from(\n getDataSource(this.state.datasource, {\n __sceneObject: wrapInSafeSerializableSceneObject(this),\n })\n ).pipe(\n mergeMap((ds) => {\n return from(this._getKeys(ds)).pipe(\n tap((response) => {\n if (responseHasError(response)) {\n this.setState({ error: response.error.message });\n }\n }),\n map((response) => dataFromResponse(response)),\n take(1),\n mergeMap((data) => {\n // @ts-expect-error Remove when 11.1.x is released\n const a: VariableValueOption[] = data.map((i) => {\n return {\n label: i.text,\n value: i.value ? String(i.value) : i.text,\n group: i.group,\n };\n });\n return of(a);\n })\n );\n })\n );\n }\n\n public constructor(initialState: Partial<GroupByVariableState>) {\n super({\n isMulti: true,\n name: '',\n value: [],\n text: [],\n options: [],\n datasource: null,\n baseFilters: [],\n applyMode: 'auto',\n layout: 'horizontal',\n type: 'groupby' as VariableType,\n ...initialState,\n noValueOnClear: true,\n });\n\n this.addActivationHandler(() => {\n allActiveGroupByVariables.add(this);\n\n return () => allActiveGroupByVariables.delete(this);\n });\n }\n\n /**\n * Get possible keys given current filters. Do not call from plugins directly\n */\n public _getKeys = async (ds: DataSourceApi) => {\n // TODO: provide current dimensions?\n const override = await this.state.getTagKeysProvider?.(this, null);\n\n if (override && override.replace) {\n return override.values;\n }\n\n if (this.state.defaultOptions) {\n return this.state.defaultOptions.concat(dataFromResponse(override?.values ?? []));\n }\n\n if (!ds.getTagKeys) {\n return [];\n }\n\n const queries = getQueriesForVariables(this);\n\n const otherFilters = this.state.baseFilters || [];\n const timeRange = sceneGraph.getTimeRange(this).state.value;\n const response = await ds.getTagKeys({\n filters: otherFilters,\n queries,\n timeRange,\n ...getEnrichedFiltersRequest(this),\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;\n };\n\n /**\n * Allows clearing the value of the variable to an empty value. Overrides default behavior of a MultiValueVariable\n */\n public getDefaultMultiState(options: VariableValueOption[]): { value: VariableValueSingle[]; text: string[] } {\n return { value: [], text: [] };\n }\n}\nexport function GroupByVariableRenderer({ model }: SceneComponentProps<MultiValueVariable>) {\n const { value, text, key, maxVisibleValues, noValueOnClear, options, includeAll, allowCustomValue } =\n model.useState();\n\n const values = useMemo<Array<SelectableValue<VariableValueSingle>>>(() => {\n const arrayValue = isArray(value) ? value : [value];\n const arrayText = isArray(text) ? text : [text];\n\n return arrayValue.map((value, idx) => ({\n value,\n label: String(arrayText[idx] ?? value),\n }));\n }, [value, text]);\n\n const [isFetchingOptions, setIsFetchingOptions] = useState(false);\n const [isOptionsOpen, setIsOptionsOpen] = useState(false);\n const [inputValue, setInputValue] = useState('');\n\n // To not trigger queries on every selection we store this state locally here and only update the variable onBlur\n const [uncommittedValue, setUncommittedValue] = useState(values);\n\n const optionSearcher = useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);\n\n // Detect value changes outside\n useEffect(() => {\n setUncommittedValue(values);\n }, [values]);\n\n const onInputChange = (value: string, { action }: InputActionMeta) => {\n if (action === 'input-change') {\n setInputValue(value);\n if (model.onSearchChange) {\n model.onSearchChange!(value);\n }\n return value;\n }\n\n if (action === 'input-blur') {\n setInputValue('');\n return '';\n }\n\n return inputValue;\n };\n\n const filteredOptions = useMemo(\n () => handleOptionGroups(optionSearcher(inputValue).map(toSelectableValue)),\n [optionSearcher, inputValue]\n );\n\n return (\n <MultiSelect<VariableValueSingle>\n data-testid={`GroupBySelect-${key}`}\n id={key}\n placeholder={'Select value'}\n width=\"auto\"\n allowCustomValue={allowCustomValue ?? true}\n inputValue={inputValue}\n value={uncommittedValue}\n noMultiValueWrap={true}\n maxVisibleValues={maxVisibleValues ?? 5}\n tabSelectsValue={false}\n virtualized\n options={filteredOptions}\n filterOption={filterNoOp}\n closeMenuOnSelect={false}\n isOpen={isOptionsOpen}\n isClearable={true}\n hideSelectedOptions={false}\n isLoading={isFetchingOptions}\n components={{ Option: OptionWithCheckbox }}\n onInputChange={onInputChange}\n onBlur={() => {\n model.changeValueTo(\n uncommittedValue.map((x) => x.value!),\n uncommittedValue.map((x) => x.label!)\n );\n }}\n onChange={(newValue, action) => {\n if (action.action === 'clear' && noValueOnClear) {\n model.changeValueTo([]);\n }\n setUncommittedValue(newValue);\n }}\n onOpenMenu={async () => {\n setIsFetchingOptions(true);\n await lastValueFrom(model.validateAndUpdate());\n setIsFetchingOptions(false);\n setIsOptionsOpen(true);\n }}\n onCloseMenu={() => {\n setIsOptionsOpen(false);\n }}\n />\n );\n}\n\nconst filterNoOp = () => true;\n\nfunction toSelectableValue(input: VariableValueOption): SelectableValue<VariableValueSingle> {\n const { label, value, group } = input;\n const result: SelectableValue<VariableValueSingle> = {\n label,\n value,\n };\n\n if (group) {\n result.group = group;\n }\n\n return result;\n}\n"],"names":["value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DO,MAAM,wBAAwB,kBAAyC,CAAA;AAAA,EAyErE,YAAY,YAA6C,EAAA;AAC9D,IAAM,KAAA,CAAA,aAAA,CAAA,cAAA,CAAA;AAAA,MACJ,OAAS,EAAA,IAAA;AAAA,MACT,IAAM,EAAA,EAAA;AAAA,MACN,OAAO,EAAC;AAAA,MACR,MAAM,EAAC;AAAA,MACP,SAAS,EAAC;AAAA,MACV,UAAY,EAAA,IAAA;AAAA,MACZ,aAAa,EAAC;AAAA,MACd,SAAW,EAAA,MAAA;AAAA,MACX,MAAQ,EAAA,YAAA;AAAA,MACR,IAAM,EAAA,SAAA;AAAA,KAAA,EACH,YAXC,CAAA,EAAA;AAAA,MAYJ,cAAgB,EAAA,IAAA;AAAA,KACjB,CAAA,CAAA,CAAA;AArFH,IAAS,IAAA,CAAA,MAAA,GAAA,IAAA,CAAA;AAET,IAAU,IAAA,CAAA,QAAA,GAAsC,IAAI,6BAAA,CAA8B,IAAI,CAAA,CAAA;AA+FtF,IAAO,IAAA,CAAA,QAAA,GAAW,OAAO,EAAsB,KAAA;AA/JjD,MAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAiKI,MAAA,MAAM,WAAW,OAAM,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAA,CAAK,KAAM,EAAA,kBAAA,KAAX,4BAAgC,IAAM,EAAA,IAAA,CAAA,CAAA,CAAA;AAE7D,MAAI,IAAA,QAAA,IAAY,SAAS,OAAS,EAAA;AAChC,QAAA,OAAO,QAAS,CAAA,MAAA,CAAA;AAAA,OAClB;AAEA,MAAI,IAAA,IAAA,CAAK,M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,IACA,aAAa,MAAM;AACjB,MAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,KACxB;AAAA,GACF,CAAA,CAAA;AAEJ,CAAA;AAEA,MAAM,aAAa,MAAM,IAAA,CAAA;AAEzB,SAAS,kBAAkB,KAAkE,EAAA;AAC3F,EAAA,MAAM,EAAE,KAAA,EAAO,KAAO,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAChC,EAAA,MAAM,MAA+C,GAAA;AAAA,IACnD,KAAA;AAAA,IACA,KAAA;AAAA,GACF,CAAA;AAEA,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,MAAA,CAAO,KAAQ,GAAA,KAAA,CAAA;AAAA,GACjB;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"GroupByVariable.js","sources":["../../../../src/variables/groupby/GroupByVariable.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\n// @ts-expect-error Remove when 11.1.x is released\nimport { AdHocVariableFilter, DataSourceApi, GetTagResponse, MetricFindValue, SelectableValue } from '@grafana/data';\nimport { allActiveGroupByVariables } from './findActiveGroupByVariablesByUid';\nimport { DataSourceRef, VariableType } from '@grafana/schema';\nimport { SceneComponentProps, ControlsLayout, SceneObjectUrlSyncHandler } from '../../core/types';\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { ValidateAndUpdateResult, VariableValueOption, VariableValueSingle } from '../types';\nimport { MultiValueVariable, MultiValueVariableState, VariableGetOptionsArgs } from '../variants/MultiValueVariable';\nimport { from, lastValueFrom, map, mergeMap, Observable, of, take, tap } from 'rxjs';\nimport { getDataSource } from '../../utils/getDataSource';\nimport { InputActionMeta, MultiSelect } from '@grafana/ui';\nimport { isArray } from 'lodash';\nimport { dataFromResponse, getQueriesForVariables, handleOptionGroups, responseHasError } from '../utils';\nimport { OptionWithCheckbox } from '../components/VariableValueSelect';\nimport { GroupByVariableUrlSyncHandler } from './GroupByVariableUrlSyncHandler';\nimport { getOptionSearcher } from '../components/getOptionSearcher';\nimport { getEnrichedFiltersRequest } from '../getEnrichedFiltersRequest';\nimport { wrapInSafeSerializableSceneObject } from '../../utils/wrapInSafeSerializableSceneObject';\n\nexport interface GroupByVariableState extends MultiValueVariableState {\n /** Defaults to \"Group\" */\n name: string;\n /** The visible keys to group on */\n // TODO review this type and name (naming is hard)\n defaultOptions?: MetricFindValue[];\n /** Base filters to always apply when looking up keys */\n baseFilters?: AdHocVariableFilter[];\n /** Datasource to use for getTagKeys and also controls which scene queries the group by should apply to */\n datasource: DataSourceRef | null;\n /** Controls if the group by can be changed */\n readOnly?: boolean;\n /**\n * @experimental\n * Controls the layout and design of the label.\n * Vertical layout does not yet support operator selector.\n */\n layout?: ControlsLayout;\n /**\n * Defaults to same-datasource which means group by will automatically be applied to all queries with the same data source as this GroupBySet.\n * In manual mode no queries are re-run on changes, and you have to manually apply the filter to whatever queries you want.\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\nexport type getTagKeysProvider = (\n set: GroupByVariable,\n currentKey: string | null\n) => Promise<{ replace?: boolean; values: MetricFindValue[] | GetTagResponse }>;\n\nexport class GroupByVariable extends MultiValueVariable<GroupByVariableState> {\n static Component = GroupByVariableRenderer;\n isLazy = true;\n\n protected _urlSync: SceneObjectUrlSyncHandler = new GroupByVariableUrlSyncHandler(this);\n\n public validateAndUpdate(): Observable<ValidateAndUpdateResult> {\n return this.getValueOptions({}).pipe(\n map((options) => {\n this._updateValueGivenNewOptions(options);\n return {};\n })\n );\n }\n\n private _updateValueGivenNewOptions(options: VariableValueOption[]) {\n const { value: currentValue, text: currentText } = this.state;\n\n const stateUpdate: Partial<MultiValueVariableState> = {\n options,\n loading: false,\n value: currentValue ?? [],\n text: currentText ?? [],\n };\n\n this.setState(stateUpdate);\n }\n\n public getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]> {\n // When default dimensions are provided, return the static list\n if (this.state.defaultOptions) {\n return of(\n this.state.defaultOptions.map((o) => ({\n label: o.text,\n value: String(o.value),\n // @ts-expect-error Remove when we update to @grafana/data > 11.1.0\n group: o.group,\n }))\n );\n }\n\n this.setState({ loading: true, error: null });\n\n return from(\n getDataSource(this.state.datasource, {\n __sceneObject: wrapInSafeSerializableSceneObject(this),\n })\n ).pipe(\n mergeMap((ds) => {\n return from(this._getKeys(ds)).pipe(\n tap((response) => {\n if (responseHasError(response)) {\n this.setState({ error: response.error.message });\n }\n }),\n map((response) => dataFromResponse(response)),\n take(1),\n mergeMap((data) => {\n // @ts-expect-error Remove when 11.1.x is released\n const a: VariableValueOption[] = data.map((i) => {\n return {\n label: i.text,\n value: i.value ? String(i.value) : i.text,\n group: i.group,\n };\n });\n return of(a);\n })\n );\n })\n );\n }\n\n public constructor(initialState: Partial<GroupByVariableState>) {\n super({\n isMulti: true,\n name: '',\n value: [],\n text: [],\n options: [],\n datasource: null,\n baseFilters: [],\n applyMode: 'auto',\n layout: 'horizontal',\n type: 'groupby' as VariableType,\n ...initialState,\n noValueOnClear: true,\n });\n\n this.addActivationHandler(() => {\n allActiveGroupByVariables.add(this);\n\n return () => allActiveGroupByVariables.delete(this);\n });\n }\n\n /**\n * Get possible keys given current filters. Do not call from plugins directly\n */\n public _getKeys = async (ds: DataSourceApi) => {\n // TODO: provide current dimensions?\n const override = await this.state.getTagKeysProvider?.(this, null);\n\n if (override && override.replace) {\n return override.values;\n }\n\n if (this.state.defaultOptions) {\n return this.state.defaultOptions.concat(dataFromResponse(override?.values ?? []));\n }\n\n if (!ds.getTagKeys) {\n return [];\n }\n\n const queries = getQueriesForVariables(this);\n\n const otherFilters = this.state.baseFilters || [];\n const timeRange = sceneGraph.getTimeRange(this).state.value;\n const response = await ds.getTagKeys({\n filters: otherFilters,\n queries,\n timeRange,\n ...getEnrichedFiltersRequest(this),\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;\n };\n\n /**\n * Allows clearing the value of the variable to an empty value. Overrides default behavior of a MultiValueVariable\n */\n public getDefaultMultiState(options: VariableValueOption[]): { value: VariableValueSingle[]; text: string[] } {\n return { value: [], text: [] };\n }\n}\nexport function GroupByVariableRenderer({ model }: SceneComponentProps<MultiValueVariable>) {\n const { value, text, key, maxVisibleValues, noValueOnClear, options, includeAll } = model.useState();\n\n const values = useMemo<Array<SelectableValue<VariableValueSingle>>>(() => {\n const arrayValue = isArray(value) ? value : [value];\n const arrayText = isArray(text) ? text : [text];\n\n return arrayValue.map((value, idx) => ({\n value,\n label: String(arrayText[idx] ?? value),\n }));\n }, [value, text]);\n\n const [isFetchingOptions, setIsFetchingOptions] = useState(false);\n const [isOptionsOpen, setIsOptionsOpen] = useState(false);\n const [inputValue, setInputValue] = useState('');\n\n // To not trigger queries on every selection we store this state locally here and only update the variable onBlur\n const [uncommittedValue, setUncommittedValue] = useState(values);\n\n const optionSearcher = useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);\n\n // Detect value changes outside\n useEffect(() => {\n setUncommittedValue(values);\n }, [values]);\n\n const onInputChange = (value: string, { action }: InputActionMeta) => {\n if (action === 'input-change') {\n setInputValue(value);\n if (model.onSearchChange) {\n model.onSearchChange!(value);\n }\n return value;\n }\n\n if (action === 'input-blur') {\n setInputValue('');\n return '';\n }\n\n return inputValue;\n };\n\n const filteredOptions = useMemo(\n () => handleOptionGroups(optionSearcher(inputValue).map(toSelectableValue)),\n [optionSearcher, inputValue]\n );\n\n return (\n <MultiSelect<VariableValueSingle>\n data-testid={`GroupBySelect-${key}`}\n id={key}\n placeholder={'Select value'}\n width=\"auto\"\n allowCustomValue={true}\n inputValue={inputValue}\n value={uncommittedValue}\n noMultiValueWrap={true}\n maxVisibleValues={maxVisibleValues ?? 5}\n tabSelectsValue={false}\n virtualized\n options={filteredOptions}\n filterOption={filterNoOp}\n closeMenuOnSelect={false}\n isOpen={isOptionsOpen}\n isClearable={true}\n hideSelectedOptions={false}\n isLoading={isFetchingOptions}\n components={{ Option: OptionWithCheckbox }}\n onInputChange={onInputChange}\n onBlur={() => {\n model.changeValueTo(\n uncommittedValue.map((x) => x.value!),\n uncommittedValue.map((x) => x.label!)\n );\n }}\n onChange={(newValue, action) => {\n if (action.action === 'clear' && noValueOnClear) {\n model.changeValueTo([]);\n }\n setUncommittedValue(newValue);\n }}\n onOpenMenu={async () => {\n setIsFetchingOptions(true);\n await lastValueFrom(model.validateAndUpdate());\n setIsFetchingOptions(false);\n setIsOptionsOpen(true);\n }}\n onCloseMenu={() => {\n setIsOptionsOpen(false);\n }}\n />\n );\n}\n\nconst filterNoOp = () => true;\n\nfunction toSelectableValue(input: VariableValueOption): SelectableValue<VariableValueSingle> {\n const { label, value, group } = input;\n const result: SelectableValue<VariableValueSingle> = {\n label,\n value,\n };\n\n if (group) {\n result.group = group;\n }\n\n return result;\n}\n"],"names":["value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DO,MAAM,wBAAwB,kBAAyC,CAAA;AAAA,EAyErE,YAAY,YAA6C,EAAA;AAC9D,IAAM,KAAA,CAAA,aAAA,CAAA,cAAA,CAAA;AAAA,MACJ,OAAS,EAAA,IAAA;AAAA,MACT,IAAM,EAAA,EAAA;AAAA,MACN,OAAO,EAAC;AAAA,MACR,MAAM,EAAC;AAAA,MACP,SAAS,EAAC;AAAA,MACV,UAAY,EAAA,IAAA;AAAA,MACZ,aAAa,EAAC;AAAA,MACd,SAAW,EAAA,MAAA;AAAA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,KAAM,EAAE,KAAM,CAAA;AAAA,QACpC,gBAAiB,CAAA,GAAA,CAAI,CAAC,CAAA,KAAM,EAAE,KAAM,CAAA;AAAA,OACtC,CAAA;AAAA,KACF;AAAA,IACA,QAAA,EAAU,CAAC,QAAA,EAAU,MAAW,KAAA;AAC9B,MAAI,IAAA,MAAA,CAAO,MAAW,KAAA,OAAA,IAAW,cAAgB,EAAA;AAC/C,QAAM,KAAA,CAAA,aAAA,CAAc,EAAE,CAAA,CAAA;AAAA,OACxB;AACA,MAAA,mBAAA,CAAoB,QAAQ,CAAA,CAAA;AAAA,KAC9B;AAAA,IACA,YAAY,YAAY;AACtB,MAAA,oBAAA,CAAqB,IAAI,CAAA,CAAA;AACzB,MAAM,MAAA,aAAA,CAAc,KAAM,CAAA,iBAAA,EAAmB,CAAA,CAAA;AAC7C,MAAA,oBAAA,CAAqB,KAAK,CAAA,CAAA;AAC1B,MAAA,gBAAA,CAAiB,IAAI,CAAA,CAAA;AAAA,KACvB;AAAA,IACA,aAAa,MAAM;AACjB,MAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,KACxB;AAAA,GACF,CAAA,CAAA;AAEJ,CAAA;AAEA,MAAM,aAAa,MAAM,IAAA,CAAA;AAEzB,SAAS,kBAAkB,KAAkE,EAAA;AAC3F,EAAA,MAAM,EAAE,KAAA,EAAO,KAAO,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAChC,EAAA,MAAM,MAA+C,GAAA;AAAA,IACnD,KAAA;AAAA,IACA,KAAA;AAAA,GACF,CAAA;AAEA,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,MAAA,CAAO,KAAQ,GAAA,KAAA,CAAA;AAAA,GACjB;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
package/dist/index.d.ts CHANGED
@@ -1758,6 +1758,10 @@ interface VizPanelState<TOptions = {}, TFieldConfig = {}> extends SceneObjectSta
1758
1758
  * Offset hoverHeader position on the y axis
1759
1759
  */
1760
1760
  hoverHeaderOffset?: number;
1761
+ /**
1762
+ * Only shows vizPanelMenu on hover if false, otherwise the menu is always visible in the header
1763
+ */
1764
+ showMenuAlways?: boolean;
1761
1765
  /**
1762
1766
  * Defines a menu in the top right of the panel. The menu object is only activated when the dropdown menu itself is shown.
1763
1767
  * So the best way to add dynamic menu actions and links is by adding them in a behavior attached to the menu.
@@ -2442,6 +2446,11 @@ declare class VizPanelBuilder<TOptions extends {}, TFieldConfig extends {}> impl
2442
2446
  * Set if panel header should be shown on hover.
2443
2447
  */
2444
2448
  setHoverHeader(hoverHeader: VizPanelState['hoverHeader']): this;
2449
+ /**
2450
+ * Set if VizPanelMenu "kebab" icon is shown on panel hover for desktop devices. Set as false to always show menu icon.
2451
+ * @param showMenuAlways
2452
+ */
2453
+ setShowMenuAlways(showMenuAlways: VizPanelState['showMenuAlways']): this;
2445
2454
  /**
2446
2455
  * Set panel menu scene object.
2447
2456
  */
package/dist/index.js CHANGED
@@ -2991,7 +2991,7 @@ class GroupByVariable extends MultiValueVariable {
2991
2991
  }
2992
2992
  GroupByVariable.Component = GroupByVariableRenderer;
2993
2993
  function GroupByVariableRenderer({ model }) {
2994
- const { value, text, key, maxVisibleValues, noValueOnClear, options, includeAll, allowCustomValue } = model.useState();
2994
+ const { value, text, key, maxVisibleValues, noValueOnClear, options, includeAll } = model.useState();
2995
2995
  const values = React.useMemo(() => {
2996
2996
  const arrayValue = lodash.isArray(value) ? value : [value];
2997
2997
  const arrayText = lodash.isArray(text) ? text : [text];
@@ -3034,7 +3034,7 @@ function GroupByVariableRenderer({ model }) {
3034
3034
  id: key,
3035
3035
  placeholder: "Select value",
3036
3036
  width: "auto",
3037
- allowCustomValue: allowCustomValue != null ? allowCustomValue : true,
3037
+ allowCustomValue: true,
3038
3038
  inputValue,
3039
3039
  value: uncommittedValue,
3040
3040
  noMultiValueWrap: true,
@@ -6859,6 +6859,7 @@ function VizPanelRenderer({ model }) {
6859
6859
  _pluginLoadError,
6860
6860
  displayMode,
6861
6861
  hoverHeader,
6862
+ showMenuAlways,
6862
6863
  hoverHeaderOffset,
6863
6864
  menu,
6864
6865
  headerActions,
@@ -6980,6 +6981,7 @@ function VizPanelRenderer({ model }) {
6980
6981
  width,
6981
6982
  height,
6982
6983
  displayMode,
6984
+ showMenuAlways,
6983
6985
  hoverHeader,
6984
6986
  hoverHeaderOffset,
6985
6987
  titleItems: titleItemsElement,
@@ -13019,6 +13021,10 @@ class VizPanelBuilder {
13019
13021
  this._state.hoverHeader = hoverHeader;
13020
13022
  return this;
13021
13023
  }
13024
+ setShowMenuAlways(showMenuAlways) {
13025
+ this._state.showMenuAlways = showMenuAlways;
13026
+ return this;
13027
+ }
13022
13028
  setMenu(menu) {
13023
13029
  this._state.menu = menu;
13024
13030
  return this;