* feat: introduce exposable components and update the public APIs
Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
* tests: fix the tests for `usePluginComponent()`
I broke them when I wrapped the component with the PluginContextProvider which fetches the plugin metadata.
* fix: typo
---------
Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
* do it
* set empty child version to parent version
* feat(plugins): use pluginId for loader cache keys
* feat(plugins): apply caching to all js and css files systemjs loads
* remove old code and add comment
* test(plugins): update systemjs hooks tests in line with better caching
* test(plugins): wip - comment out failing backend loader tests
* fix tests and improve comment
* Update public/app/features/plugins/loader/cache.test.ts
Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
---------
Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
* add version to time-interval models
* set time interval fingerprint as version
* update to check provided version
* delete to check if version is provided in query parameter 'version'
* update integration tests
* update specs
* Support record struct in provisioning API
* Update api spec
* Use record field
* Restrict API endpoints following toggle
* Fix swagger spec
* Add recording rule validation to store validator
* Update types
* Mark datasource as supporting traces
* Add logic to transform exemplar query to traces query
* Render appropriate editor
* Run trace query for exemplars
* Refactor out common functions
- Add function to retrieve first/default subscription
* Add route for trace exemplars
* Update logic to appropriately query exemplars
* Update traces query builder
* Update instance test
* Remove unneeded import
* Set traces pseudo data source
* Replace deprecated function calls
* Add helper for setting default traces query
* Don't show resource field for exemplars query
* When resetting operation ID for exemplars set query to default
- Update tests
* Update query header to appropriately set the service value
* Fix response frame creation and update tests
* Correctly select resource
* Convert subscriptionsApiVersion to const
* Add feature toggle
* revert Select changes as we can handle it outside of the base select component
* update scenes
* update scenes properly
* revert changes to azure-monitor e2e tests
* Kick start your query: keep pipe operations in the original query
* QueryPatternsModal: define keep operations from the operations list
* QueryPatternsModal: resolve deprecation
* QueryPatternsModal: use the correct import
* QueryPatternsModal: use category instead of order rank
* QueryPatternsModal: add unit test case
* Chore: change button cta
* 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>
* feat: add search input and filters
* feat: add state management v0
* feat: update search view and add to trash page
* refactor: fix some errors
* feat: page population
* feat: fix error
* Run betterer checks locally
* Run i18n abstraction
* refactor: clean up after merging main
* refactor: clean up after merging main
* Run i18n abstraction
* refactor: remove browse view
* Grafana UI: stop input element of the react select component from overflowing the input container
* update snapshot since the css changed
---------
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
* Show queryVariable editor even if the variable does not support variables
* Fix VariableQueryRunner unit test, now takes into account the new function
* Cloud migration: create route to fetch cloud migration token
* implement gcomStub.ListTokens
* fix swagger for POST /cloudmigration/migration
* fix swagger for POST /cloudmigration/migration
* fix swagger for POST /cloudmigration/migration
* AzureMonitor: get the list of azure clouds from the SDK instead of from a hard coded list
* add azure-sdk to yarn.lock
* merge legacy with custom options
* Normalize legacy cloud names
* Workaround: send new credential format to backend while we wait to migrate to the new format
* Lint fix
* resolveLegacyCloudName should not return undefined
* re-add undefined handling in resolveLegacyCloudName so that we fallback to getDefaultAzureCloud when not defined
---------
Co-authored-by: Jeremy Angel <jeremyangel@microsoft.com>
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
Co-authored-by: Alex Petrov <alex.petrov.vt@gmail.com>
Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
Co-authored-by: Alex Petrov <apetrov@fastly.com>
* Scopes: Select scope even without data retrieval
* Pass entire scope and not only the spec to Prometheus
* Enrich ScopeSpec that is sent to Prometheus
* add name to BE
---------
Co-authored-by: Kyle Brandt <kyle@grafana.com>
fix: in Components, `model.useState()`, instead of `model.state`
Generally, it is better practice. More succinct.
It could also eliminate subtle state bugs.
* Add custom attention state to dashboard
* Add attention state to DashboardGrid
* Remove old functionality
* Add attention state to keybindingSrv
* Create PanelAttentionService
* Add PanelAttentionService with scenes support
* Remove unused code
* Use viz panel key instead of VizPanel
* Add type assertion
* Add e2e test
* Update comments
* Use panel id for non-scenes use case
* Support undefined service use case
* Memoize singleton call
* Debounce mouseover
* Set panelAttention with appEvents
* Use AppEvents for Scenes
* Remove panelAttentionSrv
* Wait in e2e to handle debounce
* Move subscription to KeybindingSrv
* Remove imports and reset keyboardShortcuts from main
* Fix on* event handlers
* Azure monitor: Basic Logs frontend (#85905)
* adds datasource level config for enabling basic logs
* add basiclogsquery type to query json
* add toggle between basic and analytics
* adds basic logs toggle from UI, blocks time picker to only dashboard if basic logs is selected
* add check to remove UI if alerting
* tests for logsmanagement component
* tests for logs query editor
* tests for time mangement control
* remove unused imports
* clears query whenever toggle changes from basic <-> analytics
* add test to account for clearning query
* Update public/app/plugins/datasource/azuremonitor/components/ConfigEditor/BasicLogsToggle.tsx
wording
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsQueryEditor.tsx
spelling
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsQueryEditor.tsx
spelling
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* update dependency list
* clear basic logs if resources change
* fix tests
---------
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* Azure Monitor: Basic Logs modal acknowledgement (#86244)
* adds datasource level config for enabling basic logs
* add basiclogsquery type to query json
* add toggle between basic and analytics
* adds basic logs toggle from UI, blocks time picker to only dashboard if basic logs is selected
* add check to remove UI if alerting
* tests for logsmanagement component
* tests for logs query editor
* tests for time mangement control
* remove unused imports
* add confirm modal
* clears query whenever toggle changes from basic <-> analytics
* add test to account for clearning query
* adds modal acknowledgement for basic logs query
* tests for handling modal logic
* basic logs ack type
* Update public/app/plugins/datasource/azuremonitor/components/ConfigEditor/BasicLogsToggle.tsx
wording
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsQueryEditor.tsx
spelling
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsQueryEditor.tsx
spelling
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* update dependency list
* clear basic logs if resources change
* remove modal from config page
* remove basic logs query ack type
* add modal acknowledgement to toggle between basic and analytics
* clear query if resources change
* fix tests
* fix tests
* Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsManagement.tsx
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* fix tests
---------
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* Azure Monitor: Basic Logs Backend (#87653)
* fix logic for showingBasicLogsToggle
* move to utils function and add basiclogsquery in apply template variable
* add backend safeguards for basiclogsqueries
* adds support for calling search or query apis based on whether it is basic logs or not
* add tests for utils
* initial test for basic logs query in the backend
* tests for basic logs
* remve comment
* simplify checks for basic logs
* adds fromAlert prop for azure monitor backend services
* adds fromAlert check fo basic logs
* fix working and empty tags
* add telemetry for basic logs
* remove import from grafana core package
* change fromAlert true in tests
* change the way tests catch errors
* Update pkg/tsdb/azuremonitor/loganalytics/utils.go
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* Update pkg/tsdb/azuremonitor/loganalytics/utils.go
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* Update pkg/tsdb/azuremonitor/loganalytics/utils.go
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* Update pkg/tsdb/azuremonitor/loganalytics/azure-log-analytics-datasource.go
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* restructure code to only run basic logs checks if basiclogsflag is true
* data retention warning
* tests for calculate time range
* Simplify determining if request is from alerting
* Fix lint and bool check
* Fix tests
* clarify data retention
---------
Co-authored-by: Jocelyn <jcolladokuri@microsoft.com>
Co-authored-by: jcolladokuri <jocelyncollado52@gmail.com>
* Azure Monitor: Basic Logs data volume notification (#88009)
* frontend changes for data ingested warning
* initial logic for getResource
* payload processing
* create basicLogs usage function
* add utils for converting time and getting the data volume query for basic logs
* frontend updates for showing the data ingested for the given query
* frontend tests
* add check for when no dataIngested is returned
* remove backend.logger prints
* comment on what function does
* fix merge
* make resource URI regex case insensitive
* add support for workspace variables in basic logs flow
* add undefined check
* structure and add tests for variable support
* Update pkg/tsdb/azuremonitor/loganalytics/azure-log-analytics-datasource.go
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* add tracing for basic logs usage request
* clean up data volume query struct
* use async/await instead of callback
* fix parameters for getApiURL
* restrict time on usage query to 8 days max
* add time to dependency array to refetch basic logs usage
* move time check implementation to backend
* fix utils tests
---------
Co-authored-by: Jocelyn <jcolladokuri@microsoft.com>
Co-authored-by: jcolladokuri <jocelyncollado52@gmail.com>
---------
Co-authored-by: jcolladokuri <jcolladokuri@microsoft.com>
Co-authored-by: jcolladokuri <jocelyncollado52@gmail.com>
* NodeGraph: Use values from fixedX/fixedY column for layout
* Cleanup some code, typings and naming
* Add test
---------
Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com>
* LogRowMessage: strip new lines when wrapping is disabled
* LogRowMessage: prevent conflicts between failed json parsing and unwrapping
* LogRowMessage: expand multi-line unwrapped logs when opening details
* Add unit test
* Prettier
* chore: update comment
* POC preserve filters and group by when navigating between dashboards
* Save all variables and time range
* minor refactor
* Add feature toggle
* Update feature toggle usage
* Delete local storage item if nothing to preserve
* Structural changes
* Simplify restore params code
* Use session storage
* Add tests
* Merge fix
* Remove unused code
* And make it better, errrrrr
* Minor deduplication refactor
* last minor
* Prometheus: get the list of azure clouds from the SDK instead of from a hard coded list
* Update yarn.lock
* Fix lint
---------
Co-authored-by: Jeremy Angel (from Dev Box) <jeremyangel@microsoft.com>
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* WIP
* Refactor and update how we display these fields in the form
* Add test for getTemplateOptions and udpate parseTemplates to handle minus simbol
* fix betterer
* Fix wrapper
* Create new usePreviewTemplate to be reused from TemplatePreview and TemplateContentAndPreview
* remove unnecessary check
* track interactions
* Include the whole content of the template in the preview
* Update parseTemplates function to return default templates
* handle nested templates in parseTemplates function
* Missing border fixed, whitespaces preserved and no empty space at the bottom
* remove unused styles and add a comment in test
* Add missing error in getPreviewResults
* fix styles for template selector containers
* Alerting: PR feedback to move default templates into RTKQ (#88172)
Move default templates to RTKQ API + constant
* move parseTemplates to a utils file and refactor last part of this function
* Keep selected options when loading exising input and when switching between tabs
* Update descritpion in tabs
* Fix not previewing when loading existing values
* Update text addressing Brenda's feedback
* Add test for matchesOnlyOneTemplate function
* Add minheight to viewer container and fix getContentFromOptions function
---------
Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
* Fix variable saving inconsistencies
* add tests
* for variable changes to be detected, save variables need to be true
* Fix for issue with buildNewDashboardSaveModel creating filter variable withouth filter property
* remove unused import
* Read path, main API
* Define record field for incoming requests
* Refactor several alerting specific validators into two paths
* Refactor validateCondition actually contain all the condition validation logic
* Move condition validation inside rule path
* Validators for recording rules
* Wire feature flag through to validators
* Test for accepting a valid recording rule
* Tests for negative case, no UID
* Test for ignoring alerting fields
* Build conditions based on recording rules as well
* Regenerate swagger docs
* Fix CRUD test to cover the right thing
* Re-generate swagger docs with backdated v0.30.2 version
* Regenerate base spec
* Regenerate ngalert specs
* Regenerate top level specs
* Comment and rename
* Return struct instead of modifying ref
* Use deepEqual to ensure migratedQuery is only returned when query is unchanged
* Add selectors for query editors
* Add more tests for query editor component
* Clarifying comments
* Fix how state is set
* Simplify query editor loading and migration
* MultiSelect: Respect value passed to the component regardless of custom value being allowed or not
* reset input for test
---------
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
* chore(storybook): run yarn dlx storybook@latest upgrade
* chore(storybook): remove storybook/blocks patch
* chore(yarn): clean up storybook dependencies
* feat(storybook): migrate to v8 config via migration codemods
* refactor(storybook): update stories to use v8 types via codemod
* refactor(storybook): update stories to use preview-api instead of client-api
* refactor(storybook): replace mdx usage of ArgsTable with PureArgsTable
* refactor(storybook): migrate remaining mdx files to v8 storybook/blocks api
* refactor(storybook): clean up mdx imports and blocks component names
* chore(storybook): clean up typescript configuration
* fix(frontend): align types/react versions across monorepo so grafana ui can be built
* fix(storybook): pub back react-docgen-typescript and use ArgTypes so props tables work
* chore(storybook): patch blocks package to expose Preview component
* revert(storybook): revert changes related to using Canvas component in mdx files
* Storybook upgrade: Fix icon typing (#87793)
fix iconOptions typing
* refactor(storybook): prefer as const over asserting types
* revert(storybook): put back correct case in box.mdx
---------
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
* Implement changes for new Scopes API
* Update from linkID to linkId
* Fixes
* Fix tests
* prom/scopes: change query model to recieve []ScopeSpec
* Move to basic backend service
---------
Co-authored-by: Kyle Brandt <kyle@grafana.com>
* Tempo: Escape backslash in span name for promsql query
In promsql, backslashes in regexes must be doubly escaped for them to be
interpreted as a literal backslash character.
Fixes#79791
* Fix regex replace
---------
Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com>
* WIP
* add configure irm componet and pass it to Nav
* add check if theres datasource for Alerts
* update incident steps links
* uncomment done property in the interface
* Fix not having data sources in store and removing warning using wrong Icon name type
* call incidents api in done step
* Show checked steps with an icon instead of a badge
* Implemnt check contact point ready in essentials
* Fix codeowners and prettify file
* Check if there is one oncall integration in at least one contact point
* Refactor
* Check for oncall integration being created
* Add the test oncall integration action
* Do not hide any card in irm page, and refactor
* Refactor: move hooks to a separate file
* Implement oncall chatops checks
* update incidents hook
* Show new irm page only on cloud and for admins
* fix prettier in irmhooks
* remove unused import
* fix prettier in irm hooks
* fix axios method
* Add progress bar on essentials
* Update texts and some styles
* Refactor
* fix api call
* fix check is plugin is installed
* fix async call
* fix lint
* Do not show check icon when done field is undefined in a step
* refactor
* Add test for Essentials
* check if incident plugin installed
* call incidents api to get steps
* add the new api to get config
* fix prettier
* memoize the api call
* fix lint
* add proper api call
* check if response is valid
* fix typo
* use state to save the values
* fix lint
* fix response schema
* fix prettier
* update incident steps copy
* udapte texts in respond tooltips
* Fix confiure IRM route check
* Fix logic for the data source check: check if there is a data source that is alerting compatible
* Use existing header prop in NavLandingPage instead of creating a new prop
* fix wrong updated file
* Update logic for default contact point check and update some links
* Update texts and show only one item for oncall integration with alerting checks
* Update texts following suggestions in the doc
* Fix getting default contact point and update oncall link for slack tab
* Update texts, buttons and checks following last meeting action items
* remove unnecessary component drawer
* Track interactions: user open or close essentials drawer
* Refactor
* remove unnecessary createMonitoringLogger for tracking irm events
* remove unnecessary style
* refactor
* refactor
* Add fallback links and labels for action buttons when step is done
* Update irm card styles
* remove extra space after progress bar numbers
* remove progress bar border
* Address pr review comments
* remove unnecessary AlertmanagerProvider
* fix logic behind default contact point check
* update test
* Address pr review comments part1
* add aria and properties role for Progressbar
* Reorganize hooks into separate folders/files for each app
* move done field to the step level
* Handle empty dropdown options
* Handle loading state
* Update tooltip for connecting alerting to oncall
* Use RTKQ for incidents
* handle loading for oncall hooks
* refactor getting configuration for each app
* fix incident rtkq query to be a query instead of mutation
* refactor: rename variable
* Address some nits in the review
---------
Co-authored-by: reemtariqq <reem.tariq@grafana.com>
* Create basic feature toggle
* Rename context to reflect it contains query history and query library
* Update icons and variants
* Rename hooks
* Update tests
* Fix mock
* Add tracking
* Turn button into a toggle
* Make dropdown active as well
This is required to have better UI and an indication of selected state in split view
* Update Query Library icon
This is to make it consistent with the toolbar button
* Hide query history button when query library is available
This is to avoid confusing UX with 2 button triggering the drawer but with slightly different behavior
* Make the drawer bigger for query library
To avoid confusion for current users and test it internally a bit more it's behind a feature toggle. Bigger drawer may obstruct the view and add more friction in the UX.
* Fix tests
The test was failing because queryLibraryAvailable was set to true for tests. This change makes it more explicit what use case is being tested
* Remove active state underline from the dropdown
* Add basic types and api methods
This is just moved from the app. To be cleaned up and refactored later.
* Move API utils from Query Library app to Grafana packages
* Move API utils from Query Library app to Grafana packages
* Move API utils from Query Library app to Grafana packages
* Add basic table for query templates
* Add sorting
* Style cells
* Style table cells
* Allow closing Query Library drawer from the toolbar
* Remove Private Query toggle
It will be moved to the kebab
* Add empty state
* Remove variables detection for now
Just to simplify the PR, it's not needed for Explore yet.
* Simplify getting useDatasource.tsx
* Rename cell
* Move QueryTemplatesTable to a separate folder
* Use RTK Query to get list of query templates
* Clean up query templates table
* Simplify useDatasource hook
* Add a test
* Retrigger the build
* Remove unused code
* Small clean up
* Update import
* Add reduxjs/toolkit as a peer dependecy
* Revert "Add reduxjs/toolkit as a peer dependecy"
This reverts commit aa9da6e442.
* Update import
* Add reduxjs/toolkit as a peer dependecy
* Revert "Add reduxjs/toolkit as a peer dependecy"
This reverts commit 2e68a62ab6.
* Add @reduxjs/toolkit as peer dependency
* Add @reduxjs/toolkit as peer dependecy
* Move reactjs/toolkit to dev dependecies
* Minor clean up and use react-redux as a peer dependency
* Move query library code to core features
* Update code owners
* Update export
* Update exports
* Use Redux store instead of APIProvider
* Await for query templates to show during the test
* Add more explicit docs that the feature is experimental
---------
Co-authored-by: Kristina Durivage <kristina.durivage@grafana.com>
* Fix deleting rules when silencing/resuming rule from a panel alert tab
* fix test and return early when no group target is found
* address pr review comment