-
Notifications
You must be signed in to change notification settings - Fork 11
Add Favorites Plugin Integration to Auto-show/hide App Nav Button #211
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
base: main
Are you sure you want to change the base?
Conversation
src/main/java/io/jenkins/plugins/customizable_header/HeaderRootAction.java
Fixed
Show fixed
Hide fixed
mawinter69
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.
Way too complex. This can be achieved much simpler.
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 class is not needed. When the appnav button is visible it will fetch dynamically all links including the currently defined favorites for a user.
| this.logo = logo; | ||
| } | ||
|
|
||
| @Exported |
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.
Not needed
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.
Changes are not needed
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.
The favorite plugin already sends a javascript event favorite-plugin-icon-change
See https://github.com/jenkinsci/favorite-plugin/blob/da0aca35f77d219c65bff687c6eac96bb9404445/src/main/resources/hudson/plugins/favorite/assets.js
Lines 14 and 23
So all you need to do is setup and event listener to react on that event and then ask via a fetch call if links are defined or not.
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.
Reacting if someone adds a link (could also be an admin that configured the first link) or you toggle the favorite in another window would be a nice to have but is not a must here. For that it is sufficient to just ask if links are defined for the user every 5 to 10 seconds and then show/hide the app-nav button accordingly
| <j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"> | ||
| <f:entry> | ||
| <f:textarea field="message" previewEndpoint="/markupFormatter/previewDescription"/> | ||
| <f:textarea field="message" previewEndpoint="/markupFormatter/previewDescription?isPreview=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.
That seems to be unrelated for the purpose of this PR
| <j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout"> | ||
| <j:if test="${!it.dismissed}"> | ||
| <div class="jenkins-alert jenkins-alert-${it.level.name()} custom-header__system-message-header"> | ||
| <!-- Use a conditional style for previews --> |
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.
That seems to be unrelated for the purpose of this PR
|
@mawinter69 Thank you for the feedback! I apologize for the overly complex approach. |
|
I have to apologize I should have formulated the issue more clearly. |
This PR adds integration with the Favorites plugin to automatically show/hide the app navigation button when there are no other links defined and a favorite is added or removed. Solves #203 .
Key changes:
Testing done
I manually tested this by:
Submitter checklist