* Add group actions menu
* Refactor modals to accept raw ruler group
* Use prometheus and ruler responses to dispaly GMA rules in the hierarchical view
* Add groups loader component for data source managed rules
* Improve rules matching algorithm for the search results
* Use plus and minus icons for reconciliation state
* loading spinner WIP for operations / transactions
* update comment
* Use ruler rules order when displaying a group, change rurler preload behaviour
* Add ruler-based ordering for GMA rules
* Refactor ruler API mocking
* Refactor rule components to accept ruler only rules
* Add tests for GrafanaGroupLoader
* Add tests for vanilla prom groups
* Unify data matching code, add tests for DS groups loader
* Fix errors after rebasing
* Improve handling of ruler group absence
* Fix cache key
* Add group action buttons for the new group pages
* Add new rule action buttons to the new list page
* Address PR feeback, component renaming, missing translations
* Unify groups and rules links and actions
* Fix new rule button
* Add rule list action buttons tests
* Fix lint errors
* Add redirect to rule details page on save
* Update FilterView tests
* Fix imports and remove unused code
* Improve type definitions, add pooling to Prom hooks, add inline docs
* Remove unused code of group modals
* Update translations
* Disable cache population for filter-view generators
* Add consistency check Alert to the RuleViewer when V2 list is enabled
* Disable UI errors in prom generator
* Improve missing datasouce handling
* Add missing translations
* Improve group loader tests, remove unused code
* Enhance Prometheus API query to include notification options
* Improve error handling, remove consistency check for vanilla prom data sources
* Address PR feedback, add new version of the useHasRuler hook
---------
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
* Add alertingRuleVersionHistory feature toggle
* WIP: Add version history tab
* revert temp change in index.ts
* wip2
* --wip--
* sync code with the BE changes in the endpoint
* add translations
* Add translations
* use ff only for restore feature
* WIP: Add tracking, make version required, and start mapping dif results
Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
* Tweak more translations and improve types
* Add button to show/hide JSON diff
* update type for top level rule fields
* Create types
* Make updated_by/version properties optional
* Update mocks to remove updated by and version
* add comments to restore code
* rename fetature flag, as we use this one only for the restore feature
* Update version history to handle special cases
* Add diff numbers
* Fix conflicts
* Move generic computeVersionDiff to a utils file
* Update DOM structure of version summary and tidy up types
* Add tests for version comparison logic
* Lint fix utils file
* Rename props and add docs
* Change to EmptyState and log when no versions
* Remove CreatedBy component and simplify
* Add missing i18n for version history
* add test for computeVersionDiff
* update test
* fix number diff order and add a test
* fix prettier
* fix prettier
* Add promise resolve back in
* Rename to humanReadableDiff and tweak translation
* Show tab for recording rules as well
* Split components out to separate files
* Add optional interval seconds
* Update i18n
* Remove commented code
* Remove value
* Remove unneeded version
* Consistent rendering of updated by
* Mode parseVersionInfo to a separate pure function
* update invalidate/provide tags for getAlertVersionHistory
* Use checkedVersions state only in the parent component
* update getSpecialUidMap name and create an interface
* Fix prettier
* update tab description
* use set instead of map for checkedVersions
---------
Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
* Add translations for notification preview
* Make notifications endpoints use alertmanager config mock entity
* Fix translations and error handling in preview component
* Update preview hook to use new k8s APIs
* Move receivers k8s mock logic so it always comes from the mock config
* Fix test that wasn't using the correct receiver
* Fix object_matchers
* Remove mockApi method and update tests
* Update translation for error case
* Remove useMemo
* Add basic usage of K8s API for notification policies
* Add permissions checks for navtree for routes
* Add and update permissions for routing tree logic
* Add capability to skip calling contact points hook
* Conditionally show list of mute timings depending on permissions
* Conditionally link to mute timings if user can see at least one
* Add work in progress k8s handlers for routing tree
* Update notification policy hooks
* Wire up policies to permissions better (conditionally calling APIs)
* Add additional checks for whether to show grafana AM
* Add permission checks to access control
* Remove accidental permissions after rebase
* Update types and const for k8s routes
* Improve statefulness and reset routing tree in tests
* Update notif policy tests to check k8s and config API
* Fix type assertion
* Move non-grafana test out of .each
* Make failure case safer
* Override tag invalidation for notification policies API
* Pass in error and add new error alert component
* Add basic mock server conflict check
* Add test to check user can save after a conflict
* Add logic to allow reloading policies if changed by another user
* Fix test
* Update translations in Modals
* Add ViewAlertGroups ability
* Tweak provisioning logic and memoize AM config response
* Update snapshots for useAbilities
* Update result destructure
* Use enums for provenance in routingtrees
* Use consistent memoisation
* Fix _metadata for vanilla AM
* useAsync for error / update state
* move k8s api error handling to separate file
* use cause for error codes
* Use `supported` bools from Alertmanager abilities and clarify default policy
---------
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
* Remove role requirement for editing silence (instead handled by silence editor displaying error)
* Send query params for metadata/access control silence logic
* Add new access control types to enum
* Add folder-specific checks for silences
* Remove filtering in alert manager picker
* fix flakey rule viewer test and update permissions helper
* Use `returnTo` in rule viewer page
* Fix incorrect display of duration
* Clean up some mock server behaviour in rule details tests
* Tweak styles for silences alerts table
* Remove alertmanager picker from silences drawer
* Add error if user cannot edit a silence
* Show alert rule name in silences table and consume RBAC logic
* Update mocks to include RBAC access control logic
* Update silences tests
* Update silences type to include access control info
* Update comment for missing alertmanager
* Update mock handlers and query param logic
* Tweak query params again
* Update access control mock
* Revert AM picker fix as user may not have access to Grafana AM
* Swap ternary order
* Change text for no alert rule targeted
* Don't show error alert from RTKQ query and remove alert instance preview in case of error
* Add missing translations
* Fix test adding missing mock for getting alert rule
* Add missing translations in SilencesTable
* Add translations autogenerated files
* fix allowing edit silence in external alert manager
---------
Co-authored-by: Sonia Aguilar <soniaaguilarpeiron@gmail.com>
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
* Change ruler API to expect the folder UID as namespace
* Update example requests
* Fix tests
* Update swagger
* Modify FIle field in /api/prometheus/grafana/api/v1/rules
* Fix ruler export
* Modify folder in responses to be formatted as <parent UID>/<title>
* Add alerting test with nested folders
* Apply suggestion from code review
* Alerting: use folder UID instead of title in rule API (#77166)
Co-authored-by: Sonia Aguilar <soniaaguilarpeiron@gmail.com>
* Drop a few more latent uses of namespace_id
* move getNamespaceKey to models package
* switch GetAlertRulesForScheduling to use folder table
* update GetAlertRulesForScheduling to return folder titles in format `parent_uid/title`.
* fi tests
* add tests for GetAlertRulesForScheduling when parent uid
* fix integration tests after merge
* fix test after merge
* change format of the namespace to JSON array
this is needed for forward compatibility, when we migrate to full paths
* update EF code to decode nested folder
---------
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
Co-authored-by: Virginia Cepeda <virginia.cepeda@grafana.com>
Co-authored-by: Sonia Aguilar <soniaaguilarpeiron@gmail.com>
Co-authored-by: Alex Weaver <weaver.alex.d@gmail.com>
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
* Add export formats drawer when exporting contact points
* Add 'export by format' drawer in policies (root policy)
* Add test for showing export policies button
* Add tests for Policy.tsx
* Add tests for export functionality in receivers
* Add exporter drawer for receivers
* Fix prettier warnings
* Allow HCL only for alert rules exports
* Add tests for Policies
* Fix tests
* Refactor: Update ExportProviders types for limiting the avaliable export formats when using GrafanaExportDrawer
* Delete unused shouldShowExportOption method and tests
* Use useAlertmanagerAbility hook to check if canReadSecrets
* Update snapshot for useAbilities test
* Fix prettier
* Convert decrypt to boolean
* Fix prettier
* Rename CanReadSecrets action to DecryptSecrets
* Update the string value for DecryptSecrets
* Fix snapshor for useAbilities after renaming the can-read-secrets
* Add notification policies preview in alert rule form
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
* Refactor using new useGetPotentialInstances hook and apply some style changes
* Add notification policy detail modal
* Use backtesting api for simulating potential alert instances
* Fix logic to travserse all the children from the root route
* Split notification preview by alert manager
* Add instance count to matching policy header and fix some styles
* Move some logic to a new hook useGetAlertManagersSourceNames to make the code more clean
* Fix some tests
* Add initial test for NotificationPreview
* Use button to preview potential instances
* Add link to contact point details
* Add route matching result details
* Show AlertManager image in the routing preview list
* Add tests setup, add single AM preview test
* Handle no matchers and no labels use case
* Update some style in collapse component and fix policy path in modal
* Update modal styles
* Update styles
* Update collapse header styling
* Normalize tree nodes should happen before findMatchingRoutes call
* Fix findMatchingRoutes and findMatchingAlertGroups methods after reabasing
* Move instances matching to the web worker code
* Fix config fetching for vanilla prometheus AMs
* Add tests
* Add tests mocks
* Fix tests after adding web worker
* Display matching labels for each matching alert instance
* Add minor css improvements
* Revert changes added in Collapse component as we don't use it anymore
* Move the route details modal to a separate file
* Move NotificationRoute and preview hook into separate files
* Fix Alertmanager preview tests
* Fix tests
* Move matcher code to a separate file, improve matcher mock
* Add permissions control for contact point edit view link
* Fix from and to for the temporal use of backtesting api
* Fix tests, add lazy loading of the preview component
Co-authored-by: Sonia Aguilar <soniaaguilarpeiron@gmail.com>
* Fix preview test
* Add onclick on the header div so it collapse and expands when clicking on it, and update styles to be consistent with the rest of tables
* Adapt the code to the new rule testing endpoint definition
* Fix tests
* small changes after reviewing the final code
* compute entire inherited tree before computing the routes map
* Throw error in case of not having receiver in routesByIdMap and add test for the use case of inheriting receiver from parent to check UI throws no errors
* Add list of labels in the policy route path that produces the policy matchers to match potential instances
* Use color determined by the key, in label tags when hovering matchers in the policy tree
* Remove labels in modal and handle empty string as receiver to inherit from parent as we do with undefined
* Revert "Add list of labels in the policy route path that produces the policy matchers to match potential instances"
This reverts commit ee73ae9cf9caf10c33bcd58973279f23437a9146.
* fix inheritance for computeInheritedTree
* Fix message shown when preview has not been executed yet
* First round for adressing PR review comments
* Adress the rest of PR review commments
* Update texts and rename id prop in NotificaitonStep to alertUid
---------
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>