Class: Smriti::Admin::MatViewRunsController

Inherits:
ApplicationController show all
Includes:
DatatableHelper
Defined in:
app/controllers/smriti/admin/mat_view_runs_controller.rb

Overview

Smriti::Admin::MatViewRunsController

Controller for viewing materialised view run history in the admin UI.

Responsibilities:

  • Provides a list of recent runs (create/refresh/delete) for all definitions.
  • Shows details for an individual run in a Turbo frame/drawer context.

Filters:

  • before_action :ensure_frame → enforces frame-only access.
  • before_action :set_mat_view_run → loads and authorizes a single run.

Views:

  • Index renders smriti/admin/runs/embed_frame partial.
  • Show renders smriti/admin/runs/embed_show_drawer partial.

Instance Method Summary collapse

Methods included from AuthBridge

#user

Instance Method Details

#indexvoid

This method returns an undefined value.

GET /:lang/admin/runs

Two part rendering:

  • Full page load when no stream param: renders index with datatable frame. This is essentially shell of the datatable for initial load.
  • When shell is loaded, it requests the stream version which renders just the datatable rows and pagination controls. This allows for dynamic updates via Turbo Streams.


43
44
45
46
47
48
49
50
51
52
53
# File 'app/controllers/smriti/admin/mat_view_runs_controller.rb', line 43

def index
  authorize_smriti!(:read, :smriti_runs)

  assign_index_state

  if params[:stream].present?
    render_dt_turbo_streams
  else
    render 'index', formats: :html, layout: 'smriti/turbo_frame', locals: { row_meta: @row_meta }
  end
end

#showvoid

This method returns an undefined value.

GET /:lang/admin/runs/:id

Displays details for a single run.



60
61
62
63
64
# File 'app/controllers/smriti/admin/mat_view_runs_controller.rb', line 60

def show
  authorize_smriti!(:read, :smriti_run, @run)

  render 'show', formats: :html, layout: 'smriti/turbo_frame'
end