176 Commits

Author SHA1 Message Date
a0873736aa Frontend: Filter assets-manifest to only include entrypoints (#94679)
build(webpack): filter assets-manifest to only entrypoints
2025-07-17 10:30:52 +02:00
8f17f607fa FEMT: Add no-restricted-img-srcs rule (#105006) 2025-05-12 10:34:17 +01:00
759aa12d2b Revert "Build swagger ui in seperate webpack build" (#104580)
Revert "Build swagger ui in seperate webpack build (#102046)"

This reverts commit 314e337d76df9adcecfd30f4a302fa9d73e56da9.
2025-04-25 22:07:43 +01:00
314e337d76 Build swagger ui in seperate webpack build (#102046)
* Build swagger ui in seperate webpack build

* render grafana and swagger

* include light theme

* merge main

* update webassets usage

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2025-04-25 14:22:57 +01:00
b7c0e8bd33 Scenes: add support for sourcemaps when linking (#104328)
Scenes: add support for sourcemaps when linking
2025-04-23 09:17:47 -04:00
f96e4e9ad2 Frontend: Remove Angular (#99760)
* chore(angularsupport): delete feature toggle to disable angular

* feat(angular-support): remove config.angularSupportEnabled

* chore(jest): remove angular from setup file

* chore(angular): delete angular deprecation ui components

* refactor(angular): move migration featureflags into migration notice

* chore(dashboard): remove angular deprecation notices

* chore(annotations): remove angular editor loader

* feat(appwrapper): no more angular app loading

* feat(pluginscatalog): clean up angular plugin warnings and logic

* chore(angular): delete angular app and associated files

* feat(plugins): delete old angular graph plugin

* feat(plugins): delete old angular table panel

* feat(frontend): remove unused appEvent type

* feat(dashboards): clean up angular from panel options and menu

* feat(plugins): remove graph and table-old from built in plugins and delete sdk

* feat(frontend): remove angular related imports in routes and explore graph

* feat(theme): remove angular panel styles from global styles

* chore(i18n): run make i18n-extract

* test(api_plugins_test): refresh snapshot due to deleting old graph and table plugins

* chore(angulardeprecation): delete angular migration notice components and usage

* test(frontend): clean up tests that assert rendering angular deprecation notices

* chore(backend): remove autoMigrateOldPanels feature flag

* chore(config): remove angularSupportEnabled from config preventing loading angular plugins

* chore(graphpanel): remove autoMigrateGraphPanel from feature toggles

* chore(tablepanel): delete autoMigrateTablePanel feature flag

* chore(piechart): delete autoMigratePiechartPanel feature flag

* chore(worldmappanel): remove autoMigrateWorldmapPanel feature toggle

* chore(statpanel): remove autoMigrateStatPanel feature flag

* feat(dashboards): remove automigrate feature flags and always auto migrate angular panels

* test(pluginsintegration): fix failing loader test

* test(frontend): wip: fix failures and skip erroring migration tests

* chore(codeowners): remove deleted angular related files and directories

* test(graphite): remove angular mock from test file

* test(dashboards): skip failing exporter test, remove angularSupportEnabled flags

* test(dashbaord): skip another failing panel menu test

* Tests: fixes pkg/services/pluginsintegration/loader/loader_test.go (#100505)

* Tests: fixes pkg/services/pluginsintegration/plugins_integration_test.go

* Trigger Build

* chore(dashboards): remove angularComponent from getPanelMenu, update test

* feat(dashboards): remove all usage of AngularComponent and getAngularLoader

* chore(betterer): refresh results file

* feat(plugins): remove PluginAngularBadge component and usage

* feat(datasource_srv): remove usage of getLegacyAngularInjector

* feat(queryeditor): delete AngularQueryComponentScope type

* Chore: removes Angular from plugin_loader

* Chore: remove angular from getPlugin

* Chore: fix i18n

* Trigger Build

* Chore: remove more Angular from importPanelPlugin

* Chore: remove search options warning

* Chore: remove and deprecate Angular related

* chore(angular): remove angular dependencies from core and runtime

* chore(runtime): delete angular injector

* chore(data): delete angular scope from event bus

* chore(plugin-catalog): remove code pushing app plugins angular config page

* chore(yarn): refresh lock file

* chore(frontend): remove ng-loader from webpack configs, remove systemjs cjs plugin

* chore(navigation): remove tether-drop cleanup from GrafanaRouter, delete dependency

* chore(runtime): delete AngularLoader

* chore(betterer): refresh results file

* chore(betterer): fix out of sync results file

* feat(query): fix type and import errors in QueryEditorRow

* test(dashboards): delete skipped angular related tests

* Tests: add back tests and fix betterer

* Tests: fix broken test

* Trigger build

* chore(i18n): remove angular deprecation related strings

* test: clean up connections and plugins catalog tests

* chore(betterer): update results file

---------

Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>
2025-04-04 11:31:35 +02:00
ddd3b82581 remove webpack aliasing for runtime + data (#102449) 2025-03-24 10:07:03 +00:00
bbfeb8d220 Feature: Introduce subresource integrity checks (SRI) for frontend assets (#100983)
* feat(featuremgmt): introduce feature toggle for enabling sri checks

* feat(frontend): use assetSriChecks feature toggle to inject integrity hash into script tags

* chore(webpack): align sri algorithms across dev and prod builds

* docs(featuremgmt): update assetSriChecks to pass CI

* docs(featuremgmt): fix more spelling complaints with assetSriChecks

* Add crossorigin attribute

* chore(webpack): add subresource-integrity plugin

* build(webpack): wrap webpack jsonp loader integrity checks in feature flag checks

* revert(index.html): remove crossorigin attribute if assertSriChecks is disabled

---------

Co-authored-by: Kristian Bremberg <kristian.bremberg@grafana.com>
2025-03-04 11:56:35 +01:00
e3e580edfa Chore: Prevent direct path imports from workspace grafana packages (#98940)
* restrict imports from @grafana/ui/src paths

* prevent path imports from all grafana packages

* just run on ui, runtime, data packages

* update
2025-01-15 15:47:44 +02:00
e0121055fb Update dependency typescript to v5.7.2 (#93749)
* Update dependency typescript to v5.7.2

* typescript fixes

* don't need this change

* remaining typescript fixes

* remove emotion/react aliasing

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2025-01-09 15:20:45 +00:00
b34fd6b6a1 Chore: update react-inlinesvg and use new icon caching mechanism (#97725)
* Update dependency react-inlinesvg to v4

* attempt to use new icon caching

* remove unicons chunk

* fix layout shift

* update snapshot

* parameterise cache by commit hash and clear old caches

* remove icon caching in storybook

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-12 13:35:28 +00:00
9688d5b56b Frontend: Add build:stats for analysing bundles (#94729)
* build(webpack): add a stats config and build:stats script for analysing bundles locally

* chore(yarn): dedupe lock file

* feat(webpack): use bundle analyser by default, env vars for additional plugins
2024-12-09 12:09:32 +01:00
cfbeea4ce7 Chore: Setup live reloading (#97248)
* setup live reloading

* put live-reloading behind cli flag, remove webpack.hot.js

* use env.liveReload

* fix lint

---------

Co-authored-by: joshhunt <josh@trtr.co>
2024-12-02 12:58:50 +00:00
20837d3837 Chore: silence sass warnings since we're going to remove sass anyway (#96530)
silence sass warnings since we're going to remove sass anyway
2024-11-15 12:18:58 +02:00
787f3b8d6c Webpack: Set eslint plugin config to flat to prevent cli errors (#96199)
fix(webpack): set eslint plugin config to flat to prevent cli errors
2024-11-11 10:23:24 +02:00
bcdcb1f74b Explore Metrics: Introduce augurs sorting options in breakdown view (#91189)
* refactor breakdown scene

* refactor BreakdownScene along with LayoutSwitcher

* rename

* don't pass default layout

* better type handling

* betterer

* add @bsull/augurs

* implement LabelBreakdownScene

* integrate SortByScene in LabelBreakdownScene

* move to new directory

* introduce BreakdownSearchScene

* integrate searchScene

* cleaning

* initialize @bsull/augurs

* add interaction

* use new breakdown scene

* resolve merge conflicts

* ugrade @bsull/augurs

* update import

* update css

* update tooltip text

* refine sorting

* fix unit test

* fix

* implement outlier detector

* support wasm

* jest testing fix

* localization fix

* use unknown instead of any

* update i18n

* update betterer

* fix locales

* update test

* fix tests maybe

* prettier

* chore: update jest config

* chore: create mock for @bsull/augurs (#92156)

chore: create mock for bsull/augurs

@bsull/augurs assumes it will be running as an ESM, not
a CommonJS module, so can't be loaded by Jest (specifically
because it contains a reference to import.meta.url).

This PR provides a mock implementation which gets tests passing
again.

Ideally we'd be able to load the actual @bsull/augurs module
in tests so this is just a stopgap really, until a better
solution appears.

* fix unit tests

* remove unused BreakdownScene.tsx

* set outliers as undefined if an error occurs

* Add labels

* betterer

* reset event implemented

* fix controls positioning

* update augurs

* betterer

* i18n

* conflict fixes

* update texts

---------

Co-authored-by: Matias Chomicki <matyax@gmail.com>
Co-authored-by: Ben Sully <ben.sully@grafana.com>
2024-11-05 08:34:09 +01:00
e894b19c1a Build: Fix failing CSS asset paths (#95380)
* build(webpack): set publicpath and process urls to resolve assets correctly

* build(webpack): add back --progress to build

* Add local cdn

(cherry picked from commit 7a19523fa476fd5ff2d7669d116f5be462b100f5)

* chore(devenv): fix local_cdn path in ngnix conf

* chore(codeowners): add frontend-ops as owners of local_cdn docker block

---------

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
2024-10-25 13:45:44 +02:00
3a7096d0a6 Chore: Increase fork ts webpack memory to 5GB (#94810) 2024-10-21 09:42:35 +02:00
cfb46c8003 Frontend: Extract CSS imports into files (#94655)
* build(webpack): extract css imports into files including node_modules

* feat(webassets): add cssfiles to entrypoint assets for extracted css files

* feat(views): add entrypoint css link tags to html templates

* feat(webassets): set CDN prefix for CSS files

* test(webassets): trim down sample-assets-manifest, fix failing snapshot tests

* Update pkg/api/webassets/webassets_test.go

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* build(webpack): remove css module loader

---------

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2024-10-16 11:10:34 +02:00
37e4353a18 Chore: Fix running frontend unit tests in JetBrains (#93441)
read the files with their absolute paths
2024-09-18 17:51:58 +02:00
427dad26a2 Swagger: Add a custom swagger/api page (#91785)
Co-authored-by: Kristian Bremberg <kristian.bremberg@grafana.com>
2024-08-14 09:03:00 +03:00
8136fbef1f Chore: Add capability for overriding local development behaviour using env vars (#85603) 2024-08-13 13:07:42 +01:00
dbb64b3ff0 Icons: Cache Bookmark icons (#91332) 2024-08-01 17:27:44 +01:00
8f99d58aaf WebpackDev: Resolve react-router-dom from local node modules (#89547)
resolve react-router-dom from local node modules
2024-07-04 13:28:54 +03: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
5f326e98c1 NodeGraph: Add msagl and the layered layout code (#88375) 2024-05-28 17:04:03 +02:00
20294b0fb6 NodeGraph: Remove msagl lib and layered layout option (#87905)
* Remove msagl lib

* Change drone.yml

* update signature
2024-05-20 13:50:08 +02:00
6599fa805d Plugins: Always load decoupled frontend assets from builds (#81873)
* Wip

* Wip

* Adapt to load external module

* build: remove cloudmonitoring from built_in_plugins, clean up webpack output

* chore(plugins): remove decoupled plugins from package.json deps

* chore(codeowners): update file for nx.json

* revert(webpack): put back path in config

* build(frontend): use nx to run prod builds of decoupled plugins with yarn build

* style(prometheus): run prettier-write to fix tsconfig.json

* style(backend): remove unused subFile.isDistDir

* revert(locales): remove formatting changes adding new line at end of files

* chore(webpack): clean up dev output

* build(nx): make grafana an nx project, bump lerna and nx

* build(plugin-configs): move cache directory to node_modules

* style(datasource-plugins): add eslint ignore for .gen.ts files

* chore(codeowners): add frontend-ops as owner of project.json

* build(webpack): add getDecoupledPlugins to automatically ignore when watching

* ci(drone): skip nx cache when building frontend packages

* style(ci): fix missing trailing comma

* Revert "style(ci): fix missing trailing comma"

This reverts commit 7520d41576e08c1f44c9bf04117250f7e52bdec5.

* Revert "ci(drone): skip nx cache when building frontend packages"

This reverts commit 46938883acaefb74d189e8c622eb2a13fd45cdfb.

* feat(zipkin): remove from grafana core bundle

* chore(npm): bump nx package to latest 18.0.8

* docs(dev-guide): add a note about what yarn start now builds

---------

Co-authored-by: Andres Martinez <andres.martinez@grafana.com>
2024-03-13 12:40:09 +01:00
ad80518db0 Update dependency webpack-dev-server to v5 (#83258)
* Update dependency webpack-dev-server to v5

* update webpack.hot config (is this even used anymore?)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2024-02-23 11:43:16 +02:00
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
57993f65ed Chore: webpack alias react and grafana-runtime to share singletons (#81789)
* Chore: webpack alias react and grafana-runtime to share singletons

* Move alias to dev webpack, add alias for grafana-data as well

* remove whitespace
2024-02-05 16:25:19 +00:00
cb945aa5df NodeGraph: Use layered layout instead of force based layout (#78957) 2024-01-31 17:26:12 +01:00
6d582858f7 Webpack: Allow watching workspaces (#81569)
* build(webpack): remove symlinks:false to enable watching packages with yarn start

* build(webpack): add resolve node_modules for enterprise to resolve packages

* add comment

---------

Co-authored-by: joshhunt <josh@trtr.co>
2024-01-30 16:59:18 +01:00
8f0ae76afe Chore: Use yarn node-modules linker (#79947)
* Chore: Use yarn node-modules linker

* fix react-router types resolution

* temp skip failing tests

* remove yarn-links for internal path aliases to fix some webpack errors

* transpile all .ts files, even those in node_modules (usually our internal workspace packages

* fix transformers mock

* import react router type directly

* remove old resolution

* more cleanup

* remove preserveSymlinks: true from tsconfig to make Go To Definition resolve grafana ui to the original location

* developer guide

* update dev guide

* remove sdks

* reenable tests

* fix tsconfig trailing commas (where did they come from)
2024-01-29 14:27:35 +00:00
ed128ea964 Frontend: Foundations for multi tenant frontend (#78815)
* Frontend: Foundations for multi tenant frontend

* improve manifest parsing for multi-tenant frontend (#78876)

* add test

* add test

* ??

* Updates

* Added cache

* test cleanup

* lint

* fix test

* fix error templates

* cleanup

* remove copy

* revert changes to list testdata

* comment cleanup

* prepare integration tests

* Remove integrety

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-12-05 08:34:22 +01:00
4ad7aed096 Chore: Remove eval source maps to fix trusted types during dev (#72664)
* user essentials mob! 🔱

lastFile:scripts/webpack/webpack.dev.js

* user essentials mob! 🔱

* delete results.md

Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com>
Co-authored-by: tskarhed <1438972+tskarhed@users.noreply.github.com>
Co-authored-by: Roxana Turc <anamaria-roxana.turc@grafana.com>

---------

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com>
Co-authored-by: tskarhed <1438972+tskarhed@users.noreply.github.com>
Co-authored-by: Roxana Turc <anamaria-roxana.turc@grafana.com>
2023-08-02 07:35:36 +00:00
00f0ff038e Chore: Introduce yarn start:noLint (#64430)
chore(webpack): introduce start:noLint to bypass typecheck and lint plugins during dev
2023-08-01 11:58:39 +02:00
61459e2b96 Bump scenes to 0.17.2 (#70893)
* Bump scenes to 0.17.2

* Update jest config

* Update tsconfig

* Update webpack config

* Update to latest API
2023-07-05 07:24:48 -07:00
ed5a697825 Plugins: Sandbox frontend plugins DOM access. (#69246) 2023-06-21 14:49:22 +02:00
a6484c6f81 Azure: Fix Kusto auto-completion for Azure datasources (#69685)
* Fix Kusto auto-completion not working in HG

* Add update to script paths

* Update CODEOWNERS

* Missed the ts
2023-06-07 11:49:43 +01:00
b65ce6738f Chore: Change dev sourcemaps to work around firefox warning (#67929)
Change dev sourcemaps to work around firefox warning
2023-06-05 09:51:48 +00:00
1fbff3c807 Update dependency esbuild to v0.17.19 (#61522)
* Update dependency esbuild to v0.17.18

* chore(npm): update all esbuild dependencies to use esbuild@0.17.18

* build(esbuild): update configs so esbuild-loader matches loader from file extension

* build(webpack): fix failed monaco editor loading due to require not existing

* chore(esbuild): bump to 0.17.19

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2023-06-01 10:23:09 +02:00
362936b002 Build: Force same version of @emotion/react via webpack config (#66822) 2023-04-24 17:13:52 +02:00
0c0d63b830 Build: enable caching in eslint plugin (#64325)
enable caching in eslint plugin
2023-03-07 14:53:50 +00:00
3a7623753b Build: Replace babel-loader with esbuild-loader (#57837)
* build(webpack): replace babel-loader with esbuild-loader

* build(webpack): add esbuild minifier to production builds

* Wip

* Removed ngInject and replaced with manual inject params

* chore: bump esbuild to 0.15.13

* Fixed angular issues

* build(frontend): update esbuild to 0.16.16

* chore(webpack): support browserslist for esbuild

* build(esbuild): unify versions of esbuild to 0.16.17 and esbuild-loader to 2.21.0

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2023-01-23 12:15:05 +01:00
5ea01dc9b9 Build: Introduce webpack manifest plugin (#49798)
* build(webpack): introduce manifest plugin

* build(webpack): move manifest.json to root of project and git ignore
2022-08-30 05:18:55 -04:00
112f69177b Build: Replace the file-loader loader with asset module in webpack config (#53088) 2022-08-04 10:29:42 +02:00
78bef7a26a Build: Enable long term caching for frontend assets (#47625)
* build(webpack): move CopyUniconsPlugin into own file

* chore(webpack): delete unused blobUrl and compile loaders

* build(webpack): prefer contenthash over fullhash for longer caching

* build(webpack): set optimization.moduleIds named only in dev

* build(webpack): introduce HTMLWebpackCSSChunks so templates can access theme css by name

* feat: inject css files with contenthash in html templates

* revert(error-template): remove ContentDeliveryURL from CSS href

* refactor(index-template): update grafanaBootData.themePaths

* chore(webpack): add typescript annotations for CopyUniconsPlugin
2022-05-26 11:49:18 +02:00
3c6e0e8ef8 Chore: ESlint import order (#44959)
* Add and configure eslint-plugin-import

* Fix the lint:ts npm command

* Autofix + prettier all the files

* Manually fix remaining files

* Move jquery code in jest-setup to external file to safely reorder imports

* Resolve issue caused by circular dependencies within Prometheus

* Update .betterer.results

* Fix missing // @ts-ignore

* ignore iconBundle.ts

* Fix missing // @ts-ignore
2022-04-22 14:33:13 +01:00
5f67d78219 Use bookmark icon for Saved Items, add support for solid bookmark icon (#46775)
* Use bookmark icon for Saved Items, add support for solid bookmark icon

* Add some unit tests

* Refactor utils into own file

* Update test title

* Fix import

* consistent function style
2022-03-21 13:01:43 +00:00