Commit graph

155 commits

Author SHA1 Message Date
Ida Štambuk
51f9660eec
Dynamic dashboards: Remove reference to kubernetesDashboards in e2e tests (#117490) 2026-02-18 20:21:45 +01:00
grafana-delivery-bot[bot]
bc391397bb
Release: Bump version to 13.0.0-pre (#118398)
bump version 13.0.0-pre

Co-authored-by: grafana-delivery-bot[bot] <grafana-delivery-bot[bot]@users.noreply.github.com>
2026-02-18 10:08:25 -07:00
Ashley Harrison
74bdd124c2
React 19: Update grafana-plugin-configs webpack config + adjust versions for core plugins (#118071)
* update grafana-plugin-configs webpack config + bump versions for core plugins

* just use >=12.3.0
2026-02-16 15:38:40 +00:00
Alexa Vargas
51cb7a6d20
A11y: Fix Navigation and Drawer dialogs missing programatic titles for screen readers (#118093)
* A11y: Fix Navigation and Share dialogs missing programatic titles for screen readers

* Fix unit test to use the new expected labelledby title

* Fix saved query tests

* update i18n

* Fix issue with saveQueries test

* update i18n

* Fix e2e tests to not use Drawer title prefix

* Revert i18n not related to the PR
2026-02-16 13:18:16 +01:00
Ashley Harrison
c61af73d7b
Internationalisation: Remove specific i18n sorting function (#118178)
remove specific i18n sorting function
2026-02-16 10:29:51 +00:00
grafana-pr-automation[bot]
234760f61e
I18n: Download translations from Crowdin (#117817)
* New Crowdin translations by GitHub Action

* use pre-release

* add testId prop for locale-stable e2e selectors

* use latest plugin-e2e

* fix other e2e tests

* fix translations

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2026-02-13 18:09:21 +00:00
Ashley Harrison
67efb31b05
Internationalisation: Switch to a more basic sort (#118117)
add a basic sort function
2026-02-13 17:40:33 +00:00
Alex Khomenko
124a7202b6
A11y: Add distinguishing context to bookmark button labels (#118063)
Update bookmark button aria-labels to include the associated item name, enabling screen reader users to distinguish which item each bookmark button belongs to. This fixes WCAG 4.1.2 (Name, Role, Value) violation.

Fixes #117829
2026-02-13 17:31:35 +02:00
Jack Westbrook
62af60916d
chore: bump react-router-dom in e2e test plugins (#118072)
chore(yarn): bump react-router-dom to fix vuln alert
2026-02-13 14:02:27 +00:00
Galen Kistler
cb140a5e62
TableNG: Support managed sortBy (#117953)
* feat(TableNG): support managed sortBy
2026-02-13 07:14:25 -06:00
Andrej Ocenas
b0ce27d38f
I18n: Stricter collator for the string extraction (#117875)
Stricter collator
2026-02-13 09:04:20 +01:00
Adela Almasan
9a942bdf04
Suggestions: Flow v2 (#117563)
* remove editPreview 1

* remove editPreview 2

* use this suggestion -> edit

* refactor

* save panel and revert

* skip tests for PoC

* skip another test

* Revert save panel and revert

* Do not auto select for existing panels

* Update e2d tests

* Add test coverage

* fix auto-select

* update comment

* useStructureRev

* Update test for new panels

* Skip problematic e2e test for now

* update e2e to have dynamic dashboards enabled

* Clean up

---------

Co-authored-by: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com>
Co-authored-by: Paul Marbach <paul.marbach@grafana.com>
2026-02-12 17:42:21 -08:00
Galen Kistler
299d550441
Logs Table: E2E (#117715)
* test(e2e): logs table panel e2e init
2026-02-12 13:40:01 -06:00
Andrej Ocenas
80c73c2c81
i18n: Specify sorting for extraction (#117171)
* Specify sort

* update sorting for plugins

* merge

---------

Co-authored-by: joshhunt <josh.hunt@grafana.com>
2026-02-10 11:21:23 +01:00
Laura Fernández
f3da785037
Chore: Update webpack to 5.105.0 (#117660) 2026-02-09 20:41:07 +01:00
Bogdan Matei
1519d69768
Dashboard: Don't show popup warning when switching rows<>tabs (#117310) 2026-02-04 15:19:31 +00:00
Dominik Prokop
58bf5a1ba2
Remove dashboardSceneSolo and dashboardSceneForViewers feature flags (#117083)
* Remove dashboardSceneSolo and dashboardSceneForViewers feature flags

* e2e updates

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 15:05:23 +01:00
Ashley Harrison
8a6c0b8b4d
Chore: Backwards-compatible changes for react 19 (#117157)
* test stability improvements for react 19

* fix queryHistory test

* slightly nicer mock

* kick CI
2026-02-03 12:54:49 +00:00
Ivan Ortega Alba
381cc6555d
Refactor dashboard import to separate k8s and legacy paths (#116482)
* when importing v1 dashboard, use POST

* fix es-lint

* cleanup

* Isolate legacy import api usage

* Update translations

* Improve type detection

* Refactor types and utils to avoid duplication and isolate them in legacy when needed

* Use types from manage-dashboard since it is used from other files out of import

* Avoid regressions

* Fix linting and tests

* Improve types

* Consilidate api utils checkers

* Split ImportOverview in two versions

* simplify utils

* Fix tests

* Rename to ExportFormat

* linter

* refactor tests

* add gap

* add gap on ImportForm

* Update public/app/core/utils/isRecord.ts

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>

* clean up

* fix layout

* fix mock

* update kind when exporting to be DashboardWithAccessInfo

* remove type assertions; don't process built in annotations

* update E2Es to use correct dashboard kind

* update export test

* another e2e

* fix v2 dash for e2e

* check for "Dashboard" when checking for a resource

* update test

---------

Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com>
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2026-02-02 07:14:01 -07:00
Erik Sundell
112a2fb140
Chore: Add OpenFeature tests (#117055)
* bump plugin-e2e

* add OF tests

* handle empty/invalid grafanaVersion in resolveSelectors
2026-01-30 09:45:32 +01:00
Torkel Ödegaard
fceb315b03
Dashboard: Do not select element always (#116986)
* Dashboard: Do not select element always

* clear selection when switching tabs

* expand/collapse row clears selection

* Update

* fixing e2e

* Fix e2e

* fix
2026-01-30 08:43:43 +01:00
Deyan Halachliyski
74c5dcad1b
Alerting: Make saved search name clickable to apply search (#116832)
* Alerting: Make saved search name clickable to apply search

Replace the magnifying glass icon with a clickable name for applying saved searches.
The name now underlines on hover and triggers the apply action when clicked,
matching the Dashboard list page interaction pattern.

* Alerting: Update i18n extraction

Remove unused apply-tooltip translation key.

* Alerting: Fix E2E test for applying saved search

Update test to click the search name button instead of the removed apply icon.

* Alerting: Use TextLink for saved search names

Refactor saved search name to use TextLink component instead of button,
following the pattern used for alert rule names in the rule list.
2026-01-27 17:04:40 +01:00
Ida Štambuk
cfc99e40a2
E2E: Fix flaky test (#116841) 2026-01-26 15:38:52 +00:00
Ida Štambuk
32829022f6
Dynamic Dashboards: Add new panel button with drag & drop (#116276) 2026-01-21 11:08:27 +01:00
Paul Marbach
d2de4f95dc
E2E: Use updated plugin-e2e setVisualization method (#116558) 2026-01-20 15:28:37 -06:00
Paul Marbach
d25321b4a2
Gauge: More e2e tests (#116386)
Some checks are pending
Integration Tests / Postgres (8/16) (push) Blocked by required conditions
Integration Tests / Postgres (9/16) (push) Blocked by required conditions
Integration Tests / All backend integration tests complete (push) Blocked by required conditions
publish-technical-documentation-next / sync (push) Waiting to run
Reject GitHub secrets / reject-gh-secrets (push) Waiting to run
Build Release Packages / setup (push) Waiting to run
Build Release Packages / Dispatch grafana-enterprise build (push) Blocked by required conditions
Build Release Packages / / darwin-amd64 (push) Blocked by required conditions
Build Release Packages / / darwin-arm64 (push) Blocked by required conditions
Build Release Packages / / linux-amd64 (push) Blocked by required conditions
Build Release Packages / / linux-armv6 (push) Blocked by required conditions
Build Release Packages / / linux-armv7 (push) Blocked by required conditions
Build Release Packages / / linux-arm64 (push) Blocked by required conditions
Build Release Packages / / linux-s390x (push) Blocked by required conditions
Build Release Packages / / windows-amd64 (push) Blocked by required conditions
Build Release Packages / / windows-arm64 (push) Blocked by required conditions
Build Release Packages / Upload artifacts (push) Blocked by required conditions
Build Release Packages / publish-dockerhub (push) Blocked by required conditions
Build Release Packages / Dispatch publish NPM canaries (push) Blocked by required conditions
Build Release Packages / notify-pr (push) Blocked by required conditions
Run dashboard schema v2 e2e / dashboard-schema-v2-e2e (push) Waiting to run
Shellcheck / Shellcheck scripts (push) Waiting to run
Run Storybook a11y tests / Detect whether code changed (push) Waiting to run
Run Storybook a11y tests / Run Storybook a11y tests (light theme) (push) Blocked by required conditions
Run Storybook a11y tests / Run Storybook a11y tests (dark theme) (push) Blocked by required conditions
Swagger generated code / Detect whether code changed (push) Waiting to run
Swagger generated code / Verify committed API specs match (push) Blocked by required conditions
Dispatch sync to mirror / dispatch-job (push) Waiting to run
trigger-dashboard-search-e2e / trigger-search-e2e (push) Waiting to run
Trivy Scan / trivy-scan (push) Waiting to run
* Gauge: More e2e tests

* fix double id
2026-01-16 11:39:58 -05:00
Paul Marbach
d287523972
Suggestions: Set up editPreview on panel creation too (#116156)
* Suggestions: Set up editPreview on panel creation too

* fix bug where we need to clear the editPreview

* add e2e to exercise the case

* clean up some of the cruft from review

* clean up after failing tests

* remove some unused imports

* use temp setVisualization method which forces the picker to be on the All visualizations tab

* fix selector

* update e2e since configure button now appears

* fix e2e
2026-01-15 19:54:18 +00:00
Konrad Lalik
0faab257b1
Alerting: Add E2E test configuration and fix saved searches tests (#116203)
Some checks are pending
Integration Tests / Postgres (9/16) (push) Blocked by required conditions
Integration Tests / All backend integration tests complete (push) Blocked by required conditions
publish-kinds-next / main (push) Waiting to run
publish-technical-documentation-next / sync (push) Waiting to run
Reject GitHub secrets / reject-gh-secrets (push) Waiting to run
Build Release Packages / setup (push) Waiting to run
Build Release Packages / Dispatch grafana-enterprise build (push) Blocked by required conditions
Build Release Packages / / darwin-amd64 (push) Blocked by required conditions
Build Release Packages / / darwin-arm64 (push) Blocked by required conditions
Build Release Packages / / linux-amd64 (push) Blocked by required conditions
Build Release Packages / / linux-armv6 (push) Blocked by required conditions
Build Release Packages / / linux-armv7 (push) Blocked by required conditions
Build Release Packages / / linux-arm64 (push) Blocked by required conditions
Build Release Packages / / linux-s390x (push) Blocked by required conditions
Build Release Packages / / windows-amd64 (push) Blocked by required conditions
Build Release Packages / / windows-arm64 (push) Blocked by required conditions
Build Release Packages / Upload artifacts (push) Blocked by required conditions
Build Release Packages / publish-dockerhub (push) Blocked by required conditions
Build Release Packages / Dispatch publish NPM canaries (push) Blocked by required conditions
Build Release Packages / notify-pr (push) Blocked by required conditions
Run dashboard schema v2 e2e / dashboard-schema-v2-e2e (push) Waiting to run
Shellcheck / Shellcheck scripts (push) Waiting to run
Run Storybook a11y tests / Detect whether code changed (push) Waiting to run
Run Storybook a11y tests / Run Storybook a11y tests (light theme) (push) Blocked by required conditions
Run Storybook a11y tests / Run Storybook a11y tests (dark theme) (push) Blocked by required conditions
Swagger generated code / Detect whether code changed (push) Waiting to run
Swagger generated code / Verify committed API specs match (push) Blocked by required conditions
Dispatch sync to mirror / dispatch-job (push) Waiting to run
trigger-dashboard-search-e2e / trigger-search-e2e (push) Waiting to run
Trivy Scan / trivy-scan (push) Waiting to run
* Alerting: Fix and stabilize saved searches E2E tests

Stabilizes the saved searches E2E tests by ensuring correct feature
toggles are enabled and improving the data cleanup logic.

Previously, `clearSavedSearches` relied on clearing localStorage, which
was insufficient as saved searches are persisted server-side via the
UserStorage API. The cleanup now correctly invokes the UserStorage API.

Changes:
- Add `alerting` project to Playwright configuration with authentication
- Enable `alertingListViewV2`, `alertingFilterV2`, and `alertingSavedSearches` toggles in tests
- Update `clearSavedSearches` helper to use UserStorage API for reliable cleanup
- Improve test selectors to use more robust `getByRole` and `getByText` queries
- Update `SavedSearchItem` to merge `aria-label` into `tooltip` for consistency

* Fix saved searchers unit tests
2026-01-14 16:41:53 +01:00
Ida Štambuk
60abd9a159
Dynamic dashboards: Add tests for custom grid repeats (#114545) 2026-01-13 19:42:47 +01:00
Tobias Skarhed
d1064da4cd
Scopes: Add RTK Query API client for caching (#115494)
* Scopes API client

* Initial RTK query commit

* Copy API client from generated enterprise folder

* Mock ScopesApiClient for integration tests

* Update e2e tests

* Handle group expansion for dashboard navigation

* Extract integration test mocks

* Move mock to only be for integration tests

* Update path for enterprise sync script

* Re-export mockData

* Disregard caching for search

* Leave name parameters empty

* Disable subscriptions for client requests

* Add functionality to reset cache between mocked requests

* Use grafana-test-utils for scopes integration tests

* Rollback mock setup

* Remove store form window object

* Remove cache helper

* Restore scopenode search functionality

* Improve request erro handling

* Clean up subscription in case subscription: false lies

* Fix logging security risk

* Rewrite tests to cover RTK query usage and improve error catching

* Update USE_LIVE_DATA to be consistent

* Remove unused timout parameter

* Fix error handling

* Make dashboard-navigation test pass
2026-01-13 13:09:08 +01:00
Ashley Harrison
ca6ab973b4
Modal/Drawer: Switch to use floating-ui's focus trapping (#116017)
* Add awareness of a parent when toggletip is rendered to work inside other modals

* switch modal + drawer to use floating-ui's focus trapping

* remove outdated docs

* fix some unit tests

* fix scopes tests

* remove duplicate aria-label

* kick CI

* fix e2e tests

---------

Co-authored-by: tdbishop <thomas.bishop@grafana.com>
2026-01-09 16:47:25 +00:00
Ida Štambuk
05681efee3
Dynamic Dashboards: Show hidden variables greyed out (#115723) 2026-01-07 09:48:50 +01:00
Adela Almasan
5698f2d039
Tooltips: Prevent dismissing with keyboard shortcuts (#115802) 2026-01-05 08:56:21 -06:00
Jesse David Peterson
d8cdee80f0
Canvas: Fix image loading when icon element SVG defined by field mappings (#115748)
* chore(gdev-dashboard): minimal repro of escalation #19939 bug report

* fix(canvas): add branching logic to handle field mapping to icons case

* test(canvas): validate integration of canvas icon mappings

* refactor(resource-dimension): defensive against JS `undefined` in paths
2026-01-05 10:48:16 -04:00
Paul Marbach
e3bc61e7d2
Suggestions: Add intermediate state to avoid unexpected saved states (#115709)
* Suggestions: Add intermediate state to avoid unexpected saved states

* cleanup

* update and add e2es to confirm behavior

* fix some of the change dispatch

* codeowners

* fix js error that this exposed

* Apply suggestion from @fastfrwrd
2025-12-31 10:56:47 -05:00
Paul Marbach
44e6ea3d8b
Gauge: Fix issues found during bug bash (#115740)
* fix warning for VizRepeater styles

* Gauge: Update test dashboard to round two of the segment panels to whole numbers

* Gauge: E2E tests

* add test for sparklines

* Gauge: Change inner glow to be friendlier to our a11y tests

* remove unused CODEOWNER declaration

* expose text mode so that old displayName usage is somewhat preserved

* update migrations to use the value_and_text mode if displayName has a non-empty value

* more test cases

* update unit tests for fixture updates
2025-12-30 15:27:32 -05:00
Dominik Prokop
759035a465
Remove kubernetesDashboardsV2 feature toggle (#114912)
Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
2025-12-30 09:45:33 +01:00
Paul Marbach
3023a72175
E2E: Use updated setVisualization from grafana/e2e (#115640) 2025-12-29 10:10:04 -05:00
Deyan Halachliyski
62b2a202de
Alerting: Add saved searches feature for alert rules page (#115001)
* Alerting: Add saved searches feature for alert rules page

Add ability to save, rename, delete, and apply search queries on the
Alert Rules page. Includes auto-apply default search on navigation
and UserStorage persistence.

Behind feature toggle `alertingSavedSearches` (disabled by default).

* Alerting: Add i18n translations for saved searches

* Alerting: Remove unused imports in saved searches

* Alerting: Add CODEOWNERS for e2e-playwright/alerting-suite

* Alerting: Add useSavedSearches mock to RulesFilter.v2 tests

* Alerting: Fix failing unit tests for saved searches

- Fix Jest mock hoisting issue in useSavedSearches.test.ts by configuring
  UserStorage mock implementation after imports instead of inline
- Update SavedSearches.test.tsx to use findBy* queries for async popup content
- Fix tests to click apply button instead of text for applying searches
- Update maxLength test to verify attribute instead of trying to exceed it

* Alerting: Fix saved searches test mocking and assertions

- Fix UserStorage mock in useSavedSearches.test.ts by creating mock with
  default Promise-returning functions inside jest.mock() factory, then
  accessing the instance via getMockUserStorageInstance() helper
- Fix SavedSearches.test.tsx apply button tests to use correct accessible
  name "Apply this search" (from tooltip) instead of dynamic aria-label
- Fix disabled button assertion to check native disabled attribute instead
  of relying on aria-disabled which is set inconsistently by Button component
- Use findAllByRole for async popup content queries

* Alerting: Fix test query for disabled save button

Use findByText + closest instead of findByRole to find the disabled
"Save current search" button. The Grafana Button component renders
with conflicting accessibility attributes (disabled="" + aria-disabled="false")
which breaks role-based queries in React Testing Library.

* fix(alerting): preserve UserStorage mock reference before clearAllMocks

* fix(alerting): add missing test mocks for crypto and console

- Mock crypto.randomUUID for Node.js test environment
- Add console.error spy to tests expecting storage/parse errors
- Add console.warn spy to test expecting validation warnings

Fixes jest-fail-on-console failures and crypto.randomUUID TypeError.

* fix(alerting): add console.error spy to save failure test

* fix(alerting): address PR review feedback for saved searches

- Register alertingSavedSearches feature toggle in backend
- Extract shared types to SavedSearches.types.ts to fix circular dependencies
- Extract sub-components: InlineSaveInput, InlineRenameInput, SavedSearchItem
- Remove unused imports (IconButton, Input) and styles from SavedSearches.tsx
- Add try/catch for auto-apply default search error handling
- Remove maxLength validation and corresponding test

* fix(alerting): fix validation error display in saved searches

- Fix useEffect dependency array that was immediately clearing validation errors
- Remove error from deps so errors only clear when user types, not when set
- Run i18n-extract to remove unused error-name-too-long translation key

* fix(alerting): address PR review feedback for saved searches

- Replace toHaveBeenCalled assertions with UI verification using AppNotificationList
- Rename useSavedSearches.test.ts to .tsx for JSX support
- Update README documentation to reflect current test patterns
- Add test cleanup between E2E tests to prevent data leakage

* fix(alerting): remove unused import and fix test wrapper

- Remove unused locationService import from RulesFilter.v2.tsx
- Add missing bootData spread in useSavedSearches.test.tsx mock
- Add createWrapper to renderHook call for user-specific storage key test

* fix(alerting): add Redux wrapper to all useSavedSearches hook tests

All renderHook calls for useSavedSearches now include the createWrapper()
which provides the Redux Provider context required by useAppNotification.

* fix(alerting): use regex patterns in MSW handlers for UserStorage tests

MSW handlers now use regex patterns to match any namespace and user UID,
since UserStorage reads config values from internal imports that aren't
affected by jest.mock of @grafana/runtime.

* fix(alerting): mock UserStorage directly instead of using MSW

Replace MSW HTTP handlers with a direct mock of the UserStorage class.
The MSW approach failed because UserStorage evaluates config.namespace
at module load time, before jest.mock takes effect, causing the regex
patterns to not match the actual request URLs.

This follows the same pattern used in useFavoriteDatasources.test.ts.

* refactor(alerting): use react-hook-form and Dropdown for saved searches

- Migrate InlineRenameInput and InlineSaveInput to react-hook-form
- Replace custom PopupCard with Grafana Dropdown component
- Use useReducer for centralized dropdown state management
- Add stopPropagation handlers to prevent dropdown closing during form interactions
- Update tests to use real useSavedSearches hook with mocked UserStorage
- Consolidate and simplify saved searches test suite

* fix: resolve CI failures in SavedSearches component

- Fix TypeScript TS2540 errors by using MutableRefObject type for refs
- Fix form submission by using onClick instead of type="submit" on IconButton
  (IconButton doesn't forward the type prop to the underlying button)
- Fix action menu tests by stopping click propagation on ActionMenu wrapper
- Fix Escape key handling by focusing the dialog element instead of the
  potentially-disabled save button

* fix(alerting): add navTree to runtime mock in useSavedSearches tests

Add empty navTree array to the @grafana/runtime config mock to prevent
store initialization crash when buildInitialState() calls .find() on
undefined navTree.

* fix(alerting): add error handling for auto-apply default search

Wrap handleApplySearch call in try-catch to prevent unhandled exceptions
when auto-applying the default saved search on navigation.

* fix(alerting): prevent saved searches dropdown from closing when clicking action menu

The nested Dropdown components caused the outer SavedSearches dropdown to close
when clicking on action menu items (Set as default, Rename, Delete). This happened
because @floating-ui/react's useDismiss hook detected clicks on the inner Menu
(rendered via Portal) as "outside" clicks.

Fix: Replace the outer Dropdown with PopupCard and add custom click-outside
handling that explicitly excludes portal elements ([role="menu"] and
[data-popper-placement]). This matches the pattern used before the Dropdown
refactor.

Changes:
- SavedSearches.tsx: Use PopupCard instead of Dropdown, add click-outside handler
- SavedSearchItem.tsx: Add menuPortalRoot prop for action menu positioning
- RulesFilter.v2.tsx: Fix double analytics tracking on auto-apply

* fix(alerting): auto-apply default saved search on page navigation

The default saved search was not being applied when navigating to the
Alert rules page. This was caused by a race condition where `isLoading`
was `false` on initial render (status was 'not-executed'), causing the
auto-apply effect to run before saved searches were loaded.

Fix: Include the uninitialized state in the loading check so the effect
waits until data is actually loaded before attempting to auto-apply.

Also adds tests for the auto-apply functionality.

* fix(alerting): align action menu icon and improve saved search tests

- Fix vertical alignment of three-dot menu icon in saved search items
  by adding flex centering to the wrapper div
- Add feature toggle setup/teardown in saved searches test suite
- Fix location mocking in test for URL search parameter handling

* refactor(alerting): improve saved searches validation and organization

- Rename SavedSearches.types.ts to savedSearchesSchema.ts
- Use react-hook-form's built-in validation instead of manual setError
- Change error handling to throw ValidationError instead of returning it
- Add type guard isValidationError for safe error checking
- Add alphabetical sorting for saved searches (default first)
- Replace console.warn/error with logWarning/logError for analytics
- Extract helper functions: sortSavedSearches, loadSavedSearchesFromStorage, hasUrlSearchQuery

* refactor(alerting): address PR review comments for saved searches (steps 9-12)

- Add comprehensive comment explaining useEffect double-render limitation
  and potential future improvements for default search auto-apply (step 9)
- Add test documenting expected behavior when navigating back to alert list
  after leaving the page - default filter is re-applied (step 10)
- Update RulesFilter.v2.test.tsx to use testWithFeatureToggles helper and
  add MSW UserStorage handlers for future use (step 11)
- Update SavedSearches.test.tsx to use render from test/test-utils and
  byRole selectors for menu items (step 12)

* test(alerting): update saved searches tests for refactored API

- Update mockSavedSearches order to match sorted output (default first, then alphabetically)
- Change validation error tests to use rejects pattern (saveSearch/renameSearch now throw)
- Add hasPermission mock to contextSrv for module-level permission check

* fix(alerting): fix CI failures for saved searches

- Update onRenameComplete type to match throw-based API (Promise<void>)
- Run i18n-extract to add missing translation keys

* fix(alerting): salvage valid entries when saved searches validation fails

Instead of returning an empty array when array validation fails,
iterate through each item and keep only the valid entries.
This prevents losing all saved searches if a single entry is corrupted.

* test(alerting): update test to expect valid entries to be preserved

Update the test assertion to match the new behavior where valid saved
search entries are preserved when some entries fail validation, rather
than discarding all entries.

* fix(alerting): eliminate double API request on saved search auto-apply

Move saved searches loading and auto-apply logic from RulesFilterV2 to
RuleListPage. This ensures the default search filter is applied BEFORE
FilterView mounts, preventing double API requests on initial page load.

- Load saved searches at RuleListPage level
- Gate RuleList rendering until saved searches are loaded
- Pass savedSearchesResult as prop to avoid duplicate hook calls
- Remove auto-apply tests from RulesFilter.v2.test.tsx (behavior moved)

* fix(alerting): mock useSavedSearches in RuleList.v2 tests

The useSavedSearches hook triggers async state updates that complete
after tests finish, causing React act() warnings. Mock the hook to
prevent async operations during tests.

* refactor(alerting): migrate saved searches tests to use MSW

Address code review feedback by migrating UserStorage tests from
jest.mock to MSW-based mocking:

- Add MSW helper functions (setAlertingStorageItem, getAlertingStorageItem)
  to simplify test setup for UserStorage
- Migrate useSavedSearches.test.tsx to use MSW handlers instead of
  jest.mock('@grafana/runtime/internal')
- Migrate RulesFilter.v2.test.tsx to use MSW handlers
- Update README documentation to accurately reflect how tests use MSW
- Add tests for default search auto-apply behavior in RuleListPage
- Simplify comments to be concise and accurate

* fix(alerting): mock UserStorage directly in useSavedSearches tests

The UserStorage class caches its storage spec at the instance level,
and the useSavedSearches hook creates the instance at module level.
This caused test isolation issues where cached state leaked between
tests, making all tests that depended on loading data fail.

Fix by mocking UserStorage class directly instead of relying on MSW
handlers. This gives each test explicit control over what getItem
and setItem return, ensuring proper isolation.

Also update persistence assertions to verify mock.setItem calls
instead of reading from MSW storage (which the mock bypasses).

* refactor(alerting): remove setup helper in SavedSearches tests

Replace the `setup()` helper function with direct `render()` calls
as suggested in PR review. This makes tests more explicit about
what component is being rendered and with what props.

* refactor(alerting): extract default search auto-apply into dedicated hook

Moves the default saved search auto-apply logic from useSavedSearches into
a new useApplyDefaultSearch hook. This improves separation of concerns by
keeping useSavedSearches focused on CRUD operations while the new hook
handles the page-level auto-apply behavior.

Key changes:
- Created useApplyDefaultSearch hook with session-based visit tracking
- Removed getAutoApplySearch method and user-specific session keys from useSavedSearches
- Exported loadDefaultSavedSearch utility for independent default search loading
- Simplified test mocks to use loadDefaultSavedSearch instead of full hook mocking
- Removed unused savedSearchesResult prop passing through component tree

* fix(alerting): improve default search auto-apply timing and test reliability

Replace react-use's auto-executing useAsync with internal useAsync hook
for better control over when default search is loaded. This prevents
race conditions and ensures the async operation only executes when needed.

Test improvements:
- Add proper session storage cleanup in beforeEach
- Use waitFor to handle async operations correctly
- Prevent visited flag from affecting subsequent tests
- Clear mock call history between tests

The internal useAsync hook doesn't auto-execute on mount, allowing us to
control exactly when the default search loads based on conditions rather
than relying on dependency array triggers.

---------

Co-authored-by: Konrad Lalik <konradlalik@gmail.com>
2025-12-19 15:32:27 +01:00
Kristina Demeshchik
321e60e69c
Dashboards: Add missing keyboard shortcuts for new layouts (#115377)
* missing key bindings

* Collapse repeted panels
2025-12-16 09:34:10 -05:00
Paul Marbach
359d097154
Table: Remove hardcoded assumption of __nestedFrames field name (#115117)
* Table: Remove hardcoded assumption of __nestedFrames field name

* E2E for nested tables

* Apply suggestion from @fastfrwrd
2025-12-12 21:57:47 +00:00
Bogdan Matei
f8027e4d75
Dashboard: Implement modal to confirm layout change (#111093) 2025-12-11 19:17:23 +00:00
Tobias Skarhed
f63c2cb2dd
Scopes: Don't use redirect if you're on an active scope navigation (#115149)
* Don't use redirectUrl if we are on an active scope navigation

* Remove superflous test
2025-12-11 17:42:47 +01:00
Kristina Demeshchik
533ee1f078
Dashboard : Allow applying variable regex to display text (#114426)
* Ability to apply regex to display text

* Frontend tests

* scenes-react version

* lock file

* adjust tests input

* adjust inputs

* unused variable

* change data type

* unit tests

* bump scenes

* bump scenes

* Update docs

* V2->V1 conversion

* re-generate files

* update openai snapshots
2025-12-09 10:55:51 -05:00
Torkel Ödegaard
ca342afb25
AppChrome: Add proper menu icon for menu, logo icon becomes home (#114713)
* AppChrome: Add proper menu icon for menu, logo icon becomes home

* Update

* Update

* fix merge issue

* Aligning icons

* Simplify styling and fix issues

* fixes

* style fix

* Fixed unit test

* review updates

* update

* Update

* Remove feature highlight

* fix lint

* remove unused parts
2025-12-09 09:59:40 +01:00
Hugo Häggmark
3490c3b0fd
e2e: add tests for translations (#114390)
e2e: add tests for translations
2025-12-08 10:19:44 +01:00
Marc M.
0adb2461e9
Dashboards: Improve custom variable editor and undo/redo (#114559) 2025-12-05 16:48:34 +01:00
Levente Balogh
32a58c56ed
Dashboard Controls: Add UI for displaying under menu (#113517)
* feat: add options to render under the controls menu

* fix: filter out hidden annotation layers from the dashboard-controls menu

* fix: adjust spacing between annotation controls in the dashboard-controls menu

* fix: e2e test for variables

* feat: move the menu button next to the variables

* fix: remove duplicate link controls

* fix: show dashboard controls when the dashboard is not saved
2025-12-04 16:22:41 +01:00
Torkel Ödegaard
e89efd7068
Dashboard: Simplify layout categories (#114682)
* Dashboard: Simplify layout categories

* update

* fixing e2e
2025-12-03 16:07:10 +01:00
Paul Marbach
021e0c6da0
Suggestions: improve styling for new version (#114381)
Some checks are pending
Integration Tests / Postgres (8/16) (push) Blocked by required conditions
Integration Tests / Postgres (9/16) (push) Blocked by required conditions
Integration Tests / All backend integration tests complete (push) Blocked by required conditions
publish-kinds-next / main (push) Waiting to run
Reject GitHub secrets / reject-gh-secrets (push) Waiting to run
Build Release Packages / setup (push) Waiting to run
Build Release Packages / Dispatch grafana-enterprise build (push) Blocked by required conditions
Build Release Packages / / darwin-amd64 (push) Blocked by required conditions
Build Release Packages / / darwin-arm64 (push) Blocked by required conditions
Build Release Packages / / linux-amd64 (push) Blocked by required conditions
Build Release Packages / / linux-armv6 (push) Blocked by required conditions
Build Release Packages / / linux-armv7 (push) Blocked by required conditions
Build Release Packages / / linux-arm64 (push) Blocked by required conditions
Build Release Packages / / linux-s390x (push) Blocked by required conditions
Build Release Packages / / windows-amd64 (push) Blocked by required conditions
Build Release Packages / / windows-arm64 (push) Blocked by required conditions
Build Release Packages / Upload artifacts (push) Blocked by required conditions
Build Release Packages / publish-dockerhub (push) Blocked by required conditions
Build Release Packages / Dispatch publish NPM canaries (push) Blocked by required conditions
Build Release Packages / notify-pr (push) Blocked by required conditions
Run dashboard schema v2 e2e / dashboard-schema-v2-e2e (push) Waiting to run
Shellcheck / Shellcheck scripts (push) Waiting to run
Run Storybook a11y tests / Detect whether code changed (push) Waiting to run
Run Storybook a11y tests / Run Storybook a11y tests (light theme) (push) Blocked by required conditions
Run Storybook a11y tests / Run Storybook a11y tests (dark theme) (push) Blocked by required conditions
Swagger generated code / Detect whether code changed (push) Waiting to run
Swagger generated code / Verify committed API specs match (push) Blocked by required conditions
Dispatch sync to mirror / dispatch-job (push) Waiting to run
trigger-dashboard-search-e2e / trigger-search-e2e (push) Waiting to run
Trivy Scan / trivy-scan (push) Waiting to run
* Suggestions: hashes on suggestions, update logic to select first suggestion

* fix types

* Suggestions: New UI style updates

* update some styles

* getting styles just right

* remove grouping when not on flag

* adjust minimum width for sidebar

* CI cleanups

* updates from ad hoc review

* add loading and error states to suggestions

* remove unused import

* update header ui for panel editor

* restore back button to vizpicker

* fix e2e test

* fix e2e

* add i18n update

* use new util for setVisualization operation

* Apply suggestions from code review

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>

* comments from review

* updates from review

---------

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2025-12-02 11:36:46 -08:00