Module: Karst::Web::PopulationsPanel

Defined in:
lib/karst/web/populations_panel.rb

Overview

The local approval surface for Karst::Access::PopulationDiscovery: browse the application-defined groups Karst found, approve the ones Karst may try, optionally preview one, and see which approvals are no longer doing anything. Approving is the whole workflow -- generating Ruby configuration is kept as an advanced export path, not the way a developer is expected to finish.

Kept as a pure renderer, exactly like Karst::Web::Panel: every value this module needs (the discovery result, the approved entries, stale approvals, an optional storage error, an optional generated snippet, an optional single preview) is computed by Karst::Web::Middleware and passed in, so this file never touches Active Record, the filesystem, or Karst.config directly. rubocop:disable Metrics/ModuleLength

Constant Summary collapse

CANDIDATE_SEPARATOR =
"::"

Class Method Summary collapse

Class Method Details

.render(discovery:, approved: [], stale: [], snippet: nil, preview: nil, storage_path: nil, storage_error: nil, saved: false) ⇒ Object

approved and each entry of stale are anything exposing #model_name/#method_name -- in practice Karst::Access::PopulationApprovals::Entry. rubocop:disable Metrics/ParameterLists



142
143
144
145
146
147
148
# File 'lib/karst/web/populations_panel.rb', line 142

def render(discovery:, approved: [], stale: [], snippet: nil, preview: nil, storage_path: nil,
           storage_error: nil, saved: false)
  nonce = SecureRandom.hex(16)
  state = { approved: approved, stale: stale, snippet: snippet, preview: preview,
            storage_path: storage_path, storage_error: storage_error, saved: saved }
  [200, headers(nonce), [document(discovery, state, nonce)]]
end