Commit Graph

876 Commits

Author SHA1 Message Date
Johan Persson 00d09525ed refactor(techdocs): extract shared hooks from reader components
Signed-off-by: Johan Persson <johanopersson@gmail.com>
2026-03-19 15:16:15 +01:00
Johan Persson dc3cc87599 feat(techdocs): migrate alpha plugin pages to BUI header system
Signed-off-by: Johan Persson <johanopersson@gmail.com>
2026-03-19 14:50:42 +01:00
Patrik Oldsberg ed8d9ce67c further NFS icon migration and alignment
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-03-16 21:39:40 +01:00
Fredrik Adelöw e46834752a fix(techdocs): fix flaky useReaderState stale content test
Switch from real timers to fake timers so state transitions are
deterministic. The test previously relied on a ~100ms real-time window
between the 1000ms buildingTimeout and the 1100ms mock sync delay,
which was too tight for slow CI machines to observe reliably.

Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Made-with: Cursor
2026-03-09 20:58:22 +01:00
Patrik Oldsberg 30e08dfbcc Add default entity content groups for techdocs and api-docs plugins
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-25 15:37:10 +01:00
Patrik Oldsberg 018ca876d0 add plugin title and icons
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-17 11:55:34 +01:00
Ferin Patel af59acbab7 Merge branch 'backstage:master' into master 2026-02-15 13:45:51 -04:00
Gabriel Dugny c47f3d8a73 Flip boolean config
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-02-10 23:59:40 +01:00
Gabriel Dugny 46c1c648b0 Merge remote-tracking branch 'origin/master' into techdocs-nfs
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>

# Conflicts:
#	packages/techdocs-cli-embedded-app/package.json
#	plugins/techdocs/src/alpha/index.tsx
#	yarn.lock
2026-02-10 23:47:25 +01:00
Patrik Oldsberg 22dce2b644 techdocs: migrate nfs addons to utility API
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-01-26 16:53:04 +01:00
Gabriel Dugny 9e29545114 fix(techdocs): Improve sidebar position, scroll (#31483)
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-01-21 11:15:05 +01:00
bond yan 2bfbf56da7 Merge pull request #32260 from GabDug/blv/techdocs-copy-button-layout
fix(techdocs): Code block Copy To Clipboard button layout with latest mkdocs-material
2026-01-19 14:17:16 -05:00
bond yan 1861ee760c Merge pull request #32087 from leboncoin/fix-techdocs-colors-calc
fix(techdocs): correct colors calculation
2026-01-19 14:15:00 -05:00
Gabriel Dugny 27798df0a3 Migrate techdocs-cli-embedded-app to NFS
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-01-11 20:25:25 +01:00
Gabriel Dugny 94ff7abe78 fix(techdocs): Code block Copy To Clipboard button layout with latest mkdocs-material
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-01-07 14:22:19 +01:00
ferin79 0a887797ce Added title prop to OffsetPaginatedDocsTable for proper display
Signed-off-by: ferin79 <ferinpatel79@gmail.com>
2025-12-17 22:50:02 -04:00
Johan Persson cd0b8a11a3 chore: make jest a peer dependency with v29/v30 support
Move jest from dependencies to peer dependencies, allowing users to
choose between Jest 29 and Jest 30.

The CLI now detects the Jest version at runtime and uses the
appropriate environment:
- Jest 29: Uses standard jest-environment-jsdom
- Jest 30: Uses a custom environment based on @jest/environment-jsdom-abstract
  with fixes for Web API globals (fetch, streams, Error, etc.)

The cross-fetch polyfill is only injected for Jest 29, as with Jest 30+
our patched Jest environment is used. The network request blocker is made
MSW-compatible by checking if fetch was wrapped before blocking.

Jest 30 (with jsdom v27) fixes `Could not parse CSS stylesheet`
warnings/errors when testing components from @backstage/ui or other
packages using CSS `@layer` declarations.

New peer dependencies (install based on your Jest version):
- jest (required, ^29 or ^30)
- Jest 29 requires: jest-environment-jsdom
- Jest 30 requires: @jest/environment-jsdom-abstract, jsdom

Production code changes for jsdom 27 testability:
- AppIdentityProxy: extract navigateToUrl method for spying
- LiveReloadAddon: export utils.reloadPage for spying
- collect.ts: export internal.resolvePackagePath for mocking

MockFetchApi: evaluate global.fetch at call time instead of construction
time, allowing MSW to patch fetch after MockFetchApi is constructed.

Test adaptations for jsdom 27:
- Use RGB values instead of named colors in CSS assertions
- Update error format expectations (hyphenated type names, SyntaxError
  instead of FetchError for JSON parse errors)
- Simplify URL error assertions for cross-version compatibility
- Fix accessible name whitespace handling for external links
- Use history.replaceState for location mocking (non-configurable)
- Use fireEvent.blur for contentEditable elements
- Move async assertions inside waitFor for race conditions
- Remove Blob.prototype.text polyfill (now native)
- Remove test case using credentials in plugin:// URLs

Test adaptations for Jest 30:
- Replace `expect.objectContaining([...])` with direct array equality
- Replace `expect.objectContaining({ length: N })` with
  `expect.any(Array)` + separate `toHaveLength()` assertions
- Use child process for native Node.js module resolution in
  collect.test.ts to work around Jest 30's resolver behavior
- Update snapshot headers for new Jest format

Also removes the jest-haste-map patch which is no longer needed.

Signed-off-by: Johan Persson <johanopersson@gmail.com>
2025-12-11 18:06:55 +01:00
Thomas Cardonne 0afb8a63ec fix(techdocs): correct colors calculation
Signed-off-by: Thomas Cardonne <thomas.cardonne@adevinta.com>
2025-12-09 15:26:40 +01:00
Patrik Oldsberg 1c7ea4a3e8 plugins: remove unnecessary use of convertLegacyRouteRef(s)
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-11-23 14:36:02 +01:00
Patrik Oldsberg d02db50b42 plugins: cleanup unnecessary use of compatWrapper
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-11-23 12:56:54 +01:00
Ben Lambert 3bdeb378e2 Merge pull request #31277 from Andy2003/feature/provide-icon-for-search-result-icon
Add support for customizable icons in SearchResultListItemBlueprint
2025-11-04 11:21:14 +01:00
Gabriel Dugny 52e01b98bc chore: Simplify by removing a useless useMemo & merging useEffect
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2025-10-17 22:05:55 +02:00
Gabriel Dugny a4d4a7084a chore: changeset & clarifications
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2025-10-16 18:47:13 +02:00
Gabriel Dugny 1b3d2a1bbe chore: split to dedicated hook
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2025-10-16 18:21:11 +02:00
Gabriel Dugny da6b06f4ff fix(techdocs): Header reload when navigating inside Techdocs
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>

Attempt to fix regression introduced by https://github.com/backstage/backstage/pull/30984

LLM-generated, not review thoroughly yet.

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2025-10-16 18:02:23 +02:00
Andreas Berger 0a4e495019 Merge remote-tracking branch 'origin/master' into feature/provide-icon-for-search-result-icon 2025-10-09 08:50:15 +02:00
Andreas Berger a521911fbc Add support for customizable icons in SearchResultListItemBlueprint and related components
Signed-off-by: Andreas Berger <andreas@berger-ecommerce.com>
2025-09-25 12:40:31 +02:00
Sydney Achinger e02473eeb3 Update test
Signed-off-by: Sydney Achinger <sydneynicoleachinger@spotify.com>
2025-09-23 16:18:13 -04:00
Fredrik Adelöw e6ff786ae4 Merge pull request #30991 from MegaManSec/xss-fix 2025-09-15 17:19:25 +02:00
Joshua Rogers b87e54c355 tests(techdocs): add transformer tests for sanitizing javascript: hrefs
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
2025-09-11 08:44:33 +02:00
Joshua Rogers cb9e2d1155 Revert "techdocs: Disallow javascript URLs"
This reverts commit 067fdcd0a5.

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
2025-09-11 08:26:59 +02:00
Luna Stadler 8d18d23e34 Improve TechDocs page titles (especially for nested pages) (#31054)
* Replace underscores in techdocs titles

Signed-off-by: Luna Stadler <luc@spreadshirt.net>

* Make techdocs titles similar to component titles

The pattern for components is entity name, page/tab and then app title.
This ordering makes it easier to distinguish tabs at a glance.

Signed-off-by: Luna Stadler <luc@spreadshirt.net>

* Abbreviate nested pages in techdocs

A deeply nested page like `/really/very/deeply/nested/page`, will now
become "Really | ... | Nested | Page".

This should preserve some of the context and support docs whith deeply
nested pages.

Signed-off-by: Luna Stadler <luc@spreadshirt.net>

* Add changeset for TechDocs page title improvements

Signed-off-by: Luna Stadler <luc@spreadshirt.net>

* Display the full title based on all parts of the path

Signed-off-by: Luna Stadler <luc@spreadshirt.net>

---------

Signed-off-by: Luna Stadler <luc@spreadshirt.net>
2025-09-10 14:34:58 -04:00
Fredrik Adelöw 933a982c12 Merge pull request #30984 from Frueber/tech-docs/external-tech-docs-redirect/add-handling-tests-and-documentation 2025-09-10 19:24:28 +02:00
Jackson Chen d821c01c5e refactor and fix dompurify tsc errors
Signed-off-by: Jackson Chen <jacksonc@spotify.com>
2025-09-09 17:32:04 -04:00
Fredrik Adelöw 1184c55a2a Merge pull request #30723 from Believe-SA/techdocs-redirect-dompurify 2025-09-09 20:27:05 +02:00
Owen Shartle ff40e2297c Using catalogApiMock from @backstage/plugin-catalog-react/testUtils.
Signed-off-by: Owen Shartle <timeloveinvent+github@gmail.com>
2025-09-01 21:09:50 -04:00
Owen Shartle 8eb950ff64 Adding a try-catch around the usage of the catalog API in the TechDocsReaderPage as it could still attempt to load a standard TechDocs page.
Signed-off-by: Owen Shartle <timeloveinvent+github@gmail.com>
2025-08-25 21:36:57 -04:00
Owen Shartle a0b604cb6a Adding handling which checks if the current entity (the catalog entity being loaded) has an annotation for an external entity's TechDocs. If it does then we will redirect there rather than allowing a 404 (mic drop). This helps keep older URLs routing to the updated locations.
Adding changesets.
Adding test coverage for external TechDocs entitiy redirect.

Signed-off-by: Owen Shartle <timeloveinvent+github@gmail.com>
2025-08-25 15:39:29 -04:00
John Philip 53b4426952 revert sidebar css changes
Signed-off-by: John Philip <jphilip@spotify.com>
2025-08-20 11:36:00 -04:00
John Philip 65c2b6148e fix CSS rules depending on if sidebar is present
Signed-off-by: John Philip <jphilip@spotify.com>
2025-08-08 13:49:59 -04:00
Joshua Rogers 067fdcd0a5 techdocs: Disallow javascript URLs
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
2025-08-05 11:18:09 +02:00
Patrik Oldsberg 147482b700 frontend-plugin-api: switch naming recommendation from define to defineParams
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-08-04 17:17:05 +02:00
Patrik Oldsberg e4ddf22854 frontend-plugin-api,catalog-react: remove default* prefix from blueprint params
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-08-04 16:46:55 +02:00
Gabriel Dugny 4ce58318da fix(techdocs): support dompurify 3.2.6
Element.tagName is uppercased, see https://developer.mozilla.org/fr/docs/Web/API/Element/tagName

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2025-08-01 14:56:46 +02:00
Patrik Oldsberg f2f133ce8d update all usages of ApiBlueprint
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-07-28 22:27:13 +02:00
Nick Hudkins cb0541f294 feat(sanitizer): add support for allowlisting additional URI protocols
Signed-off-by: Nick Hudkins <nick@nickhudkins.com>
2025-07-21 13:23:32 -04:00
Chris Suich ad187bde2e just defaultPath
Signed-off-by: Chris Suich <csuich2@gmail.com>
2025-06-18 12:30:34 -04:00
Chris Suich 1debf7fa35 fix(techdocs): handle undefined defaultPath in techdocs initial redirect
When handling the initial redirect for techdocs deep linking an
undefined value for defaultPath was being included in the url
resulting in an error page.

https://github.com/backstage/backstage/issues/30300

Signed-off-by: Chris Suich <csuich2@gmail.com>
2025-06-18 11:57:34 -04:00
Camila Belo 8ee146cea9 refactor: apply second round of review suggestions
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2025-06-04 11:29:33 +02:00
Camila Belo 3c59ece2e0 refactor: apply review suggestions
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2025-06-04 09:16:17 +02:00