Commit Graph

1489 Commits

Author SHA1 Message Date
Tom Ratcliffe
4fb1ac2bec Check error state more reliably 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
a0373c66c3 Add fallback for alertmanager alerts 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
9bf2cf0a52 Rename silences RTKQ tag 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
4d4bf39184 Check for server received body
This is not ideal! Preference would be to have a more robust mock server
that responds to the received silence and appends it to a stateful list for the test
and then resets afterwards
2024-04-29 14:15:48 +01:00
Tom Ratcliffe
0dc003aadc Split handlers out into separate files 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
f419c9b53a Add comment explaining reset in silences editor 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
df5c62b8ad Misc tidy up 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
21a3f4817a Add correct tag invalidation after creating a silence 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
cdfc6baea4 Remove unused fetchAlerts method 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
f397830098 Refactor Silences test 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
10fcd541e3 Add handlers to mock server 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
341449f4f5 Remove unused actions/reducers 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
a1d2a9670b Restructure Silences components for better separation of concerns 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
11ed882c84 Add mock server handlers necessary for Silences 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
8f27ec2521 Add silences RTK Query API 2024-04-29 14:15:48 +01:00
Ashley Harrison
c151a97110
Chore: Enable no-unreduced-motion and fix errors (#86572)
* enable `no-unreduced-motion` in betterer

* move all animation calls inside handleReducedMotion

* fix violations + enable rule

* update rule README

* remove unnecessary transition from <Collapse>

* remove handleReducedMotion utility and add handleMotion to theme

* update to use new theme value

* handle Dropdown and IconButton

* handle AppChromeMenu and update lint message

* keep rotation at a reduced speed

* handle DashboardLoading
2024-04-29 13:12:36 +01:00
Sonia Aguilar
a68df4be88
Alerting: Skip flaky test (#86921)
Skip flacky test
2024-04-25 13:43:37 +01:00
Tom Ratcliffe
f43762f39a Remove (most) occurrences of HorizontalGroup within Alerting 2024-04-25 12:54:41 +01:00
Erik Sundell
0140dfdddf
Chore: Add e2e selectors to alert rule page (#86909)
wip
2024-04-25 10:00:11 +02:00
Tom Ratcliffe
0582e05f8f Add PoC for different MSW approach 2024-04-24 15:57:11 +01:00
Marcus Andersson
804c726413
PluginExtensions: Make the extensions registry reactive (#83085)
* feat: add a reactive extension registry

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* feat: add hooks to work with the reactive registry

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* feat: start using the reactive registry

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* feat: update the "command palette" extension point to use the hook

* feat: update the "alerting" extension point to use the hooks

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* feat: update the "explore" extension point to use the hooks

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* feat: update the "datasources config" extension point to use the hooks

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* feat: update the "panel menu" extension point to use the hooks

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* feat: update the "pyroscope datasource" extension point to use the hooks

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* feat: update the "user profile page" extension point to use the hooks

* chore: update betterer

* fix: update the hooks to not re-render unnecessarily

* chore: remove the old `createPluginExtensionRegistry` impementation

* chore: add "TODO" for `PanelMenuBehaviour` extension point

* feat: update the return value of the hooks to contain a `{ isLoading }` param

* tests: add more tests for the usePluginExtensions() hook

* fix: exclude the cloud-home-app from being non-awaited

* refactor: use uuidv4() for random ID generation (for the registry object)

* fix: linting issue

* feat: use the hooks for the new alerting extension point

* feat: use `useMemo()` for `AlertInstanceAction` extension point context

---------

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
2024-04-24 09:33:16 +02:00
Sonia Aguilar
68564b1940
Alerting: Gops labels integration (#85467)
* Show list of labels on the alert rule form in a more visual way, and use a modal for managing them

* fix test

* Fix more tests

* Show orange badge when no labels are selected

* Remove unused datasource property in LabelsField

* Remove unused div and add comment

* Use button instead of icon for editing labels

* Use subform for labels

* Move logic fetching labels from different places in a separate hook

* Fix tests

* remove unused getLabelInput const in test

* Add ellispis and tooltip for long labels and move labels list in modal to the bottom

* Use text instead of badge when no using labels

* Fix tests after adding ellipsis and tooltip to the labels

* simplify styles

* Fix fetching values from gops when new key is used

* Address pr review comments

* Address pr review comments part2

* Fix tag on rtkq

* Remove color for no labels selected text

* Disable already used keys in the labels sub form

* Fix typo

* use the UseFieldArrayRemove type from react-hook-form

* Update some styles and text in the labels modal

* Address some review comments (nits)

* Address review comments part1

* Move logic getting labels in useCombinedLabels hook

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2024-04-23 14:38:31 +02:00
Ashley Harrison
fc45b56d9d
EmptyState: Apply call-to-action variant in core (#86448)
* apply empty state in a bunch of places

* fix unit tests

* put alert back on top

* add data-testids so e2e tests keep working

* remove info boxes

* fix annotations empty state alignment with new maxWidth
2024-04-22 17:01:24 +01:00
Konrad Lalik
7caa30bc2e
Alerting: Add plugins extension point to alerting home page (#85725)
* Add basic extension point to alerting home page

* Remove home page scenes app. Improve plugins styles

* Remove unused code

* Fix home page rendering when no plugins registered

* Add row-based integrations component

* Add missing margins

* Rollback the Box component changes

* Remove unused import
2024-04-22 13:42:11 +02:00
Konrad Lalik
1b930c341d
Alerting: Fix max_alerts field handling (#86651)
Fix max_alerts field parsing
2024-04-22 12:25:04 +02:00
Santiago
9ed616a7b3
Alerting: Fix typo ('Alert manager' -> 'Alertmanager') (#86608)
* Alerting: Fix typo ('Alert manager' -> 'Alertmanager')

* fix front-end test
2024-04-19 20:53:51 +02:00
Konrad Lalik
344cea1725
Alerting: Fix external Alertmanager settings payload (#86413)
* Remove helper properties from the AM config object

* Make the omitTemporaryIdentifiers a pure function

* Add formValuesToCloudReceiver test

* Remove immer produce to prevent object freezing
2024-04-18 15:55:13 +02:00
Tom Ratcliffe
a5c75c5ffb Remove explicit imports of whatwg-fetch from individual test files 2024-04-18 12:23:38 +01:00
Tom Ratcliffe
ab605e37df Remove unnecessary server.listen() 2024-04-18 09:04:53 +01:00
Tom Ratcliffe
ef5c4b69f3 Remove unused msw import 2024-04-18 09:04:53 +01:00
Tom Ratcliffe
de4510cc70 Reuse setupMswServer for alerting tests 2024-04-18 09:04:53 +01:00
Tom Ratcliffe
2674043cef Add whatwg-fetch and fixes to alerting tests that break when polyfill is added 2024-04-18 09:04:53 +01:00
Konrad Lalik
9614126cb7
Alerting: Fix instances link when served from subpath (#86432)
Fix instances link when served from subpath
2024-04-18 08:56:30 +02:00
Konrad Lalik
acd3e83c1c
Alerting: Take receivers into account when custom grouping Alertmanager groups (#86127)
* Take receiver into account when custom grouping Alertmanager alert groups

* Fix and add tests
2024-04-17 08:55:01 +02:00
Brendan O'Handley
f85470d652
Prometheus: Use the frontend package in Prometheus and remove feature toggle (#86080)
* add history links for monaco completion provider folder

* add history links for monaco query field folder

* add history links for components folder

* add history links for configuration folder

* add history links for dashboard json folder

* add history links for gcopypaste folder

* add history link for variableMigration

* add history link for querybuilder/components/metrics-modal folder

* add history link for querybuilder/components/promqail folder

* add history links for querybuilder/components folder

* add history links for querybuilder/hooks folder

* add history links for querybuilder/shared folder

* add history links for querybuilder folder

* add history links for querycache folder

* add history links for src folder

* use frontend package and custom auth in module.ts

* remove files and fix import issues

* remove usePrometheusFrontendPackage

* remove extra files

* update betterer

* remove extra files after rebase

* fix betterer for rebase

* fix e2e flakiness
2024-04-15 16:45:23 -05:00
Tobias Skarhed
f1f02207f2
Alerting: Improve heading accessibility (#85723)
* Change from h5 to Text component

* Fix goworksum error

* Add headings for contact points and notification policies

* Alert group h2

* Reset labels and move h2 to group by

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2024-04-12 16:19:47 +02:00
Tom Ratcliffe
ce5fc59d54 Use ActiveTab type for custom hook 2024-04-12 09:13:29 +01:00
Tom Ratcliffe
ccaf850c09 Refactor to useTabQueryParam 2024-04-12 09:13:29 +01:00
Tom Ratcliffe
d91e1a4e3a Refactor tab query param logic and add tests 2024-04-12 09:13:29 +01:00
Tom Ratcliffe
800a2e0228 Fix tests being stateful due to locationService 2024-04-12 09:13:29 +01:00
Tom Ratcliffe
94ad66998f Send tab query param through when returning from template save 2024-04-12 09:13:29 +01:00
Tom Ratcliffe
933cc3f075 Tweak ContactPoints to use query param for tab selection 2024-04-12 09:13:29 +01:00
Tom Ratcliffe
a852b70953 Fix console.errors from edit group modal tests 2024-04-10 19:13:41 +01:00
Tom Ratcliffe
fff524b54c Make quick eval buttons in group edit set dirty state on form and handle invalid case 2024-04-10 19:13:41 +01:00
Tom Ratcliffe
584d2bcb91 Remove useEffect that was setting incorrect display value for pending period 2024-04-10 19:13:41 +01:00
Armand Grillet
212acb9bc5
Alerting: clarify alerting silences (#85853)
* Clarify alerting silences

* Update docs/sources/alerting/configure-notifications/create-silence.md

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
2024-04-10 18:30:21 +02:00
Ashley Harrison
3c69de6be5
Chore: removing some type assertions (#85839)
* fix some type assertions in loops

* some more cleanup

* some alerting fixes

* put comments in correct place to ignore rule

* couple more

* undo SilencesFilter changes
2024-04-10 14:54:31 +01:00
Sonia Aguilar
e234d098e9
Alerting: Get oncall metada only when we have alert manager configuration data (#85622)
* Get oncall metada from url in settings only when we have alert manager configuration

* Add test in useContactPointsWithStatus hook

* Fix tests
2024-04-09 09:02:44 +02:00
Adela Almasan
5f0ca1429b
Annotations: Fix annotation title (#85614) 2024-04-05 17:39:10 -05:00
Konrad Lalik
9b4f88c6f6
Alerting: Improve template preview (#84798)
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2024-04-04 18:37:24 +03:00
Gilles De Mey
d3ee3c0a24
Alerting: Evaluation quick buttons (#85010)
Co-authored-by: Tom Ratcliffe <tomratcliffe@users.noreply.github.com>
2024-04-04 16:24:35 +02:00
Gilles De Mey
c41b0a71cf
Alerting: Add state history polling interval (#84837) 2024-04-04 14:06:15 +02:00
Tobias Skarhed
f387cff836
Accessibility: Default Icon to aria-hidden (#84362)
* Icon: aria hide icon, unless a label is set

* Update doc

* Remove weird auto import

* Fix fialing tests

* Add recommendation for Tooltip

* Consider more aria attributes to support Tooltip

* Handle tabIndex and aria-hidden case

* Add comment about aria-label
2024-04-04 12:07:50 +02:00
Tom Ratcliffe
0ec48cfdbd Add success toast for rule update back in 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
d585a5bc88 Rename tag for combined alert rules 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
1fcb264c87 Add InfoPausedRule back to alert detail view 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
20a1955026 Reuse StateTag for Paused state 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
0e87adbc97 Remove await from dispatch 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
ff8203a6cf Forward ref to StateTag so it can work with Tooltip 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
fb40c09eaf Reuse existing mock user method 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
2ca5e43a65 Remove superfluous alert from pause text 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
30471c340a Use verbose mutation from RTKQ for better IDE experience 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
28572102cf Use produce for pause payload generation and return early 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
12eeda5b7d Hide alert update success toast 2024-04-03 18:38:49 +01:00
Gilles De Mey
fbe43100aa add paused badge 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
30699dabec Move repeated Paused message into component 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
31fb80b29a Move MenuItemPaused to components folder 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
1e54899c6d Remove unneeded type 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
b037236b9c Add tag invalidation to updateRule mutation
...so the alert detail view updates appropriately
2024-04-03 18:38:49 +01:00
Tom Ratcliffe
9ca2f7bece Add pause/resume logic to menu items on Alert detail view 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
7d80373b5e Move repeated menu item logic for pausing rules into separate component 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
b84962ef3f Update tests to use existing mock server approach 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
5fbca0962e Fix import/export messing with Policy tests 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
bd06607a51 Fix typing check for paused rules in table 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
820f4f0ef5 Remove console logs, fix aggregate errors and add missing endpoint 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
8c313add00 Add test for resuming a paused alert rule 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
fef481efc3 Add mock data for paused rules 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
5505b72998 Add first pass of basic mock server for alerting usage 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
72a3142c3b Add pause/resume button with mutation for saving alert rule changes 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
9a416b8241 Fix potential display of "0" on rule details tab
When looking at the details tab of an alert rule, the last evaluation could potentially display as `0` due to falsy checks on React rendering
2024-04-03 18:38:49 +01:00
Tom Ratcliffe
a94c3d63cc Update utils for determining paused state of a rule 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
7fd9cbbfb5 Export alerts limit for reuse when re-fetching rules list 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
1a5d227e05 Hide "firing for time" if a rule is paused 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
93fd11fe86 Update alert state tag to display Paused as its own "state" 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
a881e7e404 Display info message on rule detail view when a rule is paused 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
31be1231cf Move max width from rule editor parent 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
d0dcb72683 Display info message on rule form when a rule is paused 2024-04-03 18:38:49 +01:00
Tom Ratcliffe
e5a6dff801 Add mutation method to update a rule 2024-04-03 18:38:49 +01:00
Leon Sorokin
d601acac3a
VizTooltips: Remove old tooltips and annotations (#84420)
Co-authored-by: Adela Almasan <adela.almasan@grafana.com>
2024-04-02 15:32:46 -05:00
Torkel Ödegaard
e90b87589f
ModalsContext: Unify modals context and manager (#84916)
* ModalsContext: Unify modals context and manager

* Clear on location change

* fixes

* Update

* use generics to avoid anys

---------

Co-authored-by: joshhunt <josh@trtr.co>
2024-03-28 13:26:57 +01:00
Gilles De Mey
a574db6f64
Alerting: Fix removing nested policy (#85242) 2024-03-27 13:58:59 +02:00
Gilles De Mey
90a1e8a82f
Alerting: Make hovercard accessible (#85195) 2024-03-27 10:05:30 +01:00
Torkel Ödegaard
b20da139ad
DashboardScene: Show insights icon (#84877)
* DashboardScene: Show insights icon

* Update

* Create separate group for precence indicators

* fix

* Update

* fix tests
2024-03-22 09:46:29 +01:00
Gilles De Mey
8c9ba97642
Alerting: Support PromQL-style matchers (#84672) 2024-03-21 14:11:18 +01:00
Gilles De Mey
4c247f959b
Alerting: Fix broken panelId links (#84839) 2024-03-21 13:58:34 +01:00
Erik Sundell
29d4f6a217
Datasource: Change query filtering (#84656)
* call filterQuery from queryrunner

* test query hide filtering

* fix more broken tests

* lint errrors

* remove redundant filterQuery call

* skip filter in variable queries

* fix broken cypress test

* change tooltip text

* fix translations

* fix comments

* do not execute query is targets are empty

* add more tests

* remove unsued import

* update translations

* revert id change

* change header text

* update comment for hide prop

* rename hide query prop

* change tooltip and introduce different toggle state text

* update tests

* update comment and regenerate types

* run extract again

* fix broken e2e test

* track event

* fix build issues

* revert changes in wire file
2024-03-21 13:39:39 +01:00
Alex Khomenko
b41ad688f2
Alerting: Remove deprecated InputControl (#84793) 2024-03-21 12:59:41 +02:00
Laura Benz
d8a116e696
ReturnToPrevious: Add e2e test (#83115)
* feat: add incomplete unit test

* refactor: add idea for unit test

* feat: create new e2e test

* feat: add some steps

* feat: add comment

* feat: complete prep work

* feat: complete clean up

* rebase

* feat: add more steps to test flow

* refactor: remove unit test

* refactor: clean up

* refactor: create a provisioned alert rule

* refactor: change location and content

* refactor: e2e test

* refactor: betterer

* refactor: move provisioned alert rule

* refactor: make provisioning file available remote

* refactor: clean up test

* refactor: move provisioned alert rule

* refactor: remove wait()

* feat: restructure first test and add more tests

* feat: add another provisioned alert rule

* feat: add a new test

* feat: complete new test

* refactor: replace data-testid in alert rules

* refactor: replace data-testid

* refactor: fix tests for drone

* refactor: fix third test after review

* refactor: fix last test

* temp

* refactor: improve some things

* refactor: adjust unit tests

* refactor: remove assertions for alert rule details view

* refactor: remove assertions

* refactor: add check for button text

* refactor: remove session storage

* refactor: apply changes from code review

* refactor: add codeowner

* refactor

* refactor

* refactor: clean up

* refactor: clean up

* refactor: clean up

* refactor: increase pa11y threshold for /alerting/list
2024-03-21 09:05:51 +01:00
Gilles De Mey
5a57ff1307
Alerting: Preserve newlines and whitespace for Prometheus and Loki queries (#84755) 2024-03-19 19:38:04 +02:00
Sonia Aguilar
b38436eeb0
Alerting: Fix used badge in contact points list (#84714)
Fix used badge in contact points list
2024-03-19 13:30:06 +01:00