23 Commits

Author SHA1 Message Date
3cd29d2cdd Alerting: Improve simplified routing test (#107251)
Improve SimplifiedRuleEditor test performance
2025-06-27 09:56:42 +02:00
e256f2d5e2 Alerting: Enable recording rules by default (#105603) 2025-06-02 10:56:05 +02:00
97a1614cde Alerting: Rework rule editor layout (#103744) 2025-04-29 15:45:45 +02:00
dc0501e376 Alerting: Simplify actions (#103494) 2025-04-23 12:45:28 +02:00
f9471ac10b Alerting: Recover deleted alert rules (#101869)
* add column guid to alert rule table and rule_guid to rule version table

+ populate the new field with UUID

* update storage and domain models

* patch GUID

* ignore GUID in fingerprint tests

* get alert rule versions by GUID

* update rule delete to reset uid in history instead of deleting rows

* add test

* Update delete rule to require UserUID, remove all versions and create "delete" version

that holds information about who and when deleted the rule

* update usages of the delete method

* add list deleted rules to store

* list api to support deleted query parameter

* add list deleted rules to store

^ Conflicts:
^	pkg/services/ngalert/store/alert_rule_test.go

* list api to support deleted query parameter

* Restore deleted rules

* fix recovering manually recording rules

* update role control for the trash route

* add alertingRuleRecoverDeleted feature toggle enabled by default

* fix access control for trash menu item in the navtree

* Add alertingRuleRecoverDeleted feature toggle,
add Delete permanently alert rule menu option

* hide remove permanently functionality in the UI until we have the api available for it

* discard wrong changes after merging

* Reverted changes in pkg/apis/dashboard_manifest.go after fixing conflicts

* Reverted changes in go.work.sum after fixing conflicts

* Reverted changes in pkg/apis/dashboard_manifest.go after fixing conflicts

* Reverted changes in pkg/services/ngalert/models/alert_rule.go after fixing conflicts

* Reverted changes in pkg/apis/dashboard_manifest.go after fixing conflicts

* restore delete permanently and add the queryparam for it

* update snapshots

* fix translations

* protect trash route by the feature toggles

* use the new rulerRuleType for checks

* revert ability to delete permanently and alert rule from the ui

* remove unnecessary update after reverting

* fix ff

* add tracking

* use recently deleted instead of trash

* create isRecoverDeletedRulesEnabled for checking ffs

* address pr feedback 1

* include alert rule uid in getRowId

* use RulerGrafanaRulesConfigDTO for deleted rules response

* use isLoading in the AlertingPageWrapper

* fix wrong check for recording rules type

* add test for restoring manually through the alert rule form

* add test for restoring deleted rule

* use importAlertingComponent

* udpate mock

* address pr feedback

* update translations

* address feedback

* address feedback 2

* address feedback 3

* address feedback 4

* move transformation of the response to the endpoint

* fix typo

* refactor grafanaRuleDtoToFormValues

* update translations

* use guid for identifying rows

* prettier

* use ONLY the guid for identifying rows

* Add provides/invalidates tags for deleted rules

---------

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
2025-03-27 16:39:26 +02:00
0bf31c14a7 Alerting: Improve default form values handling (#97564)
This PR refactors how rule form state is managed and relies less on prop drilling and removes dependency on redux store.
2025-01-28 15:49:47 +02:00
394d081df2 Selectors: Add selectors for alert rule steps (#99553)
* add selectors for alert rule steps

* refactor alert rule tests
2025-01-27 13:57:31 +01:00
52c95f77cd Alerting: Include error from current condition when previewing queries (#98202) 2025-01-20 17:56:21 +00:00
9c7a355afd Alerting: Add tests for combination of switch modes in the alert rule form (#98052)
* Add tests for combination of switch

* refactor test

* use alerting option for default datasource in RuleEditor Grafana rules test

* add test for grafana recording rules

* use enum for grafana steps in tests

* dont make each test dependent on previous localstorage

* add test for local storage
2025-01-08 14:48:08 +01:00
b91b9a1e38 Alerting: Use jest/expect-expect rule to check for assertions (#93112) 2024-10-11 13:08:50 +03:00
97249d15d1 Routing: Update alerting routes to react router 6 (#94469)
* Update alertingRuleEditor

* Update Policy.test

* Update AlertRuleForm

* Update ReceiversSection

* Update SimplifiedRuleEditor.test.tsx

* Update CloneRule.tsx
2024-10-10 07:33:16 +03:00
3ec2084c23 Alerting: Remove all but one usage of TestProvider within test code (#91542) 2024-08-07 10:58:58 +01:00
47f8717149 React: Use new JSX transform (#88802)
* update eslint, tsconfig + esbuild to handle new jsx transform

* remove thing that breaks the new jsx transform

* remove react imports

* adjust grafana-icons build

* is this the correct syntax?

* try this

* well this was much easier than expected...

* change grafana-plugin-configs webpack config

* fixes

* fix lockfile

* fix 2 more violations

* use path.resolve instead of require.resolve

* remove react import

* fix react imports

* more fixes

* remove React import

* remove import React from docs

* remove another react import
2024-06-25 12:43:47 +01:00
93870c1cd8 Alerting: Use new endpoints to fetch single GMA rule on view and edit pages (#87625) 2024-05-30 12:55:06 +02:00
0e7c0d25fe Alerting: Add test for creating an alert rule with simplified routing. (#80610)
* Add test for creating an alert rule with simplified routing

* Fix mocking folders after merging from main (folder uid change)
2024-03-11 08:47:56 +01:00
3605d85c4c Dashboards: Remove advancedDataSourcePicker feature toggle (#81790)
* remove advancedDataSourcePicker feature toggle from DataSourcePickerWithPrompt

* remove advancedDataSourcePicker toggle from DataSourcePicker and adjust tests that relied on old picker

* adjust failing tests in QueryVariableEditorForm

* move DataSourceDropdown to DataSourcePicker file

* covert style declaration syntax to object style in DataSourcePicker

* remove advancedDataSourcePicker  feature flag from registry

* remove .only from test

* adjust QueryVariableEditor test to avoid console.error
2024-02-06 09:20:07 +00:00
1456b26075 Alerting: Fix being redirected to list view when clicking Save rule button (#75510)
* Fix: dont allow 'Save rule' button and let 'Save rule and exit' in case of new rule

* Fix tests
2023-10-03 14:55:42 +02:00
a2c93bb8bc Alerting: Alert creation UI changes (#73835) 2023-09-06 13:24:48 +02:00
718401d250 Alerting: Add smart type selection when creating a new alert rule (#71071)
* Add smart type selection when creating a new alert rule

* Auto switch when switch button has not been clicked yet

* remove unnecessay code after the last refacgtor

* Refactor

* Remove unneeded prop

* Move SmartAlertTypeDetector to its own file

* Fix tests

* Refactor: new useSetExpressionAndDataSource hook

* Fix expressions not been propagated when switching from one type to another

* Change texts

* Update tests

* Update text in switch button

* Update texts and tests

* Refactor: move code to getCanSwitch new method

* Move smart alert after queries and remove auto-switch

* Remove expressions and restore them when switching between grafana and cloud type

* Rename previous expression state

* Fix tests

* Add data source name for data source-managed alert selection

* Update reducer when changing cloud data source

* PR review suggestions

* PR review suggestions 2nd part

* PR review suggestions 3th part

* Fix canSwitch

* Update texts on smart alert

---------

Co-authored-by: Virginia Cepeda <virginia.cepeda@grafana.com>
2023-07-13 17:02:47 +02:00
e796063a1e Alerting: Reorder new alert and export buttons (#68418)
* Add component for rule creation and dropdown

* Make each route type have a different path

* Remove unneeded import

* Fix tests

* Rename CreateRuleButton to MoreActionRuleButtons

* Remove Recording Rule option from new rule form

* Use alerting and recording for path params on new rules

* Fix tests

* Only show new button if permissions are granted

* Fix tests
2023-05-31 10:56:54 -03:00
49ff85ef54 Alerting: Fix action buttons label and placement in several views following standard and being consistent with the rest of the ui (#67799)
* Fix action buttons label and placement in several views following standard and being consistent with the rest of the ui

* Update public/app/features/alerting/unified/components/mute-timings/MuteTimingForm.tsx

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>

* Fix secondary buttons to not have outline

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2023-05-04 17:05:26 +02:00
b8e7ef48d0 AppChrome: Unify logic for chromeless pages that should not have NavBar, CommandPalette, Search etc (#62281)
* Keybindings: No global keybindings on chromeless pages

* simplify condition

* Refactoring

* Align name and file

* Move logic into AppChrome

* minor fix

* Update Page.tsx

* Fixing test

* Fixed tests

* More fixes

* Fixed more tests

* Fixing final test

* Fixed search in old nav
2023-02-02 09:53:06 +01:00
55055d0b9b Alerting: Fix RuleEditor flaky test for existing grafana managed alert (#59780)
* Fix RuleEditor flaky test for existing grafana managed alert

* Fix RuleEditor flaky test for creating a new grafana managed alert

* Fix tests for cloud rules

* Split tests for different rule types

* Move common clickSelectOption method to helpers

* Remove from RuleEditorCloudRules.test.tsx  a repeated cloud rule test

* Move existing grafana rule test case to a new file

* Split RuleEditorCloudRules test: move checking only allowed data sources test case to a new test file

* Re-use common ui const

* Re-use renderRuleEditor method

* Create getDiscoverFeaturesMock to reduce code
2022-12-07 16:15:33 +01:00