Skip to content

Add ContentTypeManagement widget to ui.xml#3903

Open
jmendeza wants to merge 3 commits intocraftercms:developfrom
jmendeza:feature/8496
Open

Add ContentTypeManagement widget to ui.xml#3903
jmendeza wants to merge 3 commits intocraftercms:developfrom
jmendeza:feature/8496

Conversation

@jmendeza
Copy link
Copy Markdown
Member

@jmendeza jmendeza commented Mar 19, 2026

Add ContentTypeManagement widget to ui.xml
craftercms/craftercms#8496
Related to
craftercms/craftercms#8583

Summary by CodeRabbit

  • New Features

    • Adds a Content Type Management widget to the Studio UI for configuring page and component schemas, system properties, control icons and datasource mappings.
  • Chores

    • Introduces automated upgrade steps to apply the UI transformation during version upgrades.
  • Tests

    • Adds test coverage validating the UI upgrade/XSLT transformation.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 19, 2026

Walkthrough

Adds an XSLT upgrade that conditionally injects a new craftercms.components.ContentTypeManagement widget (with page and component descriptors) into siteUi, plus pipeline entries, repo bootstrap UI files, tests, and input/expected XML fixtures for the transformation.

Changes

Cohort / File(s) Summary
XSLT transformation
src/main/resources/crafter/studio/upgrade/5.0.x/config/ui/ui-v5.0.0.1.xslt
New XSLT 2.0 identity transform that appends a craftercms.components.ContentTypeManagement <widget> under <siteUi> only if it doesn't already exist; defines page and component object types, fields, sections, controls, and datasources.
Upgrade pipelines
src/main/resources/crafter/studio/upgrade/pipelines.yaml
Added pipeline steps: a pipelines.system.versions step (5.0.0.15 → 5.0.0.16) updating sample UI, and a configurations.ui.pipeline.versions step (5.0.0.0 → 5.0.0.1) that runs the new XSLT upgrader.
Repo-bootstrap / UI config
src/main/webapp/repo-bootstrap/global/blueprints/1000_website_editorial/config/studio/ui.xml, src/main/webapp/repo-bootstrap/global/configuration/samples/sample-ui.xml
Inserted craftercms.components.ContentTypeManagement widget declarations into repo-bootstrap and sample UI; includes object type schemas (page, component), field descriptors (file-name, internal-name, navLabel, placeInNav), and UI icon mappings for controls/datasources.
Tests & fixtures
src/test/java/org/craftercms/studio/XsltTest.java, src/test/resources/crafter/studio/upgrade/xslt/ui/v5.0/5.0.0.1/input.xml, .../expected.xml
Added TestNG data provider and test method to validate XSLT. Included input fixture (baseline siteUi) and expected fixture (siteUi with injected ContentTypeManagement configuration).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • sumerjabri
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Add ContentTypeManagement widget to ui.xml' accurately describes the primary change—adding a new widget to UI configuration files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/main/resources/crafter/studio/upgrade/pipelines.yaml (1)

1365-1367: Misleading commit message.

The commitDetails says "Update the UI to use new icons for dashboard widgets" but the actual change performed by ui-v5.0.0.1.xslt is injecting the craftercms.components.ContentTypeManagement widget. Consider updating to accurately describe the change, e.g., "Add ContentTypeManagement widget to ui.xml".

Suggested fix
             -   currentVersion: 5.0.0.0
                 nextVersion: 5.0.0.1
                 operations:
                     -   type: xsltFileUpgrader
                         template: crafter/studio/upgrade/5.0.x/config/ui/ui-v5.0.0.1.xslt
-                        commitDetails: Update the UI to use new icons for dashboard widgets
+                        commitDetails: Add ContentTypeManagement widget to ui.xml
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/resources/crafter/studio/upgrade/pipelines.yaml` around lines 1365 -
1367, The commitDetails for the xsltFileUpgrader entry referencing template
crafter/studio/upgrade/5.0.x/config/ui/ui-v5.0.0.1.xslt is misleading; change
the commitDetails string from "Update the UI to use new icons for dashboard
widgets" to an accurate description such as "Add ContentTypeManagement widget to
ui.xml" so it reflects that the XSLT injects the
craftercms.components.ContentTypeManagement widget.
src/main/webapp/repo-bootstrap/global/blueprints/1000_website_editorial/config/studio/ui.xml (1)

394-479: Add ContentTypeManagement widget definition to other blueprints for consistency.

The 2000_headless_store, 4000_empty, and 5000_headless_blog blueprints reference craftercms.components.ContentTypeManagement as a tool with only a self-closing widget tag, while 1000_website_editorial includes the full widget definition with configuration for objectTypes (page and component). Adding the widget definition to the other blueprints would align their configuration with 1000_website_editorial.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/webapp/repo-bootstrap/global/blueprints/1000_website_editorial/config/studio/ui.xml`
around lines 394 - 479, The other blueprints (2000_headless_store, 4000_empty,
5000_headless_blog) only include a self-closing <widget
id="craftercms.components.ContentTypeManagement" /> while 1000_website_editorial
defines the full widget with <configuration> containing <objectTypes id="page">
and <objectTypes id="component">; update those blueprints to replace the
self-closing widget with the full ContentTypeManagement widget definition copied
from 1000_website_editorial (including the page and component <descriptor>
entries, fields like file-name, internal-name, navLabel, placeInNav, and the
System Properties <sections>) so all blueprints share the same configured
craftercms.components.ContentTypeManagement widget.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/main/resources/crafter/studio/upgrade/pipelines.yaml`:
- Around line 1365-1367: The commitDetails for the xsltFileUpgrader entry
referencing template crafter/studio/upgrade/5.0.x/config/ui/ui-v5.0.0.1.xslt is
misleading; change the commitDetails string from "Update the UI to use new icons
for dashboard widgets" to an accurate description such as "Add
ContentTypeManagement widget to ui.xml" so it reflects that the XSLT injects the
craftercms.components.ContentTypeManagement widget.

In
`@src/main/webapp/repo-bootstrap/global/blueprints/1000_website_editorial/config/studio/ui.xml`:
- Around line 394-479: The other blueprints (2000_headless_store, 4000_empty,
5000_headless_blog) only include a self-closing <widget
id="craftercms.components.ContentTypeManagement" /> while 1000_website_editorial
defines the full widget with <configuration> containing <objectTypes id="page">
and <objectTypes id="component">; update those blueprints to replace the
self-closing widget with the full ContentTypeManagement widget definition copied
from 1000_website_editorial (including the page and component <descriptor>
entries, fields like file-name, internal-name, navLabel, placeInNav, and the
System Properties <sections>) so all blueprints share the same configured
craftercms.components.ContentTypeManagement widget.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c373df2-5efd-48b6-a71e-0cb765884d68

📥 Commits

Reviewing files that changed from the base of the PR and between c233f16 and 40a3714.

📒 Files selected for processing (7)
  • src/main/resources/crafter/studio/upgrade/5.0.x/config/ui/ui-v5.0.0.1.xslt
  • src/main/resources/crafter/studio/upgrade/pipelines.yaml
  • src/main/webapp/repo-bootstrap/global/blueprints/1000_website_editorial/config/studio/ui.xml
  • src/main/webapp/repo-bootstrap/global/configuration/samples/sample-ui.xml
  • src/test/java/org/craftercms/studio/XsltTest.java
  • src/test/resources/crafter/studio/upgrade/xslt/ui/v5.0/5.0.0.1/expected.xml
  • src/test/resources/crafter/studio/upgrade/xslt/ui/v5.0/5.0.0.1/input.xml

@jmendeza jmendeza marked this pull request as ready for review April 20, 2026 20:24
@jmendeza jmendeza requested a review from sumerjabri as a code owner April 20, 2026 20:24
@jvega190
Copy link
Copy Markdown
Member

All good here

Copy link
Copy Markdown
Member

@russdanner russdanner left a comment

Choose a reason for hiding this comment

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

The one thing that stands out to me is the name of this tag is plural but it represents a signle objectType. I think this will lead to mistakes.

<objectTypes id="component">

You see the same patter with controls and data sources:

<controls id="input-email">

@sumerjabri
Copy link
Copy Markdown
Member

@russdanner I'll hold off until you approve this PR.

@russdanner
Copy link
Copy Markdown
Member

The one thing that stands out to me is the name of this tag is plural but it represents a signle objectType. I think this will lead to mistakes.

<objectTypes id="component">

You see the same patter with controls and data sources:

<controls id="input-email">

@rart @sumerjabri We need a decision on this

@sumerjabri
Copy link
Copy Markdown
Member

@russdanner will changing this to singular break backward compat?

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.

4 participants