Class: Plutonium::UI::Interaction::Async::RunningBanner

Inherits:
Component::Base show all
Defined in:
lib/plutonium/ui/interaction/async/running_banner.rb

Overview

Lists the runs currently working on THIS resource, above its collection.

Why it exists

A dispatch redirects to the run's own page, but a user who navigates away has no way back short of knowing the URL. The index of the resource being worked on is where they will look, so that is where the run has to be.

Why it queries on target_type

target_type is a real column rather than a key inside the options JSON precisely so this predicate can be indexed — see the migration's own comment. An opaque run has no target_type at all and therefore appears on no resource index: it belongs to no resource.

Why it can render nothing

An always-present empty banner is chrome that teaches the user to ignore the area it occupies. When nothing is running there is nothing to say.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Component::Behaviour

#around_template

Methods included from Component::Tokens

#classes, #tokens

Methods included from Component::Kit

#BuildActionButton, #BuildActionsDropdown, #BuildAvatar, #BuildBlock, #BuildBreadcrumbs, #BuildBulkActionsToolbar, #BuildColorModeSelector, #BuildDynaFrameContent, #BuildDynaFrameHost, #BuildEmptyCard, #BuildFrameNavigatorPanel, #BuildModalCentered, #BuildModalSlideover, #BuildPageHeader, #BuildPanel, #BuildRowActionsDropdown, #BuildSkeletonTable, #BuildTabList, #BuildTableFilterPills, #BuildTableInfo, #BuildTablePagination, #BuildTableScopesBar, #BuildTableScopesPills, #BuildTableSearchBar, #BuildTableToolbar, #BuildTableViewSwitcher, #method_missing, #respond_to_missing?

Constructor Details

#initialize(runs:) ⇒ RunningBanner

Returns a new instance of RunningBanner.



27
28
29
# File 'lib/plutonium/ui/interaction/async/running_banner.rb', line 27

def initialize(runs:)
  @runs = runs
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Plutonium::UI::Component::Kit

Instance Attribute Details

#runsObject (readonly)

Returns the value of attribute runs.



31
32
33
# File 'lib/plutonium/ui/interaction/async/running_banner.rb', line 31

def runs
  @runs
end

Instance Method Details

#view_templateObject



33
34
35
36
37
38
39
# File 'lib/plutonium/ui/interaction/async/running_banner.rb', line 33

def view_template
  return if runs.empty?

  div(class: "pu-running-banner mb-3 rounded-[var(--pu-radius-md)] border border-[var(--pu-border)] bg-[var(--pu-surface-alt)] p-3 space-y-2") do
    runs.each { |run| render_run(run) }
  end
end