Skip to content

Replace UVE app configuration textarea with a Routes editor and validated JSON #37897

Description

@rjvelazco

Description

The UVE app (dotema-config-v2) asks for its configuration as raw JSON in a plain textarea. Users get no help writing it and no validation. Mistakes only show up when the editor fails to load. The example in the hint itself is invalid JSON, because it has a trailing comma after "url".

Replace the textarea with a structured Routes editor, keep raw JSON as a fallback tab, and validate the value on both the client and the server. The saved format does not change: it is still the same JSON string in the same configuration secret.

Routes tab (default)

Element Behavior
Route card One per config entry: Path pattern (RegEx), Server URL, optional Allowed dev URLs list
Card title Says what the route does, e.g. /blogs/(.*) → myspa.blogs.com, plus a #N order badge
Catch-all A .* route shows a Default tag and the title "All other pages → host"
Order Move up and move down buttons, because the first matching pattern wins
Unreachable route A route after a .* route shows a Never used warning (save is not blocked)
Add route Appends a new route at the end

JSON tab

  • A Monaco editor with live JSON validation and a Format JSON button.
  • The tab is meant for pasting a config, and for keys the form doesn't know about.
  • The field hint shows only on this tab.

Backend

  • Add a new JSON value to the app param type enum (com.dotcms.security.apps.Type).
  • Validate JSON when saving and updating, in AppsUtil.validateForSave and AppsHelper.validateFormForUpdate.
  • Validate a JSON param's default value when loading the app YAML, in AppDescriptorHelper.
  • SecretView reports the descriptor's JSON type for configs that were saved as STRING.
  • In dotema-config-v2.yml, set configuration to type: 'JSON' and rewrite the hint with a valid example.

Hints across all Apps

  • Code blocks in any app's hint get a header with the language and a Copy button.
  • JSON in those blocks is highlighted with dotCMS theme colors.

Acceptance Criteria

Routes editor

  • Opening a valid saved UVE config shows one card per config entry, in the saved order.
  • An empty config starts with one .* route.
  • Add, remove, move up and move down update the saved JSON. Remove is disabled when only one route is left.
  • A route with an empty or invalid RegEx pattern shows an inline error and disables Save.
  • A route with an empty or non-http(s) Server URL shows an inline error and disables Save.
  • An allowed dev URL that is not http(s) shows an inline error and disables Save.
  • Errors appear only after the user leaves a field.
  • Blank dev URLs and an empty options object are left out of the saved JSON.
  • Keys the form doesn't edit, in a route or in options, are kept on save.

JSON tab

  • Switching Routes → JSON → Routes → JSON keeps the content every time.
  • Invalid JSON shows the parse error and disables Save.
  • Valid JSON that can't be shown as routes (no config list) opens on the JSON tab, and the Routes tab is disabled with an explanation.
  • Format JSON re-indents valid JSON and is disabled while the JSON is invalid.

Backend

  • Saving or updating the UVE configuration with invalid JSON fails with a clear error message.
  • Importing an Apps export whose UVE configuration is invalid JSON is rejected with the same error.
  • Configs saved before this change, typed as STRING, open in the new editor.
  • An app YAML with a JSON param whose default value is not valid JSON fails descriptor validation.

Hints

  • The Copy button copies the raw code block and briefly shows a "Copied" state.
  • Hint code blocks are no longer blurred by the global Prism text-shadow.

Environment-locked values

  • A value set from the environment shows read-only in both tabs.

Priority

Medium

Additional Context

  • Prototype: done on local branch issue-uve-app-new-json-file; not pushed yet.
  • Why "Reject import": an invalid UVE config already fails at render time, so rejecting it on import surfaces the problem earlier.
  • Supported keys: the UVE reads only pattern, url and options.allowedDevURLs per entry (dot-ema-shell.component.ts).
  • New message keys: apps.uve.*, apps.json.field.* and apps.code.block.* in Language.properties.

Activity

  1. added theissue type on Oct 5, 2026
  2. self-assigned this
    on Oct 5, 2026
  3. github-actions commented on Oct 5, 2026

    @github-actions
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions