Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide preview button for 'EscapedMarkupFormatter' #9368

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

janfaracik
Copy link
Contributor

@janfaracik janfaracik commented Jun 9, 2024

Unlike other formatters, the 'Preview' link doesn't do anything for the default 'EscapedMarkupFormatter' formatter, clicking it just presents back the escaped version of the text the user has entered in. Intention would be to remove this link for the default formatter where afaik it doesn't serve a purpose, and keep it for other formatters.

Before
image

After
image

Testing done

  • Preview link isn't visible for 'EscapedMarkupFormatter'
  • Preview link is visible for other formatters

Proposed changelog entries

  • Hide preview button for 'EscapedMarkupFormatter'

Proposed upgrade guidelines

N/A

Submitter checklist

Desired reviewers

@jenkinsci/sig-ux

Before the changes are marked as ready-for-merge:

Maintainer checklist

@daniel-beck
Copy link
Member

daniel-beck commented Jun 10, 2024

clicking it just presents back the escaped version of the text the user has entered in

Mostly at least. A notable exception is that tab characters aren't retained. (At least consecutive spaces and line breaks are both retained.)

I'm ±0 on this. It looks a little nicer but loses some information (more about which formatter it is than what it looks like).

@MarkEWaite
Copy link
Contributor

I'm "+1" for the change but I think it will need to be checked that it does not break tests in the plugin bill of materials or in the acceptance test harness.

@MarkEWaite MarkEWaite added the rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Jun 24, 2024
@janfaracik janfaracik changed the title Discussion: Hide preview button for 'EscapedMarkupFormatter' Hide preview button for 'EscapedMarkupFormatter' Jul 15, 2024
@janfaracik
Copy link
Contributor Author

/label web-ui

@comment-ops-bot comment-ops-bot bot added the web-ui The PR includes WebUI changes which may need special expertise label Jul 15, 2024
Copy link
Member

@jtnord jtnord left a comment

Choose a reason for hiding this comment

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

code logic looks incorrect in that it ignores any user defined preview endpoint

@@ -105,7 +105,8 @@ THE SOFTWARE.
<j:mute>${customizedFields.add(name)}</j:mute>
</j:if>
</f:possibleReadOnlyField>
<j:if test="${attrs.previewEndpoint!=null and !readOnlyMode}">

<j:if test="${attrs.previewEndpoint!=null and !readOnlyMode and app.markupFormatter.class.name != 'hudson.markup.EscapedMarkupFormatter'}">
Copy link
Member

@jtnord jtnord Jul 17, 2024

Choose a reason for hiding this comment

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

Am I missing something?
Nothing ties previews to markup formatters does it? if so nothing here says the preview needs to be done using only a the Jenkins MarkupFormatter.

Suggested change
<j:if test="${attrs.previewEndpoint!=null and !readOnlyMode and app.markupFormatter.class.name != 'hudson.markup.EscapedMarkupFormatter'}">
<j:if test="${attrs.previewEndpoint!=null and !readOnlyMode and (app.markupFormatter.class.name != 'hudson.markup.EscapedMarkupFormatter or attrs.previewEndpoint != '/markupFormatter/previewDescription')'}">

That is I could have a jenkins using the EscapedMarkupFormatter but I may have set the previewEndPoint to MyDescriptorImpl.preview(String)

Indeed, the test on line 111 does implies that I should be able to use this irrespective of any global markup formatter.

a completely contrived example could be where a user supplies some toml, and my descriptor takes that toml (per job) and merges it with some global toml to create the "end toml" which is then displayed to the user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted web-ui The PR includes WebUI changes which may need special expertise
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants