Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Hide last repeatable delete button with minimum > 0#26277

Merged
MarkEWaite merged 1 commit into
jenkinsci:masterfrom
mawinter69:repeatable-minimum
Feb 9, 2026
Merged

Hide last repeatable delete button with minimum > 0#26277
MarkEWaite merged 1 commit into
jenkinsci:masterfrom
mawinter69:repeatable-minimum

Conversation

@mawinter69
Copy link
Copy Markdown
Contributor

@mawinter69 mawinter69 commented Feb 6, 2026

When a repeatable has set a minimum > 0 it means there should always be at least one such entry. So showing the delete button in that case when there is only one entry is wrong. Interestingly there is already support for this behaviour with the class show-if-not-only. A few plugins used that with the old input based buttons.
This change now makes this automatic. The repeated-container gets the value of the passed minimum and the corresponding class is automatically added to all delete buttons in the container.

Not sure if I should label this as bug or enhancement. It's kind of both as with the introduction of the f:repeatableDeleteButton that feature was somehow lost/forgotten, but before it was also not automatic. Labelled it for now as rfe.
Note that some plugins use the construct

<div class="show-if-not-only" align="right">
  <f:repeatableDeleteButton/>
</div>

to hide the delete button while using f:repeatableDeleteButton. This doesn't influence the behaviour

Testing done

Test with minimum=1

  1. installed git plugin (this requires at least 1 repository)
  2. Create a freestyle project
  3. Select git as scm
  4. Verified with only one repository configured there is no delete button
  5. Added another repository
  6. Verified then both have a delete button
  7. Delete the first repo
  8. Verified there is no longer a delete button

Test with minimum=0 with a log recorder

  1. create a new log recorder
  2. click on the Add button for Loggers
  3. Verified the delete button is always there.

Screenshots (UI changes only)

Before

image

After

image

Proposed changelog entries

  • Automatically hide last repeatable delete button with minimum > 0

Proposed changelog category

/label rfe,web-ui

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@mention

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

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, be a Bug or Improvement, and either the issue or pull request must be labeled as lts-candidate to be considered.

When a repeatable has set a minimum > 0 it means there should always be
at least one such entry. So showing the delete button in that case when
there is only one entry is wrong. Interestingly there is already support
for this behaviour with the class `show-if-not-only`. A few plugins used
that with the old input based buttons.
This change now makes this automatic. The repeated-container gets the
value of the passed minimum and the corresponding class is automatically
added to all delete buttons in the container.
@comment-ops-bot comment-ops-bot Bot added 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 labels Feb 6, 2026
Copy link
Copy Markdown
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Thanks!

@MarkEWaite
Copy link
Copy Markdown
Contributor

This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback.

/label ready-for-merge

@comment-ops-bot comment-ops-bot Bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Feb 8, 2026
@lemeurherve
Copy link
Copy Markdown
Member

lemeurherve commented Feb 8, 2026

Maybe for another PR, but can the row where that delete button was be removed too? (The empty space above "Repository URL" in your "after" screenshot)

@mawinter69
Copy link
Copy Markdown
Contributor Author

Maybe for another PR, but can the row where that delete button was be removed too? (The empty space above "Repository URL" in your "after" screenshot)

See #23882

Copy link
Copy Markdown

@A1exKH A1exKH left a comment

Choose a reason for hiding this comment

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

LGTM.

@MarkEWaite MarkEWaite merged commit ca794fa into jenkinsci:master Feb 9, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback 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.

5 participants