-
Notifications
You must be signed in to change notification settings - Fork 42
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
Width and height are not set for large icons (addBadge) #148
Comments
Thanks for the details. I can duplicate the problem with a one line Pipeline script using the set of plugins and versions you provided:
BeforeThe icon is 16x16 even though the source icon is using a 48x48 icon. This is the preferred result. AfterThe icon is 48x48. This is not the preferred result. |
Symbols do not require height or width but icons without height and width will render at their original size instead of rendering at 16x16. Fixes jenkinsci#148
@Tersaramor I've attempted a fix for the bug. Could you confirm that the incremental build works well in your environment? |
* Set height and width for icons that are not symbols Symbols do not require height or width but icons without height and width will render at their original size instead of rendering at 16x16. Fixes #148 * Simplify expression using startsWith, not indexOf * Use when/otherwise to simplify logic * Use `icon-sm` for all sizes, not just for symbols Uses the common way of specifying sizes now instead of explicitly declaring height and width attributes of the image. Simplifies the code dramatically and avoids conditionals in the jelly file. --------- Co-authored-by: Martin Pokorny <89339813+mPokornyETM@users.noreply.github.com>
Hey @timonwalkley. Sorry you still need to deal with this issue. I can reproduce it, however I think it has to do with the SVG itself as it does have some sort of sizing attached to it which I'm not sure we can actually override. I'll look a little deeper into it and come back to you as soon as possible. |
From what I can tell this happens for the "core" icons that can be referenced as either It appears that in icon.jelly it is determined hey, this is a core icon using Functions and IconSet. There it is decided hey, since this is a core icon it has this size which is then used for the style. This functionallity is rather complex and can likely not be adapted even though one could argue that overridding the actual given css class could be considered a bug. Maybe someone from @jenkinsci/sig-ux could share some insights here or confirm my observations. As of now it seems the only remedy is to hard-code the icon |
can't you add something like the class |
We already do that, but it does not seem to work for these icons - or at least not always.
does produce icons with width and height set to 48px when used with
works perfectly fine. Right now I fail to reproduce it on master (but I'm certain I did just an hour ago) |
I would be wary of defaulting to html for tooltips but that code looks fine |
The icon code is a mess, you would need to experiment with it to understand why this is happening: I can't tell from just reading it. |
I tried to dig a little deeper into it and found that in This means if i build an icon using If I just use I do agree this code is a mess and changing anything will end up causing more issues for sure. |
nice analysis. I'm sure it could be cleaned up, but would require some testing and analysis... |
@jonsgity that does not seem like it is related to the badge plugin or at least it is a very different behavior than any other report. Please open a new issue and include the stack trace that has likely been written to the Jenkins log file when that message appears. You can also test the build of this pull request in your environment to confirm that it does not resolve the issue. The "Checks" tab includes a section called "Incrementals". The page in that section provides a URL where you can download the build of this pull request. |
Jenkins and plugins versions report
Jenkins: 2.440.3, Java 11.0.13, and plugins
What Operating System are you using (both controller, and any agents involved in the problem)?
Ubuntu 20.04
Reproduction steps
addBadge(icon: relativeIconPath, text: displayName, link: url)
Expected Results
Icon is 16x16
Actual Results
icon has actual size
Anything else?
Probably related to https://github.com/jenkinsci/badge-plugin/pull/130/files
Are you interested in contributing a fix?
No response
The text was updated successfully, but these errors were encountered: