@grafana/scenes 4.27.0--canary.766.9369774725.0 → 4.27.0--canary.766.9398430196.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +2 -0
  3. package/dist/esm/components/SceneTimeRangeCompare.js +55 -1
  4. package/dist/esm/components/SceneTimeRangeCompare.js.map +1 -1
  5. package/dist/esm/components/VizPanel/VizPanel.js +3 -0
  6. package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
  7. package/dist/esm/core/PanelBuilders/VizConfigBuilder.js +78 -0
  8. package/dist/esm/core/PanelBuilders/VizConfigBuilder.js.map +1 -0
  9. package/dist/esm/core/PanelBuilders/VizConfigBuilders.js +114 -0
  10. package/dist/esm/core/PanelBuilders/VizConfigBuilders.js.map +1 -0
  11. package/dist/esm/core/types.js.map +1 -1
  12. package/dist/esm/index.js +4 -1
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/esm/querying/ExtraQueryProvider.js +6 -0
  15. package/dist/esm/querying/ExtraQueryProvider.js.map +1 -0
  16. package/dist/esm/querying/SceneQueryRunner.js +85 -88
  17. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  18. package/dist/esm/querying/extraQueryProcessingOperator.js +46 -0
  19. package/dist/esm/querying/extraQueryProcessingOperator.js.map +1 -0
  20. package/dist/esm/utils/writeSceneLog.js +5 -1
  21. package/dist/esm/utils/writeSceneLog.js.map +1 -1
  22. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +3 -1
  23. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  24. package/dist/esm/variables/components/VariableValueSelect.js +9 -2
  25. package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
  26. package/dist/esm/variables/components/getOptionSearcher.js +2 -1
  27. package/dist/esm/variables/components/getOptionSearcher.js.map +1 -1
  28. package/dist/esm/variables/interpolation/sceneInterpolator.js +3 -3
  29. package/dist/esm/variables/interpolation/sceneInterpolator.js.map +1 -1
  30. package/dist/esm/variables/utils.js.map +1 -1
  31. package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -1
  32. package/dist/index.d.ts +256 -146
  33. package/dist/index.js +1127 -897
  34. package/dist/index.js.map +1 -1
  35. package/package.json +4 -7
  36. package/dist/esm/querying/timeShiftQueryResponseOperator.js +0 -60
  37. package/dist/esm/querying/timeShiftQueryResponseOperator.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # v4.26.2 (Thu Jun 06 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Variables: Support variable expressions inside custom values [#774](https://github.com/grafana/scenes/pull/774) ([@torkelo](https://github.com/torkelo))
6
+ - SceneQueryRunner: Act as if we're loading when waiting for variables to load. [#768](https://github.com/grafana/scenes/pull/768) ([@oscarkilhed](https://github.com/oscarkilhed))
7
+
8
+ #### Authors: 2
9
+
10
+ - Oscar Kilhed ([@oscarkilhed](https://github.com/oscarkilhed))
11
+ - Torkel Ödegaard ([@torkelo](https://github.com/torkelo))
12
+
13
+ ---
14
+
15
+ # v4.26.1 (Wed Jun 05 2024)
16
+
17
+ #### 🐛 Bug Fix
18
+
19
+ - PlainReact: Expose scene features through contexts and hooks and normal react components [#734](https://github.com/grafana/scenes/pull/734) ([@torkelo](https://github.com/torkelo) [@oscarkilhed](https://github.com/oscarkilhed))
20
+ - SceneQueryRunner: decouple time range comparisons [#587](https://github.com/grafana/scenes/pull/587) ([@sd2k](https://github.com/sd2k))
21
+
22
+ #### Authors: 3
23
+
24
+ - Ben Sully ([@sd2k](https://github.com/sd2k))
25
+ - Oscar Kilhed ([@oscarkilhed](https://github.com/oscarkilhed))
26
+ - Torkel Ödegaard ([@torkelo](https://github.com/torkelo))
27
+
28
+ ---
29
+
1
30
  # v4.26.0 (Tue Jun 04 2024)
2
31
 
3
32
  #### 🚀 Enhancement
package/README.md CHANGED
@@ -21,6 +21,8 @@
21
21
  - URL sync.
22
22
  - ... and more.
23
23
 
24
+ For library documentation go to [https://grafana.com/developers/scenes](https://grafana.com/developers/scenes).
25
+
24
26
  ## Development
25
27
 
26
28
  To work on @grafana/scenes SDK, please follow the guides below.
@@ -1,13 +1,18 @@
1
- import { rangeUtil, dateTime } from '@grafana/data';
1
+ import { rangeUtil, dateTime, FieldType } from '@grafana/data';
2
+ import { config } from '@grafana/runtime';
2
3
  import { useStyles2, ButtonGroup, ToolbarButton, Checkbox, ButtonSelect } from '@grafana/ui';
3
4
  import React from 'react';
4
5
  import { sceneGraph } from '../core/sceneGraph/index.js';
5
6
  import { SceneObjectBase } from '../core/SceneObjectBase.js';
6
7
  import { SceneObjectUrlSyncConfig } from '../services/SceneObjectUrlSyncConfig.js';
8
+ import { getCompareSeriesRefId } from '../utils/getCompareSeriesRefId.js';
7
9
  import { parseUrlParam } from '../utils/parseUrlParam.js';
8
10
  import { css } from '@emotion/css';
11
+ import { of } from 'rxjs';
9
12
 
10
13
  var __defProp = Object.defineProperty;
14
+ var __defProps = Object.defineProperties;
15
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
11
16
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
12
17
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
18
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -23,6 +28,7 @@ var __spreadValues = (a, b) => {
23
28
  }
24
29
  return a;
25
30
  };
31
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
32
  const PREVIOUS_PERIOD_VALUE = "__previousPeriod";
27
33
  const NO_PERIOD_VALUE = "__noPeriod";
28
34
  const PREVIOUS_PERIOD_COMPARE_OPTION = {
@@ -80,6 +86,27 @@ class SceneTimeRangeCompare extends SceneObjectBase {
80
86
  };
81
87
  this.addActivationHandler(this._onActivate);
82
88
  }
89
+ getExtraQueries(request) {
90
+ const extraQueries = [];
91
+ const compareRange = this.getCompareTimeRange(request.range);
92
+ if (!compareRange) {
93
+ return extraQueries;
94
+ }
95
+ const targets = request.targets.filter((query) => query.timeRangeCompare !== false);
96
+ if (targets.length) {
97
+ extraQueries.push({
98
+ req: __spreadProps(__spreadValues({}, request), {
99
+ targets,
100
+ range: compareRange
101
+ }),
102
+ processor: timeShiftAlignmentProcessor
103
+ });
104
+ }
105
+ return extraQueries;
106
+ }
107
+ shouldRerun(prev, next) {
108
+ return prev.compareWith !== next.compareWith;
109
+ }
83
110
  getCompareTimeRange(timeRange) {
84
111
  let compareFrom;
85
112
  let compareTo;
@@ -128,6 +155,33 @@ class SceneTimeRangeCompare extends SceneObjectBase {
128
155
  }
129
156
  }
130
157
  SceneTimeRangeCompare.Component = SceneTimeRangeCompareRenderer;
158
+ const timeShiftAlignmentProcessor = (primary, secondary) => {
159
+ const diff = secondary.timeRange.from.diff(primary.timeRange.from);
160
+ secondary.series.forEach((series) => {
161
+ series.refId = getCompareSeriesRefId(series.refId || "");
162
+ series.meta = __spreadProps(__spreadValues({}, series.meta), {
163
+ timeCompare: {
164
+ diffMs: diff,
165
+ isTimeShiftQuery: true
166
+ }
167
+ });
168
+ series.fields.forEach((field) => {
169
+ if (field.type === FieldType.time) {
170
+ field.values = field.values.map((v) => {
171
+ return diff < 0 ? v - diff : v + diff;
172
+ });
173
+ }
174
+ field.config = __spreadProps(__spreadValues({}, field.config), {
175
+ color: {
176
+ mode: "fixed",
177
+ fixedColor: config.theme.palette.gray60
178
+ }
179
+ });
180
+ return field;
181
+ });
182
+ });
183
+ return of(secondary);
184
+ };
131
185
  function SceneTimeRangeCompareRenderer({ model }) {
132
186
  var _a;
133
187
  const styles = useStyles2(getStyles);
@@ -1 +1 @@
1
- {"version":3,"file":"SceneTimeRangeCompare.js","sources":["../../../src/components/SceneTimeRangeCompare.tsx"],"sourcesContent":["import { DateTime, dateTime, GrafanaTheme2, rangeUtil, TimeRange } from '@grafana/data';\nimport { ButtonGroup, ButtonSelect, Checkbox, ToolbarButton, useStyles2 } from '@grafana/ui';\nimport React from 'react';\nimport { sceneGraph } from '../core/sceneGraph';\nimport { SceneObjectBase } from '../core/SceneObjectBase';\nimport { SceneComponentProps, SceneObjectState, SceneObjectUrlValues } from '../core/types';\nimport { SceneObjectUrlSyncConfig } from '../services/SceneObjectUrlSyncConfig';\nimport { parseUrlParam } from '../utils/parseUrlParam';\nimport { css } from '@emotion/css';\n\nexport interface TimeRangeCompareProvider {\n getCompareTimeRange(timeRange: TimeRange): TimeRange | undefined;\n}\n\ninterface SceneTimeRangeCompareState extends SceneObjectState {\n compareWith?: string;\n compareOptions: Array<{ label: string; value: string }>;\n}\n\nconst PREVIOUS_PERIOD_VALUE = '__previousPeriod';\nconst NO_PERIOD_VALUE = '__noPeriod';\n\nexport const PREVIOUS_PERIOD_COMPARE_OPTION = {\n label: 'Previous period',\n value: PREVIOUS_PERIOD_VALUE,\n};\n\nexport const NO_COMPARE_OPTION = {\n label: 'No comparison',\n value: NO_PERIOD_VALUE,\n};\n\nexport const DEFAULT_COMPARE_OPTIONS = [\n { label: 'Day before', value: '24h' },\n { label: 'Week before', value: '1w' },\n { label: 'Month before', value: '1M' },\n];\n\nexport class SceneTimeRangeCompare\n extends SceneObjectBase<SceneTimeRangeCompareState>\n implements TimeRangeCompareProvider\n{\n static Component = SceneTimeRangeCompareRenderer;\n protected _urlSync = new SceneObjectUrlSyncConfig(this, { keys: ['compareWith'] });\n\n public constructor(state: Partial<SceneTimeRangeCompareState>) {\n super({ compareOptions: DEFAULT_COMPARE_OPTIONS, ...state });\n this.addActivationHandler(this._onActivate);\n }\n\n private _onActivate = () => {\n const sceneTimeRange = sceneGraph.getTimeRange(this);\n this.setState({ compareOptions: this.getCompareOptions(sceneTimeRange.state.value) });\n\n this._subs.add(\n sceneTimeRange.subscribeToState((timeRange) => {\n const compareOptions = this.getCompareOptions(timeRange.value);\n const stateUpdate: Partial<SceneTimeRangeCompareState> = { compareOptions };\n\n // if current compareWith is not applicable to the new time range, set it to previous period comparison\n if (Boolean(this.state.compareWith) && !compareOptions.find(({ value }) => value === this.state.compareWith)) {\n stateUpdate.compareWith = PREVIOUS_PERIOD_VALUE;\n }\n\n this.setState(stateUpdate);\n })\n );\n };\n\n public getCompareOptions = (timeRange: TimeRange) => {\n const diffDays = Math.ceil(timeRange.to.diff(timeRange.from));\n\n const matchIndex = DEFAULT_COMPARE_OPTIONS.findIndex(({ value }) => {\n const intervalInMs = rangeUtil.intervalToMs(value);\n return intervalInMs >= diffDays;\n });\n\n return [\n NO_COMPARE_OPTION,\n PREVIOUS_PERIOD_COMPARE_OPTION,\n ...DEFAULT_COMPARE_OPTIONS.slice(matchIndex).map(({ label, value }) => ({ label, value })),\n ];\n };\n\n public onCompareWithChanged = (compareWith: string) => {\n if (compareWith === NO_PERIOD_VALUE) {\n this.onClearCompare();\n } else {\n this.setState({ compareWith });\n }\n };\n\n public onClearCompare = () => {\n this.setState({ compareWith: undefined });\n };\n\n public getCompareTimeRange(timeRange: TimeRange): TimeRange | undefined {\n let compareFrom: DateTime;\n let compareTo: DateTime;\n\n if (this.state.compareWith) {\n if (this.state.compareWith === PREVIOUS_PERIOD_VALUE) {\n const diffMs = timeRange.to.diff(timeRange.from);\n compareFrom = dateTime(timeRange.from!).subtract(diffMs);\n compareTo = dateTime(timeRange.to!).subtract(diffMs);\n } else {\n compareFrom = dateTime(timeRange.from!).subtract(rangeUtil.intervalToMs(this.state.compareWith));\n compareTo = dateTime(timeRange.to!).subtract(rangeUtil.intervalToMs(this.state.compareWith));\n }\n return {\n from: compareFrom,\n to: compareTo,\n raw: {\n from: compareFrom,\n to: compareTo,\n },\n };\n }\n\n return undefined;\n }\n\n public getUrlState(): SceneObjectUrlValues {\n return {\n compareWith: this.state.compareWith,\n };\n }\n\n public updateFromUrl(values: SceneObjectUrlValues) {\n if (!values.compareWith) {\n return;\n }\n\n const compareWith = parseUrlParam(values.compareWith);\n\n if (compareWith) {\n const compareOptions = this.getCompareOptions(sceneGraph.getTimeRange(this).state.value);\n\n if (compareOptions.find(({ value }) => value === compareWith)) {\n this.setState({\n compareWith,\n });\n } else {\n this.setState({\n compareWith: '__previousPeriod',\n });\n }\n }\n }\n}\n\nfunction SceneTimeRangeCompareRenderer({ model }: SceneComponentProps<SceneTimeRangeCompare>) {\n const styles = useStyles2(getStyles);\n const { compareWith, compareOptions } = model.useState();\n\n const [previousCompare, setPreviousCompare] = React.useState(compareWith);\n const previousValue = compareOptions.find(({ value }) => value === previousCompare) ?? PREVIOUS_PERIOD_COMPARE_OPTION;\n\n const value = compareOptions.find(({ value }) => value === compareWith);\n const enabled = Boolean(value);\n\n const onClick = () => {\n if (enabled) {\n setPreviousCompare(compareWith);\n model.onClearCompare();\n } else if (!enabled) {\n model.onCompareWithChanged(previousValue.value);\n }\n };\n\n return (\n <ButtonGroup>\n <ToolbarButton\n variant=\"canvas\"\n tooltip=\"Enable time frame comparison\"\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n onClick();\n }}\n >\n <Checkbox label=\" \" value={enabled} onClick={onClick} />\n Comparison\n </ToolbarButton>\n\n {enabled ? (\n <ButtonSelect\n variant=\"canvas\"\n value={value}\n options={compareOptions}\n onChange={(v) => {\n model.onCompareWithChanged(v.value!);\n }}\n />\n ) : (\n <ToolbarButton className={styles.previewButton} disabled variant=\"canvas\" isOpen={false}>\n {previousValue.label}\n </ToolbarButton>\n )}\n </ButtonGroup>\n );\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n previewButton: css({\n '&:disabled': {\n border: `1px solid ${theme.colors.secondary.border}`,\n color: theme.colors.text.disabled,\n opacity: 1,\n },\n }),\n };\n}\n"],"names":["value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,qBAAwB,GAAA,kBAAA,CAAA;AAC9B,MAAM,eAAkB,GAAA,YAAA,CAAA;AAEjB,MAAM,8BAAiC,GAAA;AAAA,EAC5C,KAAO,EAAA,iBAAA;AAAA,EACP,KAAO,EAAA,qBAAA;AACT,EAAA;AAEO,MAAM,iBAAoB,GAAA;AAAA,EAC/B,KAAO,EAAA,eAAA;AAAA,EACP,KAAO,EAAA,eAAA;AACT,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QAAA;AAAA,IAAS,MAAQ,EAAA,KAAA;AAAA,GAC/E,EAAA,aAAA,CAAc,KACjB,CAEJ,CAAA,CAAA;AAEJ,CAAA;AAEA,SAAS,UAAU,KAAsB,EAAA;AACvC,EAAO,OAAA;AAAA,IACL,eAAe,GAAI,CAAA;AAAA,MACjB,YAAc,EAAA;AAAA,QACZ,MAAQ,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,MAAA,CAAO,SAAU,CAAA,MAAA,CAAA,CAAA;AAAA,QAC5C,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,QAAA;AAAA,QACzB,OAAS,EAAA,CAAA;AAAA,OACX;AAAA,KACD,CAAA;AAAA,GACH,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"SceneTimeRangeCompare.js","sources":["../../../src/components/SceneTimeRangeCompare.tsx"],"sourcesContent":["import { DataQueryRequest, DateTime, dateTime, FieldType, GrafanaTheme2, rangeUtil, TimeRange } from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { ButtonGroup, ButtonSelect, Checkbox, ToolbarButton, useStyles2 } from '@grafana/ui';\nimport React from 'react';\nimport { sceneGraph } from '../core/sceneGraph';\nimport { SceneObjectBase } from '../core/SceneObjectBase';\nimport { SceneComponentProps, SceneObjectState, SceneObjectUrlValues } from '../core/types';\nimport { DataQueryExtended } from '../querying/SceneQueryRunner';\nimport { ExtraQueryDescriptor, ExtraQueryDataProcessor, ExtraQueryProvider } from '../querying/ExtraQueryProvider';\nimport { SceneObjectUrlSyncConfig } from '../services/SceneObjectUrlSyncConfig';\nimport { getCompareSeriesRefId } from '../utils/getCompareSeriesRefId';\nimport { parseUrlParam } from '../utils/parseUrlParam';\nimport { css } from '@emotion/css';\nimport { of } from 'rxjs';\n\ninterface SceneTimeRangeCompareState extends SceneObjectState {\n compareWith?: string;\n compareOptions: Array<{ label: string; value: string }>;\n}\n\nconst PREVIOUS_PERIOD_VALUE = '__previousPeriod';\nconst NO_PERIOD_VALUE = '__noPeriod';\n\nexport const PREVIOUS_PERIOD_COMPARE_OPTION = {\n label: 'Previous period',\n value: PREVIOUS_PERIOD_VALUE,\n};\n\nexport const NO_COMPARE_OPTION = {\n label: 'No comparison',\n value: NO_PERIOD_VALUE,\n};\n\nexport const DEFAULT_COMPARE_OPTIONS = [\n { label: 'Day before', value: '24h' },\n { label: 'Week before', value: '1w' },\n { label: 'Month before', value: '1M' },\n];\n\nexport class SceneTimeRangeCompare\n extends SceneObjectBase<SceneTimeRangeCompareState>\n implements ExtraQueryProvider<SceneTimeRangeCompareState> {\n\n static Component = SceneTimeRangeCompareRenderer;\n protected _urlSync = new SceneObjectUrlSyncConfig(this, { keys: ['compareWith'] });\n\n public constructor(state: Partial<SceneTimeRangeCompareState>) {\n super({ compareOptions: DEFAULT_COMPARE_OPTIONS, ...state });\n this.addActivationHandler(this._onActivate);\n }\n\n private _onActivate = () => {\n const sceneTimeRange = sceneGraph.getTimeRange(this);\n this.setState({ compareOptions: this.getCompareOptions(sceneTimeRange.state.value) });\n\n this._subs.add(\n sceneTimeRange.subscribeToState((timeRange) => {\n const compareOptions = this.getCompareOptions(timeRange.value);\n const stateUpdate: Partial<SceneTimeRangeCompareState> = { compareOptions };\n\n // if current compareWith is not applicable to the new time range, set it to previous period comparison\n if (Boolean(this.state.compareWith) && !compareOptions.find(({ value }) => value === this.state.compareWith)) {\n stateUpdate.compareWith = PREVIOUS_PERIOD_VALUE;\n }\n\n this.setState(stateUpdate);\n })\n );\n };\n\n public getCompareOptions = (timeRange: TimeRange) => {\n const diffDays = Math.ceil(timeRange.to.diff(timeRange.from));\n\n const matchIndex = DEFAULT_COMPARE_OPTIONS.findIndex(({ value }) => {\n const intervalInMs = rangeUtil.intervalToMs(value);\n return intervalInMs >= diffDays;\n });\n\n return [\n NO_COMPARE_OPTION,\n PREVIOUS_PERIOD_COMPARE_OPTION,\n ...DEFAULT_COMPARE_OPTIONS.slice(matchIndex).map(({ label, value }) => ({ label, value })),\n ];\n };\n\n public onCompareWithChanged = (compareWith: string) => {\n if (compareWith === NO_PERIOD_VALUE) {\n this.onClearCompare();\n } else {\n this.setState({ compareWith });\n }\n };\n\n public onClearCompare = () => {\n this.setState({ compareWith: undefined });\n };\n\n // Get a time shifted request to compare with the primary request.\n public getExtraQueries(request: DataQueryRequest): ExtraQueryDescriptor[] {\n const extraQueries: ExtraQueryDescriptor[] = [];\n const compareRange = this.getCompareTimeRange(request.range);\n if (!compareRange) {\n return extraQueries;\n }\n\n const targets = request.targets.filter((query: DataQueryExtended) => query.timeRangeCompare !== false);\n if (targets.length) {\n extraQueries.push({\n req: {\n ...request,\n targets,\n range: compareRange,\n },\n processor: timeShiftAlignmentProcessor,\n });\n }\n return extraQueries;\n }\n\n // The query runner should rerun the comparison query if the compareWith value has changed.\n public shouldRerun(prev: SceneTimeRangeCompareState, next: SceneTimeRangeCompareState): boolean {\n return prev.compareWith !== next.compareWith;\n }\n\n public getCompareTimeRange(timeRange: TimeRange): TimeRange | undefined {\n let compareFrom: DateTime;\n let compareTo: DateTime;\n\n if (this.state.compareWith) {\n if (this.state.compareWith === PREVIOUS_PERIOD_VALUE) {\n const diffMs = timeRange.to.diff(timeRange.from);\n compareFrom = dateTime(timeRange.from!).subtract(diffMs);\n compareTo = dateTime(timeRange.to!).subtract(diffMs);\n } else {\n compareFrom = dateTime(timeRange.from!).subtract(rangeUtil.intervalToMs(this.state.compareWith));\n compareTo = dateTime(timeRange.to!).subtract(rangeUtil.intervalToMs(this.state.compareWith));\n }\n return {\n from: compareFrom,\n to: compareTo,\n raw: {\n from: compareFrom,\n to: compareTo,\n },\n };\n }\n\n return undefined;\n }\n\n public getUrlState(): SceneObjectUrlValues {\n return {\n compareWith: this.state.compareWith,\n };\n }\n\n public updateFromUrl(values: SceneObjectUrlValues) {\n if (!values.compareWith) {\n return;\n }\n\n const compareWith = parseUrlParam(values.compareWith);\n\n if (compareWith) {\n const compareOptions = this.getCompareOptions(sceneGraph.getTimeRange(this).state.value);\n\n if (compareOptions.find(({ value }) => value === compareWith)) {\n this.setState({\n compareWith,\n });\n } else {\n this.setState({\n compareWith: '__previousPeriod',\n });\n }\n }\n }\n}\n\n// Processor function for use with time shifted comparison series.\n// This aligns the secondary series with the primary and adds custom\n// metadata and config to the secondary series' fields so that it is\n// rendered appropriately.\nconst timeShiftAlignmentProcessor: ExtraQueryDataProcessor = (primary, secondary) => {\n const diff = secondary.timeRange.from.diff(primary.timeRange.from);\n secondary.series.forEach((series) => {\n series.refId = getCompareSeriesRefId(series.refId || '');\n series.meta = {\n ...series.meta,\n // @ts-ignore Remove when https://github.com/grafana/grafana/pull/71129 is released\n timeCompare: {\n diffMs: diff,\n isTimeShiftQuery: true,\n },\n };\n series.fields.forEach((field) => {\n // Align compare series time stamps with reference series\n if (field.type === FieldType.time) {\n field.values = field.values.map((v) => {\n return diff < 0 ? v - diff : v + diff;\n });\n }\n\n field.config = {\n ...field.config,\n color: {\n mode: 'fixed',\n fixedColor: config.theme.palette.gray60,\n },\n };\n return field;\n });\n });\n return of(secondary);\n}\n\nfunction SceneTimeRangeCompareRenderer({ model }: SceneComponentProps<SceneTimeRangeCompare>) {\n const styles = useStyles2(getStyles);\n const { compareWith, compareOptions } = model.useState();\n\n const [previousCompare, setPreviousCompare] = React.useState(compareWith);\n const previousValue = compareOptions.find(({ value }) => value === previousCompare) ?? PREVIOUS_PERIOD_COMPARE_OPTION;\n\n const value = compareOptions.find(({ value }) => value === compareWith);\n const enabled = Boolean(value);\n\n const onClick = () => {\n if (enabled) {\n setPreviousCompare(compareWith);\n model.onClearCompare();\n } else if (!enabled) {\n model.onCompareWithChanged(previousValue.value);\n }\n };\n\n return (\n <ButtonGroup>\n <ToolbarButton\n variant=\"canvas\"\n tooltip=\"Enable time frame comparison\"\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n onClick();\n }}\n >\n <Checkbox label=\" \" value={enabled} onClick={onClick} />\n Comparison\n </ToolbarButton>\n\n {enabled ? (\n <ButtonSelect\n variant=\"canvas\"\n value={value}\n options={compareOptions}\n onChange={(v) => {\n model.onCompareWithChanged(v.value!);\n }}\n />\n ) : (\n <ToolbarButton className={styles.previewButton} disabled variant=\"canvas\" isOpen={false}>\n {previousValue.label}\n </ToolbarButton>\n )}\n </ButtonGroup>\n );\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n previewButton: css({\n '&:disabled': {\n border: `1px solid ${theme.colors.secondary.border}`,\n color: theme.colors.text.disabled,\n opacity: 1,\n },\n }),\n };\n}\n"],"names":["value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,qBAAwB,GAAA,kBAAA,CAAA;AAC9B,MAAM,eAAkB,GAAA,YAAA,CAAA;AAEjB,MAAM,8BAAiC,GAAA;AAAA,EAC5C,KAAO,EAAA,iBAAA;AAAA,EACP,KAAO,EAAA,qBAAA;AACT,EAAA;AAEO,MAAM,iBAAoB,GAAA;AAAA,EAC/B,KAAO,EAAA,eAAA;AAAA,EACP,KAAO,EAAA,eAAA;AACT,EAAA;AAEO,MAAM,uBAA0B,GAAA;AAAA,EACrC,EAAE,KAAA,EAAO,YAAc,EAAA,KAAA,EAAO,KAAM,EAAA;AAAA,EACpC,EAAE,KAAA,EAAO,aAAe,EAAA,KAAA,EAAO,IAAK,EAAA;AAAA,EACpC,EAAE,KAAA,EAAO,cAAgB,EAAA,KAAA,EAAO,IAAK,EAAA;AACvC,EAAA;AAEO,MAAM,8BACH,eACkD,CAAA;AAAA,EAKnD,YAAY,KAA4C,EAAA;AAC7D,IAAM,KAAA,CAAA,cAAA,CAAA,EAAE,cAAgB,EAAA,uBAAA,EAAA,EAA4B,KAAO,CAAA,CAAA,CAAA;AAH7D,IAAU,IAAA,CAAA,QAAA,GAAW,IAAI,wBAAyB,CAAA,IAAA,EAAM,EAAE,IAAM,EAAA,CAAC,aAAa,CAAA,EAAG,CAAA,CAAA;AAOjF,IAAA,IAAA,CAAQ,cAAc,MAAM;AAC1B,MAAM,MAAA,cAAA,G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ACf,MAAM,KAAA,CAAA,oBAAA,CAAqB,EAAE,KAAM,CAAA,CAAA;AAAA,KACrC;AAAA,GACF,oBAEC,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA;AAAA,IAAc,WAAW,MAAO,CAAA,aAAA;AAAA,IAAe,QAAQ,EAAA,IAAA;AAAA,IAAC,OAAQ,EAAA,QAAA;AAAA,IAAS,MAAQ,EAAA,KAAA;AAAA,GAC/E,EAAA,aAAA,CAAc,KACjB,CAEJ,CAAA,CAAA;AAEJ,CAAA;AAEA,SAAS,UAAU,KAAsB,EAAA;AACvC,EAAO,OAAA;AAAA,IACL,eAAe,GAAI,CAAA;AAAA,MACjB,YAAc,EAAA;AAAA,QACZ,MAAQ,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,MAAA,CAAO,SAAU,CAAA,MAAA,CAAA,CAAA;AAAA,QAC5C,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,QAAA;AAAA,QACzB,OAAS,EAAA,CAAA;AAAA,OACX;AAAA,KACD,CAAA;AAAA,GACH,CAAA;AACF;;;;"}
@@ -258,6 +258,9 @@ class VizPanel extends SceneObjectBase {
258
258
  (_a = this._panelContext) != null ? _a : this._panelContext = this.buildPanelContext();
259
259
  return this._panelContext;
260
260
  }
261
+ clearFieldConfigCache() {
262
+ this._dataWithFieldConfig = void 0;
263
+ }
261
264
  applyFieldConfig(rawData) {
262
265
  var _a, _b, _c, _d;
263
266
  const plugin = this._plugin;
@@ -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, 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) {\n const plugin = loadPanelPluginSync(pluginId);\n\n if (plugin) {\n this._pluginLoaded(plugin);\n } else {\n const { importPanelPlugin } = getPluginImportUtils();\n\n try {\n const result = await importPanelPlugin(pluginId);\n this._pluginLoaded(result);\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) {\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 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: 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 });\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 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) => {\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, (_, srcValue) => {\n if (isArray(srcValue)) {\n return srcValue;\n }\n return;\n });\n\n const withDefaults = getPanelOptionsWithDefaults({\n plugin: this._plugin!,\n currentOptions: nextOptions,\n currentFieldConfig: fieldConfig,\n isAfterPluginChange: false,\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 /**\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;AAiHhC,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,IAAA,EAAM,KAAM,CAAA,SA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A,CAAA;AAAA,KAC7C;AAEA,IAAO,OAAA,OAAA,CAAA;AAAA,GACT;AACF,CAAA;AAtYa,QAAA,CAGG,SAAY,GAAA,gBAAA,CAAA;AAqY5B,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, 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) {\n const plugin = loadPanelPluginSync(pluginId);\n\n if (plugin) {\n this._pluginLoaded(plugin);\n } else {\n const { importPanelPlugin } = getPluginImportUtils();\n\n try {\n const result = await importPanelPlugin(pluginId);\n this._pluginLoaded(result);\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) {\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 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: 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 });\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 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) => {\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, (_, srcValue) => {\n if (isArray(srcValue)) {\n return srcValue;\n }\n return;\n });\n\n const withDefaults = getPanelOptionsWithDefaults({\n plugin: this._plugin!,\n currentOptions: nextOptions,\n currentFieldConfig: fieldConfig,\n isAfterPluginChange: false,\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;AAiHhC,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,IAAA,EAAM,KAAM,CAAA,SAAA,CAAU,IAAI,CAAA;AAAA,UAC1B,EAAA,EAAI,KAAM,CAAA,SAAA,C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mB,CAAA,IAAA,EAAM,OAAO,CAAA,CAAA;AAAA,KAC7C;AAEA,IAAO,OAAA,OAAA,CAAA;AAAA,GACT;AACF,CAAA;AA1Ya,QAAA,CAGG,SAAY,GAAA,gBAAA,CAAA;AAyY5B,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;;;;"}
@@ -0,0 +1,78 @@
1
+ import { FieldConfigBuilder } from './FieldConfigBuilder.js';
2
+ import { PanelOptionsBuilder } from './PanelOptionsBuilder.js';
3
+
4
+ class VizConfigBuilder {
5
+ constructor(pluginId, pluginVersion, defaultOptions, defaultFieldConfig) {
6
+ this._pluginId = pluginId;
7
+ this._pluginVersion = pluginVersion;
8
+ this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);
9
+ this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);
10
+ }
11
+ setColor(color) {
12
+ this._fieldConfigBuilder.setColor(color);
13
+ return this;
14
+ }
15
+ setDecimals(decimals) {
16
+ this._fieldConfigBuilder.setDecimals(decimals);
17
+ return this;
18
+ }
19
+ setDisplayName(displayName) {
20
+ this._fieldConfigBuilder.setDisplayName(displayName);
21
+ return this;
22
+ }
23
+ setFilterable(filterable) {
24
+ this._fieldConfigBuilder.setFilterable(filterable);
25
+ return this;
26
+ }
27
+ setLinks(links) {
28
+ this._fieldConfigBuilder.setLinks(links);
29
+ return this;
30
+ }
31
+ setMappings(mappings) {
32
+ this._fieldConfigBuilder.setMappings(mappings);
33
+ return this;
34
+ }
35
+ setMax(max) {
36
+ this._fieldConfigBuilder.setMax(max);
37
+ return this;
38
+ }
39
+ setMin(min) {
40
+ this._fieldConfigBuilder.setMin(min);
41
+ return this;
42
+ }
43
+ setNoValue(noValue) {
44
+ this._fieldConfigBuilder.setNoValue(noValue);
45
+ return this;
46
+ }
47
+ setThresholds(thresholds) {
48
+ this._fieldConfigBuilder.setThresholds(thresholds);
49
+ return this;
50
+ }
51
+ setUnit(unit) {
52
+ this._fieldConfigBuilder.setUnit(unit);
53
+ return this;
54
+ }
55
+ setCustomFieldConfig(id, value) {
56
+ this._fieldConfigBuilder.setCustomFieldConfig(id, value);
57
+ return this;
58
+ }
59
+ setOverrides(builder) {
60
+ this._fieldConfigBuilder.setOverrides(builder);
61
+ return this;
62
+ }
63
+ setOption(id, value) {
64
+ this._panelOptionsBuilder.setOption(id, value);
65
+ return this;
66
+ }
67
+ build() {
68
+ return {
69
+ pluginId: this._pluginId,
70
+ pluginVersion: this._pluginVersion,
71
+ options: this._panelOptionsBuilder.build(),
72
+ fieldConfig: this._fieldConfigBuilder.build()
73
+ };
74
+ }
75
+ }
76
+
77
+ export { VizConfigBuilder };
78
+ //# sourceMappingURL=VizConfigBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VizConfigBuilder.js","sources":["../../../../src/core/PanelBuilders/VizConfigBuilder.ts"],"sourcesContent":["import { DeepPartial } from '../types';\nimport { FieldConfigBuilder } from './FieldConfigBuilder';\nimport { FieldConfigOverridesBuilder } from './FieldConfigOverridesBuilder';\nimport { PanelOptionsBuilder } from './PanelOptionsBuilder';\nimport { StandardFieldConfig, StandardFieldConfigInterface, VizConfig } from './types';\n\nexport class VizConfigBuilder<TOptions extends {}, TFieldConfig extends {}>\n implements StandardFieldConfigInterface<StandardFieldConfig, VizConfigBuilder<TOptions, TFieldConfig>, 'set'>\n{\n private _fieldConfigBuilder: FieldConfigBuilder<TFieldConfig>;\n private _panelOptionsBuilder: PanelOptionsBuilder<TOptions>;\n private _pluginId: string;\n private _pluginVersion: string;\n\n public constructor(\n pluginId: string,\n pluginVersion: string,\n defaultOptions?: () => Partial<TOptions>,\n defaultFieldConfig?: () => TFieldConfig\n ) {\n this._pluginId = pluginId;\n this._pluginVersion = pluginVersion;\n this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);\n this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);\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 * Build the panel.\n */\n public build(): VizConfig<TOptions, TFieldConfig> {\n return {\n pluginId: this._pluginId,\n pluginVersion: this._pluginVersion,\n options: this._panelOptionsBuilder.build(),\n fieldConfig: this._fieldConfigBuilder.build(),\n };\n }\n}\n"],"names":[],"mappings":";;;AAMO,MAAM,gBAEb,CAAA;AAAA,EAMS,WACL,CAAA,QAAA,EACA,aACA,EAAA,cAAA,EACA,kBACA,EAAA;AACA,IAAA,IAAA,CAAK,SAAY,GAAA,QAAA,CAAA;AACjB,IAAA,IAAA,CAAK,cAAiB,GAAA,aAAA,CAAA;AACtB,IAAK,IAAA,CAAA,mBAAA,GAAsB,IAAI,kBAAA,CAAmB,kBAAkB,CAAA,CAAA;AACpE,IAAK,IAAA,CAAA,oBA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A,CAAA;AAC3C,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,cAAc,UAAqD,EAAA;AACxE,IAAK,IAAA,CAAA,mBAAA,CAAoB,cAAc,UAAU,CAAA,CAAA;AACjD,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,QAAQ,IAAyC,EAAA;AACtD,IAAK,IAAA,CAAA,mBAAA,CAAoB,QAAQ,IAAI,CAAA,CAAA;AACrC,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAEO,oBAAA,CAAgE,IAAO,KAAgC,EAAA;AAC5G,IAAK,IAAA,CAAA,mBAAA,CAAoB,oBAAqB,CAAA,EAAA,EAAI,KAAK,CAAA,CAAA;AACvD,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAEO,aAAa,OAAuE,EAAA;AACzF,IAAK,IAAA,CAAA,mBAAA,CAAoB,aAAa,OAAO,CAAA,CAAA;AAC7C,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,SAAA,CAAiD,IAAO,KAAgC,EAAA;AAC7F,IAAK,IAAA,CAAA,oBAAA,CAAqB,SAAU,CAAA,EAAA,EAAI,KAAK,CAAA,CAAA;AAC7C,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAKO,KAA2C,GAAA;AAChD,IAAO,OAAA;AAAA,MACL,UAAU,IAAK,CAAA,SAAA;AAAA,MACf,eAAe,IAAK,CAAA,cAAA;AAAA,MACpB,OAAA,EAAS,IAAK,CAAA,oBAAA,CAAqB,KAAM,EAAA;AAAA,MACzC,WAAA,EAAa,IAAK,CAAA,mBAAA,CAAoB,KAAM,EAAA;AAAA,KAC9C,CAAA;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,114 @@
1
+ import { defaultOptions, defaultFieldConfig } from '@grafana/schema/dist/esm/raw/composable/barchart/panelcfg/x/BarChartPanelCfg_types.gen';
2
+ import { defaultOptions as defaultOptions$1 } from '@grafana/schema/dist/esm/raw/composable/bargauge/panelcfg/x/BarGaugePanelCfg_types.gen';
3
+ import { defaultOptions as defaultOptions$2 } from '@grafana/schema/dist/esm/raw/composable/datagrid/panelcfg/x/DatagridPanelCfg_types.gen';
4
+ import { defaultOptions as defaultOptions$3 } from '@grafana/schema/dist/esm/raw/composable/gauge/panelcfg/x/GaugePanelCfg_types.gen';
5
+ import { defaultOptions as defaultOptions$4 } from '@grafana/schema/dist/esm/raw/composable/geomap/panelcfg/x/GeomapPanelCfg_types.gen';
6
+ import { defaultOptions as defaultOptions$5 } from '@grafana/schema/dist/esm/raw/composable/heatmap/panelcfg/x/HeatmapPanelCfg_types.gen';
7
+ import { defaultOptions as defaultOptions$6, defaultFieldConfig as defaultFieldConfig$1 } from '@grafana/schema/dist/esm/raw/composable/histogram/panelcfg/x/HistogramPanelCfg_types.gen';
8
+ import { defaultOptions as defaultOptions$7 } from '@grafana/schema/dist/esm/raw/composable/news/panelcfg/x/NewsPanelCfg_types.gen';
9
+ import { defaultOptions as defaultOptions$8 } from '@grafana/schema/dist/esm/raw/composable/piechart/panelcfg/x/PieChartPanelCfg_types.gen';
10
+ import { defaultOptions as defaultOptions$9 } from '@grafana/schema/dist/esm/raw/composable/stat/panelcfg/x/StatPanelCfg_types.gen';
11
+ import { defaultOptions as defaultOptions$a, defaultFieldConfig as defaultFieldConfig$2 } from '@grafana/schema/dist/esm/raw/composable/statetimeline/panelcfg/x/StateTimelinePanelCfg_types.gen';
12
+ import { defaultOptions as defaultOptions$b, defaultFieldConfig as defaultFieldConfig$3 } from '@grafana/schema/dist/esm/raw/composable/statushistory/panelcfg/x/StatusHistoryPanelCfg_types.gen';
13
+ import { defaultOptions as defaultOptions$c } from '@grafana/schema/dist/esm/raw/composable/table/panelcfg/x/TablePanelCfg_types.gen';
14
+ import { defaultOptions as defaultOptions$d } from '@grafana/schema/dist/esm/raw/composable/text/panelcfg/x/TextPanelCfg_types.gen';
15
+ import { defaultOptions as defaultOptions$e, defaultFieldConfig as defaultFieldConfig$4 } from '@grafana/schema/dist/esm/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen';
16
+ import { VizConfigBuilder } from './VizConfigBuilder.js';
17
+
18
+ const VizConfigBuilders = {
19
+ barchart() {
20
+ return new VizConfigBuilder(
21
+ "barchart",
22
+ "10.0.0",
23
+ () => defaultOptions,
24
+ () => defaultFieldConfig
25
+ );
26
+ },
27
+ bargauge() {
28
+ return new VizConfigBuilder("bargauge", "10.0.0", () => defaultOptions$1);
29
+ },
30
+ datagrid() {
31
+ return new VizConfigBuilder("datagrid", "10.0.0", () => defaultOptions$2);
32
+ },
33
+ flamegraph() {
34
+ return new VizConfigBuilder("flamegraph", "10.0.0");
35
+ },
36
+ gauge() {
37
+ return new VizConfigBuilder("gauge", "10.0.0", () => defaultOptions$3);
38
+ },
39
+ geomap() {
40
+ return new VizConfigBuilder("geomap", "10.0.0", () => defaultOptions$4);
41
+ },
42
+ heatmap() {
43
+ return new VizConfigBuilder("heatmap", "10.0.0", () => defaultOptions$5);
44
+ },
45
+ histogram() {
46
+ return new VizConfigBuilder(
47
+ "histogram",
48
+ "10.0.0",
49
+ () => defaultOptions$6,
50
+ () => defaultFieldConfig$1
51
+ );
52
+ },
53
+ logs() {
54
+ return new VizConfigBuilder("logs", "10.0.0");
55
+ },
56
+ news() {
57
+ return new VizConfigBuilder("news", "10.0.0", () => defaultOptions$7);
58
+ },
59
+ nodegraph() {
60
+ return new VizConfigBuilder("nodeGraph", "10.0.0");
61
+ },
62
+ piechart() {
63
+ return new VizConfigBuilder(
64
+ "piechart",
65
+ "10.0.0",
66
+ () => defaultOptions$8
67
+ );
68
+ },
69
+ stat() {
70
+ return new VizConfigBuilder("stat", "10.0.0", () => defaultOptions$9);
71
+ },
72
+ statetimeline() {
73
+ return new VizConfigBuilder(
74
+ "state-timeline",
75
+ "10.0.0",
76
+ () => defaultOptions$a,
77
+ () => defaultFieldConfig$2
78
+ );
79
+ },
80
+ statushistory() {
81
+ return new VizConfigBuilder(
82
+ "status-history",
83
+ "10.0.0",
84
+ () => defaultOptions$b,
85
+ () => defaultFieldConfig$3
86
+ );
87
+ },
88
+ table() {
89
+ return new VizConfigBuilder("table", "10.0.0", () => defaultOptions$c);
90
+ },
91
+ text() {
92
+ return new VizConfigBuilder("text", "10.0.0", () => defaultOptions$d);
93
+ },
94
+ timeseries() {
95
+ return new VizConfigBuilder("timeseries", "10.0.0");
96
+ },
97
+ trend() {
98
+ return new VizConfigBuilder("trend", "10.0.0");
99
+ },
100
+ traces() {
101
+ return new VizConfigBuilder("traces", "10.0.0");
102
+ },
103
+ xychart() {
104
+ return new VizConfigBuilder(
105
+ "xychart",
106
+ "10.0.0",
107
+ () => defaultOptions$e,
108
+ () => defaultFieldConfig$4
109
+ );
110
+ }
111
+ };
112
+
113
+ export { VizConfigBuilders };
114
+ //# sourceMappingURL=VizConfigBuilders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VizConfigBuilders.js","sources":["../../../../src/core/PanelBuilders/VizConfigBuilders.ts"],"sourcesContent":["import { TableFieldOptions as TableFieldConfig } from '@grafana/schema';\n\nimport {\n Options as BarChartOptions,\n FieldConfig as BarChartFieldConfig,\n defaultOptions as defaultBarChartOptions,\n defaultFieldConfig as defaultBarChartFieldConfig,\n} from '@grafana/schema/dist/esm/raw/composable/barchart/panelcfg/x/BarChartPanelCfg_types.gen';\nimport {\n Options as BarGaugeOptions,\n defaultOptions as defaultBarGaugeOptions,\n} from '@grafana/schema/dist/esm/raw/composable/bargauge/panelcfg/x/BarGaugePanelCfg_types.gen';\nimport {\n Options as DataGridOptions,\n defaultOptions as defaultDataGridOptions,\n} from '@grafana/schema/dist/esm/raw/composable/datagrid/panelcfg/x/DatagridPanelCfg_types.gen';\nimport {\n Options as GaugeOptions,\n defaultOptions as defaultGaugeOptions,\n} from '@grafana/schema/dist/esm/raw/composable/gauge/panelcfg/x/GaugePanelCfg_types.gen';\nimport {\n Options as GeomapOptions,\n defaultOptions as defaultGeomapOptions,\n} from '@grafana/schema/dist/esm/raw/composable/geomap/panelcfg/x/GeomapPanelCfg_types.gen';\nimport {\n Options as HeatmapOptions,\n FieldConfig as HeatmapFieldConfig,\n defaultOptions as defaultHeatmapOptions,\n} from '@grafana/schema/dist/esm/raw/composable/heatmap/panelcfg/x/HeatmapPanelCfg_types.gen';\nimport {\n Options as HistogramOptions,\n FieldConfig as HistogramFieldConfig,\n defaultOptions as defaultHistogramOptions,\n defaultFieldConfig as defaultHistogramFieldConfig,\n} from '@grafana/schema/dist/esm/raw/composable/histogram/panelcfg/x/HistogramPanelCfg_types.gen';\nimport { Options as LogsOptions } from '@grafana/schema/dist/esm/raw/composable/logs/panelcfg/x/LogsPanelCfg_types.gen';\nimport {\n Options as NewsOptions,\n defaultOptions as defaultNewsOptions,\n} from '@grafana/schema/dist/esm/raw/composable/news/panelcfg/x/NewsPanelCfg_types.gen';\nimport { Options as NodeGraphOptions } from '@grafana/schema/dist/esm/raw/composable/nodegraph/panelcfg/x/NodeGraphPanelCfg_types.gen';\nimport {\n Options as PieChartOptions,\n FieldConfig as PieChartFieldConfig,\n defaultOptions as defaultPieChartOptions,\n} from '@grafana/schema/dist/esm/raw/composable/piechart/panelcfg/x/PieChartPanelCfg_types.gen';\nimport {\n Options as StatOptions,\n defaultOptions as defaultStatOptions,\n} from '@grafana/schema/dist/esm/raw/composable/stat/panelcfg/x/StatPanelCfg_types.gen';\nimport {\n Options as StateTimelineOptions,\n FieldConfig as StateTimelineFieldConfig,\n defaultOptions as defaultStateTimelineOptions,\n defaultFieldConfig as defaultStateTimelineFieldConfig,\n} from '@grafana/schema/dist/esm/raw/composable/statetimeline/panelcfg/x/StateTimelinePanelCfg_types.gen';\nimport {\n Options as StatusHistoryOptions,\n FieldConfig as StatusHistoryFieldConfig,\n defaultOptions as defaultStatusHistoryOptions,\n defaultFieldConfig as defaultStatusHistoryFieldConfig,\n} from '@grafana/schema/dist/esm/raw/composable/statushistory/panelcfg/x/StatusHistoryPanelCfg_types.gen';\nimport {\n Options as TableOptions,\n defaultOptions as defaultTableOptions,\n} from '@grafana/schema/dist/esm/raw/composable/table/panelcfg/x/TablePanelCfg_types.gen';\nimport {\n Options as TextOptions,\n defaultOptions as defaultTextOptions,\n} from '@grafana/schema/dist/esm/raw/composable/text/panelcfg/x/TextPanelCfg_types.gen';\nimport {\n Options as TimeSeriesOptions,\n FieldConfig as TimeSeriesFieldConfig,\n} from '@grafana/schema/dist/esm/raw/composable/timeseries/panelcfg/x/TimeSeriesPanelCfg_types.gen';\nimport {\n Options as TrendOptions,\n FieldConfig as TrendFieldConfig,\n} from '@grafana/schema/dist/esm/raw/composable/trend/panelcfg/x/TrendPanelCfg_types.gen';\nimport {\n Options as XYChartOptions,\n defaultOptions as defaultXYChartOptions,\n defaultFieldConfig as defaultXYChartFieldConfig,\n} from '@grafana/schema/dist/esm/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen';\n\nimport { VizConfigBuilder } from './VizConfigBuilder';\n\nexport const VizConfigBuilders = {\n barchart() {\n return new VizConfigBuilder<BarChartOptions, BarChartFieldConfig>(\n 'barchart',\n '10.0.0',\n () => defaultBarChartOptions,\n () => defaultBarChartFieldConfig\n );\n },\n bargauge() {\n return new VizConfigBuilder<BarGaugeOptions, {}>('bargauge', '10.0.0', () => defaultBarGaugeOptions);\n },\n datagrid() {\n return new VizConfigBuilder<DataGridOptions, {}>('datagrid', '10.0.0', () => defaultDataGridOptions);\n },\n flamegraph() {\n return new VizConfigBuilder<{}, {}>('flamegraph', '10.0.0');\n },\n gauge() {\n return new VizConfigBuilder<GaugeOptions, {}>('gauge', '10.0.0', () => defaultGaugeOptions);\n },\n geomap() {\n return new VizConfigBuilder<GeomapOptions, {}>('geomap', '10.0.0', () => defaultGeomapOptions);\n },\n heatmap() {\n return new VizConfigBuilder<HeatmapOptions, HeatmapFieldConfig>('heatmap', '10.0.0', () => defaultHeatmapOptions);\n },\n histogram() {\n return new VizConfigBuilder<HistogramOptions, HistogramFieldConfig>(\n 'histogram',\n '10.0.0',\n () => defaultHistogramOptions,\n () => defaultHistogramFieldConfig\n );\n },\n logs() {\n return new VizConfigBuilder<LogsOptions, {}>('logs', '10.0.0');\n },\n news() {\n return new VizConfigBuilder<NewsOptions, {}>('news', '10.0.0', () => defaultNewsOptions);\n },\n nodegraph() {\n return new VizConfigBuilder<NodeGraphOptions, {}>('nodeGraph', '10.0.0');\n },\n piechart() {\n return new VizConfigBuilder<PieChartOptions, PieChartFieldConfig>(\n 'piechart',\n '10.0.0',\n () => defaultPieChartOptions\n );\n },\n stat() {\n return new VizConfigBuilder<StatOptions, {}>('stat', '10.0.0', () => defaultStatOptions);\n },\n statetimeline() {\n return new VizConfigBuilder<StateTimelineOptions, StateTimelineFieldConfig>(\n 'state-timeline',\n '10.0.0',\n () => defaultStateTimelineOptions,\n () => defaultStateTimelineFieldConfig\n );\n },\n statushistory() {\n return new VizConfigBuilder<StatusHistoryOptions, StatusHistoryFieldConfig>(\n 'status-history',\n '10.0.0',\n () => defaultStatusHistoryOptions,\n () => defaultStatusHistoryFieldConfig\n );\n },\n table() {\n return new VizConfigBuilder<TableOptions, TableFieldConfig>('table', '10.0.0', () => defaultTableOptions);\n },\n text() {\n return new VizConfigBuilder<TextOptions, {}>('text', '10.0.0', () => defaultTextOptions);\n },\n timeseries() {\n return new VizConfigBuilder<TimeSeriesOptions, TimeSeriesFieldConfig>('timeseries', '10.0.0');\n },\n trend() {\n return new VizConfigBuilder<{}, {}>('trend', '10.0.0');\n },\n traces() {\n return new VizConfigBuilder<TrendOptions, TrendFieldConfig>('traces', '10.0.0');\n },\n xychart() {\n return new VizConfigBuilder<XYChartOptions, {}>(\n 'xychart',\n '10.0.0',\n () => defaultXYChartOptions,\n () => defaultXYChartFieldConfig\n );\n },\n};\n"],"names":["defaultBarChartOptions","defaultBarChartFieldConfig","defaultBarGaugeOptions","defaultDataGridOptions","defaultGaugeOptions","defaultGeomapOptions","defaultHeatmapOptions","defaultHistogramOptions","defaultHistogramFieldConfig","defaultNewsOptions","defaultPieChartOptions","defaultStatOptions","defaultStateTimelineOptions","defaultStateTimelineFieldConfig","defaultStatusHistoryOptions","defaultStatusHistoryFieldConfig","defaultTableOptions","defaultTextOptions","defaultXYChartOptions","defaultXYChartFieldConfig"],"mappings":";;;;;;;;;;;;;;;;;AAsFO,MAAM,iBAAoB,GAAA;AAAA,EAC/B,QAAW,GAAA;AACT,IAAA,OAAO,IAAI,gBAAA;AAAA,MACT,UAAA;AAAA,MACA,QAAA;AAAA,MACA,MAAMA,cAAA;AAAA,MACN,MAAMC,kBAAA;AAAA,KACR,CAAA;AAAA,GACF;AAAA,EACA,QAAW,GAAA;AACT,IAAA,OAAO,IAAI,gBAAA,CAAsC,UAAY,EAAA,QAAA,EAAU,MAAMC,gBAAsB,CAAA,CAAA;AAAA,GACrG;AAAA,EACA,QAAW,GAAA;AACT,IAAA,OAAO,IAAI,gBAAA,CAAsC,UAAY,EAAA,QAAA,EAAU,MAAMC,gBAAsB,CAAA,CAAA;AAAA,GACrG;AAAA,EACA,UAAa,GAAA;AACX,IAAO,OAAA,IAAI,gBAAyB,CAAA,YAAA,EAAc,QAAQ,CAAA,CAAA;AAAA,GAC5D;AAAA,EACA,KAAQ,GAAA;AACN,IAAA,OAAO,IAAI,gBAAA,CAAmC,OAAS,EAAA,QAAA,EAAU,MAAMC,gBAAmB,CAAA,CAAA;AAAA,GAC5F;AAAA,EACA,MAAS,GAAA;AACP,IAAA,OAAO,IAAI,gBAAA,CAAoC,QAAU,EAAA,QAAA,EAAU,MAAMC,gBAAoB,CAAA,CAAA;AAAA,GAC/F;AAAA,EACA,OAAU,GAAA;AACR,IAAA,OAAO,IAAI,gBAAA,CAAqD,SAAW,EAAA,QAAA,EAAU,MAAMC,gBAAqB,CAAA,CAAA;AAAA,GAClH;AAAA,EACA,SAAY,GAAA;AACV,IAAA,OAAO,IAAI,gBAAA;AAAA,MACT,WAAA;AAAA,MACA,QAAA;AAAA,MACA,MAAMC,gBAAA;AAAA,MACN,MAAM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