Class: Karafka::Web::Ui::Base
- Inherits:
-
Roda
- Object
- Roda
- Karafka::Web::Ui::Base
- Defined in:
- lib/karafka/web/ui/base.rb
Overview
Base Roda application
Direct Known Subclasses
Constant Summary collapse
- CONTEXT_DETAILS =
Details that need to be evaluated in the context of OSS or Pro web UI. If those would be evaluated in the base, they would not be initialized as expected
lambda do plugin( :public, root: Karafka::Web.gem_root.join('lib/karafka/web/ui/public'), # Cache all static files for the end user for as long as possible # We can do it because we ship per version assets so they invalidate with gem bumps headers: { 'Cache-Control' => 'max-age=31536000, immutable' }, gzip: true, brotli: true ) plugin :render_each plugin :partials # The secret here will be reconfigured after Web UI configuration setup # This is why we assign here a random value as it will have to be changed by the end # user to make the Web UI work. plugin :sessions, key: '_karafka_session', secret: SecureRandom.hex(64) plugin :route_csrf end
Constants included from Helpers::TailwindHelper
Helpers::TailwindHelper::TYPES
Instance Method Summary collapse
-
#params ⇒ Karafka::Web::Ui::Controllers::Requests::Params
Curated params.
-
#render_response(response) ⇒ Object
Sets appropriate template variables based on the response object and renders the expected view.
Methods included from Helpers::TailwindHelper
#badge, #link_button, #tailwind_types
Methods included from Helpers::ApplicationHelper
#deep_merge, #flat_hash, #format_memory, #human_readable_time, #icon, #kafka_state_badge, #lag_trend_badge, #lag_with_label, #lso_risk_state_badge, #lso_risk_state_bg, #nav_class, #number_with_delimiter, #object_value_to_s, #offset_with_label, #poll_state_with_change_time_label, #relative_time, #sort_link, #status_badge, #tags, #time_with_label, #truncate, #view_title
Methods included from Helpers::PathsHelper
#asset_path, #explorer_path, #flatten_params, #root_path, #scheduled_messages_explorer_path
Instance Method Details
#params ⇒ Karafka::Web::Ui::Controllers::Requests::Params
Returns curated params.
162 163 164 |
# File 'lib/karafka/web/ui/base.rb', line 162 def params Controllers::Requests::Params.new(request.params) end |
#render_response(response) ⇒ Object
Sets appropriate template variables based on the response object and renders the expected view
151 152 153 154 155 156 157 158 159 |
# File 'lib/karafka/web/ui/base.rb', line 151 def render_response(response) response.attributes.each do |key, value| instance_variable_set( "@#{key}", value ) end view(response.path) end |