jenkins icon indicating copy to clipboard operation
jenkins copied to clipboard

Add updates count badge to Updates sidebar item

Open janfaracik opened this issue 2 years ago • 8 comments

Screenshot 2022-09-08 at 21 21 57

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
  • [ ] 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 a Proposed 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).

janfaracik avatar Sep 08 '22 20:09 janfaracik

There should be usage guidelines.

@janfaracik is that something you're able to add to design library before we ship this?

timja avatar Sep 09 '22 10:09 timja

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?

janfaracik avatar Sep 09 '22 10:09 janfaracik

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.

daniel-beck avatar Sep 09 '22 10:09 daniel-beck

Will do, am I good to add it to the existing 'Layouts' PR?

Yes 👍

timja avatar Sep 09 '22 10:09 timja

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:

image

janfaracik avatar Sep 09 '22 12:09 janfaracik

Do you plan to address Daniel's comment on badges in context menu's in this PR?

timja avatar Sep 09 '22 13:09 timja

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?

janfaracik avatar Sep 10 '22 14:09 janfaracik

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.)

daniel-beck avatar Sep 10 '22 20:09 daniel-beck

@janfaracik do you plan to take a look at the context menu changes?

timja avatar Oct 20 '22 08:10 timja

@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.

janfaracik avatar Oct 23 '22 12:10 janfaracik

Updated the PR so that dropdown menus now support badges, as well as items in the Manage Jenkins page.

image

Currently badges just support numbers, could there be a use case for returning text?

janfaracik avatar Oct 23 '22 20:10 janfaracik

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%).

uhafner avatar Oct 24 '22 12:10 uhafner

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

timja avatar Oct 24 '22 12:10 timja

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.

uhafner avatar Oct 24 '22 20:10 uhafner

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

timja avatar Dec 30 '22 23:12 timja

Please take a moment and address the merge conflicts of your pull request. Thanks!

github-actions[bot] avatar Jan 02 '23 18:01 github-actions[bot]

Please take a moment and address the merge conflicts of your pull request. Thanks!

github-actions[bot] avatar Mar 17 '23 09:03 github-actions[bot]

Please take a moment and address the merge conflicts of your pull request. Thanks!

github-actions[bot] avatar Mar 25 '23 09:03 github-actions[bot]

Is this PR good for merge notice now @timja?

janfaracik avatar Apr 13 '23 12:04 janfaracik

/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!

timja avatar Apr 13 '23 15:04 timja