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

Revamp icon legend as a modal #7718

Merged
merged 11 commits into from
Mar 17, 2023

Conversation

janfaracik
Copy link
Contributor

@janfaracik janfaracik commented Mar 12, 2023

image

  • Introduces a new lightweight modal component (currently lacking in depth, but eventually it could be used for confirmation dialogs, notices etc)
  • Replaces the icon legend page with an accessible modal

Relates to https://issues.jenkins.io/browse/JENKINS-68357

Testing done

  • Icon legend works the same as before

Proposed changelog entries

  • Revamp icon legend as a modal

Proposed upgrade guidelines

N/A

Submitter checklist

  • The Jira 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.
  • 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

@jenkinsci/sig-ux

Maintainer checklist

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

  • 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, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@timja timja requested a review from a team March 12, 2023 16:26
@timja
Copy link
Member

timja commented Mar 12, 2023

Looks really nice.

Feedback / questions

  1. Should an overlay be placed on the rest of the page to show you can't interact with it when the modal is open?
  2. Should clicking outside the modal close it? (It currently doesn't)
  3. Contrast isn't sufficient for disabled / aborted on dark theme:

image

@timja timja added rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted needs-security-review Awaiting review by a security team member labels Mar 12, 2023
@timja timja requested a review from a team March 12, 2023 16:29
@janfaracik
Copy link
Contributor Author

  1. Should an overlay be placed on the rest of the page to show you can't interact with it when the modal is open?

There is an overlay (it darkens the page)

  1. Should clicking outside the modal close it? (It currently doesn't)

That makes sense to me, especially for a simple modal like this.

  1. Contrast isn't sufficient for disabled / aborted on dark theme:

👍 Just opened a PR for dark theme jenkinsci/dark-theme-plugin#338

Thanks!

@timja
Copy link
Member

timja commented Mar 12, 2023

There is an overlay (it darkens the page)

The overlay only works on safari, doesn't work on Firefox or Chrome

@janfaracik
Copy link
Contributor Author

There is an overlay (it darkens the page)

The overlay only works on safari, doesn't work on Firefox or Chrome

Hadn't spotted that, thanks - opened a new dark theme PR to address janfaracik/dark-theme-plugin#44

@timja
Copy link
Member

timja commented Mar 12, 2023

That’s been opened against your fork not the origin

@janfaracik
Copy link
Contributor Author

That’s been opened against your fork not the origin

Whoops, opened it again jenkinsci/dark-theme-plugin#339

Comment on lines -1989 to -1993
remove: function(element) {
element = $(element);
element.parentNode.removeChild(element);
return element;
},
Copy link
Member

Choose a reason for hiding this comment

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

why was this removed? it's what is causing the ATH failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was interfering with the removal of the modal (I'm assuming because the modal doesn't have a parent?

Copy link
Member

Choose a reason for hiding this comment

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

do we still need to remove this function now that you've changed the core components to not use it?
https://github.com/search?q=org%3Ajenkinsci+Element.remove%28+language%3AJavaScript&type=code&l=JavaScript&p=1

It looks like it should be okay to remove.

Copy link
Member

Choose a reason for hiding this comment

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

(Accidentally resolved this in case you missed it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I'm understanding correctly, we still need to remove the function as it interferes with removing the modal.

Copy link
Member

Choose a reason for hiding this comment

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

I tested locally and it seems to be working fine? not sure how it could be causing an issue if nothing is calling it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

With the remove() function restored I get the above error when closing the modal.

Copy link
Member

Choose a reason for hiding this comment

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

weird I get that error in Safari but not chrome...

Maybe it has a parent in chrome, I guess we already hit a browser difference with this functionality.

@timja timja mentioned this pull request Mar 12, 2023
14 tasks
@NotMyFault NotMyFault added the web-ui The PR includes WebUI changes which may need special expertise label Mar 13, 2023
timja added a commit to jenkinsci/acceptance-test-harness that referenced this pull request Mar 13, 2023
@timja
Copy link
Member

timja commented Mar 13, 2023

ATH passed: jenkinsci/acceptance-test-harness#1062

Copy link
Member

@NotMyFault NotMyFault left a comment

Choose a reason for hiding this comment

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

A very welcoming change :)

Copy link
Contributor

@yaroslavafenkin yaroslavafenkin left a comment

Choose a reason for hiding this comment

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

Tested manually on FF, Chrome and Safari, seems to behave as expected.
Security-wise looks good to me too.

@timja
Copy link
Member

timja commented Mar 16, 2023

/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 Mar 16, 2023
@timja timja added needs-security-review Awaiting review by a security team member security-approved @jenkinsci/core-security-review reviewed this PR for security issues and removed needs-security-review Awaiting review by a security team member labels Mar 17, 2023
@github-actions github-actions bot added the unresolved-merge-conflict There is a merge conflict with the target branch. label Mar 17, 2023
@github-actions
Copy link

Please take a moment and address the merge conflicts of your pull request. Thanks!

@github-actions github-actions bot removed the unresolved-merge-conflict There is a merge conflict with the target branch. label Mar 17, 2023
@timja timja merged commit 38d3a27 into jenkinsci:master Mar 17, 2023
@timja timja deleted the revamp-icon-legend-as-modal branch March 17, 2023 13:26
</l:main-panel>
</l:layout>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<h1 class="jenkins-modal__title">${%Icon legend}</h1>
Copy link
Member

Choose a reason for hiding this comment

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

Since this is no longer a standalone view, attempts to access the URL /legend (e.g. from links in outside documentation, or browser history) will result in the logging of the message

Mar 17, 2023 5:00:06 PM WARNING jenkins.security.stapler.StaplerFilteredActionListener onDispatchTrigger
New Stapler dispatch rules result in the URL "/legend" no longer being allowed. If you consider it safe to use, add the following to the whitelist: "hudson.model.Hudson legend". Learn more: https://www.jenkins.io/redirect/stapler-facet-restrictions

This seems unnecessary. Perhaps rename the view to _legend so it's a simple 404?

Copy link
Member

Choose a reason for hiding this comment

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

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 security-approved @jenkinsci/core-security-review reviewed this PR for security issues web-ui The PR includes WebUI changes which may need special expertise
Projects
None yet
5 participants