@grafana/scenes 5.19.1 → 5.20.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v5.20.0 (Thu Oct 10 2024)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - VizPanel: Fix issue where changing panel options wouldn't cause re-render [#934](https://github.com/grafana/scenes/pull/934) ([@kaydelaney](https://github.com/kaydelaney))
6
+
7
+ #### Authors: 1
8
+
9
+ - kay delaney ([@kaydelaney](https://github.com/kaydelaney))
10
+
11
+ ---
12
+
1
13
  # v5.19.1 (Wed Oct 09 2024)
2
14
 
3
15
  #### 🐛 Bug Fix
@@ -40,7 +40,8 @@ class VizPanel extends SceneObjectBase {
40
40
  options: {},
41
41
  fieldConfig: { defaults: {}, overrides: [] },
42
42
  title: "Title",
43
- pluginId: "timeseries"
43
+ pluginId: "timeseries",
44
+ _renderCounter: 0
44
45
  }, state));
45
46
  this._variableDependency = new VariableDependencyConfig(this, {
46
47
  statePaths: ["title", "options", "fieldConfig"]
@@ -85,6 +86,7 @@ class VizPanel extends SceneObjectBase {
85
86
  this.setState({ displayMode });
86
87
  };
87
88
  this.onOptionsChange = (optionsUpdate, replace = false, isAfterPluginChange = false) => {
89
+ var _a;
88
90
  const { fieldConfig, options } = this.state;
89
91
  const nextOptions = replace ? optionsUpdate : mergeWith(cloneDeep(options), optionsUpdate, (objValue, srcValue, key, obj) => {
90
92
  if (isArray(srcValue)) {
@@ -103,7 +105,8 @@ class VizPanel extends SceneObjectBase {
103
105
  isAfterPluginChange
104
106
  });
105
107
  this.setState({
106
- options: withDefaults.options
108
+ options: withDefaults.options,
109
+ _renderCounter: ((_a = this.state._renderCounter) != null ? _a : 0) + 1
107
110
  });
108
111
  };
109
112
  this.onFieldConfigChange = (fieldConfigUpdate, replace) => {
@@ -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}\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 ...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 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 !== this.state.pluginVersion) {\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 await this._loadPlugin(pluginId, newOptions ?? {}, newFieldConfig, true);\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 });\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFO,MAAM,iBAA8D,eAEzE,CAAA;AAAA,EAcO,YAAY,KAAuD,EAAA;AAvG5E,IAAA,IAAA,EAAA,CAAA;AAwGI,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,KAAA,EACP,KACJ,CAAA,CAAA,CAAA;AAlBH,IAAU,IAAA,CAAA,mBAAA,GAAsB,IAAI,wBAAA,CAAyB,IAAM,EAAA;AAAA,MACjE,UAAY,EAAA,CAAC,OAAS,EAAA,SAAA,EAAW,aAAa,CAAA;AAAA,KAC/C,CAAA,CAAA;AAOD,IAAA,IAAA,CAAQ,aAAwB,GAAA,CAAA,CAAA;AA0HhC,IAAO,IAAA,CAAA,iBAAA,GAAoB,CAAC,SAAiC,KAAA;AAC3D,MAAM,MAAA,cAAA,GAAiB,UAAW,CAAA,YAAA,CAAa,IAAI,CAAA,CAAA;AACnD,MAAA,cAAA,CAAe,iBAAkB,CAAA;AAAA,QAC/B,GAAK,EAAA;AAAA,UACH,IAA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,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 * 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 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 !== this.state.pluginVersion) {\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 await this._loadPlugin(pluginId, newOptions ?? {}, newFieldConfig, true);\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,EAAA,CAAA;AAAA,KAAA,EACb,KACJ,CAAA,CAAA,CAAA;AAnBH,IAAU,IAAA,CAAA,mBAAA,GAAsB,IAAI,wBAAA,C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AAS,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;;;;"}
@@ -21,7 +21,8 @@ function VizPanelRenderer({ model }) {
21
21
  menu,
22
22
  headerActions,
23
23
  titleItems,
24
- description
24
+ description,
25
+ _renderCounter = 0
25
26
  } = model.useState();
26
27
  const [ref, { width, height }] = useMeasure();
27
28
  const appEvents = useMemo(() => getAppEvents(), []);
@@ -166,7 +167,7 @@ function VizPanelRenderer({ model }) {
166
167
  transparent: false,
167
168
  width: innerWidth,
168
169
  height: innerHeight,
169
- renderCounter: 0,
170
+ renderCounter: _renderCounter,
170
171
  replaceVariables: model.interpolate,
171
172
  onOptionsChange: model.onOptionsChange,
172
173
  onFieldConfigChange: model.onFieldConfigChange,
@@ -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 } = 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={0}\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,iBAAA;AAAA,IACA,IAAA;AAAA,IACA,aAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,GACF,GAAI,MAAM,QAAS,EAAA,CAAA;AACnB,EAAA,MAAM,C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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 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;AAAA,IACA,WAAA;AAAA,IACA,gBAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;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,OAAQ,CAAA,MAAM,YAAa,EAAA,EAAG,EAAE,CAAA,CAAA;AAElD,EAAM,MAAA,iBAAA,GAAoB,YAAY,MAAM;AAC1C,IAAU,SAAA,CAAA,OAAA,CAAQ,IAAI,sBAAuB,CAAA,EAAE,SAAS,KAAM,CAAA,KAAA,CAAM,GAAI,EAAC,CAAC,CAAA,CAAA;AAAA,KACzE,CAAC,KAAA,CAAM,KAAM,CAAA,GAAA,EAAK,SAAS,CAAC,CAAA,CAAA;AAC/B,EAAA,MAAM,kBAAqB,GAAA,OAAA;AA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AAA,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;;;;"}
package/dist/index.d.ts CHANGED
@@ -1768,6 +1768,7 @@ interface VizPanelState<TOptions = {}, TFieldConfig = {}> extends SceneObjectSta
1768
1768
  _pluginLoadError?: string;
1769
1769
  /** Internal */
1770
1770
  _pluginInstanceState?: any;
1771
+ _renderCounter?: number;
1771
1772
  }
1772
1773
  declare class VizPanel<TOptions = {}, TFieldConfig extends {} = {}> extends SceneObjectBase<VizPanelState<TOptions, TFieldConfig>> {
1773
1774
  static Component: typeof VizPanelRenderer;
package/dist/index.js CHANGED
@@ -6621,7 +6621,8 @@ function VizPanelRenderer({ model }) {
6621
6621
  menu,
6622
6622
  headerActions,
6623
6623
  titleItems,
6624
- description
6624
+ description,
6625
+ _renderCounter = 0
6625
6626
  } = model.useState();
6626
6627
  const [ref, { width, height }] = reactUse.useMeasure();
6627
6628
  const appEvents = React.useMemo(() => runtime.getAppEvents(), []);
@@ -6766,7 +6767,7 @@ function VizPanelRenderer({ model }) {
6766
6767
  transparent: false,
6767
6768
  width: innerWidth,
6768
6769
  height: innerHeight,
6769
- renderCounter: 0,
6770
+ renderCounter: _renderCounter,
6770
6771
  replaceVariables: model.interpolate,
6771
6772
  onOptionsChange: model.onOptionsChange,
6772
6773
  onFieldConfigChange: model.onFieldConfigChange,
@@ -7080,7 +7081,8 @@ class VizPanel extends SceneObjectBase {
7080
7081
  options: {},
7081
7082
  fieldConfig: { defaults: {}, overrides: [] },
7082
7083
  title: "Title",
7083
- pluginId: "timeseries"
7084
+ pluginId: "timeseries",
7085
+ _renderCounter: 0
7084
7086
  }, state));
7085
7087
  this._variableDependency = new VariableDependencyConfig(this, {
7086
7088
  statePaths: ["title", "options", "fieldConfig"]
@@ -7125,6 +7127,7 @@ class VizPanel extends SceneObjectBase {
7125
7127
  this.setState({ displayMode });
7126
7128
  };
7127
7129
  this.onOptionsChange = (optionsUpdate, replace = false, isAfterPluginChange = false) => {
7130
+ var _a;
7128
7131
  const { fieldConfig, options } = this.state;
7129
7132
  const nextOptions = replace ? optionsUpdate : lodash.mergeWith(lodash.cloneDeep(options), optionsUpdate, (objValue, srcValue, key, obj) => {
7130
7133
  if (lodash.isArray(srcValue)) {
@@ -7143,7 +7146,8 @@ class VizPanel extends SceneObjectBase {
7143
7146
  isAfterPluginChange
7144
7147
  });
7145
7148
  this.setState({
7146
- options: withDefaults.options
7149
+ options: withDefaults.options,
7150
+ _renderCounter: ((_a = this.state._renderCounter) != null ? _a : 0) + 1
7147
7151
  });
7148
7152
  };
7149
7153
  this.onFieldConfigChange = (fieldConfigUpdate, replace) => {