Commit Graph

634 Commits

Author SHA1 Message Date
Tom Ratcliffe
3ec2084c23
Alerting: Remove all but one usage of TestProvider within test code (#91542) 2024-08-07 10:58:58 +01:00
Ashley Harrison
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
Ashley Harrison
50dd95c09b
Chore: Remove betterPageScrolling toggle (#89339)
* remove betterPageScrolling toggle

* add scrollTo test shim
2024-06-18 14:33:08 +01:00
Konrad Lalik
93870c1cd8
Alerting: Use new endpoints to fetch single GMA rule on view and edit pages (#87625) 2024-05-30 12:55:06 +02:00
Ashley Harrison
9bf3adabd8
Spinner: Change spinner icon when prefers-reduced-motion is set (#87641)
* change spinner icon when prefers-reduced-motion is set

* update mock

* remove outdated comment

* fix matchMedia mocks

* update spinner aria label
2024-05-13 11:32:02 +01:00
Tom Ratcliffe
08884f16af
Chore: Remove redux-rtl test helper (#87596) 2024-05-13 11:03:21 +01:00
Ashley Harrison
670960f70c
Chore: Upgrade redux (#86877)
* update packages

* fix type errors

* upgrade redux toolkit as well

* don't need eslint-disable command

* remove comment

* fix unit tests

* call rtk query selector directly

* remove unnecessary checks
2024-05-10 14:28:51 +01:00
Tom Ratcliffe
31231cf5bf Change test render method to use locationService 2024-04-29 14:15:48 +01:00
Tom Ratcliffe
389250afe0 Add whatwg-fetch polyfill to jest test setup so all tests run it 2024-04-18 12:23:38 +01:00
Tom Ratcliffe
8f0f0387b8 Simplify providers used for test utils method
For now, keep the providers down to just what was already in TestProvider
2024-04-16 12:23:50 +01:00
Tom Ratcliffe
488c5b8396 Use PropsWithChildren and allow router configuration in test utils render 2024-04-16 12:23:50 +01:00
Tom Ratcliffe
045ec86984 Add typing for react-inlinesvg mock now its included in tsconfig 2024-04-16 12:23:50 +01:00
Tom Ratcliffe
0f88075e4c Mark TestProvider as deprecated
(up for discussion, depending on adoption of test utils. Alternative approach could be to re-use TestProvider in test-utils)
2024-04-16 12:23:50 +01:00
Tom Ratcliffe
c0cb36c9d6 Add initial test-utils file with render helper, wrapping in (most) required providers 2024-04-16 12:23:50 +01:00
Ashley Harrison
b3cff22db3
Chore: Improve types (#85659)
* fixing some types

* more type fixes

* few more

* last couple

* tiny tweak
2024-04-08 09:56:21 +01: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
Andrej Ocenas
aba65747c9
Nodegraph: Fix issue with rendering single node (#84930)
Fix for single node graph case
2024-03-26 13:43:43 +01:00
Sonia Aguilar
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
Ivan Ortega Alba
29d6cd8fa0
DashboardScene: Share change detection logic between saving and runtime (#81958)
Co-authored-by: Alexandra Vargas <alexa1866@gmail.com>
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2024-02-29 18:18:26 +02:00
Jack Westbrook
0dcdfc261b
Monaco Editor: Load via ESM (#78261)
* chore(monaco): bump monaco-editor to latest version

* feat(codeeditor): use esm to load monaco editor

* revert(monaco): put back previous version

* feat(monaco): setup MonacoEnvironment when bootstrapping app

* feat(monaco): load monaco languages from registry as workers

* feat(webpack): clean up warnings, remove need to copy monaco into lib

* fix(plugins): wip - remove amd loader workaround in systemjs hooks

* chore(azure): clean up so QueryField passes typecheck

* test(jest): update config to fix failing tests due to missing monaco-editor

* test(jest): update config to work with monaco-editor and kusto

* test(jest): prevent message eventlistener in nodeGraph/layout.worker tripping up monaco tests

* test(plugins): wip - remove amd related tests from systemjs hooks

* test(alerting): prefer clearAllMocks to prevent monaco editor failing due to missing matchMedia

* test(parca): fix failing test due to undefined backendSrv

* chore: move monacoEnv to app/core

* test: increase testing-lib timeout to 2secs, fix parca test to assert dom element

* feat(plugins): share kusto via systemjs

* test(e2e): increase timeout for checking monaco editor in exemplars spec

* test(e2e): assert monaco has loaded by checking the spinner is gone and window.monaco exists

* test(e2e): check for monaco editor textarea

* test(e2e): check monaco editor is loaded before assertions

* test(e2e): add waitForMonacoToLoad util to reduce duplication

* test(e2e): fix failing mysql spec

* chore(jest): add comment to setupTests explaining need to incresae default timeout

* chore(nodegraph): improve comment in layout.worker.utils to better explain the need for file
2024-02-22 12:31:40 +01:00
Ivan Ortega Alba
5460d75e74
QueryVariableEditor: Select a variable ds does not work (#83144) 2024-02-21 17:57:53 +02:00
Ashley Harrison
cf65d91ee9
Chore: upgrade to msw v2 (#82270)
* Update dependency msw to v2

* close

* minor fixes

* fetch import changes

* fix some alerting tests

* fix another alerting test

* fix systemjs tests

* don't return undefined in json mocks

* don't return undefined in json response

* add type

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-14 13:16:44 +00:00
Sergej-Vlasov
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
Matias Chomicki
2a734a9e3f
Supplementary queries: allow plugin decoupling by allowing providers to return a request instance (#80281)
* Supplementary queries: add support for providers returning a request instance

* Formatting

* DataSourceWithSupplementaryQueriesSupport: update getDataProvider signature

* getLogLevelFromLabels: fix buggy implementation

* getLogLevelFromKey: fix key type

Why number??

* Revert "getLogLevelFromKey: fix key type"

This reverts commit 14a95298a6f803cc3270e0421b2e04dd0d65f131.

* getSupplementaryQueryProvider: remove observable support

* Datasources: remove unnecessary check

The switch is doing the same job

* Supplementary queries: update unit test

* datasource_srv: sync mock with real api

* Formatting

* Supplementary queries: pass targets from getSupplementaryQueryProvider

* LogsVolumeQueryOptions: remove range and make extract level optional

* logsModel: add missing range to test data

* query: sync tests with changes

* Formatting

* DataSourceWithSupplementaryQueriesSupport: update interface with deprecated and new methods

* DataSourceWithSupplementaryQueriesSupport: sync Loki and Elasticsearch

* queryLogsVolume: extractLevel no longer customizable

* Loki: update test

* Supplementary queries: add support for the new method

* hasSupplementaryQuerySupport: update signature

* Formatting

* Betterer

* Query: update test

* Supplementary queries: add test for the legacy API

* Update public/app/features/explore/utils/supplementaryQueries.ts

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

---------

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2024-01-30 12:36:20 +02:00
Ashley Harrison
68ba6cc67b
Chore: some type fixes (#80094)
* some type fixes

* few more fixes

* more

* fix unit test
2024-01-09 10:00:00 +00:00
Torkel Ödegaard
e924627659
Frontend: Reload the browser when backend configuration/assets change (#79057)
* Detect frontend asset changes

* Update

* merge main

* Frontend: Detect new assets / versions / config changes (#79258)

* avoid first check

* Updates and add tests

* Update

* Update

* Updated code

* refine

* use context

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2024-01-04 08:00:07 +01:00
Ashley Harrison
2c0c51a0df
Chore: improve types (#78126)
* fix some types

* more type updates

* some more fixes

* more changes

* string instead of unknown

* more like original logic

* remove outdated comment

* update betterer
2023-11-16 12:39:12 +00:00
Esteban Beltran
0b03344baa
Chore: Update to typescript 5 (#76511)
* Update dependency typescript to v5

* Update yarn.lock

* Fix typescript errors

* Update typescript version sdk

* Revert useDescription.ts

* Fix ts errors

* Fix Typescript errors after Symbol.unscopables type change

* Fix colormanipulator errors

* Update packages/grafana-data/src/vector/FunctionalVector.ts

* Fix ts errors in dashboardmigrator

* Fix sandbox component typescript error

* Update yarn

* Update to typescript 5.2

* Fix typescript error

* update typescript/vscode patch/sdk/whatever

* fix ts errors in elasticsearch

* Fix two errors in alerting

* Fix error in dashboard-scene

* Fix errors in dashboard tests

* Fix errors in explore tests

* Fix error in plugins sandbox

* fix error in DashboardQueryRunner

* fix errors in grafana-data

* fix errors in PanelChrome story

* update betterer

* better fix for cloud monitoring

* fix error in reducer tester

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
Co-authored-by: Josh Hunt <joshhunt@users.noreply.github.com>
Co-authored-by: joshhunt <josh@trtr.co>
2023-11-07 13:20:20 +00:00
Ashley Harrison
d1e52d4788
Chore: type fixes (#77618)
* type fixes

* couple more

* just a couple more

* small fixes to prometheus typings

* improve some more datasource types
2023-11-06 11:28:44 +00:00
Ashley Harrison
07cc7504ee
Icon: Simplify and remove wrapping <div> (#76819)
* remove wrapping div

* update tests, just gotta figure out how to handle fontawesome :(

* add spinner.svg which matches the font-awesome spinner

* add mock for react-inlinesvg

* update mock and fix some tests

* fix FormField test

* fix CorrelationsPage tests

* increase timeout
2023-10-24 12:16:32 +01:00
Jack Westbrook
d282b7a6f8
Grafana UI: Make it possible to bundle package with plugins (#76191)
* moved themecontext to data

* chore(grafana-ui): re-export ThemeContext from grafana/data for backwards compatibility

* Moved icon bundling to core.

* feat(plugins): share react-inlinesvg with plugins for grafana/ui bundling

* chore(codeowners): add generate-icon-bundle.js to file

* chore(storybook): update path to iconBundle file for theme

* feat(plugins): share i18n dependency via systemjs

* Make sure that icon bundle is initialized for tests.

* Removed comment.

* added tests for icon root.

* Removing the need of having an init variable.

* feat(grafana-ui): add icon svgs to bundle for projects that don't rely on grafana

---------

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2023-10-13 14:11:41 +02:00
Simen Bekkhus
3749c17556
chore: replace Sinon usage with Jest (#75940) 2023-10-04 11:12:30 +01:00
Sonia Aguilar
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
Josh Hunt
44e51ffe8b
Dashlist: Use new nested folder picker (#74011)
* Add new folderUID property

* Add nested folder picker + migration to UID

* fix folderUID

* comment
2023-09-07 13:57:31 +03:00
Gilles De Mey
a2c93bb8bc
Alerting: Alert creation UI changes (#73835) 2023-09-06 13:24:48 +02:00
Jack Westbrook
62821c69b3
Plugins: Bump SystemJS to 6.14.2 (#70068)
* chore(plugins): bump systemjs to latest version

* refactor(plugins): switch runtime over to use latest systemjs, add typings

* refactor(plugins): use latest systemjs APIs for runtime dependency resolution

* refactor(plugins): return valid urls from backend for latest systemjs import to work

* revert(plugins): remove cfg from assetpath in favour of relative paths

* fix(plugins): useDefault for systemjs deps to solve undefined errors

* feat(plugins): add basic support for loading plugins via CDN

* fix(plugins): load nested plugins with latest systemjs

* feat(plugins): add back ability to transform plugin src for cdns

* feat(plugins): get caching for module.js working, clean up

* refactor(plugin_loader): create buildImportMap fn and more clean up

* refactor(angularapp): use buildImportMap for dependencies and clean up

* test(plugin_loader): fix failing test due to systemjs update

* test(jest): mock systemjs amd extra in tests to prevent it breaking tests

* chore(plugins): remove systemjs module-types extra, already included with system

* fix(plugins): update key for invalidating cached plugins

* fix: move systemjs amd define to another global so monaco can load

* refactor(plugins): clean up cache buster and tests

* chore(plugins): remove debug

* refactor(plugins): move systemjs define to keep global cleaner

* fix(plugins): set useDefault so system modules lodash references dont fail

* feat(plugins): hook systemjs onload so stylesheets are applied to the dom

* refactor(plugins): wrap amd formatted plugins in iife to prevent define collision

* feat(plugins): support system module format for legacy plugins

* test(plugincachebuster): update tests to match latest implementation

* test(plugins-loader): fix up tests post module property change

* fix test

* Update pkg/plugins/manager/loader/assetpath/assetpath.go

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>

* chore(plugin_loader): remove stray import from merge conflict

* Revert "Update pkg/plugins/manager/loader/assetpath/assetpath.go"

This reverts commit 0df57d1cf20f49c22c93369001c70aae46a97c42.

* fix(plugin_loader): set use default for shared plugin dependencies

* refactor(plugins): use leading slash for Module and BaseUrl

* fix(plugins): fix resolve appending extension to cache query param

* refactor(plugins): align baseurl and module paths

* refactor(plugins): update builtInPlugins keys to match naming convention

* refactor(plugins): minor loader clean up, fix up types

* test(plugins): fix failing tests

* refactor(plugins): rename cache buster systemjs plugin to cache

* refactor(plugins): separate plugin_loader into smaller files

* chore(plugins): clean up plugin_loader types

* chore(plugin_sandbox): fix typescript error

* chore(npm): remove unplug debug and pin systemjs to 6.14.1

* refactor(plugins-cdn): update loaders to use absolute module url from backend

* fix(plugins): escape period in systemjs  module regex

* chore(plugins): delete redundant systemjs plugins

* refactor(plugin_loader): move hooks into own file, add types

* test(plugins): add tests for systemjs loader hooks

* chore(plugins): rename systemjshooks file

* chore(plugins): remove redundant systemjs cdn backend code

* fix(plugins): handle loading with config.appSubUrl

* chore(plugins): delete redundant plugin-cdn angular code

* test(plugins): fix failing systemjs test missing pluginsCDNBaseUrl

* refactor(plugins): backend provides base and module properties with AppSubUrl

* fix(plugins): consider AppSubUrl for plugin logos

* fix(plugins): use isHostedOnCDN util when checking for cdn hosted plugins

* add new appSubURL field to config

* refactor relative URL func

* fix path for core app

* refactor asset path input

* fix(plugins): catch errors in loadPluginCss

* feat(plugins-cdn): selectively transform sourceMapURL

* re-add deleted test case

* chore(plugins): bump to latest systemjs@6.14.2

* feat(plugins): add systemjs-cjs-extra for loading commonjs plugins

---------

Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2023-08-31 15:45:44 +02:00
Torkel Ödegaard
74d453f056
DashboardSchema: Remove old unused legacy props style and timepicker.enable (#73879)
* DashboardScheam: Remove old unused legacy props style and timepicker.enable

* Update

* fix test
2023-08-28 12:18:17 +02:00
Laura Fernández
b632eb33b9
Grafana UI: Text component show all text on hover when it is truncated (#68578) 2023-07-31 18:04:48 +02:00
Ashley Harrison
9852b24d61
Chore: Upgrade prettier to v3 (#71764)
* Update dependency prettier to v3 (#71586)

* Update dependency prettier to v3

* run prettier

* ignore prettier update in legacy select scss

* update command line arg

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>

* unplug prettier

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-17 15:58:22 +01:00
Ashley Harrison
5ca382c88a
Revert "Update dependency prettier to v3 (#71586)" (#71755)
This reverts commit 2e8cd1c021.
2023-07-17 14:46:15 +01:00
renovate[bot]
2e8cd1c021
Update dependency prettier to v3 (#71586)
* Update dependency prettier to v3

* run prettier

* ignore prettier update in legacy select scss

* update command line arg

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2023-07-17 09:19:27 +01:00
Sonia Aguilar
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
Torkel Ödegaard
e7797ac439
SceneDashboard: Adds menu to panels, a start for inspect drawer state (#71194)
* Began work on panel menu

* SceneDashboard: Basic state handling for inspect panel

* Switched to using scene url sync instead

* Updated

* Update comment on hack

* Fixed url synnc issues and more / better DashboardsLoader tests

* Progress on test

* Updates

* Progress

* Progress

* Update

* Update

* Update

* Update

* Update scenes lib

* Update

* Update

---------

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2023-07-12 13:37:26 +02:00
Ashley Harrison
ff429c9af5
Navigation: Fix toolbar actions flickering on mobile (#70524)
* fix flickering overflow

* set everything to hidden by default

* extend intersectionobserver mock
2023-06-23 08:50:51 +01:00
Giordano Ricci
d3450d75a4
Explore: URL migrations & improved state management (#69692)
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
2023-06-21 10:06:28 +01:00
Esteban Beltran
1ed4c0382b
Plugins: Add Initial implementation for frontend plugins sandboxing (#68889) 2023-06-05 10:51:36 +02:00
Virginia Cepeda
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
Ashley Harrison
07c725800b
Chore: some minor type fixes (#68402)
* some minor type fixes

* undo card change
2023-05-15 09:15:26 +01:00
Sonia Aguilar
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
Kuba Siemiatkowski
f8faacd54a
Datasource: Overhaul plugin error handling and action buttons (#67014)
* - initial work on data source config page

* - add links to test status box
- add tracking function

* - add test for the DataSourceConfigAlert component

* - fix flicker of the alert box

* - fix the build

* - small improvements

* - fix failing build

* - fix failing unit tests

* - prettier and betterer fixes

* - fix failing e2e tests

* - fix build again

* - rewrite solution according to the PR comments

* - cleanup

* - fix failing e2e

* - use absolute path in link

* Minor fixes

---------

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2023-04-28 15:57:17 +02:00