design-library-plugin icon indicating copy to clipboard operation
design-library-plugin copied to clipboard

Add a badge CSS style for tables

Open uhafner opened this issue 2 years ago • 7 comments

What feature do you want to see added?

For table cells we currently have the styling

jenkins-table__link jenkins-table__badge model-link inside

to show a badge-style link for model elements:

Bildschirmfoto 2022-04-30 um 21 10 25

It would be helpful for plugins like the warnings and code coverage plugins (and maybe a lot of otheres), if there would be similar stylings available to show plugin results with a specific color. E.g. the code coverage as a percentage, where the background color can be customized by the plugin, e.g. red on bad coverage results, green for good, etc.

Bildschirmfoto 2022-04-30 um 21 12 56

I tried to extract that part of the CSS from our Jenkins styles but I must admit that I did not understand how you achieved this existing styling in our complex CSS and LESS structure. Additionally, it might make sense if we would provide such kind of styling in a general way in Jenkins, so other plugins would not reinvent the wheel.

Upstream changes

No response

uhafner avatar Apr 30 '22 19:04 uhafner

cc @janfaracik

timja avatar May 01 '22 05:05 timja

Good idea! :)

I'm working on just that for the eventual plugins manager redesign as demoed way back in the day on the UX sig.

It'll be as simple as adding a colour class e.g. jenkins-!-color-pink to change the tag colour.

janfaracik avatar May 02 '22 15:05 janfaracik

I've opened a PR for this https://github.com/jenkinsci/jenkins/pull/6538 :)

janfaracik avatar May 03 '22 22:05 janfaracik

Ok thanks! If I understand correctly, https://github.com/jenkinsci/jenkins/pull/6538 only adds the colors. That means the badge still is not available as a separate CSS class?

uhafner avatar May 06 '22 19:05 uhafner

Ok thanks! If I understand correctly, jenkinsci/jenkins#6538 only adds the colors. That means the badge still is not available as a separate CSS class?

If I'm understanding correctly, you'd want the 'badge' component on a page, not inside a table? Currently the badge has to be inside a table, I can work on changing that if so 👍

janfaracik avatar May 06 '22 21:05 janfaracik

No, I actually want the badge in the table but I did only manage to get the badge (jenkins-table__badge) that has the additional space for the model links, or am I missing something?

But having the badge as a separate concept globally would make sense as well 😄 E.g. we could show the number of warnings, code coverage percentage as a decorator for side panel links.

uhafner avatar May 10 '22 11:05 uhafner

Will welcome the badge as extra component as well

mPokornyETM avatar Nov 27 '23 10:11 mPokornyETM