@grafana/scenes 5.17.0--canary.929.11178151684.0 → 5.18.0--canary.930.11181993017.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.17.0 (Fri Oct 04 2024)
|
2
|
+
|
3
|
+
#### 🚀 Enhancement
|
4
|
+
|
5
|
+
- Annotations: Include templateSrv.getVariables with dashboard object in legacy annotation queries [#929](https://github.com/grafana/scenes/pull/929) ([@kaydelaney](https://github.com/kaydelaney))
|
6
|
+
|
7
|
+
#### Authors: 1
|
8
|
+
|
9
|
+
- kay delaney ([@kaydelaney](https://github.com/kaydelaney))
|
10
|
+
|
11
|
+
---
|
12
|
+
|
1
13
|
# v5.16.3 (Thu Oct 03 2024)
|
2
14
|
|
3
15
|
#### 🐛 Bug Fix
|
@@ -13,6 +13,7 @@ import { DataLayerControlSwitch } from '../SceneDataLayerControls.js';
|
|
13
13
|
import { executeAnnotationQuery } from './standardAnnotationQuery.js';
|
14
14
|
import { postProcessQueryResult, dedupAnnotations } from './utils.js';
|
15
15
|
import { wrapInSafeSerializableSceneObject } from '../../../utils/wrapInSafeSerializableSceneObject.js';
|
16
|
+
import { RefreshEvent } from '@grafana/runtime';
|
16
17
|
|
17
18
|
var __defProp = Object.defineProperty;
|
18
19
|
var __defProps = Object.defineProperties;
|
@@ -46,6 +47,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
|
|
46
47
|
};
|
47
48
|
}
|
48
49
|
onEnable() {
|
50
|
+
this.publishEvent(new RefreshEvent(), true);
|
49
51
|
const timeRange = sceneGraph.getTimeRange(this);
|
50
52
|
this._timeRangeSub = timeRange.subscribeToState(() => {
|
51
53
|
this.runWithTimeRange(timeRange);
|
@@ -53,6 +55,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
|
|
53
55
|
}
|
54
56
|
onDisable() {
|
55
57
|
var _a;
|
58
|
+
this.publishEvent(new RefreshEvent(), true);
|
56
59
|
(_a = this._timeRangeSub) == null ? void 0 : _a.unsubscribe();
|
57
60
|
}
|
58
61
|
runLayer() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AnnotationsDataLayer.js","sources":["../../../../../src/querying/layers/annotations/AnnotationsDataLayer.tsx"],"sourcesContent":["import { arrayToDataFrame, DataTopic, AnnotationQuery, ScopedVars, PanelData } from '@grafana/data';\nimport { LoadingState } from '@grafana/schema';\nimport React from 'react';\nimport { map, Unsubscribable } from 'rxjs';\nimport { emptyPanelData } from '../../../core/SceneDataNode';\nimport { sceneGraph } from '../../../core/sceneGraph';\nimport {\n SceneComponentProps,\n SceneDataLayerProvider,\n SceneDataLayerProviderState,\n SceneTimeRangeLike,\n} from '../../../core/types';\nimport { getDataSource } from '../../../utils/getDataSource';\nimport { getMessageFromError } from '../../../utils/getMessageFromError';\nimport { writeSceneLog } from '../../../utils/writeSceneLog';\nimport { registerQueryWithController } from '../../registerQueryWithController';\nimport { SceneDataLayerBase } from '../SceneDataLayerBase';\nimport { DataLayerControlSwitch } from '../SceneDataLayerControls';\nimport { AnnotationQueryResults, executeAnnotationQuery } from './standardAnnotationQuery';\nimport { dedupAnnotations, postProcessQueryResult } from './utils';\nimport { wrapInSafeSerializableSceneObject } from '../../../utils/wrapInSafeSerializableSceneObject';\n\ninterface AnnotationsDataLayerState extends SceneDataLayerProviderState {\n query: AnnotationQuery;\n}\n\nexport class AnnotationsDataLayer\n extends SceneDataLayerBase<AnnotationsDataLayerState>\n implements SceneDataLayerProvider\n{\n static Component = AnnotationsDataLayerRenderer;\n\n private _scopedVars: ScopedVars = {\n __sceneObject: wrapInSafeSerializableSceneObject(this),\n };\n private _timeRangeSub: Unsubscribable | undefined;\n\n public constructor(initialState: AnnotationsDataLayerState) {\n super(\n {\n isEnabled: true,\n ...initialState,\n },\n ['query']\n );\n }\n\n public onEnable(): void {\n const timeRange = sceneGraph.getTimeRange(this);\n\n this._timeRangeSub = timeRange.subscribeToState(() => {\n this.runWithTimeRange(timeRange);\n });\n }\n\n public onDisable(): void {\n this._timeRangeSub?.unsubscribe();\n }\n\n public runLayer() {\n writeSceneLog('AnnotationsDataLayer', 'run layer');\n const timeRange = sceneGraph.getTimeRange(this);\n this.runWithTimeRange(timeRange);\n }\n\n private async runWithTimeRange(timeRange: SceneTimeRangeLike) {\n const { query } = this.state;\n\n if (this.querySub) {\n this.querySub.unsubscribe();\n }\n\n if (this._variableDependency.hasDependencyInLoadingState()) {\n writeSceneLog('AnnotationsDataLayer', 'Variable dependency is in loading state, skipping query execution');\n return;\n }\n\n try {\n const ds = await this.resolveDataSource(query);\n\n let stream = executeAnnotationQuery(ds, timeRange, query, this).pipe(\n registerQueryWithController({\n type: 'annotations',\n origin: this,\n cancel: () => this.cancelQuery(),\n }),\n map((events) => {\n const stateUpdate = this.processEvents(query, events);\n return stateUpdate;\n })\n );\n\n this.querySub = stream.subscribe((stateUpdate) => {\n this.publishResults(stateUpdate);\n });\n } catch (e) {\n this.publishResults({\n ...emptyPanelData,\n state: LoadingState.Error,\n errors: [\n {\n message: getMessageFromError(e),\n },\n ],\n });\n console.error('AnnotationsDataLayer error', e);\n }\n }\n\n protected async resolveDataSource(query: AnnotationQuery) {\n return await getDataSource(query.datasource || undefined, this._scopedVars);\n }\n\n protected processEvents(query: AnnotationQuery, events: AnnotationQueryResults): PanelData {\n let processedEvents = postProcessQueryResult(query, events.events || []);\n processedEvents = dedupAnnotations(processedEvents);\n\n const stateUpdate = { ...emptyPanelData, state: events.state };\n const df = arrayToDataFrame(processedEvents);\n\n df.meta = {\n ...df.meta,\n dataTopic: DataTopic.Annotations,\n };\n\n stateUpdate.series = [df];\n\n return stateUpdate;\n }\n}\n\nfunction AnnotationsDataLayerRenderer({ model }: SceneComponentProps<AnnotationsDataLayer>) {\n const { isHidden } = model.useState();\n\n if (isHidden) {\n return null;\n }\n\n return <DataLayerControlSwitch layer={model} />;\n}\n"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"AnnotationsDataLayer.js","sources":["../../../../../src/querying/layers/annotations/AnnotationsDataLayer.tsx"],"sourcesContent":["import { arrayToDataFrame, DataTopic, AnnotationQuery, ScopedVars, PanelData } from '@grafana/data';\nimport { LoadingState } from '@grafana/schema';\nimport React from 'react';\nimport { map, Unsubscribable } from 'rxjs';\nimport { emptyPanelData } from '../../../core/SceneDataNode';\nimport { sceneGraph } from '../../../core/sceneGraph';\nimport {\n SceneComponentProps,\n SceneDataLayerProvider,\n SceneDataLayerProviderState,\n SceneTimeRangeLike,\n} from '../../../core/types';\nimport { getDataSource } from '../../../utils/getDataSource';\nimport { getMessageFromError } from '../../../utils/getMessageFromError';\nimport { writeSceneLog } from '../../../utils/writeSceneLog';\nimport { registerQueryWithController } from '../../registerQueryWithController';\nimport { SceneDataLayerBase } from '../SceneDataLayerBase';\nimport { DataLayerControlSwitch } from '../SceneDataLayerControls';\nimport { AnnotationQueryResults, executeAnnotationQuery } from './standardAnnotationQuery';\nimport { dedupAnnotations, postProcessQueryResult } from './utils';\nimport { wrapInSafeSerializableSceneObject } from '../../../utils/wrapInSafeSerializableSceneObject';\nimport { RefreshEvent } from '@grafana/runtime';\n\ninterface AnnotationsDataLayerState extends SceneDataLayerProviderState {\n query: AnnotationQuery;\n}\n\nexport class AnnotationsDataLayer\n extends SceneDataLayerBase<AnnotationsDataLayerState>\n implements SceneDataLayerProvider\n{\n static Component = AnnotationsDataLayerRenderer;\n\n private _scopedVars: ScopedVars = {\n __sceneObject: wrapInSafeSerializableSceneObject(this),\n };\n private _timeRangeSub: Unsubscribable | undefined;\n\n public constructor(initialState: AnnotationsDataLayerState) {\n super(\n {\n isEnabled: true,\n ...initialState,\n },\n ['query']\n );\n }\n\n public onEnable(): void {\n this.publishEvent(new RefreshEvent(), true);\n \n const timeRange = sceneGraph.getTimeRange(this);\n\n this._timeRangeSub = timeRange.subscribeToState(() => {\n this.runWithTimeRange(timeRange);\n });\n }\n\n public onDisable(): void {\n this.publishEvent(new RefreshEvent(), true);\n\n this._timeRangeSub?.unsubscribe();\n }\n\n public runLayer() {\n writeSceneLog('AnnotationsDataLayer', 'run layer');\n const timeRange = sceneGraph.getTimeRange(this);\n this.runWithTimeRange(timeRange);\n }\n\n private async runWithTimeRange(timeRange: SceneTimeRangeLike) {\n const { query } = this.state;\n\n if (this.querySub) {\n this.querySub.unsubscribe();\n }\n\n if (this._variableDependency.hasDependencyInLoadingState()) {\n writeSceneLog('AnnotationsDataLayer', 'Variable dependency is in loading state, skipping query execution');\n return;\n }\n\n try {\n const ds = await this.resolveDataSource(query);\n\n let stream = executeAnnotationQuery(ds, timeRange, query, this).pipe(\n registerQueryWithController({\n type: 'annotations',\n origin: this,\n cancel: () => this.cancelQuery(),\n }),\n map((events) => {\n const stateUpdate = this.processEvents(query, events);\n return stateUpdate;\n })\n );\n\n this.querySub = stream.subscribe((stateUpdate) => {\n this.publishResults(stateUpdate);\n });\n } catch (e) {\n this.publishResults({\n ...emptyPanelData,\n state: LoadingState.Error,\n errors: [\n {\n message: getMessageFromError(e),\n },\n ],\n });\n console.error('AnnotationsDataLayer error', e);\n }\n }\n\n protected async resolveDataSource(query: AnnotationQuery) {\n return await getDataSource(query.datasource || undefined, this._scopedVars);\n }\n\n protected processEvents(query: AnnotationQuery, events: AnnotationQueryResults): PanelData {\n let processedEvents = postProcessQueryResult(query, events.events || []);\n processedEvents = dedupAnnotations(processedEvents);\n\n const stateUpdate = { ...emptyPanelData, state: events.state };\n const df = arrayToDataFrame(processedEvents);\n\n df.meta = {\n ...df.meta,\n dataTopic: DataTopic.Annotations,\n };\n\n stateUpdate.series = [df];\n\n return stateUpdate;\n }\n}\n\nfunction AnnotationsDataLayerRenderer({ model }: SceneComponentProps<AnnotationsDataLayer>) {\n const { isHidden } = model.useState();\n\n if (isHidden) {\n return null;\n }\n\n return <DataLayerControlSwitch layer={model} />;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BO,MAAM,6BACH,kBAEV,CAAA;AAAA,EAQS,YAAY,YAAyC,EAAA;A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ayerBase {
|
|
8035
8035
|
};
|
8036
8036
|
}
|
8037
8037
|
onEnable() {
|
8038
|
+
this.publishEvent(new runtime.RefreshEvent(), true);
|
8038
8039
|
const timeRange = sceneGraph.getTimeRange(this);
|
8039
8040
|
this._timeRangeSub = timeRange.subscribeToState(() => {
|
8040
8041
|
this.runWithTimeRange(timeRange);
|
@@ -8042,6 +8043,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
|
|
8042
8043
|
}
|
8043
8044
|
onDisable() {
|
8044
8045
|
var _a;
|
8046
|
+
this.publishEvent(new runtime.RefreshEvent(), true);
|
8045
8047
|
(_a = this._timeRangeSub) == null ? void 0 : _a.unsubscribe();
|
8046
8048
|
}
|
8047
8049
|
runLayer() {
|