Class: RailsErrorDashboard::ErrorsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rails_error_dashboard/errors_controller.rb

Constant Summary collapse

FILTERABLE_PARAMS =
%i[
  error_type
  unresolved
  platform
  application_id
  search
  severity
  timeframe
  frequency
  status
  assigned_to
  assignee_name
  priority_level
  hide_snoozed
  hide_muted
  reopened
  sort_by
  sort_direction
].freeze

Instance Method Summary collapse

Instance Method Details

#actioncable_health_summaryObject



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 457

def actioncable_health_summary
  unless RailsErrorDashboard.configuration.enable_actioncable_tracking &&
         RailsErrorDashboard.configuration.enable_breadcrumbs
    flash[:alert] = "ActionCable tracking is not enabled. Enable enable_actioncable_tracking and enable_breadcrumbs in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::ActionCableSummary.call(days, application_id: @current_application_id)
  all_channels = result[:channels]

  # Summary stats (computed before pagination)
  @unique_channels = all_channels.size
  @total_events = all_channels.sum { |c| c[:total_events] }
  @total_rejections = all_channels.sum { |c| c[:rejection_count] }

  @pagy, @channels = pagy(:offset, all_channels, limit: params[:per_page] || 25)
end

#activestorage_health_summaryObject



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 478

def activestorage_health_summary
  unless RailsErrorDashboard.configuration.enable_activestorage_tracking &&
         RailsErrorDashboard.configuration.enable_breadcrumbs
    flash[:alert] = "ActiveStorage tracking is not enabled. Enable enable_activestorage_tracking and enable_breadcrumbs in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::ActiveStorageSummary.call(days, application_id: @current_application_id)
  all_services = result[:services]

  # Summary stats (computed before pagination)
  @unique_services = all_services.size
  @total_operations = all_services.sum { |s| s[:total_operations] }
  @errors_with_storage = all_services.sum { |s| s[:error_count] }

  @pagy, @services = pagy(:offset, all_services, limit: params[:per_page] || 25)
end

#analyticsObject



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 170

def analytics
  days = (params[:days] || 30).to_i
  @days = days

  # Use Query to get analytics data (pass application filter)
  analytics = Queries::AnalyticsStats.call(days, application_id: @current_application_id)

  @error_stats = analytics[:error_stats]
  @errors_over_time = analytics[:errors_over_time]
  @errors_by_type = analytics[:errors_by_type]
  @errors_by_platform = analytics[:errors_by_platform]
  @errors_by_hour = analytics[:errors_by_hour]
  @top_users = analytics[:top_users]
  @resolution_rate = analytics[:resolution_rate]
  @mobile_errors = analytics[:mobile_errors]
  @api_errors = analytics[:api_errors]

  # Get recurring issues data (pass application filter)
  recurring = Queries::RecurringIssues.call(days, application_id: @current_application_id)
  @recurring_data = recurring

  # Get release correlation data (pass application filter)
  correlation = Queries::ErrorCorrelation.new(days: days, application_id: @current_application_id)
  @errors_by_version = correlation.errors_by_version
  @problematic_releases = correlation.problematic_releases
  @release_comparison = calculate_release_comparison

  # Get MTTR data (pass application filter)
  mttr_data = Queries::MttrStats.call(days, application_id: @current_application_id)
  @mttr_stats = mttr_data
  @overall_mttr = mttr_data[:overall_mttr]
  @mttr_by_platform = mttr_data[:mttr_by_platform]
end

#assignObject

Phase 3: Workflow Integration Actions (via Commands)



106
107
108
109
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 106

def assign
  @error = Commands::AssignError.call(params[:id], assigned_to: params[:assigned_to])
  redirect_to error_path(@error)
end

#batch_actionObject



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 228

def batch_action
  error_ids = params[:error_ids] || []
  action_type = params[:action_type]

  result = case action_type
  when "resolve"
    Commands::BatchResolveErrors.call(
      error_ids,
      resolved_by_name: params[:resolved_by_name],
      resolution_comment: params[:resolution_comment]
    )
  when "mute"
    Commands::BatchMuteErrors.call(error_ids, muted_by: params[:muted_by])
  when "unmute"
    Commands::BatchUnmuteErrors.call(error_ids)
  when "delete"
    Commands::BatchDeleteErrors.call(error_ids)
  else
    { success: false, count: 0, errors: [ "Invalid action type" ] }
  end

  if result[:success]
    flash[:notice] = "Successfully #{action_type}d #{result[:count]} error(s)"
  else
    flash[:alert] = "Batch operation failed: #{result[:errors].join(', ')}"
  end

  redirect_to errors_path
end

#cache_health_summaryObject



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 339

def cache_health_summary
  unless RailsErrorDashboard.configuration.enable_breadcrumbs
    flash[:alert] = "Breadcrumbs are not enabled. Enable them in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::CacheHealthSummary.call(days, application_id: @current_application_id)
  all_entries = result[:entries]

  # Summary stats (computed before pagination)
  @errors_with_cache = all_entries.size
  non_nil_rates = all_entries.map { |e| e[:hit_rate] }.compact
  @avg_hit_rate = non_nil_rates.any? ? (non_nil_rates.sum / non_nil_rates.size).round(1) : nil
  @total_cache_ops = all_entries.sum { |e| e[:reads] + e[:writes] }

  @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25)
end

#correlationObject



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 258

def correlation
  # Check if feature is enabled
  unless RailsErrorDashboard.configuration.enable_error_correlation
    flash[:alert] = "Error Correlation is not enabled. Enable it in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days
  correlation = Queries::ErrorCorrelation.new(days: days, application_id: @current_application_id)

  @errors_by_version = correlation.errors_by_version
  @errors_by_git_sha = correlation.errors_by_git_sha
  @problematic_releases = correlation.problematic_releases
  @multi_error_users = correlation.multi_error_users(min_error_types: 2)
  @time_correlated_errors = correlation.time_correlated_errors
  @period_comparison = correlation.period_comparison
  @platform_specific_errors = correlation.platform_specific_errors
end

#create_diagnostic_dumpObject



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 513

def create_diagnostic_dump
  unless RailsErrorDashboard.configuration.enable_diagnostic_dump
    flash[:alert] = "Diagnostic dumps are not enabled."
    redirect_to errors_path
    return
  end

  dump = Services::DiagnosticDumpGenerator.call

  app_name = RailsErrorDashboard.configuration.application_name ||
             ENV["APPLICATION_NAME"] ||
             (defined?(Rails) && Rails.application.class.module_parent_name) ||
             "Unknown"
  app = Commands::FindOrCreateApplication.call(app_name)

  DiagnosticDump.create!(
    application_id: app.id,
    dump_data: dump.to_json,
    captured_at: Time.current,
    note: params[:note].presence
  )

  flash[:notice] = "Diagnostic dump captured successfully."
  redirect_to diagnostic_dumps_errors_path
rescue => e
  flash[:alert] = "Failed to capture diagnostic dump: #{e.message}"
  redirect_to diagnostic_dumps_errors_path
end

#create_issueObject



146
147
148
149
150
151
152
153
154
155
156
157
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 146

def create_issue
  dashboard_url = error_url(params[:id])
  result = Commands::CreateIssue.call(params[:id], dashboard_url: dashboard_url)

  if result[:success]
    flash[:notice] = "Issue created successfully"
    flash[:new_issue_url] = result[:issue_url]
  else
    flash[:alert] = "Failed to create issue: #{result[:error]}"
  end
  redirect_to error_path(params[:id], anchor: "issue-tracking")
end

#database_health_summaryObject



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 380

def database_health_summary
  unless RailsErrorDashboard.configuration.enable_system_health
    flash[:alert] = "System health is not enabled. Enable it in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days

  # Live database health (display-time only)
  @live_health = Services::DatabaseHealthInspector.call

  # Separate host vs gem tables from live data
  all_tables = @live_health[:tables] || []
  @host_tables = all_tables.reject { |t| t[:gem_table] }
  @gem_tables = all_tables.select { |t| t[:gem_table] }

  # Historical connection pool stats
  result = Queries::DatabaseHealthSummary.call(days, application_id: @current_application_id)
  all_entries = result[:entries]

  # Summary stats (computed before pagination)
  @errors_with_pool = all_entries.size
  @max_utilization = all_entries.map { |e| e[:utilization] }.max || 0
  @total_dead = all_entries.sum { |e| e[:dead] }
  @total_waiting = all_entries.sum { |e| e[:waiting] }

  @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25)
end

#deprecationsObject



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 299

def deprecations
  unless RailsErrorDashboard.configuration.enable_breadcrumbs
    flash[:alert] = "Breadcrumbs are not enabled. Enable them in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::DeprecationWarnings.call(days, application_id: @current_application_id)
  all_deprecations = result[:deprecations]

  # Summary stats (computed before pagination)
  @unique_count = all_deprecations.size
  @total_count = all_deprecations.sum { |d| d[:count] }
  @affected_count = all_deprecations.flat_map { |d| d[:error_ids] }.uniq.size

  @pagy, @deprecations = pagy(:offset, all_deprecations, limit: params[:per_page] || 25)
end

#diagnostic_dumpsObject



499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 499

def diagnostic_dumps
  unless RailsErrorDashboard.configuration.enable_diagnostic_dump
    flash[:alert] = "Diagnostic dumps are not enabled. Enable them in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  scope = DiagnosticDump.recent
  scope = scope.where(application_id: @current_application_id) if @current_application_id.present?
  @total_dumps = scope.count

  @pagy, @dumps = pagy(:offset, scope, limit: params[:per_page] || 25)
end

#disable_coverageObject



557
558
559
560
561
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 557

def disable_coverage
  Services::CoverageTracker.disable!
  flash[:notice] = "Code path coverage disabled."
  redirect_back fallback_location: errors_path
end

#enable_coverageObject



542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 542

def enable_coverage
  unless RailsErrorDashboard.configuration.enable_coverage_tracking
    flash[:alert] = "Coverage tracking is not enabled in configuration."
    redirect_to errors_path
    return
  end

  if Services::CoverageTracker.enable!
    flash[:notice] = "Code path coverage enabled. Reproduce the error, then view source code to see executed lines."
  else
    flash[:alert] = "Could not enable coverage. Requires Ruby 3.2+."
  end
  redirect_back fallback_location: errors_path
end

#indexObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 59

def index
  # Use Query to get filtered errors
  errors_query = Queries::ErrorsList.call(filter_params)

  # Paginate with Pagy
  @pagy, @errors = pagy(:offset, errors_query, limit: params[:per_page] || 25)

  # Get dashboard stats using Query (pass application filter)
  @stats = Queries::DashboardStats.call(application_id: @current_application_id)

  # Get filter options using Query (pass application filter)
  filter_options = Queries::FilterOptions.call(application_id: @current_application_id)
  @error_types = filter_options[:error_types]
  @platforms = filter_options[:platforms]
  @assignees = filter_options[:assignees]
end

#job_health_summaryObject



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 360

def job_health_summary
  unless RailsErrorDashboard.configuration.enable_system_health
    flash[:alert] = "System health is not enabled. Enable it in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::JobHealthSummary.call(days, application_id: @current_application_id)
  all_entries = result[:entries]

  # Summary stats (computed before pagination)
  @errors_with_jobs = all_entries.size
  @total_failed = all_entries.sum { |e| e[:failed] || e[:errored] || 0 }
  @adapters_detected = all_entries.map { |e| e[:adapter] }.uniq

  @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25)
end


159
160
161
162
163
164
165
166
167
168
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 159

def link_issue
  result = Commands::LinkExistingIssue.call(params[:id], issue_url: params[:issue_url])

  if result[:success]
    flash[:notice] = "Issue linked successfully"
  else
    flash[:alert] = "Failed to link issue: #{result[:error]}"
  end
  redirect_to error_path(params[:id], anchor: "issue-tracking")
end

#muteObject



131
132
133
134
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 131

def mute
  @error = Commands::MuteError.call(params[:id], muted_by: params[:muted_by], reason: params[:reason])
  redirect_to error_path(@error)
end

#n_plus_one_summaryObject



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 319

def n_plus_one_summary
  unless RailsErrorDashboard.configuration.enable_breadcrumbs
    flash[:alert] = "Breadcrumbs are not enabled. Enable them in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::NplusOneSummary.call(days, application_id: @current_application_id)
  all_patterns = result[:patterns]

  # Summary stats (computed before pagination)
  @unique_count = all_patterns.size
  @total_count = all_patterns.sum { |p| p[:count] }
  @affected_count = all_patterns.flat_map { |p| p[:error_ids] }.uniq.size

  @pagy, @patterns = pagy(:offset, all_patterns, limit: params[:per_page] || 25)
end

#overviewObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 29

def overview
  # Get dashboard stats using Query (pass application filter)
  @stats = Queries::DashboardStats.call(application_id: @current_application_id)

  # Get platform health summary (if enabled, pass application filter)
  if RailsErrorDashboard.configuration.enable_platform_comparison
    comparison = Queries::PlatformComparison.new(days: 7, application_id: @current_application_id)
    @platform_health = comparison.platform_health_summary
    @platform_scores = comparison.platform_stability_scores
  else
    @platform_health = {}
    @platform_scores = {}
  end

  # Get correlation summary (if enabled, pass application filter)
  if RailsErrorDashboard.configuration.enable_error_correlation
    correlation = Queries::ErrorCorrelation.new(days: 7, application_id: @current_application_id)
    @problematic_releases = correlation.problematic_releases.first(3)
    @time_correlated_errors = correlation.time_correlated_errors.first(3)
    @multi_error_users = correlation.multi_error_users(min_error_types: 2).first(5)
  else
    @problematic_releases = []
    @time_correlated_errors = []
    @multi_error_users = []
  end

  # Get critical alerts using Query
  @critical_alerts = Queries::CriticalAlerts.call(application_id: @current_application_id)
end

#platform_comparisonObject



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 204

def platform_comparison
  # Check if feature is enabled
  unless RailsErrorDashboard.configuration.enable_platform_comparison
    flash[:alert] = "Platform Comparison is not enabled. Enable it in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 7).to_i
  @days = days

  # Use Query to get platform comparison data (pass application filter)
  comparison = Queries::PlatformComparison.new(days: days, application_id: @current_application_id)

  @error_rate_by_platform = comparison.error_rate_by_platform
  @severity_distribution = comparison.severity_distribution_by_platform
  @resolution_times = comparison.resolution_time_by_platform
  @top_errors_by_platform = comparison.top_errors_by_platform
  @stability_scores = comparison.platform_stability_scores
  @cross_platform_errors = comparison.cross_platform_errors
  @daily_trends = comparison.daily_trend_by_platform
  @platform_health = comparison.platform_health_summary
end

#rack_attack_summaryObject



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 436

def rack_attack_summary
  unless RailsErrorDashboard.configuration.enable_rack_attack_tracking &&
         RailsErrorDashboard.configuration.enable_breadcrumbs
    flash[:alert] = "Rack Attack tracking is not enabled. Enable enable_rack_attack_tracking and enable_breadcrumbs in config/initializers/rails_error_dashboard.rb"
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::RackAttackSummary.call(days, application_id: @current_application_id)
  all_events = result[:events]

  # Summary stats (computed before pagination)
  @unique_rules = all_events.size
  @total_events = all_events.sum { |e| e[:count] }
  @unique_ips = all_events.flat_map { |e| e[:ips] }.uniq.size

  @pagy, @events = pagy(:offset, all_events, limit: params[:per_page] || 25)
end

#releasesObject



279
280
281
282
283
284
285
286
287
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 279

def releases
  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::ReleaseTimeline.call(days, application_id: @current_application_id)
  all_releases = result[:releases]
  @summary = result[:summary]

  @pagy, @releases = pagy(:offset, all_releases, limit: params[:per_page] || 25)
end

#resolveObject



92
93
94
95
96
97
98
99
100
101
102
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 92

def resolve
  # Use Command to resolve error
  @error = Commands::ResolveError.call(
    params[:id],
    resolved_by_name: params[:resolved_by_name],
    resolution_comment: params[:resolution_comment],
    resolution_reference: params[:resolution_reference]
  )

  redirect_to error_path(@error)
end

#settingsObject



563
564
565
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 563

def settings
  @config = RailsErrorDashboard.configuration
end

#showObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 76

def show
  # Eagerly load associations to avoid N+1 queries
  # - comments: Audit trail (workflow comments from snooze/mute/status changes)
  # - parent_cascade_patterns/child_cascade_patterns: Used if cascade detection is enabled
  @error = ErrorLog.includes(:comments, :parent_cascade_patterns, :child_cascade_patterns).find(params[:id])
  @related_errors = @error.related_errors(limit: 5, application_id: @current_application_id)
  @error_markdown = Services::MarkdownErrorFormatter.call(@error, related_errors: @related_errors)

  # Fetch platform issue state and comments if linked
  @platform_issue = fetch_platform_issue(@error)
  @platform_comments = fetch_platform_comments(@error)

  # Dispatch plugin event for error viewed
  RailsErrorDashboard::PluginRegistry.dispatch(:on_error_viewed, @error)
end

#snoozeObject



121
122
123
124
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 121

def snooze
  @error = Commands::SnoozeError.call(params[:id], hours: params[:hours].to_i, reason: params[:reason])
  redirect_to error_path(@error)
end

#swallowed_exceptionsObject



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 411

def swallowed_exceptions
  unless RailsErrorDashboard.configuration.detect_swallowed_exceptions
    # On Ruby < 3.3, validate! auto-disables this feature — tell the user why
    if RUBY_VERSION < "3.3"
      flash[:alert] = "Swallowed exception detection requires Ruby 3.3+ (you have #{RUBY_VERSION}). Upgrade Ruby to use this feature."
    else
      flash[:alert] = "Swallowed exception detection is not enabled. Enable it in config/initializers/rails_error_dashboard.rb"
    end
    redirect_to errors_path
    return
  end

  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::SwallowedExceptionSummary.call(days, application_id: @current_application_id)
  all_entries = result[:entries]

  # Summary stats (computed before pagination)
  @unique_count = all_entries.size
  @total_rescue_count = all_entries.sum { |e| e[:rescue_count] }
  @total_raise_count = all_entries.sum { |e| e[:raise_count] }

  @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25)
end

#unassignObject



111
112
113
114
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 111

def unassign
  @error = Commands::UnassignError.call(params[:id])
  redirect_to error_path(@error)
end

#unmuteObject



136
137
138
139
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 136

def unmute
  @error = Commands::UnmuteError.call(params[:id])
  redirect_to error_path(@error)
end

#unsnoozeObject



126
127
128
129
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 126

def unsnooze
  @error = Commands::UnsnoozeError.call(params[:id])
  redirect_to error_path(@error)
end

#update_priorityObject



116
117
118
119
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 116

def update_priority
  @error = Commands::UpdateErrorPriority.call(params[:id], priority_level: params[:priority_level])
  redirect_to error_path(@error)
end

#update_statusObject



141
142
143
144
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 141

def update_status
  result = Commands::UpdateErrorStatus.call(params[:id], status: params[:status], comment: params[:comment])
  redirect_to error_path(result[:error])
end

#user_impactObject



289
290
291
292
293
294
295
296
297
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 289

def user_impact
  days = (params[:days] || 30).to_i
  @days = days
  result = Queries::UserImpactSummary.call(days, application_id: @current_application_id)
  all_entries = result[:entries]
  @summary = result[:summary]

  @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25)
end