diff --git a/e2e/dashboards-suite/dashboard-templating.spec.ts b/e2e/dashboards-suite/dashboard-templating.spec.ts index 7ff5f905262..8ce63e4a975 100644 --- a/e2e/dashboards-suite/dashboard-templating.spec.ts +++ b/e2e/dashboards-suite/dashboard-templating.spec.ts @@ -9,6 +9,9 @@ describe('Dashboard templating', () => { // Open dashboard global variables and interpolation e2e.flows.openDashboard({ uid: 'HYaGDGIMk' }); + const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; + const example = `Example: from=now-6h&to=now&timezone=${encodeURIComponent(timeZone)}`; + const items: string[] = []; const expectedItems: string[] = [ '__dashboard = Templating - Global variables and interpolation', @@ -36,7 +39,7 @@ describe('Dashboard templating', () => { `Server:text = All`, `Server:queryparam = var-Server=$__all`, `1 < 2`, - `Example: from=now-6h&to=now`, + example, ]; cy.get('.markdown-html li') @@ -51,10 +54,10 @@ describe('Dashboard templating', () => { }); // Check link interpolation is working correctly - cy.contains('a', 'Example: from=now-6h&to=now').should( + cy.contains('a', example).should( 'have.attr', 'href', - 'https://example.com/?from=now-6h&to=now' + `https://example.com/?from=now-6h&to=now&timezone=${encodeURIComponent(timeZone)}` ); }); }); diff --git a/package.json b/package.json index 49cb7826cb9..1ecd8531183 100644 --- a/package.json +++ b/package.json @@ -268,8 +268,8 @@ "@grafana/prometheus": "workspace:*", "@grafana/runtime": "workspace:*", "@grafana/saga-icons": "workspace:*", - "@grafana/scenes": "5.22.1", - "@grafana/scenes-react": "5.22.1", + "@grafana/scenes": "5.23.1", + "@grafana/scenes-react": "5.23.1", "@grafana/schema": "workspace:*", "@grafana/sql": "workspace:*", "@grafana/ui": "workspace:*", diff --git a/public/app/features/trails/TrailStore/TrailStore.test.ts b/public/app/features/trails/TrailStore/TrailStore.test.ts index 70379331882..c018a19ba52 100644 --- a/public/app/features/trails/TrailStore/TrailStore.test.ts +++ b/public/app/features/trails/TrailStore/TrailStore.test.ts @@ -55,11 +55,14 @@ describe('TrailStore', () => { }); describe('Initialize store with one recent trail with final current step', () => { + const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; + const history: SerializedTrail['history'] = [ { urlValues: { from: 'now-1h', to: 'now', + timezone, 'var-ds': 'cb3a3391-700f-4cc6-81be-a122488e93e6', 'var-filters': [], refresh: '', @@ -73,6 +76,7 @@ describe('TrailStore', () => { metric: 'access_permissions_duration_count', from: 'now-1h', to: 'now', + timezone, 'var-ds': 'cb3a3391-700f-4cc6-81be-a122488e93e6', 'var-filters': [], refresh: '', @@ -153,6 +157,7 @@ describe('TrailStore', () => { ['metric', 'different_metric'], ['from', 'now-1y'], ['to', 'now-30m'], + ['timezone', 'utc'], ['var-ds', 'ds'], ['var-groupby', 'job'], ['var-filters', 'cluster|=|dev-eu-west-2'], @@ -212,11 +217,14 @@ describe('TrailStore', () => { }); describe('Initialize store with one recent trail with non final current step', () => { + const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; + const history: SerializedTrail['history'] = [ { urlValues: { from: 'now-1h', to: 'now', + timezone, 'var-ds': 'ds', 'var-filters': [], refresh: '', @@ -230,6 +238,7 @@ describe('TrailStore', () => { metric: 'current_metric', from: 'now-1h', to: 'now', + timezone, 'var-ds': 'ds', 'var-filters': [], refresh: '', @@ -243,6 +252,7 @@ describe('TrailStore', () => { metric: 'final_metric', from: 'now-1h', to: 'now', + timezone, 'var-ds': 'ds', 'var-filters': [], refresh: '', @@ -450,6 +460,7 @@ describe('TrailStore', () => { ['metric', 'different_metric'], ['from', 'now-1y'], ['to', 'now-30m'], + ['timezone', 'utc'], ['var-ds', 'different'], ['var-groupby', 'job'], ['var-filters', 'cluster|=|dev-eu-west-2'], @@ -485,6 +496,8 @@ describe('TrailStore', () => { }); describe('Initialize store with one bookmark trail but no recent trails', () => { + const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; + beforeEach(() => { localStorage.clear(); localStorage.setItem( @@ -495,6 +508,7 @@ describe('TrailStore', () => { metric: 'bookmarked_metric', from: 'now-1h', to: 'now', + timezone, 'var-ds': 'prom-mock', 'var-deployment_environment': ['undefined'], 'var-otel_resources': [''], @@ -571,6 +585,8 @@ describe('TrailStore', () => { }); describe('Initialize store with one legacy bookmark trail', () => { + const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; + beforeEach(() => { localStorage.clear(); localStorage.setItem( @@ -582,6 +598,7 @@ describe('TrailStore', () => { urlValues: { from: 'now-1h', to: 'now', + timezone, 'var-ds': 'cb3a3391-700f-4cc6-81be-a122488e93e6', 'var-filters': [], refresh: '', @@ -594,6 +611,7 @@ describe('TrailStore', () => { metric: 'access_permissions_duration_count', from: 'now-1h', to: 'now', + timezone, 'var-ds': 'cb3a3391-700f-4cc6-81be-a122488e93e6', 'var-filters': [], refresh: '', @@ -683,6 +701,8 @@ describe('TrailStore', () => { }); describe('Initialize store with one bookmark matching recent trail not on final step', () => { + const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; + beforeEach(() => { localStorage.clear(); localStorage.setItem( @@ -694,6 +714,7 @@ describe('TrailStore', () => { urlValues: { from: 'now-1h', to: 'now', + timezone, 'var-ds': 'prom-mock', 'var-deployment_environment': ['undefined'], 'var-otel_resources': [''], @@ -707,6 +728,7 @@ describe('TrailStore', () => { metric: 'bookmarked_metric', from: 'now-1h', to: 'now', + timezone, 'var-ds': 'prom-mock', 'var-deployment_environment': ['undefined'], 'var-otel_resources': [''], @@ -720,6 +742,7 @@ describe('TrailStore', () => { metric: 'some_other_metric', from: 'now-1h', to: 'now', + timezone, 'var-ds': 'prom-mock', 'var-deployment_environment': ['undefined'], 'var-otel_resources': [''], @@ -741,6 +764,7 @@ describe('TrailStore', () => { metric: 'bookmarked_metric', from: 'now-1h', to: 'now', + timezone, 'var-ds': 'prom-mock', 'var-deployment_environment': ['undefined'], 'var-otel_resources': [''], diff --git a/yarn.lock b/yarn.lock index 02f2be7e504..87c80c065b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4025,12 +4025,12 @@ __metadata: languageName: unknown linkType: soft -"@grafana/scenes-react@npm:5.22.1": - version: 5.22.1 - resolution: "@grafana/scenes-react@npm:5.22.1" +"@grafana/scenes-react@npm:5.23.1": + version: 5.23.1 + resolution: "@grafana/scenes-react@npm:5.23.1" dependencies: "@grafana/e2e-selectors": "npm:^11.0.0" - "@grafana/scenes": "npm:5.22.1" + "@grafana/scenes": "npm:5.23.1" react-use: "npm:17.4.0" peerDependencies: "@grafana/data": ^11.0.0 @@ -4039,13 +4039,13 @@ __metadata: "@grafana/ui": ^11.0.0 react: ^18.0.0 react-dom: ^18.0.0 - checksum: 10/7ef272c760bb8d92a9d91a5497996a4bef44915eb83f2807d3a8b19075b401ee90d31ea665f3bf60333d2d909e488cd88e54dc93ae2dd88e925045dc5c79f650 + checksum: 10/83a17169e3382fa6d6e83ec3aec619b3591602fe8ab45bea883c293fc8460f1869596efe1f90758e364319c143345e3ef19015e684224c3325bf503d8ddeca6a languageName: node linkType: hard -"@grafana/scenes@npm:5.22.1": - version: 5.22.1 - resolution: "@grafana/scenes@npm:5.22.1" +"@grafana/scenes@npm:5.23.1": + version: 5.23.1 + resolution: "@grafana/scenes@npm:5.23.1" dependencies: "@floating-ui/react": "npm:0.26.16" "@grafana/e2e-selectors": "npm:^11.0.0" @@ -4062,7 +4062,7 @@ __metadata: "@grafana/ui": ">=10.4" react: ^18.0.0 react-dom: ^18.0.0 - checksum: 10/ebb5f887ee94ad9fa1f9d4bd7f9503502875e940380362c0f476e042eb421881585c122a1252b0567508b0e1415d78b928ba22a04adb5b93882f601b86105f76 + checksum: 10/74cc74cc42102638ab3388e910242f3f641b325da5e42a2ab9bd18d9e6d14e55adbc93f25dcfad594ecc97003f1920c27b2e166e73e1a5f17459e0573615a1fd languageName: node linkType: hard @@ -18932,8 +18932,8 @@ __metadata: "@grafana/prometheus": "workspace:*" "@grafana/runtime": "workspace:*" "@grafana/saga-icons": "workspace:*" - "@grafana/scenes": "npm:5.22.1" - "@grafana/scenes-react": "npm:5.22.1" + "@grafana/scenes": "npm:5.23.1" + "@grafana/scenes-react": "npm:5.23.1" "@grafana/schema": "workspace:*" "@grafana/sql": "workspace:*" "@grafana/tsconfig": "npm:^2.0.0"