Skip to content

[Improvement]: [Redirects] Allow redirect targets to be data objects or assets - #4269

Open
dolmit-tanel-paaro wants to merge 10 commits into
pimcore:2026.xfrom
dolmit-tanel-paaro:feature/seo-redirect-target-types
Open

dolmit-tanel-paaro wants to merge 10 commits into
pimcore:2026.xfrom
dolmit-tanel-paaro:feature/seo-redirect-target-types

Conversation

@dolmit-tanel-paaro

@dolmit-tanel-paaro dolmit-tanel-paaro commented Oct 26, 2026 •

Copy link
Copy Markdown

Changes in this pull request

Resolves pimcore/platform-version#707

Tracked in pimcore/pimcore#15398

Companion to pimcore/pimcore#18293 and pimcore/studio-backend-bundle#2155, which let a redirect target be a data object or an asset instead of always a document. Part of pimcore/pimcore#15398.

This is the UI half the maintainers asked for in pimcore/pimcore#18293 - without it the feature is not reachable for end users.

  • New Target Type column in the redirects grid (Document / Asset / Data Object), editable and sortable.
  • The Target cell now accepts data objects as well as assets and documents. Dropping an element fills in both the target and its type in a single update, instead of leaving the type behind.
  • A manually entered target sends no type, so the API detects it; changing the Target Type column restricts the lookup, which is how a path existing in more than one tree is disambiguated.
  • The grid takes over the update response, so the row shows what the server actually stored (resolved path, detected type) instead of drifting until the next reload.
  • The target cell's element tag uses the row's target type for its icon.
  • targetType added to the generated API slice and to docs.jsonopenapi.json, matching the backend's generated schema byte for byte.
  • Translations for the new column and its options in all nine locales.

Additional info

Requires pimcore/studio-backend-bundle#2155 (and pimcore/pimcore#18293 under it) - the column stays empty without the API field.

Deliberately not added to the beginner modal: that flow creates plain path/URL redirects, where there is no element for a type to describe, so the field cleared itself on almost every use.

Checked with tsc --noEmit, eslint, and manually against a 2026.x instance with Studio: drag & drop of all three element types, manual entry, type detection, external URLs, and CSV export/import.

dolmit-tanel-paaro and others added 5 commits October 25, 2026 19:44
Adds a target type column to the redirects grid and a target type field to the
beginner modal, and sends the type along when an element is dropped onto the
target cell, so the Studio API can resolve the target as a document, an asset
or a data object (pimcore/pimcore#18293).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The beginner flow creates plain path/URL redirects, where a target type has
nothing to attach to and is cleared again by the server - so the field looked
broken on almost every use. Element targets are set in the grid instead, where
dropping an element fills in the type.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Typing into the target cell reset the type to null, which discarded an explicit
choice the user had just made in the target type column. The server already
clears the type when the target does not resolve to an element.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sending the row's current type restricted the lookup to that type, so typing an
asset or object path into a cell that was set to Document never resolved. The
server now detects the type when none is sent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Delayed update responses can overwrite newer row edits, leaving stale values that subsequent saves may persist.

1 open issue
What changed in this PR

Verdict: Needs changes. This PR exposes asset and data-object redirect targets in Studio’s redirects grid, complementing the linked core and backend changes.

Changes:

  • Adds an editable Target Type column and supports dropping all three element types.
  • Sends target types to the API and applies server-resolved values to grid rows.
  • Extends API types and adds labels across nine locales.

The changes sit within the redirects module. Backend compatibility depends on the companion releases; no regression tests or documentation changes are included in the reviewed files.

File Description
translations/​studio.sv.yaml Adds Swedish target-type labels.
translations/​studio.pl.yaml Adds Polish target-type labels.
translations/​studio.no.yaml Adds Norwegian target-type labels.
translations/​studio.nl.yaml Adds Dutch target-type labels.
translations/​studio.it.yaml Adds Italian target-type labels.
translations/​studio.fr.yaml Adds French target-type labels.
translations/​studio.es.yaml Adds Spanish target-type labels.
translations/​studio.en.yaml Adds English target-type labels.
translations/​studio.de.yaml Adds German target-type labels.
assets/​js/​src/​core/​modules/​redirects/​table/​table.tsx Adds target-type editing, expanded drops, and response synchronization.
assets/​js/​src/​core/​modules/​redirects/​seo-api-slice.gen.ts Adds target types to API contracts.
assets/​js/​src/​core/​modules/​redirects/​redirects-container.tsx Initializes new rows without a target type.
assets/​js/​src/​core/​modules/​redirects/​hooks/​use-redirects.tsx Sends target types and returns updated server data.
assets/​js/​src/​core/​modules/​redirects/​hooks/​use-redirect-options.ts Supplies translated target-type options.

Review effort: Balanced

dolmit-tanel-paaro and others added 3 commits October 26, 2026 11:08
A redirect to a plain URL carries targetType: null, which the published enum
did not allow, so the backend schema now lists null among its values. Spec and
slice are regenerated output, not hand-edited.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two quick edits to one row could end with the grid showing the older value: the
response to the first edit arrived last and replaced the row. A per-row
submission counter makes a response apply only while it is still the newest one.

Also regenerates the API client for the reordered targetType property.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dolmit-tanel-paaro
dolmit-tanel-paaro marked this pull request as ready for review October 27, 2026 06:52
@pimcore-deployments
pimcore-deployments marked this pull request as draft October 27, 2026 06:52
@dolmit-tanel-paaro
dolmit-tanel-paaro marked this pull request as ready for review October 27, 2026 07:07
@pimcore-deployments
pimcore-deployments marked this pull request as draft October 27, 2026 07:07
Keeps the nesting inside onUpdateCellData within the limit, and makes the
replacement a plain function of (rows, rowId, next).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Rejected target-type updates silently revert without showing the backend validation message users need to correct their selection.

1 open issue
1 resolved since last review

Review effort: Balanced

@ValeriaMaltseva
ValeriaMaltseva requested review from robertSt7 and removed request for ValeriaMaltseva October 27, 2026 14:06
RTK Query returns a rejected mutation in result.error rather than throwing, so
a rejected update only rolled the row back with no message - including the
validation error the API now returns for a target type that resolves to no
usable element. Mirrors createNewRedirect in the same hook.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Allow redirect targets to be data objects or assets

4 participants