faultline-rails 0.4.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/app/assets/stylesheets/faultline/application.css +0 -41
- data/app/assets/stylesheets/faultline/dashboard.css +961 -0
- data/app/controllers/faultline/logged_exceptions_controller.rb +81 -8
- data/app/helpers/faultline/logged_exceptions_helper.rb +84 -5
- data/app/javascript/controllers/faultline_controller.js +349 -7
- data/app/javascript/faultline/controllers/sidebar_controller.js +21 -0
- data/app/javascript/faultline/controllers/theme_controller.js +48 -0
- data/app/models/faultline/logged_exception.rb +10 -0
- data/app/views/faultline/logged_exceptions/_exceptions.html.erb +132 -84
- data/app/views/faultline/logged_exceptions/_show.html.erb +281 -60
- data/app/views/faultline/logged_exceptions/index.html.erb +192 -123
- data/app/views/faultline/logged_exceptions/show.html.erb +1 -1
- data/app/views/layouts/faultline/application.html.erb +116 -51
- data/faultline-rails.gemspec +1 -0
- data/lib/faultline/cleanup.rb +32 -0
- data/lib/faultline/configuration.rb +172 -4
- data/lib/faultline/engine.rb +22 -0
- data/lib/faultline/logger.rb +188 -0
- data/lib/faultline/notifications.rb +80 -0
- data/lib/faultline/ransack_config.rb +2 -24
- data/lib/faultline/version.rb +1 -1
- data/lib/faultline.rb +10 -0
- data/lib/generators/faultline/customize_generator.rb +117 -0
- data/lib/generators/faultline/install_generator.rb +15 -0
- data/lib/generators/faultline/templates/faultline.rb +70 -37
- data/lib/generators/faultline/templates/javascript/controllers/faultline_controller.js +310 -0
- data/lib/generators/faultline/templates/views/faultline/logged_exceptions/_exceptions.html.erb +124 -0
- data/lib/generators/faultline/templates/views/faultline/logged_exceptions/_show.html.erb +83 -0
- data/lib/generators/faultline/templates/views/faultline/logged_exceptions/index.html.erb +113 -0
- data/lib/generators/faultline/templates/views/layouts/faultline/application.html.erb +133 -0
- data/lib/tasks/faultline.rake +147 -0
- metadata +15 -1
|
@@ -1,148 +1,217 @@
|
|
|
1
1
|
<% page_title t(".title") %>
|
|
2
2
|
|
|
3
|
-
<div class="space-y-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
<div class="space-y-4" data-controller="faultline" data-faultline-shortcuts-value="<%= Faultline.configuration.keyboard_shortcuts %>">
|
|
4
|
+
|
|
5
|
+
<%# ─── Breadcrumbs ─────────────────────────────────────────── %>
|
|
6
|
+
<nav class="fl-breadcrumbs" aria-label="Breadcrumb">
|
|
7
|
+
<a href="<%= root_path %>" class="fl-breadcrumb">Dashboard</a>
|
|
8
|
+
<span class="fl-breadcrumb-sep">/</span>
|
|
9
|
+
<span class="fl-breadcrumb-current">Exceptions</span>
|
|
10
|
+
<% if @stats && @stats[:today] > 0 %>
|
|
11
|
+
<span class="fl-breadcrumb-sep">·</span>
|
|
12
|
+
<span class="fl-badge fl-badge-danger" style="margin-left: 0.25rem"><span class="fl-pulse"></span> <%= @stats[:today] %> today</span>
|
|
13
|
+
<% end %>
|
|
14
|
+
</nav>
|
|
15
|
+
|
|
16
|
+
<%# ─── Stats Overview ──────────────────────────────────────── %>
|
|
17
|
+
<% if @stats %>
|
|
18
|
+
<div class="fl-stats">
|
|
19
|
+
<div class="fl-stat">
|
|
20
|
+
<span class="fl-stat-label">Total Exceptions</span>
|
|
21
|
+
<span class="fl-stat-value"><%= number_with_delimiter(@stats[:total]) %></span>
|
|
22
|
+
<span class="fl-stat-change">All time</span>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="fl-stat">
|
|
25
|
+
<span class="fl-stat-label">This Week</span>
|
|
26
|
+
<span class="fl-stat-value <%= 'danger' if @stats[:this_week] > 10 %>"><%= @stats[:this_week] %></span>
|
|
27
|
+
<span class="fl-stat-change">Last 7 days</span>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="fl-stat">
|
|
30
|
+
<span class="fl-stat-label">Today</span>
|
|
31
|
+
<span class="fl-stat-value <%= 'danger' if @stats[:today] > 5 %>"><%= @stats[:today] %></span>
|
|
32
|
+
<span class="fl-stat-change <%= 'up' if @stats[:today] > @stats[:yesterday] %>">
|
|
33
|
+
<% if @stats[:yesterday] > 0 %>
|
|
34
|
+
<%= ((@stats[:today].to_f / [@stats[:yesterday], 1].max - 1) * 100).round %>% vs yesterday
|
|
35
|
+
<% else %>
|
|
36
|
+
vs yesterday
|
|
37
|
+
<% end %>
|
|
38
|
+
</span>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="fl-stat">
|
|
41
|
+
<span class="fl-stat-label">Unique Classes</span>
|
|
42
|
+
<span class="fl-stat-value"><%= @stats[:top_classes]&.size || 0 %></span>
|
|
43
|
+
<span class="fl-stat-change">Exception types</span>
|
|
44
|
+
</div>
|
|
11
45
|
</div>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
46
|
+
<% end %>
|
|
47
|
+
|
|
48
|
+
<%# ─── Filters Card ────────────────────────────────────────── %>
|
|
49
|
+
<div class="fl-card">
|
|
50
|
+
<%# Filter header with icon %>
|
|
51
|
+
<div class="fl-filters" style="padding-bottom: 0.5rem">
|
|
52
|
+
<div class="flex items-center gap-2">
|
|
53
|
+
<svg class="w-4 h-4" style="color: var(--fl-text-muted)" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z" /></svg>
|
|
54
|
+
<span class="text-xs font-semibold uppercase tracking-wider" style="color: var(--fl-text-muted)">Filters</span>
|
|
55
|
+
<% if filtered? %>
|
|
56
|
+
<%= link_to "Clear all", logged_exceptions_path(per_page: params[:per_page]), class: "ml-auto text-xs font-medium", style: "color: var(--fl-primary)" %>
|
|
57
|
+
<% end %>
|
|
58
|
+
</div>
|
|
17
59
|
</div>
|
|
18
|
-
</div>
|
|
19
60
|
|
|
20
|
-
|
|
21
|
-
<div class="bg-white shadow rounded-lg p-4">
|
|
61
|
+
<%# Filter form %>
|
|
22
62
|
<%= search_form_for @q, url: query_logged_exceptions_path, data: { turbo_frame: "exceptions" } do |f| %>
|
|
23
|
-
<div class="
|
|
24
|
-
<div>
|
|
25
|
-
|
|
26
|
-
<%= f.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<%= f.label :controller_name_cont, "Controller", class: "block text-sm font-medium text-gray-700" %>
|
|
32
|
-
<%= f.search_field :controller_name_cont,
|
|
33
|
-
class: "mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",
|
|
34
|
-
placeholder: "e.g. users" %>
|
|
35
|
-
</div>
|
|
36
|
-
<div>
|
|
37
|
-
<%= f.label :message_cont, "Message", class: "block text-sm font-medium text-gray-700" %>
|
|
38
|
-
<%= f.search_field :message_cont,
|
|
39
|
-
class: "mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",
|
|
40
|
-
placeholder: "Search messages..." %>
|
|
41
|
-
</div>
|
|
42
|
-
<div class="flex items-end">
|
|
43
|
-
<%= f.submit "Search", class: "w-full inline-flex justify-center items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" %>
|
|
63
|
+
<div class="fl-filters">
|
|
64
|
+
<div class="fl-filter-group">
|
|
65
|
+
<label>Exception Type</label>
|
|
66
|
+
<%= f.select :exception_class_cont,
|
|
67
|
+
options_for_select(@exception_names.map { |n| [n, n] }, params.dig(:q, :exception_class_cont)),
|
|
68
|
+
{ include_blank: "All types" },
|
|
69
|
+
class: "fl-select",
|
|
70
|
+
data: { action: "change->faultline#submit" } %>
|
|
44
71
|
</div>
|
|
45
|
-
</div>
|
|
46
|
-
<% end %>
|
|
47
|
-
</div>
|
|
48
72
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<nav class="mt-2 space-y-1 max-h-48 overflow-y-auto">
|
|
57
|
-
<% @exception_names.each do |name| %>
|
|
58
|
-
<%= link_to name,
|
|
59
|
-
query_logged_exceptions_path(exception_names_filter: name),
|
|
60
|
-
class: "block px-3 py-2 text-sm rounded-md text-gray-700 hover:bg-gray-100 hover:text-gray-900",
|
|
61
|
-
data: { turbo_frame: "exceptions" } %>
|
|
62
|
-
<% end %>
|
|
63
|
-
</nav>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
<%# Controller/Action Filter %>
|
|
67
|
-
<div>
|
|
68
|
-
<h3 class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Controller</h3>
|
|
69
|
-
<nav class="mt-2 space-y-1 max-h-48 overflow-y-auto">
|
|
70
|
-
<% @controller_actions.each do |action| %>
|
|
71
|
-
<%= link_to action,
|
|
72
|
-
query_logged_exceptions_path(controller_actions_filter: action),
|
|
73
|
-
class: "block px-3 py-2 text-sm rounded-md text-gray-700 hover:bg-gray-100 hover:text-gray-900",
|
|
74
|
-
data: { turbo_frame: "exceptions" } %>
|
|
75
|
-
<% end %>
|
|
76
|
-
</nav>
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<%# Date Filter %>
|
|
80
|
-
<div>
|
|
81
|
-
<h3 class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Time Range</h3>
|
|
82
|
-
<nav class="mt-2 space-y-1">
|
|
83
|
-
<% [[t(".today"), 1], [t(".last_few_days"), 3], [t(".last_7_days"), 7], [t(".last_30_days"), 30]].each do |label, days| %>
|
|
84
|
-
<%= link_to label,
|
|
85
|
-
query_logged_exceptions_path(date_ranges_filter: days),
|
|
86
|
-
class: "block px-3 py-2 text-sm rounded-md text-gray-700 hover:bg-gray-100 hover:text-gray-900",
|
|
87
|
-
data: { turbo_frame: "exceptions" } %>
|
|
88
|
-
<% end %>
|
|
89
|
-
</nav>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<%# Text Search %>
|
|
93
|
-
<div>
|
|
94
|
-
<h3 class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Quick Search</h3>
|
|
95
|
-
<%= form_with url: query_logged_exceptions_path, method: :get,
|
|
96
|
-
data: { turbo_frame: "exceptions", action: "submit->faultline#submit" } do |form| %>
|
|
97
|
-
<div class="mt-2 flex gap-2">
|
|
98
|
-
<%= form.search_field :query,
|
|
99
|
-
placeholder: "Search...",
|
|
100
|
-
class: "flex-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" %>
|
|
101
|
-
<%= form.submit "Go",
|
|
102
|
-
class: "inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm leading-4 font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" %>
|
|
103
|
-
</div>
|
|
104
|
-
<% end %>
|
|
73
|
+
<div class="fl-filter-group">
|
|
74
|
+
<label>Controller</label>
|
|
75
|
+
<%= f.select :controller_name_cont,
|
|
76
|
+
options_for_select(@controller_actions.map { |a| [a, a] }, params.dig(:q, :controller_name_cont)),
|
|
77
|
+
{ include_blank: "All controllers" },
|
|
78
|
+
class: "fl-select",
|
|
79
|
+
data: { action: "change->faultline#submit" } %>
|
|
105
80
|
</div>
|
|
106
81
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<%=
|
|
110
|
-
|
|
82
|
+
<div class="fl-filter-group">
|
|
83
|
+
<label>Time Range</label>
|
|
84
|
+
<%= select_tag :date_ranges_filter,
|
|
85
|
+
options_for_select([
|
|
86
|
+
["All time", ""],
|
|
87
|
+
["Today", "1"],
|
|
88
|
+
["Last 3 days", "3"],
|
|
89
|
+
["Last 7 days", "7"],
|
|
90
|
+
["Last 30 days", "30"]
|
|
91
|
+
], params[:date_ranges_filter]),
|
|
92
|
+
class: "fl-select",
|
|
93
|
+
data: { action: "change->faultline#submit" } %>
|
|
111
94
|
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
95
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</div>
|
|
126
|
-
<div class="ml-3">
|
|
127
|
-
<p class="text-sm font-medium text-blue-800"><%= t(".loading") %></p>
|
|
96
|
+
<div class="fl-filter-group" style="min-width: 240px">
|
|
97
|
+
<label>Search</label>
|
|
98
|
+
<div class="fl-search">
|
|
99
|
+
<svg class="fl-search-icon w-4 h-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" /></svg>
|
|
100
|
+
<%= f.search_field :message_cont,
|
|
101
|
+
placeholder: "Search messages...",
|
|
102
|
+
class: "fl-input",
|
|
103
|
+
style: "padding-left: 2.25rem",
|
|
104
|
+
data: { action: "input->faultline#debouncedSubmit" } %>
|
|
105
|
+
<span class="fl-search-kbd">/</span>
|
|
128
106
|
</div>
|
|
129
107
|
</div>
|
|
108
|
+
|
|
109
|
+
<div class="flex items-center gap-2">
|
|
110
|
+
<%= f.submit "Apply", class: "fl-btn fl-btn-primary" %>
|
|
111
|
+
</div>
|
|
130
112
|
</div>
|
|
131
113
|
|
|
132
|
-
<%#
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
114
|
+
<%# Active filter pills %>
|
|
115
|
+
<% pills = active_filter_pills %>
|
|
116
|
+
<% if pills.any? %>
|
|
117
|
+
<div class="fl-filter-pills">
|
|
118
|
+
<% pills.each do |pill| %>
|
|
119
|
+
<span class="fl-filter-pill">
|
|
120
|
+
<strong><%= pill[:label] %>:</strong> <%= pill[:value] %>
|
|
121
|
+
<% new_params = params.to_unsafe_h.except(pill[:param]) %>
|
|
122
|
+
<%= link_to "×", logged_exceptions_path(new_params), class: "fl-filter-pill-x" %>
|
|
123
|
+
</span>
|
|
124
|
+
<% end %>
|
|
139
125
|
</div>
|
|
140
126
|
<% end %>
|
|
127
|
+
<% end %>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<%# ─── Content Area ────────────────────────────────────────── %>
|
|
131
|
+
<div class="flex gap-4" style="min-height: 400px">
|
|
132
|
+
|
|
133
|
+
<%# ─── Exception List ──────────────────────────────────── %>
|
|
134
|
+
<div class="flex-1 min-w-0">
|
|
135
|
+
|
|
136
|
+
<%# Loading indicator %>
|
|
137
|
+
<div id="activity" data-faultline-target="activity" class="fl-card p-3 flex items-center gap-3" role="status" aria-live="polite" hidden>
|
|
138
|
+
<svg class="animate-spin h-4 w-4 shrink-0" style="color: var(--fl-primary)" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
139
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
140
|
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
141
|
+
</svg>
|
|
142
|
+
<p class="text-sm font-medium" style="color: var(--fl-primary)"><%= t(".loading") %></p>
|
|
143
|
+
</div>
|
|
141
144
|
|
|
142
|
-
<%#
|
|
145
|
+
<%# Exception details (desktop split, mobile full) %>
|
|
146
|
+
<div id="exception-detail-desktop" class="hidden lg:block fl-card mb-4" hidden>
|
|
147
|
+
<%= turbo_frame_tag "exception-details" do %>
|
|
148
|
+
<div class="text-center py-12">
|
|
149
|
+
<div class="w-10 h-10 rounded-full flex items-center justify-center mx-auto" style="background: var(--fl-bg-secondary)">
|
|
150
|
+
<svg class="w-5 h-5" style="color: var(--fl-text-muted)" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
151
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" />
|
|
152
|
+
</svg>
|
|
153
|
+
</div>
|
|
154
|
+
<p class="mt-2 text-xs" style="color: var(--fl-text-muted)">Select an exception to view details</p>
|
|
155
|
+
<p class="mt-1 text-xs" style="color: var(--fl-text-muted)">Click a row or press <span class="fl-kbd">↓</span> <span class="fl-kbd">↑</span> to navigate</p>
|
|
156
|
+
</div>
|
|
157
|
+
<% end %>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<%# Exception table %>
|
|
143
161
|
<%= turbo_frame_tag "exceptions" do %>
|
|
144
162
|
<%= render "exceptions" %>
|
|
145
163
|
<% end %>
|
|
146
164
|
</div>
|
|
147
165
|
</div>
|
|
166
|
+
|
|
167
|
+
<%# ─── Keyboard Shortcuts Dialog ───────────────────────────── %>
|
|
168
|
+
<% if Faultline.configuration.keyboard_shortcuts %>
|
|
169
|
+
<div class="fl-shortcuts-overlay" data-faultline-target="shortcutsDialog">
|
|
170
|
+
<div class="fl-shortcuts">
|
|
171
|
+
<div class="flex items-center justify-between mb-4">
|
|
172
|
+
<h3>Keyboard Shortcuts</h3>
|
|
173
|
+
<button type="button" class="fl-icon-btn" data-action="click->faultline#closeShortcuts">
|
|
174
|
+
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg>
|
|
175
|
+
</button>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<div class="fl-shortcut-row">
|
|
179
|
+
<span class="fl-shortcut-label">Focus search</span>
|
|
180
|
+
<div class="fl-shortcut-keys"><span class="fl-kbd">/</span></div>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="fl-shortcut-row">
|
|
183
|
+
<span class="fl-shortcut-label">Navigate down</span>
|
|
184
|
+
<div class="fl-shortcut-keys"><span class="fl-kbd">j</span> or <span class="fl-kbd">↓</span></div>
|
|
185
|
+
</div>
|
|
186
|
+
<div class="fl-shortcut-row">
|
|
187
|
+
<span class="fl-shortcut-label">Navigate up</span>
|
|
188
|
+
<div class="fl-shortcut-keys"><span class="fl-kbd">k</span> or <span class="fl-kbd">↑</span></div>
|
|
189
|
+
</div>
|
|
190
|
+
<div class="fl-shortcut-row">
|
|
191
|
+
<span class="fl-shortcut-label">Open selected</span>
|
|
192
|
+
<div class="fl-shortcut-keys"><span class="fl-kbd">Enter</span></div>
|
|
193
|
+
</div>
|
|
194
|
+
<div class="fl-shortcut-row">
|
|
195
|
+
<span class="fl-shortcut-label">Go to previous</span>
|
|
196
|
+
<div class="fl-shortcut-keys"><span class="fl-kbd">p</span> or <span class="fl-kbd">←</span></div>
|
|
197
|
+
</div>
|
|
198
|
+
<div class="fl-shortcut-row">
|
|
199
|
+
<span class="fl-shortcut-label">Go to next</span>
|
|
200
|
+
<div class="fl-shortcut-keys"><span class="fl-kbd">n</span> or <span class="fl-kbd">→</span></div>
|
|
201
|
+
</div>
|
|
202
|
+
<div class="fl-shortcut-row">
|
|
203
|
+
<span class="fl-shortcut-label">Toggle theme</span>
|
|
204
|
+
<div class="fl-shortcut-keys"><span class="fl-kbd">t</span></div>
|
|
205
|
+
</div>
|
|
206
|
+
<div class="fl-shortcut-row">
|
|
207
|
+
<span class="fl-shortcut-label">Close panel / Clear</span>
|
|
208
|
+
<div class="fl-shortcut-keys"><span class="fl-kbd">Esc</span></div>
|
|
209
|
+
</div>
|
|
210
|
+
<div class="fl-shortcut-row">
|
|
211
|
+
<span class="fl-shortcut-label">Show shortcuts</span>
|
|
212
|
+
<div class="fl-shortcut-keys"><span class="fl-kbd">?</span></div>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
<% end %>
|
|
148
217
|
</div>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
-
<html lang="en" class="h-full
|
|
2
|
+
<html lang="en" class="h-full" data-controller="faultline--theme" data-faultline--theme-theme-value="<%= Faultline.configuration.theme %>">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<
|
|
6
|
+
<meta name="color-scheme" content="light dark">
|
|
7
|
+
<title><%= content_for?(:title) ? yield(:title) : Faultline.configuration.application_name || "Faultline" %></title>
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
<%# Load host app stylesheet first (provides Tailwind utilities if used) %>
|
|
10
|
+
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" if defined?(Propshaft) %>
|
|
11
|
+
<%= stylesheet_link_tag "faultline/dashboard", "data-turbo-track": "reload" %>
|
|
9
12
|
|
|
10
13
|
<% if respond_to?(:javascript_importmap_tags) %>
|
|
11
14
|
<%= javascript_importmap_tags %>
|
|
@@ -16,68 +19,130 @@
|
|
|
16
19
|
<% end %>
|
|
17
20
|
<%= csrf_meta_tags %>
|
|
18
21
|
</head>
|
|
19
|
-
<body class="h-full">
|
|
20
|
-
<div class="min-h-full">
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
<body class="h-full <%= Faultline.configuration.body_class %>">
|
|
23
|
+
<div class="min-h-full flex">
|
|
24
|
+
|
|
25
|
+
<%# Sidebar %>
|
|
26
|
+
<aside class="fl-sidebar">
|
|
27
|
+
<%# Logo %>
|
|
28
|
+
<div class="fl-sidebar-logo">
|
|
29
|
+
<%= link_to root_path, class: "flex items-center gap-2.5" do %>
|
|
30
|
+
<div class="fl-logo-icon">⚡</div>
|
|
31
|
+
<span class="fl-logo-text"><%= Faultline.configuration.application_name || "Faultline" %></span>
|
|
32
|
+
<% end %>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<%# Navigation %>
|
|
36
|
+
<nav class="fl-sidebar-nav">
|
|
37
|
+
<%= link_to root_path,
|
|
38
|
+
class: "fl-nav-item #{request.path == faultline.root_path ? 'active' : ''}" do %>
|
|
39
|
+
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z" /></svg>
|
|
40
|
+
Dashboard
|
|
41
|
+
<% end %>
|
|
42
|
+
|
|
43
|
+
<%= link_to feed_logged_exceptions_path(format: :rss),
|
|
44
|
+
class: "fl-nav-item" do %>
|
|
45
|
+
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12.75 19.5v-.75a7.5 7.5 0 00-7.5-7.5H4.5m0-6.75h.75c7.87 0 14.25 6.38 14.25 14.25v.75M6 18.75a.375.375 0 11-.75 0 .375.375 0 01.75 0z" /></svg>
|
|
46
|
+
RSS Feed
|
|
47
|
+
<% end %>
|
|
48
|
+
|
|
49
|
+
<% Faultline.configuration.sidebar_links.each do |link| %>
|
|
50
|
+
<%= link_to link[:url],
|
|
51
|
+
class: "fl-nav-item",
|
|
52
|
+
target: link[:target] || "_self" do %>
|
|
53
|
+
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25" /></svg>
|
|
54
|
+
<%= link[:label] %>
|
|
55
|
+
<% end %>
|
|
56
|
+
<% end %>
|
|
57
|
+
</nav>
|
|
58
|
+
|
|
59
|
+
<%# Footer %>
|
|
60
|
+
<div class="fl-sidebar-footer">
|
|
61
|
+
v<%= Faultline::VERSION %> · <%= Faultline::LoggedException.count %> exceptions
|
|
62
|
+
</div>
|
|
63
|
+
</aside>
|
|
64
|
+
|
|
65
|
+
<%# Main Content %>
|
|
66
|
+
<div class="flex-1 flex flex-col min-w-0">
|
|
67
|
+
<%# Top Bar %>
|
|
68
|
+
<header class="fl-topbar">
|
|
69
|
+
<div class="flex items-center gap-3">
|
|
70
|
+
<button type="button" class="lg:hidden fl-icon-btn" data-action="click->faultline--sidebar#toggle">
|
|
71
|
+
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" /></svg>
|
|
72
|
+
</button>
|
|
73
|
+
<span class="text-sm font-semibold lg:hidden"><%= Faultline.configuration.application_name || "Faultline" %></span>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div class="flex items-center gap-1.5">
|
|
77
|
+
<% if Faultline.configuration.keyboard_shortcuts %>
|
|
78
|
+
<span class="text-xs flex items-center gap-1" style="color: var(--fl-text-muted)">
|
|
79
|
+
<span class="fl-kbd">?</span>
|
|
80
|
+
</span>
|
|
81
|
+
<% end %>
|
|
82
|
+
|
|
83
|
+
<button type="button"
|
|
84
|
+
class="fl-icon-btn"
|
|
85
|
+
data-action="click->faultline--theme#toggle"
|
|
86
|
+
title="Toggle theme (t)">
|
|
87
|
+
<svg class="w-4 h-4 block dark:hidden" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" /></svg>
|
|
88
|
+
<svg class="w-4 h-4 hidden dark:block" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" /></svg>
|
|
89
|
+
</button>
|
|
90
|
+
|
|
91
|
+
<% if main_app.respond_to?(:root_path) %>
|
|
92
|
+
<%= link_to main_app.root_path,
|
|
93
|
+
class: "fl-icon-btn",
|
|
94
|
+
title: "Back to app" do %>
|
|
95
|
+
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25" /></svg>
|
|
33
96
|
<% end %>
|
|
34
|
-
|
|
97
|
+
<% end %>
|
|
35
98
|
</div>
|
|
36
|
-
</
|
|
37
|
-
</nav>
|
|
99
|
+
</header>
|
|
38
100
|
|
|
39
|
-
|
|
101
|
+
<%# Flash Messages %>
|
|
40
102
|
<% if notice.present? %>
|
|
41
|
-
<div class="
|
|
42
|
-
<div class="
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
|
46
|
-
</svg>
|
|
47
|
-
</div>
|
|
48
|
-
<div class="ml-3">
|
|
49
|
-
<p class="text-sm font-medium text-green-800"><%= notice %></p>
|
|
50
|
-
</div>
|
|
103
|
+
<div class="mx-4 sm:mx-6 mt-4">
|
|
104
|
+
<div class="fl-alert fl-alert-success">
|
|
105
|
+
<svg class="w-5 h-5 shrink-0" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
|
|
106
|
+
<p class="text-sm font-medium"><%= notice %></p>
|
|
51
107
|
</div>
|
|
52
108
|
</div>
|
|
53
109
|
<% end %>
|
|
54
110
|
|
|
55
111
|
<% if alert.present? %>
|
|
56
|
-
<div class="
|
|
57
|
-
<div class="
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
|
|
61
|
-
</svg>
|
|
62
|
-
</div>
|
|
63
|
-
<div class="ml-3">
|
|
64
|
-
<p class="text-sm font-medium text-red-800"><%= alert %></p>
|
|
65
|
-
</div>
|
|
112
|
+
<div class="mx-4 sm:mx-6 mt-4">
|
|
113
|
+
<div class="fl-alert fl-alert-error">
|
|
114
|
+
<svg class="w-5 h-5 shrink-0" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" /></svg>
|
|
115
|
+
<p class="text-sm font-medium"><%= alert %></p>
|
|
66
116
|
</div>
|
|
67
117
|
</div>
|
|
68
118
|
<% end %>
|
|
69
119
|
|
|
70
|
-
|
|
71
|
-
|
|
120
|
+
<%# Main Content %>
|
|
121
|
+
<main class="flex-1 overflow-y-auto p-4 sm:p-6">
|
|
122
|
+
<%= yield %>
|
|
123
|
+
</main>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
72
126
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
127
|
+
<%# Mobile sidebar overlay %>
|
|
128
|
+
<div class="fl-overlay" data-faultline--sidebar-target="overlay" data-action="click->faultline--sidebar#close"></div>
|
|
129
|
+
|
|
130
|
+
<%# Mobile sidebar drawer %>
|
|
131
|
+
<div class="fl-mobile-sidebar" data-faultline--sidebar-target="drawer">
|
|
132
|
+
<div class="fl-sidebar-logo">
|
|
133
|
+
<span class="fl-logo-text"><%= Faultline.configuration.application_name || "Faultline" %></span>
|
|
134
|
+
<button type="button" class="fl-icon-btn" data-action="click->faultline--sidebar#close">
|
|
135
|
+
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg>
|
|
136
|
+
</button>
|
|
137
|
+
</div>
|
|
138
|
+
<nav class="fl-sidebar-nav">
|
|
139
|
+
<%= link_to root_path, class: "fl-nav-item" do %>
|
|
140
|
+
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6z" /></svg>
|
|
141
|
+
Dashboard
|
|
142
|
+
<% end %>
|
|
143
|
+
</nav>
|
|
81
144
|
</div>
|
|
145
|
+
|
|
146
|
+
<%= turbo_frame_tag :remote_modal, target: :_top %>
|
|
82
147
|
</body>
|
|
83
148
|
</html>
|
data/faultline-rails.gemspec
CHANGED
|
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
|
|
|
14
14
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
15
15
|
spec.metadata["source_code_uri"] = "https://github.com/tamiru/faultline-rails/tree/main"
|
|
16
16
|
spec.metadata["changelog_uri"] = "https://github.com/tamiru/faultline-rails/blob/main/CHANGELOG.md"
|
|
17
|
+
spec.metadata["funding_uri"] = "https://github.com/sponsors/tamiru"
|
|
17
18
|
|
|
18
19
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
19
20
|
Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md", "faultline-rails.gemspec"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faultline
|
|
4
|
+
module Cleanup
|
|
5
|
+
class << self
|
|
6
|
+
# Delete exceptions older than the configured retention period.
|
|
7
|
+
# Call this from a cron job, Sidekiq scheduler, or Rails runner.
|
|
8
|
+
#
|
|
9
|
+
# Usage:
|
|
10
|
+
# bin/rails runner "Faultline::Cleanup.run"
|
|
11
|
+
#
|
|
12
|
+
# Or schedule with sidekiq-cron / whenever / good_job:
|
|
13
|
+
# Faultline::Cleanup.run
|
|
14
|
+
def run
|
|
15
|
+
config = Faultline.configuration
|
|
16
|
+
return unless config.retention_days.present?
|
|
17
|
+
|
|
18
|
+
cutoff = config.retention_days.days.ago
|
|
19
|
+
count = Faultline::LoggedException.where("created_at < ?", cutoff).delete_all
|
|
20
|
+
|
|
21
|
+
Rails.logger.info("[Faultline] Cleaned up #{count} exceptions older than #{config.retention_days} days") if count > 0
|
|
22
|
+
count
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Generate a rake task for cleanup.
|
|
26
|
+
# Adds `rake faultline:cleanup` to your app.
|
|
27
|
+
def self.install_rake_task
|
|
28
|
+
# This is called automatically by the engine
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|