Skip to content

Conversation

@kwhuber
Copy link

@kwhuber kwhuber commented Nov 26, 2025

Fixes #5168

EditorWrapper.tsx is where the template XML lives and eventually what the editor receives. By replacing the <viewset name> attribute, the editor will receive the user provided resource name before the XML reaches the editor. There are a few cases to look out for so the XML doesn’t break. For example, the following input could cause issues, emphasizing the need to replace them to XML entities: & resolved to &amp;, < resolved to &lt;, etc.

The majority of the fix came from defining a few new functions, replaceViewsetName, escapeXML, and replaceViewsetNameInXml. The first is defined within EditorWrapper.tsx and the latter two in a new utility file called xmlUtils. The fix makes the XML editor display the user inputted resource name (when it is provided) instead of the template name.

replaceViewsetNameInXml extracts the resource name from the resource parameter and replaces the first occurrence of the <viewset name> attribute using the following regex:

/(<viewset\b[^>]*\bname=)([\"])(.*?)\2/,

More changes were added to this fix in Editor.tsx. This is necessary if the user alters their originally defined name to something else.

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone
  • Add pr to documentation list

Testing instructions

  • Go to App Resources
  • Create a new Form Definition under Global Resources and copy one of the defaults (for example, "Vertpaleo")
  • Name it something other than the name of the one you copied
  • Switch to the XML editor and see that the "name=" value is of the name that you defined (not of the default Form Definition you copied)

Example

Screen.Recording.2025-11-24.at.1.31.19.PM.mov

@github-project-automation github-project-automation bot moved this to 📋Back Log in General Tester Board Nov 26, 2025
@kwhuber kwhuber requested a review from a team November 26, 2025 14:01
@kwhuber kwhuber added this to the 7.12.0 milestone Nov 26, 2025
Copy link
Collaborator

@emenslin emenslin left a comment

Choose a reason for hiding this comment

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

  • Go to App Resources
  • Create a new Form Definition under Global Resources and copy one of the defaults (for example, "Vertpaleo")
  • Name it something other than the name of the one you copied
  • Switch to the XML editor and see that the "name=" value is of the name that you defined (not of the default Form Definition you copied)

Looks good, name is copied correctly!

12-01_12.02.mp4

@emenslin emenslin requested a review from a team December 1, 2025 18:06
@CarolineDenis
Copy link
Contributor

@kwhuber, can you remove the DS files + gitignore + env

@kwhuber kwhuber force-pushed the issue-5168 branch 2 times, most recently from e7437af to 7e06b4d Compare December 3, 2025 18:08
Copy link
Contributor

@Iwantexpresso Iwantexpresso left a comment

Choose a reason for hiding this comment

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

  • Go to App Resources
  • Create a new Form Definition under Global Resources and copy one of the defaults (for example, "Vertpaleo")
  • Name it something other than the name of the one you copied
  • Switch to the XML editor and see that the "name=" value is of the name that you defined (not of the default Form Definition you copied)

Nice! This looks great Kaden.

image

@Iwantexpresso Iwantexpresso requested a review from a team December 11, 2025 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋Back Log

Development

Successfully merging this pull request may close these issues.

"Copy existing view definition" does not show the Form Definition name defined by the user

5 participants