Class Badge


  • public class Badge
    extends Object
    Definition of a badge that can be returned by a ManagementLink implementation. The badge is shown as a small overlay over the corresponding icon on the Manage Jenkins page, it can display additional information in a tooltip and change it's color depending on the severity.

    A badge mainly serves as a fast feedback for the corresponding management page. It could be used to just display some short status information or hint that some action can be taken. For example the badge on Manage Plugins shows information about the number of available updates and in its tooltip additionally how many updates contain incompatible changes or fix security vulnerabilities. It also changes its color when there are security fixes available.

    A badge might display the same information as an AdministrativeMonitor. While an AdministrativeMonitor can be disabled, a badge will always be shown. E.g. the badge of OldDataMonitor.ManagementLinkImpl always shows the number of old data entries.

    Since:
    2.385
    • Constructor Detail

      • Badge

        public Badge​(@NonNull
                     String text,
                     @NonNull
                     String tooltip,
                     @NonNull
                     Badge.Severity severity)
        Create a new Badge
        Parameters:
        text - The text to be shown in the badge. Keep it short, ideally just a number. More than 6 or 7 characters do not look good. Avoid spaces as they will lead to line breaks. as this might lead to line breaks.
        tooltip - The tooltip to show for the badge. Do not include html tags.
        severity - The severity of the badge (danger, warning, info)
    • Method Detail

      • getText

        public String getText()
        The text to be shown in the badge.
        Returns:
        badge text
      • getTooltip

        public String getTooltip()
        The tooltip of the badge.
        Returns:
        tooltip
      • getSeverity

        public String getSeverity()
        The severity of the badge. Influences the background color of the badge.
        Returns:
        severity as String