refactor(ui): adopt p-tag for status and locale displays via shared status badge#36144
Open
oidacra wants to merge 15 commits into
Open
refactor(ui): adopt p-tag for status and locale displays via shared status badge#36144oidacra wants to merge 15 commits into
oidacra wants to merge 15 commits into
Conversation
8 tasks
Contributor
|
Claude finished @oidacra's task in 45s —— View job Rollback Safety Analysis — Complete
Result: Safe to RollbackAll 48 changed files are Angular/TypeScript frontend only:
Zero Java ( No unsafe categories apply:
Label |
Contributor
❌ Codex Review failed —
|
Replace the p-chip + Tailwind !important color overrides with a single p-tag using PrimeNG's native severity API. Status derivation now lives in the component as computed signals (Published→success, Archived/ deleted→danger, Revision→info, Draft→warn, null→New/info), with the "New" label translated via DotMessageService. Sizing (1.75rem) comes from the existing tag block in CustomLaraPreset. Documents the tags-vs-chips rule in STYLING_STANDARDS.md. Closes #36089
…tus-badge The component renders a p-tag, so "chip" contradicted the documented tags-vs-chips rule. "Badge" names the UI concept instead of the underlying PrimeNG widget. Updates the selector, class name, file names, barrel export, all consumers (es-search, content-drive, asset-card, block-editor, edit-content, dot-pages, templates, containers, e2e page object) and the Stencil deprecation notes.
Make STATUS_SEVERITY the single source of truth: DotContentletStatus and DotContentletStatusSeverity are now derived via keyof typeof / indexed access instead of hand-written unions. Adding a status is a one-line change and the status() computed stays compiler-checked.
A single p-tag line doesn't justify a separate .html file; per ANGULAR_STANDARDS, small components prefer inline templates.
Replace assertions on PrimeNG's rendered classes (p-tag-success, etc.) with assertions on the Tag component instance inputs (severity/value), so the spec verifies our derivation logic without coupling to PrimeNG internals. Adds precedence and edge cases (archived wins over live, live-but-not-working and live-without-live-version both render Draft) via a parameterized it.each table.
…atuses Add an explicit decision rule to the Tags vs Chips section: contentlet statuses must go through the shared badge component (never a hand-rolled p-tag), other read-only states use p-tag with severity, and everything without a status uses p-chip.
The Stencil build regenerates readme.md from the component JSDoc; the @deprecated note now points to dot-contentlet-status-badge, so the checked-in readme must match or CI fails the clean-working-tree check.
407e894 to
3e2b642
Compare
The locale label in the folder list view is informative/read-only, so per the tags-vs-chips rule it renders as a p-tag. severity=info maps to the same blue.100/blue.700 pair the old Tailwind overrides hardcoded, so the visual is identical while the !important classes go away.
Pins the convention used in Content Drive so upcoming tag adopters (command bar, version history) don't pick divergent severities.
…orphaned pipe The command bar hand-rolled a p-tag with its own contentStatusSeverity mapping and DotContentletStatusPipe for the label — a third copy of the status logic. It now renders dot-contentlet-status-badge driven by a single $statusState computed (null when the contentlet is new), which also makes the New label translated. With its last consumer gone, DotContentletStatusPipe is removed entirely (files + barrel export), leaving the badge as the single owner of status derivation.
The version timeline rendered live/working/variant states as p-chip with Tailwind !important overrides. They are informative per-version labels, so per the tags-vs-chips rule they render as p-tag with native severities (success/warn/info) — visually identical via the preset.
The relationship table and the select-existing-content dialog rendered
status via a local ContentletStatusPipe ({label, classes}) whose custom
chip classes (p-chip-success/pink/gray/blue) no longer exist in the
theme — every status rendered gray. Both now use
dot-contentlet-status-badge, restoring the legacy Dojo semantics with
the modern UI (Draft/Revision/Published distinguishable again). The
pipe and its DotEditContentStatus enum are removed (last consumers).
Same pattern as the Content Drive locale column: language labels are informative, so they render as p-tag severity=info per the documented rule, dropping the Tailwind !important overrides.
label() special-cased New and rendered the other statuses in hardcoded English. All five status names exist as i18n keys in Language.properties, so the label now always resolves through DotMessageService — simpler code (no ternary) and correct i18n, with the service falling back to the key when no translation exists.
…rules The version-history timeline is the concrete example of decision rule 2 (read-only states that are not a contentlet DotContentState use raw p-tag, not the badge), and the locale rule now also cites the asset card language label.
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.
Summary
p-chiphas no severity API, so status badges fought the PrimeNG theme with Tailwind!importantoverrides scattered across the app.p-tagsupports severity natively, per the design decision: tags = informative, chips = interactive.dot-contentlet-status-chip→dot-contentlet-status-badge(it renders a tag; "badge" names the UI concept, not the PrimeNG widget). Internally it derives status/severity/label as computed signals from a singleSTATUS_SEVERITYmap with inferred types, rendered by a one-line inline<p-tag>template. All labels resolve throughDotMessageService(previously only "New" was translated).Closes #36089
Changes
Shared component (
libs/ui)dot-contentlet-status-badge.component.ts-chip. Status logic inline as computed signals (status→severity/label), types inferred from theSTATUS_SEVERITYmap (single source of truth), labels translated viaDotMessageService(all five statuses are i18n keys inLanguage.properties),ChipModule→TagModule, one-line inline template (separate.htmlremoved)dot-contentlet-status-badge.component.spec.tsspectator.query(Tag)→.severity/.value) — no coupling to PrimeNG internals. Parameterized table covers all derivation cases incl. precedence (archived wins over live) and edge cases (live-but-not-working, live-without-live-version), plus null → translated New/infodot-contentlet-status/(pipe)DotContentletStatusPipelost its last consumer (command bar)dot-asset-card.component.*p-tag severity="info"; status badge reference renamedtheme.config.tschip/tagblock comments updated (status badges are tags now; no stale "Content Status" / "version-history chips" references). Thetagblock itself (1.75rem + severity colorScheme) was already in placeConsumers migrated to the badge / tags
dot-folder-list-view)p-tag severity="info"(same blue 1:1, no!important)dot-edit-content-form)p-tag+ localcontentStatusSeverity()+ pipe injection replaced by<dot-contentlet-status-badge [state]="$statusState()" />— "New" is now translatedContentletStatusPipe({label, classes}with theme-orphanedp-chip-*classes — every status rendered gray) replaced by the badge. Restores the legacy Dojo distinction: Draft/Revision/Published are visually distinct again. Pipe +DotEditContentStatusenum deleteddot-history-timeline-item)p-tagseveritiessuccess/warn/info, labels keep their own i18n keys@deprecatednotes + generated readmeDocs
docs/frontend/STYLING_STANDARDS.md<dot-contentlet-status-badge>; 2. other read-only state →p-tag+ severity; 3. no status / interactive →p-chip), severity mapping table, explicit rule that locale labels usep-tag severity="info", and the no-Tailwind-!importantruleAcceptance Criteria
p-tagwith nativeseverityper the mapping (Published→success, Archived/deleted→danger, Revision→info, Draft→warn).stateisnull, the tag shows the translatedNewlabel withinfoseverity.CustomLaraPreset(components.tag), not per-component CSS.!importantcolor overrides remain in the component template (nor in any migrated consumer).ChipModuleremoved;TagModulefromprimeng/tagused instead.chipblock comment intheme.config.tsis updated.docs/frontend/STYLING_STANDARDS.mddocuments the tags-vs-chips rule (tags = informative, chips = interactive).yarn nx test uipasses.Test Plan
yarn nx lint— ui, edit-content, content-drive-ui, es-search, dotcms-ui: passyarn nx test ui— 678 tests passyarn nx test edit-content— 1929 tests passyarn nx test content-drive-ui— 177 tests passyarn nx test dotcms-ui— 2153 tests passyarn nx affected:test --base=origin/main—block-editor/dotcms-block-editorfailures are pre-existing onmain(verified identical 27F/36P with changes stashed)Notes
DotContentletStatusPipe(libs/ui) andContentletStatusPipe+DotEditContentStatusenum (edit-content) are deleted; the badge is the single source of truth.hasLiveVersion, verified visually.p-tag(not the badge) intentionally: those are per-version states (this version is live / is the working copy) with their own i18n keys, not a contentletDotContentState.Commits
fa634b1d53— migrate dot-contentlet-status-chip from p-chip to p-tage0f4c0eb26— rename to dot-contentlet-status-badge (28 files)fea4f64714— infer status badge types from the severity map25765b7c3a— inline the one-line template1585250b76— test at the Tag input boundary102e41888d— docs: mandate the badge for contentlet statuses3e2b64209a— fix Stencil generated readme (CI clean-tree check)3443f79fcc— Content Drive locale chip → tagde89905974— docs: locale labels rule6f39e3e09c— command bar uses the badge; drop DotContentletStatusPipec66fd2d0ef— history sidebar chips → tags426e4bab2f— relationship field uses the badge; drop ContentletStatusPipe8e28518ce1— asset card language chip → tagb1205b60ac— translate every badge label via DotMessageService