Commit graph

190 commits

Author SHA1 Message Date
Jack Westbrook
0a10a5d133
Build: Refactor Webpack config to TS (#121181)
* build(webpack): add tsconfig.json for Node strip-types compliance

* build(webpack): extract shared esbuild options to esbuild.ts

* build(webpack): add package.json to declare ESM module type

* build(webpack): convert sass.rule to TypeScript

* build(webpack): convert CorsWorkerPlugin to TypeScript

* build(webpack): convert FeatureFlaggedSriPlugin to TypeScript

* build(webpack): convert webpack.common to TypeScript, add theme entries

* build(webpack): convert webpack.dev to TypeScript, remove esbuild duplication

* build(webpack): convert webpack.prod to TypeScript, remove esbuild duplication

* build(webpack): fix TypeScript types in webpack.prod transform callback

* build(webpack): convert webpack.stats to TypeScript

* build(webpack): update scripts to use TypeScript webpack configs

* build(webpack): simplify env-util to use import.meta.dirname directly

* build(webpack): tidy up plugins

* build(webpack): move rules for ts and sass into single module

* build(webpack): consolidate shared config into common, move splitChunks to prod

- Move MiniCssExtractPlugin, esbuildRule and sassRule into common so both
  dev and prod configs share them without duplication
- Move splitChunks/runtimeChunk optimisation to webpack.prod only (not
  needed in dev)
- Use require() for SubresourceIntegrityPlugin to work around broken ESM
  build (waysact/webpack-subresource-integrity#236)
- Refactor conditional plugin logic in dev from ternary to if-blocks

* build(webpack): remove dead import and clarify webpack destructure pattern

- Remove unused MiniCssExtractPlugin import from webpack.prod (moved to common)
- Add comment explaining why DefinePlugin/EnvironmentPlugin are destructured
  from the default webpack import rather than using named ESM imports

* style(webpack): reorder consts

* chore(env-util): fix up env-util and webpack configs so tests continue to run

* refactor(env-util): accept grafanaRoot param instead of relying on __dirname

Removes the global.__dirname mutation hack in webpack.common.ts by making
the grafana root path an explicit argument to getEnvConfig. Each caller
resolves its own root and passes it in, removing the implicit path-depth
contract and the CJS/ESM compatibility workaround.

* build(webpack): remove unused angular chunk group
2026-04-28 12:45:31 +02:00
Jack Westbrook
7d6e08a6d5
Frontend: Rewrite SRI checks feature flag to support frontend-service (#123491)
* refactor(frontend): rename assetSriChecks and generate go

* feat(frontend-service): pass sri checks feature flag to frontend html template

* feat(backend): pass asset sri check feature flag to st frontend template

* build(webpack): use global __grafanaAssetSriChecksEnabled var to control sri checks in async loading

* chore(frontend-service): add assetSriChecks to goff-flags.yaml

* docs(webpack): add more info on what and why to featureflaggedsriplugin
2026-04-27 14:43:09 +02:00
Josh Hunt
069d45b84e
Build: Upgrade TypeScript to 6.0 (#118528)
* Build: Upgrade TypeScript to 6.0 beta

Update typescript from 5.9.2 to 6.0.0-beta across all packages. Configure tsconfig to handle TS 6.0 breaking changes: add `ignoreDeprecations: "6.0"` to suppress warnings for deprecated options, disable `noUncheckedSideEffectImports` to allow CSS side-effect imports, explicitly configure `types` field since TS 6.0 no longer auto-includes all @types packages, set appropriate `rootDir` in packages that include files outside their directory, and update `@ts-ignore` comment placement in Table utils to match where TS 6.0 now reports the type error.

All typecheck tests pass with 0 errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add explicit rootDir to root tsconfig for ts-jest compatibility

TS 6.0 requires rootDir to be explicitly set when it differs from the
inferred common source directory. Without this, ts-jest fails with
TS5011 when running unit tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix package builds: add rootDir and jquery types for TS 6.0

TS 6.0 requires explicit rootDir in tsconfigs that emit output. Add
rootDir to all package build configs that were missing it. Also add
jquery to the base types array since @types/jquery is no longer
auto-included.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix TS 6.0 errors in e2e and plugin tsconfigs

- e2e/tsconfig.json: Add moduleResolution: "bundler" to fix TS5098
  (customConditions requires bundler/node16/nodenext moduleResolution)
- packages/grafana-plugin-configs/tsconfig.json: Add ignoreDeprecations: "6.0"
  to fix TS5101 (downlevelIteration deprecated) inherited from @grafana/tsconfig,
  cascading to all 15 datasource plugins and 3 e2e-playwright test plugins

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix package build output: use rootDir: "./src" instead of "."

rootDir: "." caused type declarations to emit to dist/types/src/
instead of dist/types/, breaking the published package types paths.
Using rootDir: "./src" preserves the correct output structure while
satisfying TS 6.0's requirement for an explicit rootDir.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Align TS 6.0 changes with tsgo PR (#114643)

- Remove baseUrl in favor of path mapping ("*": ["./public/*"])
- Add rootDir: "./src" to grafana-sql and grafana-test-utils tsconfigs
- Add explicit Size type annotations to AutoSizer callbacks
- Add explicit type params to MultiSelect<string> in LokiContextUi
- Update @ts-ignore comments for TS5/TS6/TS7 compatibility
- Switch JS files to @ts-nocheck (eslint.config.js, env-util.js)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Build: Upgrade TypeScript from 6.0.0-beta to 6.0.1-rc

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Build: Upgrade TypeScript from 6.0.1-rc to 6.0.2 stable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix o11y-ds-frontend package build: add rootDir to build config

Same fix as other packages — the build config was inheriting
rootDir: "../../" from tsconfig.json, causing type declarations
to emit to the wrong path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 16:37:34 +01:00
Jack Westbrook
6f7f66f1f6
Frontend Service: Copy inlined JS to typescript (#121629)
* build(frontend-service): update webpack and ts configs for boot script

* feat(frontend): add types to window for boot/index.ts

* feat(frontend-service): copy JS from index.html to boot/index.ts, add types and refactor guards

* chore(codeowners): add public/boot

* chore(frontend-service): copy boot.js into dockerfile for dev

* docs(boot): add a readme to briefly explain the purpose
2026-04-15 07:59:48 +02:00
Jack Westbrook
211f3f2a91
Build: Prevent React 19 builds writing over React 18 chunks (#121338)
build(webpack): further isolate react-19 builds with chunkFilename
2026-03-30 07:12:02 +02:00
Leon Sorokin
69f991fbdb
Chore: Add asset filtering capability for bundle stats, yarn build:smolstats (#120735) 2026-03-24 21:12:24 +00:00
Josh Hunt
23c6c1e50b
CI: Speed up Playwright e2e tests workflow (#119277)
* CI: Replace Dagger builds with native make for Playwright e2e tests

Switch from Dagger-based builds to native Go/JS builds for the
Playwright e2e test pipeline. Grafana now runs as a native binary
on the CI runner instead of in a Docker container.

Key changes:
- build-backend: actions/setup-go + make build-go (instead of Dagger)
- build-frontend: actions/setup-node + make build-js + yarn e2e:plugin:build
- run-playwright-tests: downloads artifacts, uses start-server script
  to run Grafana natively (instead of Docker container from GHCR)
- build-grafana: standalone full Dagger build, off the Playwright
  critical path (still produces Docker/tarball for push-docker-image
  and run-a11y-test)
- required-playwright-tests: no longer depends on build-grafana
- Remove debug env vars (ACTIONS_STEP_DEBUG, RUNNER_DEBUG)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Fix zizmor template-injection: use docker/login-action for GHCR login in Playwright job

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Replace GHA service container with docker run for Grafana

GHA service containers start before any step (including checkout), so
volume-mounted config files don't exist yet and Grafana crashes. The
health check never passes, blocking all steps from running.

Switch to docker run -d in a step after checkout, so all files are
available when the container starts. This eliminates the need for the
docker restart workaround and the zizmor unpinned-images suppression.

Verified locally: built all three Dagger steps (backend, frontend,
assembly with --import-dir + chmod +x), loaded the Docker image, and
confirmed Grafana starts successfully with volume-mounted config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Fix Docker image binary permissions lost by actions/upload-artifact

actions/upload-artifact strips execute permissions (all files become 644).
The backend binaries need +x restored before Dagger packages them into the
Docker image, otherwise the container fails with "Permission denied" when
trying to exec the grafana binary.

Verified locally: pulled the CI-built image from GHCR, confirmed binaries
had 664 permissions, added chmod +x, and tested the full service container
restart flow successfully.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Fix CI failures: pin docker/login-action, fix docker tarball glob, suppress zizmor unpinned-images

- Pin docker/login-action@v3 to hash @5e57cd118135c172c3672efd75eb46360885c0ef
- Use glob *.docker.tar.gz in push-docker-image (Dagger produces versioned filenames)
- Add unpinned-images ignore for pr-e2e-tests.yml (dynamic build output image)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

CI: Fix missing bundled-plugins directory in build-grafana

actions/upload-artifact skips empty directories, so the bundled-plugins
dir (empty in OSS builds) doesn't exist after download. Create it before
running Dagger to prevent the --import-dir from failing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

CI: Speed up Playwright e2e tests workflow

Split the monolithic Grafana build into three Dagger jobs (backend, frontend, assembly) with granular caching. Use the --import-dir flag to pre-populate the artifact store, skipping compilation in the assembly step. Run Playwright shards in parallel with 4 workers instead of 1, reduced from 8 to 6 shards, and use GHA service containers with bind-mounted config instead of building custom e2e Docker images. Add workflow concurrency, job timeouts, and dependency caching. This reduces critical path from ~32 minutes to ~17 minutes on cold builds and ~9 minutes with warm caches.

Expected impact:
- Parallel backend/frontend builds save 6-8 minutes (vs sequential)
- GHA output cache hits reduce builds to 0 seconds on cache hit
- Docker service container approach eliminates per-shard overhead (5-7 min saved)
- 4 workers per shard and reduced retry count improve test throughput
- Workflow concurrency prevents wasted runs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

try merging frontend artifact

run the tests

shard tree artifact, delete artifacts, fix ts files being excluded

copy bin

fix path

fix path

fix script

another try

fix incorrect permissions

* try stitching together standalone grafana build

* include more dirs in frontend build

fix paths

* try caching node-modules better

try caching node-modules

disable YARN_ENABLE_HARDENED_MODE

temporarily stop caching node_modules to test performance

temp don't cache node_modules to measure perf

fix frontend cache

* add script for downloading the report and viewing it locally

* Update codeowners

* Add workflow to build grafana docker image

* add placeholder check

* Use hosted runners for everything

* Bump actions versions

* Don't cache playwright browser installs

* build e2e test plugins in each shard

* Split bench report into seperate step

and update bench to v1

* try packaging less of the public dir

* Package up whole public directory

its needed for some reason

* Run the grafana server migrations in the background while playwright installs

* Fix flaky time picker preferences tests

* Fix detect-changes always running e2e tests

* Skip building frontend source maps

* Don't check out repo in report steps

* Add per-shard failure instructions
2026-03-05 12:54:49 +00:00
Ashley Harrison
2d4f33338c
React 19: Build assets with React 19 (#118457)
* build with react 19

* don't copy assets-manifest-react19 into FS

* handle react19 in dev config
2026-02-20 14:41:43 +00:00
Marcus Andersson
c3cce293e8
Schema: Re-introduce exports for the schema package (#116683)
* wip

* added fallback exports.#

* renamed files to new pattern to follow exports.

* added fallback exports.

* added more exports.

* wip

* wip

* wip.

* Updating rollup to output proper paths.

* wip

* wip

* reverted new export APIs, will be done in follow up PRs.

* fixed rollup config.

* replaced imports with new proper exports.

* fixed tests.

* renamed missing file.

* fixed error.

* Needed to make the file names shorter due to publint limitations.

* Fixed issue with generated index fiels.

* fixed preferences export as well.

* reverted import.

* fixed conflicts.

* fixed issue with type imports.

* fixed so we are backwards compatible with the node moduleresolution.
2026-02-11 22:27:26 +01:00
Jack Westbrook
5bedcc7bd7
Frontend: use custom conditions for development and build (#111685)
Some checks are pending
Integration Tests / Postgres (5/16) (push) Blocked by required conditions
Integration Tests / Postgres (6/16) (push) Blocked by required conditions
Integration Tests / Postgres (7/16) (push) Blocked by required conditions
Integration Tests / Postgres (8/16) (push) Blocked by required conditions
Integration Tests / Postgres (9/16) (push) Blocked by required conditions
Integration Tests / All backend integration tests complete (push) Blocked by required conditions
Reject GitHub secrets / reject-gh-secrets (push) Waiting to run
Build Release Packages / setup (push) Waiting to run
Build Release Packages / Dispatch grafana-enterprise build (push) Blocked by required conditions
Build Release Packages / / darwin-amd64 (push) Blocked by required conditions
Build Release Packages / / darwin-arm64 (push) Blocked by required conditions
Build Release Packages / / linux-amd64 (push) Blocked by required conditions
Build Release Packages / / linux-armv6 (push) Blocked by required conditions
Build Release Packages / / linux-armv7 (push) Blocked by required conditions
Build Release Packages / / linux-arm64 (push) Blocked by required conditions
Build Release Packages / / linux-s390x (push) Blocked by required conditions
Build Release Packages / / windows-amd64 (push) Blocked by required conditions
Build Release Packages / / windows-arm64 (push) Blocked by required conditions
Build Release Packages / Upload artifacts (push) Blocked by required conditions
Build Release Packages / publish-dockerhub (push) Blocked by required conditions
Build Release Packages / Dispatch publish NPM canaries (push) Blocked by required conditions
Build Release Packages / notify-pr (push) Blocked by required conditions
Run dashboard schema v2 e2e / dashboard-schema-v2-e2e (push) Waiting to run
Shellcheck / Shellcheck scripts (push) Waiting to run
Run Storybook a11y tests / Detect whether code changed (push) Waiting to run
Run Storybook a11y tests / Run Storybook a11y tests (light theme) (push) Blocked by required conditions
Run Storybook a11y tests / Run Storybook a11y tests (dark theme) (push) Blocked by required conditions
Swagger generated code / Detect whether code changed (push) Waiting to run
Swagger generated code / Verify committed API specs match (push) Blocked by required conditions
Dispatch sync to mirror / dispatch-job (push) Waiting to run
* build(frontend): enable custom condition for resolving source files during dev and build

* feat(packages): apply conditional name to export properties

* chore(packages): add standard exports to flamegraph and prometheus

* chore(packages): resolve main, module, types to built files

* build(packages): clean up prepare-npm-package for custom condition changes

* refactor(packages): reduce repetition in conditional exports

* build(storybook): add @grafana-app/source to conditionNames

* test(frontend): add grafana-app/source customCondition for jest tests

* refactor(frontend): remove nested package import paths

* chore(jest): use customExportConditions for source files and browser

* chore(i18n): use src for ./eslint-plugin export

* chore(packages): set packages tsconfigs to moduleResolution bundler

* chore(packages): fix rollup builds

* build(packages): build cjs as multiple files

* chore(sql): reference MonitoringLogger for moduleresolution bundler to pass typecheck

* chore(ui): add type refs for moduleresolution bundler to pass typecheck

* feat(schema): add exports for cleaner import paths

* refactor(frontend): clean up schema paths to point to exports instead of nested file paths

* build(storybook): hack the builder-manager for custom conditions to resolve

* build(decoupled-plugins): fix broken builds due to missing conditionNames

* chore(e2e): pass condition to playwright to resolve local packages

* build(frontend): fix failing build

* chore(select): fix typings

* style(frontend): clean up eslint suppressions

* chore(packages): fix type errors due to incorrect tsconfig settings

* build(generate-apis): use swc with ts-node and moduleResolution bundler

* chore(cypress): add conditionNames to resolve monorepo packages

* build(npm): update prepare to work with latest exports changes

* build(packages): fix prepare-npm-package script

* fix(e2e-selectors): update debugoverlay for data-testid change

* build(packages): stop editing package.json at pack n publish time

* rerun ci

* chore(api-clients): use moduleResolution: bundler for customConditions support

* chore(api-clients): fix generation

* build(packages): remove aliasing exports, remove exports with only customConditions

* Revert "refactor(frontend): clean up schema paths to point to exports instead of nested file paths"

This reverts commit 7949b6ea0e60e51989d2a8149b7a24647cd68916.

* revert(schema): remove exports from package so builds work

* build(api-clients): fix up api-clients exports and rollup config

* build(api-clients): Update generated package exports for api clients

* build(schema): add overrides to cjsOutput and esmOutput so built directory structure is correct

* fix(packages): use rootDirs to prevent types/src directories in built d.ts file paths

* build(packages): prevent empty exports added to package.json during pack

* docs(packages): update readme with custom conditions information

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
2025-12-18 11:47:38 +01:00
Kristina Demeshchik
834f1c5e98
TS checker: Increase memory limit (#114236)
Increase ts checker memory limit
2025-11-20 09:13:19 -05:00
Leon Sorokin
6cdb7114a9
Chore: Disable webpack cache for noMinify builds (#112241) 2025-10-10 10:01:36 -05:00
Ashley Harrison
57db26a9bf
Frontend service: Fix geomap assets not loading (#110146)
* attempting to "fix" geomap

* copy gazetteer/maps folders into dockerfile for frontend service

* add TODO comments

* remove unused import

* conditionally use public cdn path

* fix unit tests

* try refactor e2e test for better stability

* Revert "try refactor e2e test for better stability"

This reverts commit d966d68e15.

* safer

* use grafana_public_path
2025-08-29 16:29:57 +01:00
renovate[bot]
6ee15da39c
Update dependency eslint-webpack-plugin to v5 (#109230)
* Update dependency eslint-webpack-plugin to v5

* set failOnError: false to match previous behaviour

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2025-08-06 15:18:22 +01:00
Jack Westbrook
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
Tom Ratcliffe
8f17f607fa
FEMT: Add no-restricted-img-srcs rule (#105006) 2025-05-12 10:34:17 +01:00
Josh Hunt
759aa12d2b
Revert "Build swagger ui in seperate webpack build" (#104580)
Revert "Build swagger ui in seperate webpack build (#102046)"

This reverts commit 314e337d76.
2025-04-25 22:07:43 +01:00
Josh Hunt
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
Scott Lepper
b7c0e8bd33
Scenes: add support for sourcemaps when linking (#104328)
Scenes: add support for sourcemaps when linking
2025-04-23 09:17:47 -04:00
Jack Westbrook
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
Ashley Harrison
ddd3b82581
remove webpack aliasing for runtime + data (#102449) 2025-03-24 10:07:03 +00:00
Jack Westbrook
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
Josh Hunt
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
renovate[bot]
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
Ashley Harrison
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
Jack Westbrook
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
Dominik Broj
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
Ashley Harrison
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
Jack Westbrook
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
ismail simsek
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
Jack Westbrook
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
Esteban Beltran
3a7096d0a6
Chore: Increase fork ts webpack memory to 5GB (#94810) 2024-10-21 09:42:35 +02:00
Jack Westbrook
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
ismail simsek
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
Ryan McKinley
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
Tom Ratcliffe
8136fbef1f
Chore: Add capability for overriding local development behaviour using env vars (#85603) 2024-08-13 13:07:42 +01:00
Joao Silva
dbb64b3ff0
Icons: Cache Bookmark icons (#91332) 2024-08-01 17:27:44 +01:00
Sergej-Vlasov
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
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
Andrej Ocenas
5f326e98c1
NodeGraph: Add msagl and the layered layout code (#88375) 2024-05-28 17:04:03 +02:00
Andrej Ocenas
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
Jack Westbrook
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 7520d41576.

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

This reverts commit 46938883ac.

* 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
renovate[bot]
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
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
Josh Hunt
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
Andrej Ocenas
cb945aa5df
NodeGraph: Use layered layout instead of force based layout (#78957) 2024-01-31 17:26:12 +01:00
Jack Westbrook
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
Josh Hunt
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
Torkel Ödegaard
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
Josh Hunt
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