refactor(ui): Show all toggle and JSON paste for the key/value field (#37191) - #37631
Open
adrianjm-dotCMS wants to merge 7 commits into
Open
adrianjm-dotCMS wants to merge 7 commits into
adrianjm-dotCMS wants to merge 7 commits into
Conversation
) Review feedback on #37284: revealing a long list 40 rows at a time makes an editor click repeatedly to reach the end, and the control disappears once the last page is out, leaving no way back to a short table. A two-state toggle does it in one click either way. `dot-key-value-ng` now holds a `$showingAll` flag instead of a growing `$visibleCount`, and renders "Show all (N)" / "Show less" in the same footer row. The flag stays state rather than being derived from the `variables` input: Field Variables and Apps hand back a fresh array on every edit, which would collapse the table on any change. This is the control `dot-relationship-field` already ships, down to the icons, the count on expand only and the 40-row threshold — the two fields now teach the same affordance once. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
18 tasks
Contributor
|
Claude finished @adrianjm-dotCMS's task in 1m 43s —— View job Code Review — Show all toggle + JSON paste (#37631)Reviewed the diff against
New Issues
Everything else checks out:
Overall this is clean, well-documented work. The one Medium is non-blocking — decide based on whether numeric-ID pastes are a real scenario for these consumers. · branch |
adrianjm-dotCMS
marked this pull request as ready for review
September 18, 2026 20:07
The paste shortcut only understood `KEY=VALUE`, so a JSON object matched
nothing, and the whole block landed in the Key input as one string.
`parseKeyValueBlock` now tries JSON first: the text as given, then the text
wrapped in braces with a trailing comma dropped, so a selection taken out of the
middle of a file — `"id": 1,` and the lines under it — reads as well as a whole
`{...}`. Anything else falls through to the `KEY=VALUE` reader exactly as before.
How values are written:
- a number or boolean keeps the form the JSON gave it (`1`, `true`);
- a nested object or array keeps its JSON text, so the data survives the paste
and stays visible and editable rather than being dropped in silence;
- `null` and blank are skipped, for the same reason `KEY=` is: the entry row
refuses a blank value and a paste is not a way around that.
A top-level array, string or number is rejected — no keys in it to make pairs
from — and so is text too malformed to parse, such as a selection that cut a
string in half. Both fall through to the browser's own paste, where the user can
see the text and fix it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…into issue-37191-key-value-show-all
adrianjm-dotCMS
requested review from
KevinDavilaDotCMS,
nicobytes,
oidacra,
rjvelazco and
zJaaal
September 18, 2026 20:38
fmontes
previously approved these changes
Sep 18, 2026
…ish (#37191) `format-test` failed on this file: Prettier wanted one of the calls on a single line. The pre-commit hook's `nx format:write` reported success without applying it, so it reached CI unformatted. The sample data went to English at the same time — it was written in Spanish while working through the shape of the feature, which is not what the rest of these specs read like. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
oidacra
previously approved these changes
Sep 18, 2026
`spectator.query()` returns `T | null`, so the six new assertions that read `textContent` and `aria-expanded` straight off it are strict-mode violations on lines this branch wrote. Narrowed with `?.`, which keeps each assertion failing the same way if the element is ever missing. Verified with the harness the gate itself runs: tools/scripts/strict-gate/run.mjs --base origin/main --flags strict --granularity line --scope core-web → PASS. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parent Issue
#37191 — follow-up to the review feedback on #37284 (merged).
1- PASTE JSON
Screen.Recording.2026-09-18.at.4.30.01.PM.mov
2- SHOW ALL - SHOW LESS
Screen.Recording.2026-09-18.at.4.04.34.PM.mov
Proposed Changes
Two changes to the shared Key/Value editor, both reaching its three consumers: the Edit Content key/value field, Content Type → Field Variables, and the Apps custom-properties panel.
1. Show all, in place of Load more
The field shipped with Load more: 40 rows at a time, one click per page, and the control vanishing once the last page was revealed. The feedback asked for Show all instead.
dot-key-value-ngnow renders the same two-state toggledot-relationship-fieldalready ships:⊕ Show all (N)↔⊖ Show less, in the existing footer row next to Clear AllNis the whole list, and only on expand — collapsing always returns to the same first pagearia-expandedon the buttonInternally
$visibleCountstops being a growingsignaland becomes acomputedover a$showingAllflag, with$canToggleAllreplacing$remaining, andloadMore()giving way totoggleShowAll().$showingAllis deliberately state, not derived from thevariablesinput: Field Variables and Apps hand back a fresh array on every edit, so deriving it collapsed the table the moment anything changed. Same reasoning, and same comment, asRelationshipFieldStore.showingAll.Language keys:
keyValue.action.load_more→keyValue.action.show_all+keyValue.action.show_less.2. Pasting a JSON object
The paste shortcut only understood
KEY=VALUE, so a JSON object matched nothing and the whole block landed in the Key input as one string.parseKeyValueBlocknow tries JSON first — the text as given, then the text wrapped in braces with a trailing comma dropped, so a selection taken out of the middle of a file ("id": 1,and the lines under it) reads as well as a whole{...}. Anything else falls through to theKEY=VALUEreader exactly as before.How values are written:
1,true);nulland blank are skipped, for the same reasonKEY=is — the entry row refuses a blank value and a paste is not a way around that.A top-level array, string or number is rejected (no keys in it to make pairs from), and so is text too malformed to parse, such as a selection that cut a string in half. Both fall through to the browser's own paste, where the user can see the text and fix it.
Checklist
Additional Info
The whole list stays bound to the table and only the DOM is limited, exactly as before — PrimeNG reorders the array it is given, so a shortened one would silently drop a drag. The e2e coverage for that (drag and delete with rows withheld) is kept.
136 unit tests across the four
dot-key-value-ngspecs, 11 of them new for the JSON paste.Screenshots
Verified locally against a field with 56 pairs: collapsed at 40 rows with
Show all (56), one click reveals all 56 and offersShow less.🤖 Generated with Claude Code