Class NotificationBell

java.lang.Object
hudson.model.Descriptor<PageDecorator>
hudson.model.PageDecorator
io.jenkins.plugins.interactiveinput.ui.NotificationBell
All Implemented Interfaces:
ExtensionPoint, Describable<PageDecorator>, Saveable, Loadable, OnMaster

@Extension public class NotificationBell extends PageDecorator
Injects the notification-centre data mount and shared client into every Jenkins page (§6.2.1, §8.4).

The header button itself is a primary RootAction (NotificationBellAction); this PageDecorator only contributes header.jelly (the interactive-input.bell adjunct) and footer.jelly (a hidden data mount plus the run-scoped sidebar/console controllers). bell.js finds the core header button by NotificationBellAction.HEADER_BUTTON_ID and attaches the live pending-count badge.

The bell is context-aware: on the dashboard it lists every question the viewer can answer; inside a pipeline (a page under a Job) it scopes to that pipeline's questions. The current job is resolved from the Stapler ancestor chain and handed to the client via a data-job attribute; the initial server-rendered count is scoped to match.

  • Constructor Details

    • NotificationBell

      public NotificationBell()
  • Method Details

    • isBellVisible

      public boolean isBellVisible()
      Returns:
      true if the bell should render on the current page: the feature is enabled and the viewer has at least Overall/Read (so it never shows on the login page to anonymous).
    • isClientVisible

      public boolean isClientVisible()
      Returns:
      true if the shared client adjunct should load on this page: the viewer has at least Overall/Read. The adjunct is loaded even when the bell mount itself is hidden (the notification centre is off) so its delegated click handlers work on every page — the build-history badge and, for B6, the console "Open interactive input" link, which opens the dialog in place on the Console Output page. Without a mount the adjunct only wires those handlers; it never polls. It stays gated on Overall/Read so it never loads for anonymous users on the login page.
    • getCurrentJobFullName

      public String getCurrentJobFullName()
      Returns:
      the full name of the Job the current request is under, or an empty string on the dashboard / non-job pages. Drives the client's dashboard-vs-pipeline scoping.
    • getInitialCount

      public int getInitialCount()
      Returns:
      the pending count for the initial server render, scoped to the current job if any.
    • isRunContextActive

      public boolean isRunContextActive()
      Returns:
      true when the run-scoped controllers should render: the per-project centre is on (so the run's "Interactive Input" side link exists), the page is under a build, and that build has at least one interactive-input question. Mirrors the run-action attach condition.
    • getCurrentRunJobFullName

      public String getCurrentRunJobFullName()
      Returns:
      the full name of the job owning the current build, or an empty string off a build page.
    • getCurrentRunBuildNumber

      public int getCurrentRunBuildNumber()
      Returns:
      the current build number, or 0 off a build page.
    • getCurrentRunPendingCount

      public int getCurrentRunPendingCount()
      Returns:
      the pending (WAITING) count scoped to the current build for the sidebar badge's initial render.
    • isRunViewContextActive

      public boolean isRunViewContextActive()
      Returns:
      true when the run-scoped Interactive View controller should render: the per-project centre and the interactiveView feature are on, the page is under a build, and that build has at least one review document. Mirrors InteractiveViewRunAction's attach condition so the sidebar "Interactive View" link's count stays live on every run sub-page.
    • getCurrentRunViewPendingCount

      public int getCurrentRunViewPendingCount()
      Returns:
      the open-review count scoped to the current build for the view sidebar badge's initial render.
    • isConsolePage

      public boolean isConsolePage()
      Returns:
      true when the current request is a build's HTML Console Output page (…/console or …/consoleFull). Used to scope the auto-open dialog to the console page only (the raw …/consoleText endpoint returns plain text with no page decoration, so it never reaches this decorator).
    • isReopenBuildDialogEveryVisit

      public boolean isReopenBuildDialogEveryVisit()
      Returns:
      whether the auto-open dialog re-opens on every console visit (mode B) rather than once per browser session (mode A, the default). Read by the client from the auto-open controller.
    • getPollingIntervalSeconds

      public int getPollingIntervalSeconds()
    • isRichModalEnabled

      public boolean isRichModalEnabled()
    • getIconClassName

      public String getIconClassName()
      Returns:
      the theme-aware symbol class for the configured notification icon.
    • isTabNotificationBadge

      public boolean isTabNotificationBadge()
      Returns:
      whether the client should mirror the pending count in the browser tab (title prefix + a dot painted on top of the existing favicon). On by default; a look-and-feel toggle under Manage Jenkins → Appearance. The client reads this from the bell mount's data-tab-badge attribute.
    • getHeaderActionId

      public String getHeaderActionId()
      Returns:
      the id core assigns to NotificationBellAction's header button, so bell.js can attach the live badge without guessing a CSS insertion point.