-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
[FIX JENKINS-54325] Add support for multiple SimplePageDecorators in … #3710
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
Conversation
…login.jelly Signed-off-by: Matt Sicker <boards@gmail.com>
Wadeck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you can @Deprecated the getSimplePageDecorator()
RC: The hudson/security/HudsonPrivateSecurityRealm/signup.jelly also requires a modification otherwise the login page will work but not the signup one ;)
Signed-off-by: Matt Sicker <boards@gmail.com>
Signed-off-by: Matt Sicker <boards@gmail.com>
Signed-off-by: Matt Sicker <boards@gmail.com>
|
@Wadeck Deprecated the old function, and updated signup.jelly |
| } | ||
| </script> | ||
| </j:if> | ||
| <div class="footer"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure about the HTML structure here. My use case in paranoia-plugin is to insert a <script> element here, so the rendering doesn't matter too much. The default SimplePageDescriptor does not specify a footer fragment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with that
Wadeck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐝
scherler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internal: login.jelly and signup.jelly now support displaying all registered SimplePageDecorator extensions rather than just the top priority one.
Actually there is a point behind to return only one. Your changes will provoke that all existing login pages would display 2 logos when a custom one is provided.
Did you test this?
If you are not provide a way to actually limit e.g. the logo to only one implementations I am not seeing the point to break the only one implementation approach.
|
I tested this mainly with a new plugin called Paranoia. The problem being that I can't provide any footer without losing the header, and I didn't want to copy the default headers and styles. Perhaps the logo should only display the first one while the other includes can overlap? |
|
Did you see https://jenkins.io/blog/2018/06/27/new-login-page/ ? There is no need to copy and paste but you can include the default ones. Regarding the footer could the paranoia plugin not expose another extension point which aggregates all footers and then inject it as only one The reason of only one is to have a clean design and prevent surprises in design when plugins are extending. |
|
Are you suggesting an extension point in core? If so, I could redo this change as such to add some sort of footer decorator. Otherwise, I'm not sure what you mean. I'd like to have this plugin be able to work with other custom page decorators or still use the default one otherwise. |
|
Not in core in your plugin, people using it can extend it. |
|
But then I'm stuck with either an unstyled set of login/signup pages, or I'm copying simple-head.jelly and simple-header.jelly to my plugin which makes those pages unable to be overridden. |
|
Hmm, do you want to have a quick hangouts/meet/... about it? In the blog post I wrote: That is using the core/default styles and adding to it, would that not cover your case? |
|
I mean I can do that, but this plugin isn't overriding the styles there. I'm injecting scripts into pages. Edit: see my usage here: https://github.com/jenkinsci/paranoia-plugin/blob/master/src/main/resources/io/jenkins/plugins/paranoia/DisableLoginAutocompleteDecorator/simple-footer.jelly |
scherler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I see it you need simply provide src/main/resources/jenkins/model/DefaultSimplePageDecorator/simple-footer.jelly and inject your stuff there
| <div class="footer"> | ||
|
|
||
| <st:include it="${simpleDecorator}" page="simple-footer.jelly" optional="true"/> | ||
| <j:forEach var="simpleDecorator" items="${simpleDecorators}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually the only change you need besides creating the methods to get all decorators.
| * @since 2.128 | ||
| * @deprecated use {@link #getSimplePageDecorators()} instead | ||
| */ | ||
| @Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nupp
| * Gets all {@link SimplePageDecorator}s for the login page. | ||
| * @since TODO | ||
| */ | ||
| public static List<SimplePageDecorator> getSimplePageDecorators() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| * Returns all login page decorators. | ||
| * @since TODO | ||
| */ | ||
| public static List<SimplePageDecorator> all() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| <!-- in case of error we want to surround the form elements with an error hint --> | ||
| <j:set var="inputClass" value="${data.errorMessage!=null ? 'danger' : 'normal'}"/> | ||
| <j:set var="simpleDecorator" value="${h.simplePageDecorator}"/> | ||
| <j:set var="simpleDecorators" value="${h.simplePageDecorators}"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need both
| <!-- we do not want bots on this page --> | ||
| <meta name="ROBOTS" content="NOFOLLOW"/> | ||
| <!-- css styling, will fallback to default implementation --> | ||
| <st:include it="${simpleDecorator}" page="simple-head.jelly" optional="true"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nupp
| } | ||
| </script> | ||
| </j:if> | ||
| <div class="footer"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with that
| <!-- in case of error we want to surround the form elements with an error hint --> | ||
| <j:set var="inputClass" value="${error ? 'danger' : 'normal'}"/> | ||
| <j:set var="simpleDecorator" value="${h.simplePageDecorator}"/> | ||
| <j:set var="simpleDecorators" value="${h.simplePageDecorators}"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above, you need both
| <!-- we do not want bots on this page --> | ||
| <meta name="ROBOTS" content="NOFOLLOW" /> | ||
| <!-- css styling, will fallback to default implementation --> | ||
| <st:include it="${simpleDecorator}" page="simple-head.jelly" optional="true"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
| <j:otherwise> | ||
| <div class="simple-page" role="main"> | ||
| <div class="modal login"> | ||
| <st:include it="${simpleDecorator}" page="simple-header.jelly" optional="true"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
|
Ah, I see what you mean. I'll update this to only add support for multiple footers. Then I can set a low priority on my decorator. |
|
Redone in #3721. |
…login.jelly
Signed-off-by: Matt Sicker boards@gmail.com
See JENKINS-54325.
Proposed changelog entries
Internal:login.jellyandsignup.jellynow support displaying all registeredSimplePageDecoratorextensions rather than just the top priority one.Internal:the password field in the login page now has a matchingidas itsname(j_password) for easier access from the DOM.Submitter checklist
* Use the
Internal:prefix if the change has no user-visible impact (API, test frameworks, etc.)Desired reviewers
@reviewbybees @scherler @Wadeck