Class StatusLabels

java.lang.Object
io.jenkins.plugins.batchcontrol.ui.StatusLabels

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class StatusLabels extends Object
#18.2 (Wave D, D2): the readable label a screen shows for a request, grant or activation status, an incident status or a run cause, instead of the enum name. The enum name stays the data: the element showing a label carries it in data-batch-control-status (tags/status.jelly), and CSV exports, filter tokens and the JSON summary keep it.

A request, grant or activation status and an incident status are shown as a colour badge: tone(java.lang.Enum<?>) names the badge's tone, which the element carries in data-batch-control-tone and the plugin stylesheet colours from the theme. The tone follows the constant, never a page's own wording of the label. A run cause has no tone and stays plain text. The one exception is endedTone(java.lang.Enum<?>): in the Ended table of the grants list and of the activations list an approved request is no longer in effect, so it is neutral there, whatever the cell words; the caller says where the badge is, the label is not looked at.

Each enum is mapped by a switch expression without a default branch, so a new constant without a label or a tone does not compile. Views reach this class through BatchControlRootAction#statusLabel and #statusTone (never j:invokeStatic, which cannot see plugin classes in a real Jenkins).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The run request page's wording for an approved request whose run has not started yet.
    static final String
    The label of a build that has no result yet because it is still running.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    endedTone(Enum<?> value)
    The tone of the badge showing value in an Ended table (the grants list, the activations list): an RequestStatus.APPROVED request listed there is no longer in effect (its window expired or was revoked, or a later approval replaced it), so it is neutral; every other value has its tone(java.lang.Enum<?>).
    static List<String>
    The result names the incidents' Result filter offers: the results that can open an incident.
    static String
    The opening of the incidents list's introduction: the configured incidentResults that can open an incident, as their labels (ofResult(java.lang.String)) in lower case after the first word, in the order of incidentResultNames() whatever order the setting holds, joined with commas and a final "and", then "builds" (Failed and unstable builds under the default setting).
    static String
    of(Enum<?> value)
    The label of value; an empty string for null.
    static String
    ofResult(String result)
    The label of a build result, worded as core's status icons in English: the one mapping behind the Result filter options and every result cell (the incidents list, the incident page, History, the dashboard, the run request page's Build table), so the two cannot drift apart.
    static String
    The label of a run request's status: an approved run request is one whose run has not started yet (it becomes RequestStatus.EXECUTED when it does).
    static List<String>
    The result names the runs' Result filter offers, best first.
    static Result
    #6 (Wave D, D3): the build result named exactly name (one of resultNames()), or null for anything else, which the Run cell shows as text without a status icon.
    static String
    tone(Enum<?> value)
    The tone of the badge showing value, in lower case (warning, info, success, danger or neutral), for a RequestStatus or an IncidentStatus; null for anything else (a run cause, null), which is not a badge.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • APPROVED_WAITING_TO_RUN

      public static final String APPROVED_WAITING_TO_RUN
      The run request page's wording for an approved request whose run has not started yet.
      See Also:
    • IN_PROGRESS

      public static final String IN_PROGRESS
      The label of a build that has no result yet because it is still running.
      See Also:
  • Method Details

    • resultNames

      public static List<String> resultNames()
      The result names the runs' Result filter offers, best first.
    • incidentResultNames

      public static List<String> incidentResultNames()
      The result names the incidents' Result filter offers: the results that can open an incident.
    • of

      public static String of(@CheckForNull Enum<?> value)
      The label of value; an empty string for null. An enum this class does not know is shown as its name in sentence case, without underscores.
    • tone

      @CheckForNull public static String tone(@CheckForNull Enum<?> value)
      The tone of the badge showing value, in lower case (warning, info, success, danger or neutral), for a RequestStatus or an IncidentStatus; null for anything else (a run cause, null), which is not a badge.
    • endedTone

      @CheckForNull public static String endedTone(@CheckForNull Enum<?> value)
      The tone of the badge showing value in an Ended table (the grants list, the activations list): an RequestStatus.APPROVED request listed there is no longer in effect (its window expired or was revoked, or a later approval replaced it), so it is neutral; every other value has its tone(java.lang.Enum<?>). Everywhere else an approved request is info.
    • ofRunRequest

      public static String ofRunRequest(@CheckForNull RequestStatus status)
      The label of a run request's status: an approved run request is one whose run has not started yet (it becomes RequestStatus.EXECUTED when it does).
    • ofResult

      public static String ofResult(@CheckForNull String result)
      The label of a build result, worded as core's status icons in English: the one mapping behind the Result filter options and every result cell (the incidents list, the incident page, History, the dashboard, the run request page's Build table), so the two cannot drift apart. A result is plain text, never a badge (no tone(java.lang.Enum<?>)). The name itself for a value that is not a result name; an empty string for null. CSV exports keep the name.
    • resultOf

      @CheckForNull public static Result resultOf(@CheckForNull String name)
      #6 (Wave D, D3): the build result named exactly name (one of resultNames()), or null for anything else, which the Run cell shows as text without a status icon.
    • incidentResultsOpening

      public static String incidentResultsOpening(@CheckForNull Collection<String> configured)
      The opening of the incidents list's introduction: the configured incidentResults that can open an incident, as their labels (ofResult(java.lang.String)) in lower case after the first word, in the order of incidentResultNames() whatever order the setting holds, joined with commas and a final "and", then "builds" (Failed and unstable builds under the default setting). An empty string when the setting names none of them (the configuration never stores an empty list); the view then leaves the sentence out.