jenkins
jenkins copied to clipboard
Add updates count badge to Updates sidebar item
Adds back the updates count badge introduced and removed in #6783, this time by adding an attribute to the task.jelly
component so that any view/plugin can use it.
Proposed changelog entries
- Add updates count badge to Updates sidebar item
Proposed upgrade guidelines
N/A
Submitter checklist
- [ ] (If applicable) Jira issue is well described
- [ ] Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change) and are in the imperative mood. Examples
- Fill-in the
Proposed changelog entries
section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
- Fill-in the
- [ ] Appropriate autotests or explanation to why this change has no tests
- [ ] New public classes, fields, and methods are annotated with
@Restricted
or have@since TODO
Javadoc, 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 directives (see documentation on jenkins.io). - [ ] For dependency updates: links to external changelogs and, if possible, full diffs
Desired reviewers
@jenkinsci/sig-ux
Maintainer checklist
Before the changes are marked as ready-for-merge
:
- [ ] There are at least 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 does not block the change
- [ ] Changelog entries in the PR 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,
upgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (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).
There should be usage guidelines.
@janfaracik is that something you're able to add to design library before we ship this?
There should be usage guidelines.
@janfaracik is that something you're able to add to design library before we ship this?
Will do, am I good to add it to the existing 'Layouts' PR?
I think there should there be support for badges in context menus. For a generalized feature (e.g. imagine badges with open issues in various warnings-ng
contributed sidepanel tasks) it probably makes sense to support that. Another use case of an improved task API for the context menu would be Manage Jenkins and entries like "Manage Old Data" or "In-process Script Approval" that could show a badge.
Will do, am I good to add it to the existing 'Layouts' PR?
Yes 👍
Will do, am I good to add it to the existing 'Layouts' PR?
Yes 👍
Updated that PR with some examples of when to use badges:
Do you plan to address Daniel's comment on badges in context menu's in this PR?
Do you plan to address Daniel's comment on badges in context menu's in this PR?
I'd favour doing them separately to this PR (just to get this in as I think its a nice-to-have), happy to do it though in this if you prefer @daniel-beck?
I'd prefer that this is done at the same time, to have parity between sidepanel and menus. (Unless there's a UX reason that menus should not have these badges, now or later, of course.)
@janfaracik do you plan to take a look at the context menu changes?
@janfaracik do you plan to take a look at the context menu changes?
I will do for sure, just a little swamped at the moment.
Updated the PR so that dropdown menus now support badges, as well as items in the Manage Jenkins page.

Currently badges just support numbers, could there be a use case for returning text?
Currently badges just support numbers, could there be a use case for returning text?
This is a good question. I think that we should not restrict it to only numbers in order to prevent future API breakages. Most badges support at least percentages (e.g., 83%).
Currently badges just support numbers, could there be a use case for returning text?
This is a good question. I think that we should not restrict it to only numbers in order to prevent future API breakages. Most badges support at least percentages (e.g., 83%).
see discussion here as well: https://github.com/jenkinsci/jenkins/pull/6995#discussion_r945711898
Currently badges just support numbers, could there be a use case for returning text?
This is a good question. I think that we should not restrict it to only numbers in order to prevent future API breakages. Most badges support at least percentages (e.g., 83%).
see discussion here as well: #6995 (comment)
That means it would be better to use a string for the content. I'm not sure if it makes sense to define an upper limit for the number of visible characters, I hope that developers will use that feature wisely.
I've merged this feature with https://github.com/jenkinsci/jenkins/pull/6995 in https://github.com/janfaracik/jenkins/compare/add-updates-badge...timja:jenkins:add-updates-badge-2?expand=1
All working, just missing tooltips support which came from the other feature which shouldn't be hard to add
Please take a moment and address the merge conflicts of your pull request. Thanks!
Please take a moment and address the merge conflicts of your pull request. Thanks!
Please take a moment and address the merge conflicts of your pull request. Thanks!
Is this PR good for merge notice now @timja?
/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!