From 3ca614442f7071c7ea000154329ef7e66623e11c Mon Sep 17 00:00:00 2001 From: Chuck Smith Date: Tue, 26 May 2026 08:50:29 -0400 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20Solid=20Cache=20entry=20browser=20?= =?UTF-8?q?=E2=80=94=20paginated=20table,=20key=20search,=20delete,=20flus?= =?UTF-8?q?h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds GET /cache/entries with sortable columns (key, byte_size, created_at), key-substring search, per-row delete, and "Flush All" with confirmation. Cache subnav added to the layout (Overview / Entries). Also fixes a pre-existing test where a broad JSON.pretty_generate mock was also catching importmap's internal JSON serialisation; narrowed with and_wrap_original to only raise for the specific job arguments object. Co-Authored-By: Claude Sonnet 4.6 --- .../solid_stack_web/application_controller.rb | 2 +- .../cache_entries_controller.rb | 33 +++++++++ .../solid_stack_web/application.html.erb | 11 +++ .../cache_entries/index.html.erb | 64 +++++++++++++++++ config/routes.rb | 7 +- .../solid_stack_web/cache_entries_spec.rb | 71 +++++++++++++++++++ .../solid_stack_web/failed_jobs_spec.rb | 6 +- 7 files changed, 191 insertions(+), 3 deletions(-) create mode 100644 app/controllers/solid_stack_web/cache_entries_controller.rb create mode 100644 app/views/solid_stack_web/cache_entries/index.html.erb create mode 100644 spec/requests/solid_stack_web/cache_entries_spec.rb diff --git a/app/controllers/solid_stack_web/application_controller.rb b/app/controllers/solid_stack_web/application_controller.rb index 5110276..965974d 100644 --- a/app/controllers/solid_stack_web/application_controller.rb +++ b/app/controllers/solid_stack_web/application_controller.rb @@ -16,7 +16,7 @@ class ApplicationController < ActionController::Base def current_section case controller_name when "jobs", "failed_jobs", "queues", "processes", "history", "scheduled_jobs", "recurring_tasks" then :queue - when "cache" then :cache + when "cache", "cache_entries" then :cache when "cable" then :cable else :overview end diff --git a/app/controllers/solid_stack_web/cache_entries_controller.rb b/app/controllers/solid_stack_web/cache_entries_controller.rb new file mode 100644 index 0000000..064d4f9 --- /dev/null +++ b/app/controllers/solid_stack_web/cache_entries_controller.rb @@ -0,0 +1,33 @@ +module SolidStackWeb + class CacheEntriesController < ApplicationController + def index + @search = params[:q].presence + @sort = resolve_sort + + scope = ::SolidCache::Entry.all + scope = scope.where("key LIKE ?", "%#{::ActiveRecord::Base.sanitize_sql_like(@search)}%") if @search + scope = scope.order(@sort["column"] => @sort["direction"]) + + @pagy, @entries = pagy(scope) + end + + def destroy + ::SolidCache::Entry.find(params[:id]).destroy + redirect_to cache_entries_path(q: params[:q], column: params[:column], direction: params[:direction]), + notice: "Cache entry deleted." + end + + def flush + ::SolidCache::Entry.delete_all + redirect_to cache_entries_path, notice: "All cache entries flushed." + end + + private + + def resolve_sort + column = %w[byte_size created_at key].include?(params[:column]) ? params[:column] : "byte_size" + direction = %w[asc desc].include?(params[:direction]) ? params[:direction] : "desc" + { "column" => column, "direction" => direction } + end + end +end diff --git a/app/views/layouts/solid_stack_web/application.html.erb b/app/views/layouts/solid_stack_web/application.html.erb index 1df5f2e..462f69a 100644 --- a/app/views/layouts/solid_stack_web/application.html.erb +++ b/app/views/layouts/solid_stack_web/application.html.erb @@ -24,6 +24,17 @@ + <% if current_section == :cache %> + + <% end %> + <% if current_section == :queue %>