Skip to content

refactor(ui): adopt p-tag for status and locale displays via shared status badge#36144

Open
oidacra wants to merge 15 commits into
mainfrom
issue-36089-migrate-dot-contentlet-status-chip-from-p-chip-to
Open

refactor(ui): adopt p-tag for status and locale displays via shared status badge#36144
oidacra wants to merge 15 commits into
mainfrom
issue-36089-migrate-dot-contentlet-status-chip-from-p-chip-to

Conversation

@oidacra

@oidacra oidacra commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

  • p-chip has no severity API, so status badges fought the PrimeNG theme with Tailwind !important overrides scattered across the app. p-tag supports severity natively, per the design decision: tags = informative, chips = interactive.
  • The shared status component was renamed dot-contentlet-status-chipdot-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 single STATUS_SEVERITY map with inferred types, rendered by a one-line inline <p-tag> template. All labels resolve through DotMessageService (previously only "New" was translated).
  • During implementation the scope grew (by decision) into the full tag adoption sweep: every status/locale display in the app now follows the rule, and the two duplicated status-derivation pipes were deleted — the badge is the single owner of status logic.

Closes #36089

Changes

Shared component (libs/ui)

File Change
dot-contentlet-status-badge.component.ts Renamed from -chip. Status logic inline as computed signals (statusseverity/label), types inferred from the STATUS_SEVERITY map (single source of truth), labels translated via DotMessageService (all five statuses are i18n keys in Language.properties), ChipModuleTagModule, one-line inline template (separate .html removed)
dot-contentlet-status-badge.component.spec.ts Asserts at the Tag input boundary (spectator.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/info
dot-contentlet-status/ (pipe) DeletedDotContentletStatusPipe lost its last consumer (command bar)
dot-asset-card.component.* Language chip → p-tag severity="info"; status badge reference renamed
theme.config.ts chip/tag block comments updated (status badges are tags now; no stale "Content Status" / "version-history chips" references). The tag block itself (1.75rem + severity colorScheme) was already in place

Consumers migrated to the badge / tags

Area Change
Content Drive (dot-folder-list-view) Status → badge (rename only); locale chip → p-tag severity="info" (same blue 1:1, no !important)
Edit Content — command bar (dot-edit-content-form) Hand-rolled p-tag + local contentStatusSeverity() + pipe injection replaced by <dot-contentlet-status-badge [state]="$statusState()" /> — "New" is now translated
Edit Content — relationship field (table + select-existing dialog) Local ContentletStatusPipe ({label, classes} with theme-orphaned p-chip-* classes — every status rendered gray) replaced by the badge. Restores the legacy Dojo distinction: Draft/Revision/Published are visually distinct again. Pipe + DotEditContentStatus enum deleted
Edit Content — history sidebar (dot-history-timeline-item) live/working/variant chips → p-tag severities success/warn/info, labels keep their own i18n keys
Rename-only consumers es-search, asset search, block-editor, dot-pages, dot-templates, dot-containers, e2e page object, Stencil @deprecated notes + generated readme

Docs

File Change
docs/frontend/STYLING_STANDARDS.md New Tags vs Chips section: decision rule (1. contentlet status → <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 use p-tag severity="info", and the no-Tailwind-!important rule

Acceptance Criteria

  • The component renders a single p-tag with native severity per the mapping (Published→success, Archived/deleted→danger, Revision→info, Draft→warn).
  • When state is null, the tag shows the translated New label with info severity.
  • The tag renders at a standardized 1.75rem height via design tokens in CustomLaraPreset (components.tag), not per-component CSS.
  • No Tailwind !important color overrides remain in the component template (nor in any migrated consumer).
  • ChipModule removed; TagModule from primeng/tag used instead.
  • The stale "Content Status" reference in the chip block comment in theme.config.ts is updated.
  • docs/frontend/STYLING_STANDARDS.md documents the tags-vs-chips rule (tags = informative, chips = interactive).
  • Consumers keep working with no behavioral changes beyond the intended visual/status fixes.
  • Spec covers severity per status (including null → New/info); yarn nx test ui passes.
  • Visual gate verified in running instance: Content Drive list (status + locale), Edit Content command bar, relationship field (Draft/Published/Revision rendering correctly, confirmed against legacy Dojo semantics), history sidebar.

Test Plan

  • yarn nx lint — ui, edit-content, content-drive-ui, es-search, dotcms-ui: pass
  • yarn nx test ui — 678 tests pass
  • yarn nx test edit-content — 1929 tests pass
  • yarn nx test content-drive-ui — 177 tests pass
  • yarn nx test dotcms-ui — 2153 tests pass
  • yarn nx affected:test --base=origin/mainblock-editor / dotcms-block-editor failures are pre-existing on main (verified identical 27F/36P with changes stashed)
  • PR Build green after the Stencil generated-readme fix
  • Manual visual verification in running instance (screenshots in thread: Content Drive, relationships with Draft/Published/Revision)

Notes

Commits

  1. fa634b1d53 — migrate dot-contentlet-status-chip from p-chip to p-tag
  2. e0f4c0eb26 — rename to dot-contentlet-status-badge (28 files)
  3. fea4f64714 — infer status badge types from the severity map
  4. 25765b7c3a — inline the one-line template
  5. 1585250b76 — test at the Tag input boundary
  6. 102e41888d — docs: mandate the badge for contentlet statuses
  7. 3e2b64209a — fix Stencil generated readme (CI clean-tree check)
  8. 3443f79fcc — Content Drive locale chip → tag
  9. de89905974 — docs: locale labels rule
  10. 6f39e3e09c — command bar uses the badge; drop DotContentletStatusPipe
  11. c66fd2d0ef — history sidebar chips → tags
  12. 426e4bab2f — relationship field uses the badge; drop ContentletStatusPipe
  13. 8e28518ce1 — asset card language chip → tag
  14. b1205b60ac — translate every badge label via DotMessageService

@claude

claude Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Claude finished @oidacra's task in 45s —— View job


Rollback Safety Analysis — Complete

  • Read rollback-unsafe categories reference
  • Get full PR diff (48 files, +438/−731 lines)
  • Analyze diff against all unsafe categories
  • Apply label ✅

Result: Safe to Rollback

All 48 changed files are Angular/TypeScript frontend only:

File type Count
Angular component .ts / .html / .spec.ts 40
TypeScript pipes / enums (deleted) 5
Theme config / Stencil / Markdown docs 3

Zero Java (.java), SQL, XML, or backend files are touched.

No unsafe categories apply:

Category Assessment
C-1 Structural Data Model Change ❌ No DB changes
C-2 Elasticsearch Mapping Change ❌ No ES mapping code
C-3 Content JSON Model Version Bump ❌ No contentlet_as_json / CURRENT_MODEL_VERSION changes
C-4 DROP TABLE / DROP Column ❌ No DDL
H-1 One-Way Data Migration ❌ No data transformation
H-2 RENAME TABLE / COLUMN ❌ No DDL
H-3 PK Restructuring ❌ No DDL
H-4 New ContentType Field Type ❌ No field type registration
H-5 Storage Provider Change ❌ No storage changes
H-6 DROP PROCEDURE/FUNCTION ❌ No DDL
H-7 NOT NULL Column Without Default ❌ No DDL
H-8 VTL Viewtool Contract Change ❌ No viewtool changes
M-1 Column Type Change ❌ No DDL
M-2 Push Publishing Bundle Format ❌ No bundler changes
M-3 REST/GraphQL API Contract ❌ No REST endpoint changes
M-4 OSGi Interface Change ❌ No OSGi changes

Label AI: Safe To Rollback has been applied.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

❌ Codex Review failed — openai.gpt-5.5

The review job failed before producing output. See the run for details.

Run: #27444105249

@oidacra oidacra changed the title refactor(ui): migrate dot-contentlet-status-chip from p-chip to p-tag refactor(ui): migrate contentlet status badge from p-chip to p-tag Jun 12, 2026
@oidacra oidacra marked this pull request as ready for review June 12, 2026 19:48
oidacra added 6 commits June 12, 2026 15:51
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.
@oidacra oidacra force-pushed the issue-36089-migrate-dot-contentlet-status-chip-from-p-chip-to branch from 407e894 to 3e2b642 Compare June 12, 2026 19:51
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.
oidacra added 2 commits June 12, 2026 16:38
…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.
oidacra added 2 commits June 12, 2026 17:16
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.
@oidacra oidacra changed the title refactor(ui): migrate contentlet status badge from p-chip to p-tag refactor(ui): adopt p-tag for status and locale displays via shared status badge Jun 12, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Documentation PR changes documentation files Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Migrate dot-contentlet-status-chip from p-chip to p-tag with severity mapping and standardized 1.75rem size

1 participant