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

[JENKINS-72018] Form entries in .repeated-chunk using .show-if-not-only CSS class are not hidden when they are alone #8491

Merged
merged 4 commits into from
Sep 24, 2023

Conversation

flabrie
Copy link
Contributor

@flabrie flabrie commented Sep 14, 2023

Form entries in .repeated-chunk using .show-if-not-only CSS class are not hidden when they are alone, because there are missing CSS class definitions.

See JENKINS-72018.

Testing done

Yes, and adding the missing CSS classes fix the issue.

Proposed changelog entries

  • Hide the delete button from the only repeatable element in configuration forms when at least one element is expected. (regression in 2.344)

Proposed upgrade guidelines

N/A

Submitter checklist

Edit tasklist title
Beta Give feedback Tasklist Submitter checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. The Jira issue, if it exists, is well-described.
    Options
  2. 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.
    Options
  3. There is automated testing or an explanation as to why this change has no tests.
    Options
  4. New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
    Options
  5. New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
    Options
  6. 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).
    Options
  7. For dependency updates, there are links to external changelogs and, if possible, full differentials.
    Options
  8. For new APIs and extension points, there is a link to at least one consumer.
    Options

Desired reviewers

@mention

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

Maintainer checklist

Edit tasklist title
Beta Give feedback Tasklist Maintainer checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. There are at least two (2) approvals for the pull request and no outstanding requests for change.
    Options
  2. Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
    Options
  3. Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
    Options
  4. Proper changelog labels are set so that the changelog can be generated automatically.
    Options
  5. 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).
    Options
  6. If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).
    Options

…ted-chunk .show-if-not-only ones. Without these CSS classes, form entries using .show-if-not-only class are not hidden when alone.
@daniel-beck daniel-beck changed the title Form entries in .repeated-chunk using .show-if-not-only CSS class are not hidden when they are alone [JENKINS-72018] Form entries in .repeated-chunk using .show-if-not-only CSS class are not hidden when they are alone Sep 15, 2023
@daniel-beck
Copy link
Member

Effectively reverts #6471.

Probably re-introduces the warnings motivating that PR (but for correct behavior, seems the lesser evil).

@daniel-beck daniel-beck added the regression-fix Pull request that fixes a regression in one of the previous Jenkins releases label Sep 15, 2023
@daniel-beck
Copy link
Member

daniel-beck commented Sep 15, 2023

Interactive test with Subversion plugin (see screenshots in Jira) passes, but autotests fail. Looks like HTMLUnit may lack support for what's a legal (and quite basic?) selector.

Unsure how to go about fixing those, perhaps JTH change to make https://github.com/jenkinsci/jenkins-test-harness/blob/3b9790f39c3106398edda1133833caf9c31532af/src/main/java/org/jvnet/hudson/test/JenkinsRule.java#L2337 more tolerant, reverting parts of jenkinsci/jenkins-test-harness#530, and applying the same change to

// Keep in sync with HudsonTestCase/JenkinsRule
return exception.getURI().contains("/yui/");
?

Ideally we'd find a way to express the same rule in a manner not resulting in an HTMLUnit warning however.

@daniel-beck
Copy link
Member

Per HtmlUnit/htmlunit-cssparser#36, only seems to be treated like a reserved word in HTMLUnit's CSS parser.

Awkward that it's documented in

only : it is the only chunk (automatically get first and last at the same time)
so just renaming the class might be out.

Perhaps

$ git diff war/src/
diff --git a/war/src/main/scss/form/_reorderable-list.scss b/war/src/main/scss/form/_reorderable-list.scss
index dfd0fc5c5a..c19152975d 100644
--- a/war/src/main/scss/form/_reorderable-list.scss
+++ b/war/src/main/scss/form/_reorderable-list.scss
@@ -29,7 +29,7 @@
   visibility: visible;
 }
 
-.repeated-chunk.only .show-if-not-only {
+.repeated-chunk.first.last .show-if-not-only {
   visibility: hidden;
 }
 
@@ -54,7 +54,7 @@
   visibility: visible;
 }
 
-.repeated-chunk .repeated-chunk.only .show-if-not-only {
+.repeated-chunk .repeated-chunk.first.last .show-if-not-only {
   visibility: hidden;
 }
 
@@ -79,7 +79,7 @@
   visibility: visible;
 }
 
-.repeated-chunk .repeated-chunk .repeated-chunk.only .show-if-not-only {
+.repeated-chunk .repeated-chunk .repeated-chunk.first.last .show-if-not-only {
   visibility: hidden;
 }

This makes the autotest pass at least (not manually tested).

Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

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

(Per previous comment)

war/src/main/scss/form/_reorderable-list.scss Outdated Show resolved Hide resolved
war/src/main/scss/form/_reorderable-list.scss Outdated Show resolved Hide resolved
war/src/main/scss/form/_reorderable-list.scss Outdated Show resolved Hide resolved
flabrie and others added 3 commits September 18, 2023 08:32
Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
@daniel-beck daniel-beck added the squash-merge-me Unclean or useless commit history, should be merged only with squash-merge label Sep 18, 2023
@daniel-beck daniel-beck self-requested a review September 18, 2023 14:28
Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

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

Works well in interactive testing with Subversion SCM modules in freestyle jobs.

Nesting of selectors looks error-prone, but this basically only restores what we had before the "cleanup", so seems tolerable.

When going from "not only" to "only", the "X" disappears well before the grey circle, but it doesn't look too broken.

@daniel-beck daniel-beck added the bug For changelog: Minor bug. Will be listed after features label Sep 18, 2023
@NotMyFault NotMyFault requested a review from a team September 18, 2023 20:25
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

nice fix


/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@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 Sep 22, 2023
@MarkEWaite MarkEWaite merged commit c0f6fbe into jenkinsci:master Sep 24, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback regression-fix Pull request that fixes a regression in one of the previous Jenkins releases squash-merge-me Unclean or useless commit history, should be merged only with squash-merge
Projects
None yet
4 participants