@grafana/scenes 6.40.0 → 6.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v6.40.1 (Thu Oct 23 2025)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- UrlTimeRangeMacro: Dashboard links not preserving browser timezone [#1279](https://github.com/grafana/scenes/pull/1279) ([@ivanortegaalba](https://github.com/ivanortegaalba))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Ivan Ortega Alba ([@ivanortegaalba](https://github.com/ivanortegaalba))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v6.40.0 (Thu Oct 23 2025)
|
|
2
14
|
|
|
3
15
|
#### 🚀 Enhancement
|
|
@@ -12,9 +12,6 @@ class UrlTimeRangeMacro {
|
|
|
12
12
|
var _a;
|
|
13
13
|
const timeRange = getTimeRange(this._sceneObject);
|
|
14
14
|
const urlState = (_a = timeRange.urlSync) == null ? void 0 : _a.getUrlState();
|
|
15
|
-
if ((urlState == null ? void 0 : urlState.timezone) === "browser") {
|
|
16
|
-
urlState.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
17
|
-
}
|
|
18
15
|
return new SkipFormattingValue(urlUtil.toUrlParams(urlState));
|
|
19
16
|
}
|
|
20
17
|
getValueText() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeMacros.js","sources":["../../../../src/variables/macros/timeMacros.ts"],"sourcesContent":["import { dateTimeFormat, urlUtil } from '@grafana/data';\nimport { getTimeRange } from '../../core/sceneGraph/getTimeRange';\nimport { getData } from '../../core/sceneGraph/sceneGraph';\nimport { SceneObject } from '../../core/types';\nimport { FormatVariable } from '../interpolation/formatRegistry';\nimport { SkipFormattingValue } from './types';\n\n/**\n * Handles expressions like $__url_time_range.\n */\nexport class UrlTimeRangeMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'url_variable' };\n this._sceneObject = sceneObject;\n }\n\n public getValue(): SkipFormattingValue {\n const timeRange = getTimeRange(this._sceneObject);\n const urlState = timeRange.urlSync?.getUrlState();\n
|
|
1
|
+
{"version":3,"file":"timeMacros.js","sources":["../../../../src/variables/macros/timeMacros.ts"],"sourcesContent":["import { dateTimeFormat, urlUtil } from '@grafana/data';\nimport { getTimeRange } from '../../core/sceneGraph/getTimeRange';\nimport { getData } from '../../core/sceneGraph/sceneGraph';\nimport { SceneObject } from '../../core/types';\nimport { FormatVariable } from '../interpolation/formatRegistry';\nimport { SkipFormattingValue } from './types';\n\n/**\n * Handles expressions like $__url_time_range.\n */\nexport class UrlTimeRangeMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'url_variable' };\n this._sceneObject = sceneObject;\n }\n\n public getValue(): SkipFormattingValue {\n const timeRange = getTimeRange(this._sceneObject);\n const urlState = timeRange.urlSync?.getUrlState();\n return new SkipFormattingValue(urlUtil.toUrlParams(urlState));\n }\n\n public getValueText?(): string {\n return '';\n }\n}\n\n/**\n * Handles expressions like $__from and $__to.\n */\nexport class TimeFromAndToMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'time_macro' };\n this._sceneObject = sceneObject;\n }\n\n public getValue() {\n const timeRange = getTimeRange(this._sceneObject);\n if (this.state.name === '__from') {\n return timeRange.state.value.from.valueOf();\n } else {\n return timeRange.state.value.to.valueOf();\n }\n }\n\n public getValueText?(): string {\n const timeRange = getTimeRange(this._sceneObject);\n if (this.state.name === '__from') {\n return dateTimeFormat(timeRange.state.value.from, { timeZone: timeRange.getTimeZone() });\n } else {\n return dateTimeFormat(timeRange.state.value.to, { timeZone: timeRange.getTimeZone() });\n }\n }\n}\n\n/**\n * Handles $__timezone expression.\n */\nexport class TimezoneMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'time_macro' };\n this._sceneObject = sceneObject;\n }\n\n public getValue() {\n const timeRange = getTimeRange(this._sceneObject);\n const timeZone = timeRange.getTimeZone();\n\n if (timeZone === 'browser') {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n return timeZone;\n }\n\n public getValueText?(): string {\n return this.getValue();\n }\n}\n\n/**\n * Handles $__interval and $__intervalMs expression.\n */\nexport class IntervalMacro implements FormatVariable {\n public state: { name: string; type: string; match: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject, match: string) {\n this.state = { name: name, type: 'time_macro', match: match };\n this._sceneObject = sceneObject;\n }\n\n public getValue() {\n const data = getData(this._sceneObject);\n\n if (data) {\n const request = data.state.data?.request;\n if (!request) {\n return this.state.match;\n }\n if (this.state.name === '__interval_ms') {\n return request.intervalMs;\n }\n return request.interval;\n }\n\n return this.state.match;\n }\n}\n"],"names":[],"mappings":";;;;;AAUO,MAAM,iBAA4C,CAAA;AAAA,EAIhD,WAAA,CAAY,MAAc,WAA0B,EAAA;AACzD,IAAA,IAAA,CAAK,KAAQ,GAAA,EAAE,IAAY,EAAA,IAAA,EAAM,cAAe,EAAA;AAChD,IAAA,IAAA,CAAK,YAAe,GAAA,WAAA;AAAA;AACtB,EAEO,QAAgC,GAAA;AAnBzC,IAAA,IAAA,EAAA;AAoBI,IAAM,MAAA,SAAA,GAAY,YAAa,CAAA,IAAA,CAAK,YAAY,CAAA;AAChD,IAAM,MAAA,QAAA,GAAA,CAAW,EAAU,GAAA,SAAA,CAAA,OAAA,KAAV,IAAmB,GAAA,MAAA,GAAA,EAAA,CAAA,WAAA,EAA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B,IAAA,OAAO,KAAK,KAAM,CAAA,KAAA;AAAA;AAEtB;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -2255,9 +2255,6 @@ class UrlTimeRangeMacro {
|
|
|
2255
2255
|
var _a;
|
|
2256
2256
|
const timeRange = getTimeRange(this._sceneObject);
|
|
2257
2257
|
const urlState = (_a = timeRange.urlSync) == null ? void 0 : _a.getUrlState();
|
|
2258
|
-
if ((urlState == null ? void 0 : urlState.timezone) === "browser") {
|
|
2259
|
-
urlState.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2260
|
-
}
|
|
2261
2258
|
return new SkipFormattingValue(data.urlUtil.toUrlParams(urlState));
|
|
2262
2259
|
}
|
|
2263
2260
|
getValueText() {
|