rails_nexus 2.0.6 → 2.1.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/app/assets/javascripts/rails_nexus/controllers.js +82 -5
- data/app/assets/stylesheets/rails_nexus/application.css +170 -60
- data/app/controllers/rails_nexus/backup_controller.rb +22 -18
- data/app/helpers/rails_nexus/application_helper.rb +5 -0
- data/app/javascript/controllers/rails_nexus_controller.js +6 -2
- data/app/javascript/controllers/rails_nexus_sidebar_controller.js +71 -3
- data/app/jobs/rails_nexus/backup_job.rb +18 -0
- data/app/models/rails_nexus/backup.rb +11 -11
- data/app/models/rails_nexus/backup_config.rb +7 -2
- data/app/services/rails_nexus/backup_service.rb +130 -43
- data/app/views/layouts/rails_nexus/_sidebar_navigation.html.erb +40 -10
- data/app/views/layouts/rails_nexus/application.html.erb +71 -13
- data/app/views/rails_nexus/backup/_form.html.erb +3 -0
- data/app/views/rails_nexus/backup/history.html.erb +17 -2
- data/app/views/rails_nexus/backup/index.html.erb +29 -72
- data/app/views/rails_nexus/logged_exceptions/_exceptions.html.erb +12 -44
- data/app/views/rails_nexus/logged_exceptions/index.html.erb +21 -99
- data/db/seeds/backup_configs.rb +5 -4
- data/lib/generators/rails_nexus/templates/migration.rb +8 -2
- data/lib/rails_nexus/version.rb +1 -1
- data/lib/tasks/rails_nexus.rake +4 -4
- metadata +2 -1
|
@@ -4,6 +4,7 @@
|
|
|
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
|
+
<meta name="turbo-prefetch" content="false">
|
|
7
8
|
<title><%= content_for?(:title) ? yield(:title) : RailsNexus.configuration.application_name || "RailsNexus" %></title>
|
|
8
9
|
|
|
9
10
|
<%= stylesheet_link_tag "rails_nexus/application", "data-turbo-track": "reload" %>
|
|
@@ -16,12 +17,24 @@
|
|
|
16
17
|
<%= csrf_meta_tags %>
|
|
17
18
|
<%= csp_meta_tag %>
|
|
18
19
|
</head>
|
|
19
|
-
<%
|
|
20
|
+
<%
|
|
21
|
+
exception_count = RailsNexus::LoggedException.count
|
|
22
|
+
monitor_menu_active = %w[
|
|
23
|
+
rails_nexus/logged_exceptions rails_nexus/database_health rails_nexus/n1_patterns
|
|
24
|
+
rails_nexus/analytics rails_nexus/stats
|
|
25
|
+
].include?(controller_path)
|
|
26
|
+
operations_menu_active = %w[
|
|
27
|
+
rails_nexus/cron_jobs rails_nexus/backup rails_nexus/settings
|
|
28
|
+
].include?(controller_path)
|
|
29
|
+
resources_menu_active = RailsNexus.configuration.sidebar_links.any? do |link|
|
|
30
|
+
link[:url].to_s == request.path
|
|
31
|
+
end
|
|
32
|
+
%>
|
|
20
33
|
<body class="h-full <%= RailsNexus.configuration.body_class %>" data-controller="rails_nexus-sidebar">
|
|
21
34
|
<div class="min-h-full flex">
|
|
22
35
|
|
|
23
36
|
<%# Sidebar %>
|
|
24
|
-
<aside class="rn-sidebar">
|
|
37
|
+
<aside id="rn-desktop-sidebar" class="rn-sidebar" data-rails_nexus-sidebar-target="sidebar">
|
|
25
38
|
<%# Logo %>
|
|
26
39
|
<div class="rn-sidebar-logo">
|
|
27
40
|
<%= link_to root_path, class: "flex items-center gap-2.5" do %>
|
|
@@ -34,8 +47,16 @@
|
|
|
34
47
|
</div>
|
|
35
48
|
|
|
36
49
|
<%# Navigation %>
|
|
37
|
-
<nav class="rn-sidebar-nav">
|
|
38
|
-
<
|
|
50
|
+
<nav class="rn-sidebar-nav" aria-label="RailsNexus navigation">
|
|
51
|
+
<details class="rn-nav-section" data-action="toggle->rails_nexus-sidebar#closeOtherMenus" <%= "open" if monitor_menu_active %>>
|
|
52
|
+
<summary class="rn-nav-section-toggle">
|
|
53
|
+
<span class="rn-nav-section-title">
|
|
54
|
+
<span class="rn-nav-section-icon"><svg width="15" height="15" fill="none" viewBox="0 0 24 24" stroke-width="1.75" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M3 12h3l2.25-6 4.5 12 2.25-6H21" /></svg></span>
|
|
55
|
+
<span>Monitor</span>
|
|
56
|
+
</span>
|
|
57
|
+
<svg class="rn-nav-section-chevron" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="1.75" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" /></svg>
|
|
58
|
+
</summary>
|
|
59
|
+
<div class="rn-nav-section-items">
|
|
39
60
|
<%= link_to root_path,
|
|
40
61
|
class: "rn-nav-item #{request.path == rails_nexus.root_path ? 'active' : ''}" do %>
|
|
41
62
|
<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>
|
|
@@ -69,7 +90,18 @@
|
|
|
69
90
|
Statistics
|
|
70
91
|
<% end %>
|
|
71
92
|
|
|
72
|
-
|
|
93
|
+
</div>
|
|
94
|
+
</details>
|
|
95
|
+
|
|
96
|
+
<details class="rn-nav-section" data-action="toggle->rails_nexus-sidebar#closeOtherMenus" <%= "open" if operations_menu_active %>>
|
|
97
|
+
<summary class="rn-nav-section-toggle">
|
|
98
|
+
<span class="rn-nav-section-title">
|
|
99
|
+
<span class="rn-nav-section-icon"><svg width="15" height="15" fill="none" viewBox="0 0 24 24" stroke-width="1.75" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 6.75h15M7.5 12h9m-6 5.25h3" /></svg></span>
|
|
100
|
+
<span>Operations</span>
|
|
101
|
+
</span>
|
|
102
|
+
<svg class="rn-nav-section-chevron" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="1.75" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" /></svg>
|
|
103
|
+
</summary>
|
|
104
|
+
<div class="rn-nav-section-items">
|
|
73
105
|
|
|
74
106
|
<%= link_to cron_jobs_path,
|
|
75
107
|
class: "rn-nav-item #{request.path.start_with?(rails_nexus.cron_jobs_path) ? 'active' : ''}" do %>
|
|
@@ -78,18 +110,35 @@
|
|
|
78
110
|
<% end %>
|
|
79
111
|
|
|
80
112
|
<%= link_to backup_path,
|
|
81
|
-
class: "rn-nav-item #{
|
|
113
|
+
class: "rn-nav-item #{controller_path == 'rails_nexus/backup' && !%w[all_history history].include?(action_name) ? 'active' : ''}" do %>
|
|
82
114
|
<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="M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125" /></svg>
|
|
83
115
|
Backups
|
|
84
116
|
<% end %>
|
|
85
117
|
|
|
118
|
+
<%= link_to backup_history_path,
|
|
119
|
+
class: "rn-nav-item #{controller_path == 'rails_nexus/backup' && %w[all_history history].include?(action_name) ? 'active' : ''}" do %>
|
|
120
|
+
<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 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
|
121
|
+
Backup History
|
|
122
|
+
<% end %>
|
|
123
|
+
|
|
86
124
|
<%= link_to settings_path,
|
|
87
125
|
class: "rn-nav-item #{request.path == rails_nexus.settings_path ? 'active' : ''}" do %>
|
|
88
126
|
<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="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /></svg>
|
|
89
127
|
Settings
|
|
90
128
|
<% end %>
|
|
91
129
|
|
|
92
|
-
|
|
130
|
+
</div>
|
|
131
|
+
</details>
|
|
132
|
+
|
|
133
|
+
<details class="rn-nav-section" data-action="toggle->rails_nexus-sidebar#closeOtherMenus" <%= "open" if resources_menu_active %>>
|
|
134
|
+
<summary class="rn-nav-section-toggle">
|
|
135
|
+
<span class="rn-nav-section-title">
|
|
136
|
+
<span class="rn-nav-section-icon"><svg width="15" height="15" fill="none" viewBox="0 0 24 24" stroke-width="1.75" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M10.5 6H6.75A3.75 3.75 0 003 9.75v7.5A3.75 3.75 0 006.75 21h7.5A3.75 3.75 0 0018 17.25V13.5m-6-1.5L21 3m0 0h-5.25M21 3v5.25" /></svg></span>
|
|
137
|
+
<span>Resources</span>
|
|
138
|
+
</span>
|
|
139
|
+
<svg class="rn-nav-section-chevron" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="1.75" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" /></svg>
|
|
140
|
+
</summary>
|
|
141
|
+
<div class="rn-nav-section-items">
|
|
93
142
|
|
|
94
143
|
<% if main_app.respond_to?(:root_path) %>
|
|
95
144
|
<%= link_to main_app.root_path,
|
|
@@ -113,6 +162,8 @@
|
|
|
113
162
|
<%= link[:label] %>
|
|
114
163
|
<% end %>
|
|
115
164
|
<% end %>
|
|
165
|
+
</div>
|
|
166
|
+
</details>
|
|
116
167
|
</nav>
|
|
117
168
|
|
|
118
169
|
<%# Footer %>
|
|
@@ -128,10 +179,13 @@
|
|
|
128
179
|
<header class="rn-topbar">
|
|
129
180
|
<div class="rn-topbar-title">
|
|
130
181
|
<button type="button"
|
|
131
|
-
class="rn-icon-btn rn-
|
|
182
|
+
class="rn-icon-btn rn-sidebar-toggle"
|
|
132
183
|
data-action="click->rails_nexus-sidebar#toggle"
|
|
133
|
-
|
|
134
|
-
|
|
184
|
+
data-rails_nexus-sidebar-target="toggleButton"
|
|
185
|
+
title="Toggle navigation"
|
|
186
|
+
aria-label="Hide navigation"
|
|
187
|
+
aria-controls="rn-desktop-sidebar rn-mobile-sidebar"
|
|
188
|
+
aria-expanded="true">
|
|
135
189
|
<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>
|
|
136
190
|
</button>
|
|
137
191
|
<div>
|
|
@@ -193,7 +247,7 @@
|
|
|
193
247
|
<% end %>
|
|
194
248
|
|
|
195
249
|
<%# Main Content %>
|
|
196
|
-
<main class="rn-main flex-1
|
|
250
|
+
<main class="rn-main flex-1 p-4 sm:p-6">
|
|
197
251
|
<%= yield %>
|
|
198
252
|
</main>
|
|
199
253
|
|
|
@@ -216,7 +270,7 @@
|
|
|
216
270
|
<div class="rn-overlay" data-rails_nexus-sidebar-target="overlay" data-action="click->rails_nexus-sidebar#close"></div>
|
|
217
271
|
|
|
218
272
|
<%# Mobile sidebar drawer %>
|
|
219
|
-
<div class="rn-mobile-sidebar" data-rails_nexus-sidebar-target="drawer">
|
|
273
|
+
<div id="rn-mobile-sidebar" class="rn-mobile-sidebar" data-rails_nexus-sidebar-target="drawer">
|
|
220
274
|
<div class="rn-sidebar-logo">
|
|
221
275
|
<%= link_to root_path, class: "flex items-center gap-2.5" do %>
|
|
222
276
|
<div class="rn-logo-icon">⚡</div>
|
|
@@ -229,7 +283,11 @@
|
|
|
229
283
|
<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>
|
|
230
284
|
</button>
|
|
231
285
|
</div>
|
|
232
|
-
<%= render "layouts/rails_nexus/sidebar_navigation",
|
|
286
|
+
<%= render "layouts/rails_nexus/sidebar_navigation",
|
|
287
|
+
exception_count: exception_count,
|
|
288
|
+
monitor_menu_active: monitor_menu_active,
|
|
289
|
+
operations_menu_active: operations_menu_active,
|
|
290
|
+
resources_menu_active: resources_menu_active %>
|
|
233
291
|
<div class="rn-sidebar-footer">
|
|
234
292
|
<span class="rn-sidebar-status"><span class="rn-status-dot"></span>Operational</span>
|
|
235
293
|
<span>v<%= RailsNexus::VERSION %></span>
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
<div class="rn-filter-group">
|
|
71
71
|
<label>Password</label>
|
|
72
72
|
<%= f.password_field :password, class: "rn-input", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" %>
|
|
73
|
+
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">ENV[VAR], ${VAR}, credentials[:key], or plain text</p>
|
|
73
74
|
</div>
|
|
74
75
|
<div class="rn-filter-group md:col-span-3">
|
|
75
76
|
<label>Skip Tables (comma-separated)</label>
|
|
@@ -147,6 +148,7 @@
|
|
|
147
148
|
<div class="rn-filter-group" id="encrypt-password-group" style="<%= 'display:none' unless @config.encrypted? %>">
|
|
148
149
|
<label>Encryption Password</label>
|
|
149
150
|
<%= f.password_field :encryption_password, class: "rn-input", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" %>
|
|
151
|
+
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">ENV[VAR], ${VAR}, credentials[:key], or plain text</p>
|
|
150
152
|
</div>
|
|
151
153
|
<div class="rn-filter-group">
|
|
152
154
|
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
@@ -157,6 +159,7 @@
|
|
|
157
159
|
<div class="rn-filter-group" id="gpg-password-group" style="<%= 'display:none' unless @config.gpg_enabled? %>">
|
|
158
160
|
<label>GPG Password</label>
|
|
159
161
|
<%= f.password_field :gpg_password, class: "rn-input", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" %>
|
|
162
|
+
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">ENV[VAR], ${VAR}, credentials[:key], or plain text</p>
|
|
160
163
|
</div>
|
|
161
164
|
<div class="rn-filter-group">
|
|
162
165
|
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
@@ -9,7 +9,16 @@
|
|
|
9
9
|
<span class="rn-breadcrumb-current">History</span>
|
|
10
10
|
</nav>
|
|
11
11
|
|
|
12
|
-
<
|
|
12
|
+
<div class="flex items-center justify-between">
|
|
13
|
+
<div>
|
|
14
|
+
<h1 class="text-2xl font-bold" style="color: var(--rn-text)">Backup History</h1>
|
|
15
|
+
<p class="text-sm mt-1" style="color: var(--rn-text-muted)">Review completed runs, failures, and backup logs.</p>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="flex items-center gap-2">
|
|
18
|
+
<%= link_to "Configurations", backup_path, class: "rn-btn rn-btn-ghost" %>
|
|
19
|
+
<%= link_to "New Config", new_backup_path, class: "rn-btn rn-btn-primary" %>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
13
22
|
|
|
14
23
|
<div class="rn-card">
|
|
15
24
|
<% if @records.any? %>
|
|
@@ -30,11 +39,17 @@
|
|
|
30
39
|
<tbody>
|
|
31
40
|
<% @records.each do |record| %>
|
|
32
41
|
<tr>
|
|
33
|
-
<td><span class="font-medium" style="color: var(--rn-text)"><%= record.
|
|
42
|
+
<td><span class="font-medium" style="color: var(--rn-text)"><%= record.config_name %></span></td>
|
|
34
43
|
<td>
|
|
35
44
|
<span class="rn-badge rn-badge-<%= record.status == 'success' ? 'success' : record.status == 'failed' ? 'danger' : 'warning' %>">
|
|
36
45
|
<%= record.status.capitalize %>
|
|
37
46
|
</span>
|
|
47
|
+
<% if record.status == 'failed' && record.error_message.present? %>
|
|
48
|
+
<div class="text-xs mt-1" style="color: var(--rn-danger); cursor: pointer; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap" title="Click to expand" onclick="var el=this.nextElementSibling; el.style.display=el.style.display==='none'?'block':'none'">
|
|
49
|
+
✖ <%= truncate(record.error_message, length: 60) %>
|
|
50
|
+
</div>
|
|
51
|
+
<pre class="text-xs" style="display:none; color: var(--rn-danger); background: var(--rn-bg-secondary); padding: 8px; border-radius: 4px; margin-top: 4px; max-height: 120px; overflow: auto; white-space: pre-wrap; word-break: break-word"><%= record.error_message %></pre>
|
|
52
|
+
<% end %>
|
|
38
53
|
</td>
|
|
39
54
|
<td><span class="text-xs rn-mono" style="color: var(--rn-text-secondary)"><%= record.file_path ? File.basename(record.file_path) : "—" %></span></td>
|
|
40
55
|
<td><span class="text-xs" style="color: var(--rn-text-secondary)"><%= record.file_size ? number_to_human_size(record.file_size) : "—" %></span></td>
|
|
@@ -8,31 +8,13 @@
|
|
|
8
8
|
</nav>
|
|
9
9
|
|
|
10
10
|
<div class="flex items-center justify-between">
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<%# ─── Stats ──────────────────────────────────────────────── %>
|
|
16
|
-
<div class="rn-stats">
|
|
17
|
-
<div class="rn-stat">
|
|
18
|
-
<span class="rn-stat-label">Configs</span>
|
|
19
|
-
<span class="rn-stat-value"><%= @stats[:total_configs] %></span>
|
|
20
|
-
<span class="rn-stat-change"><%= @stats[:enabled_configs] %> enabled</span>
|
|
21
|
-
</div>
|
|
22
|
-
<div class="rn-stat">
|
|
23
|
-
<span class="rn-stat-label">Total Backups</span>
|
|
24
|
-
<span class="rn-stat-value"><%= @stats[:total_backups] %></span>
|
|
25
|
-
<span class="rn-stat-change">All time</span>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="rn-stat">
|
|
28
|
-
<span class="rn-stat-label">Successful</span>
|
|
29
|
-
<span class="rn-stat-value" style="color: var(--rn-success)"><%= @stats[:successful] %></span>
|
|
30
|
-
<span class="rn-stat-change">All time</span>
|
|
11
|
+
<div>
|
|
12
|
+
<h1 class="text-2xl font-bold" style="color: var(--rn-text)">Backup Configurations</h1>
|
|
13
|
+
<p class="text-sm mt-1" style="color: var(--rn-text-muted)">Configure storage, schedules, and run backups.</p>
|
|
31
14
|
</div>
|
|
32
|
-
<div class="
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<span class="rn-stat-change">All time</span>
|
|
15
|
+
<div class="flex items-center gap-2">
|
|
16
|
+
<%= link_to "Backup History", backup_history_path, class: "rn-btn rn-btn-ghost" %>
|
|
17
|
+
<%= link_to "New Config", new_backup_path, class: "rn-btn rn-btn-primary" %>
|
|
36
18
|
</div>
|
|
37
19
|
</div>
|
|
38
20
|
|
|
@@ -80,16 +62,23 @@
|
|
|
80
62
|
<span class="rn-badge <%= config.enabled? ? 'rn-badge-success' : 'rn-badge-muted' %>">
|
|
81
63
|
<%= config.enabled? ? 'Enabled' : 'Disabled' %>
|
|
82
64
|
</span>
|
|
83
|
-
<% if config.
|
|
65
|
+
<% if config.encrypted? %><span class="rn-badge rn-badge-warning">Encrypted</span><% end %>
|
|
84
66
|
<% if config.rsync_enabled? %><span class="rn-badge rn-badge-info">RSync</span><% end %>
|
|
85
67
|
</td>
|
|
86
68
|
<td style="text-align: right">
|
|
87
69
|
<div class="flex items-center justify-end gap-1">
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
class
|
|
91
|
-
|
|
92
|
-
|
|
70
|
+
<% running = RailsNexus::Backup.where(config_name: config.name, status: "running").exists? %>
|
|
71
|
+
<% if running %>
|
|
72
|
+
<span class="rn-badge rn-badge-info">
|
|
73
|
+
<svg class="animate-spin" style="width:12px;height:12px;display:inline" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" opacity="0.25"/><path d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" fill="currentColor"/></svg>
|
|
74
|
+
Running
|
|
75
|
+
</span>
|
|
76
|
+
<% else %>
|
|
77
|
+
<%= button_to "Run", backup_trigger_path(config),
|
|
78
|
+
method: :post,
|
|
79
|
+
class: "rn-btn rn-btn-primary rn-btn-xs",
|
|
80
|
+
data: { turbo_confirm: "Run #{config.name} backup now?" } %>
|
|
81
|
+
<% end %>
|
|
93
82
|
<%= link_to "Edit", edit_backup_path(config), class: "rn-btn rn-btn-ghost rn-btn-xs" %>
|
|
94
83
|
<%= button_to "Delete", backup_destroy_path(config),
|
|
95
84
|
method: :delete,
|
|
@@ -110,46 +99,14 @@
|
|
|
110
99
|
</div>
|
|
111
100
|
<% end %>
|
|
112
101
|
</div>
|
|
113
|
-
|
|
114
|
-
<%# ─── Recent Backups ─────────────────────────────────────── %>
|
|
115
|
-
<% if @records.any? %>
|
|
116
|
-
<div class="rn-card">
|
|
117
|
-
<div class="p-4" style="border-bottom: 1px solid var(--rn-border-light)">
|
|
118
|
-
<div class="flex items-center justify-between">
|
|
119
|
-
<h2 class="text-sm font-semibold" style="color: var(--rn-text)">Recent Backups</h2>
|
|
120
|
-
<%= link_to "View All", backup_history_path, class: "text-xs font-medium", style: "color: var(--rn-primary)" %>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
<div class="rn-table-wrap">
|
|
124
|
-
<table class="rn-table">
|
|
125
|
-
<thead>
|
|
126
|
-
<tr>
|
|
127
|
-
<th>Config</th>
|
|
128
|
-
<th>Status</th>
|
|
129
|
-
<th>Size</th>
|
|
130
|
-
<th>Duration</th>
|
|
131
|
-
<th>Triggered By</th>
|
|
132
|
-
<th>Time</th>
|
|
133
|
-
</tr>
|
|
134
|
-
</thead>
|
|
135
|
-
<tbody>
|
|
136
|
-
<% @records.each do |record| %>
|
|
137
|
-
<tr>
|
|
138
|
-
<td><span class="font-medium" style="color: var(--rn-text)"><%= record.model_name %></span></td>
|
|
139
|
-
<td>
|
|
140
|
-
<span class="rn-badge rn-badge-<%= record.status == 'success' ? 'success' : record.status == 'failed' ? 'danger' : 'warning' %>">
|
|
141
|
-
<%= record.status.capitalize %>
|
|
142
|
-
</span>
|
|
143
|
-
</td>
|
|
144
|
-
<td><span class="text-xs" style="color: var(--rn-text-secondary)"><%= record.file_size ? number_to_human_size(record.file_size) : "—" %></span></td>
|
|
145
|
-
<td><span class="text-xs" style="color: var(--rn-text-secondary)"><%= record.duration ? "#{record.duration.round(1)}s" : "—" %></span></td>
|
|
146
|
-
<td><span class="text-xs" style="color: var(--rn-text-muted)"><%= record.triggered_by || "—" %></span></td>
|
|
147
|
-
<td><span class="text-xs" style="color: var(--rn-text-muted)"><%= record.started_at ? time_ago_in_words(record.started_at) + " ago" : "—" %></span></td>
|
|
148
|
-
</tr>
|
|
149
|
-
<% end %>
|
|
150
|
-
</tbody>
|
|
151
|
-
</table>
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
<% end %>
|
|
155
102
|
</div>
|
|
103
|
+
|
|
104
|
+
<script>
|
|
105
|
+
// Auto-refresh when a backup is running
|
|
106
|
+
(function() {
|
|
107
|
+
var running = document.querySelector('.animate-spin');
|
|
108
|
+
if (running) {
|
|
109
|
+
setTimeout(function() { location.reload(); }, 5000);
|
|
110
|
+
}
|
|
111
|
+
})();
|
|
112
|
+
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div id="exceptions-content" class="rn-
|
|
1
|
+
<div id="exceptions-content" class="rn-exceptions-results overflow-hidden">
|
|
2
2
|
<% if @exceptions.empty? %>
|
|
3
3
|
<div class="py-16 text-center">
|
|
4
4
|
<div class="w-12 h-12 rounded-full flex items-center justify-center mx-auto" style="background: var(--rn-success-light)">
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
<div class="rn-exceptions-toolbar-actions">
|
|
40
40
|
<%# Keyboard hint %>
|
|
41
|
-
<span class="text-xs flex items-center gap-1" style="color: var(--rn-text-muted)">
|
|
41
|
+
<span class="rn-shortcuts-hint text-xs flex items-center gap-1" style="color: var(--rn-text-muted)">
|
|
42
42
|
<span class="rn-kbd">?</span> shortcuts
|
|
43
43
|
</span>
|
|
44
44
|
|
|
@@ -58,11 +58,7 @@
|
|
|
58
58
|
<caption class="sr-only">Logged application exceptions</caption>
|
|
59
59
|
<thead>
|
|
60
60
|
<tr>
|
|
61
|
-
<th class="rn-col-severity"><span class="sr-only">Severity</span></th>
|
|
62
61
|
<th class="rn-col-exception <%= sort_header_class(:exception_class) %>"><%= sort_link @q, :exception_class, "Exception" %></th>
|
|
63
|
-
<% if exception_feature?(:platform) %>
|
|
64
|
-
<th class="rn-col-platform <%= sort_header_class(:platform) %>"><%= sort_link @q, :platform, "Platform" %></th>
|
|
65
|
-
<% end %>
|
|
66
62
|
<th class="rn-col-source <%= sort_header_class(:controller_name) %>"><%= sort_link @q, :controller_name, "Source" %></th>
|
|
67
63
|
<th class="rn-col-message <%= sort_header_class(:message) %>"><%= sort_link @q, :message, "Message" %></th>
|
|
68
64
|
<% if exception_feature?(:occurrence_count) %>
|
|
@@ -70,9 +66,6 @@
|
|
|
70
66
|
<% else %>
|
|
71
67
|
<th class="rn-col-count">Count</th>
|
|
72
68
|
<% end %>
|
|
73
|
-
<th class="rn-col-workflow <%= sort_header_class(:priority) if exception_feature?(:priority) && exception_searchable?(:priority) %>">
|
|
74
|
-
<%= exception_feature?(:priority) && exception_searchable?(:priority) ? sort_link(@q, :priority, "Workflow") : "Workflow" %>
|
|
75
|
-
</th>
|
|
76
69
|
<th class="rn-col-time <%= sort_header_class(:created_at) %>"><%= sort_link @q, :created_at, "Last Seen" %></th>
|
|
77
70
|
<th class="rn-col-actions"><span class="sr-only">Actions</span></th>
|
|
78
71
|
</tr>
|
|
@@ -88,28 +81,19 @@
|
|
|
88
81
|
data-index="<%= index %>"
|
|
89
82
|
data-rails_nexus-index-param="<%= index %>">
|
|
90
83
|
|
|
91
|
-
<%#
|
|
92
|
-
<td class="rn-col-severity">
|
|
93
|
-
<span class="rn-severity-dot rn-severity-<%= severity_for(exception) %>" aria-hidden="true"></span>
|
|
94
|
-
</td>
|
|
95
|
-
|
|
96
|
-
<%# Exception class with severity badge %>
|
|
84
|
+
<%# Exception class with severity indicator %>
|
|
97
85
|
<td class="rn-col-exception">
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
86
|
+
<div class="rn-exception-cell">
|
|
87
|
+
<span class="rn-severity-dot rn-severity-<%= severity_for(exception) %>" aria-hidden="true"></span>
|
|
88
|
+
<div class="min-w-0">
|
|
89
|
+
<span class="rn-exception-name" title="<%= exception.exception_class %>"><%= exception.exception_class %></span>
|
|
90
|
+
<% if exception.respond_to?(:fingerprint) && exception.fingerprint.present? %>
|
|
91
|
+
<span class="rn-row-meta rn-mono" title="Fingerprint <%= exception.fingerprint %>">#<%= exception.fingerprint.first(10) %></span>
|
|
92
|
+
<% end %>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
102
95
|
</td>
|
|
103
96
|
|
|
104
|
-
<%# Platform badge %>
|
|
105
|
-
<% if exception_feature?(:platform) %>
|
|
106
|
-
<td class="rn-col-platform">
|
|
107
|
-
<span class="rn-badge rn-badge-<%= exception.platform == 'ios' ? 'success' : exception.platform == 'android' ? 'warning' : exception.platform == 'api' ? 'info' : exception.platform == 'bot' ? 'muted' : 'primary' %>">
|
|
108
|
-
<%= exception.platform&.upcase || 'WEB' %>
|
|
109
|
-
</span>
|
|
110
|
-
</td>
|
|
111
|
-
<% end %>
|
|
112
|
-
|
|
113
97
|
<%# Source (controller + action) %>
|
|
114
98
|
<td class="rn-col-source">
|
|
115
99
|
<div class="rn-source" title="<%= [exception.controller_name, exception.action_name].compact.join('#') %>">
|
|
@@ -132,22 +116,6 @@
|
|
|
132
116
|
<span class="rn-occurrence-count" title="<%= pluralize(exception_occurrence_count(exception), 'occurrence') %>"><%= number_with_delimiter(exception_occurrence_count(exception)) %></span>
|
|
133
117
|
</td>
|
|
134
118
|
|
|
135
|
-
<%# Workflow indicators %>
|
|
136
|
-
<td class="rn-col-workflow">
|
|
137
|
-
<% status_label, status_style = exception_status(exception) %>
|
|
138
|
-
<div class="rn-workflow-state">
|
|
139
|
-
<span class="rn-badge rn-badge-xs rn-badge-<%= status_style %>"><%= status_label %></span>
|
|
140
|
-
<% if exception.respond_to?(:priority) && exception.priority.present? %>
|
|
141
|
-
<span class="rn-badge rn-badge-xs rn-badge-<%= exception.priority == 'critical' ? 'danger' : exception.priority == 'high' ? 'warning' : exception.priority == 'medium' ? 'info' : 'muted' %>"><%= exception.priority.upcase %></span>
|
|
142
|
-
<% end %>
|
|
143
|
-
<% if exception.respond_to?(:assigned_to) && exception.assigned_to.present? %>
|
|
144
|
-
<span class="rn-row-meta" title="Assigned to <%= exception.assigned_to %>">👤 <%= exception.assigned_to %></span>
|
|
145
|
-
<% elsif exception.respond_to?(:comments_count) && exception.comments_count.to_i > 0 %>
|
|
146
|
-
<span class="rn-row-meta"><%= exception.comments_count %> comments</span>
|
|
147
|
-
<% end %>
|
|
148
|
-
</div>
|
|
149
|
-
</td>
|
|
150
|
-
|
|
151
119
|
<%# Time (relative) %>
|
|
152
120
|
<td class="rn-col-time rn-date"><%= pretty_exception_date(exception) %></td>
|
|
153
121
|
|
|
@@ -13,103 +13,23 @@
|
|
|
13
13
|
<% end %>
|
|
14
14
|
</nav>
|
|
15
15
|
|
|
16
|
-
<%# ───
|
|
17
|
-
<%
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</div>
|
|
24
|
-
<div class="rn-stat">
|
|
25
|
-
<span class="rn-stat-label">This Week</span>
|
|
26
|
-
<span class="rn-stat-value <%= 'danger' if @stats[:this_week] > 10 %>"><%= @stats[:this_week] %></span>
|
|
27
|
-
<span class="rn-stat-change">Last 7 days</span>
|
|
28
|
-
</div>
|
|
29
|
-
<div class="rn-stat">
|
|
30
|
-
<span class="rn-stat-label">Today</span>
|
|
31
|
-
<span class="rn-stat-value <%= 'danger' if @stats[:today] > 5 %>"><%= @stats[:today] %></span>
|
|
32
|
-
<span class="rn-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="rn-stat">
|
|
41
|
-
<span class="rn-stat-label">Unique Classes</span>
|
|
42
|
-
<span class="rn-stat-value"><%= @stats[:top_classes]&.size || 0 %></span>
|
|
43
|
-
<span class="rn-stat-change">Exception types</span>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
<% end %>
|
|
47
|
-
|
|
48
|
-
<%# ─── User Impact Ranking ───────────────────────────────── %>
|
|
49
|
-
<% begin %>
|
|
50
|
-
<% if RailsNexus.configuration.user_impact_tracking %>
|
|
51
|
-
<% impact_data = RailsNexus::LoggedException.user_impact_ranking(limit: 5) %>
|
|
52
|
-
<% if impact_data.any? %>
|
|
53
|
-
<div class="rn-card">
|
|
54
|
-
<div class="p-4" style="border-bottom: 1px solid var(--rn-border-light)">
|
|
55
|
-
<div class="flex items-center gap-2">
|
|
56
|
-
<svg class="w-4 h-4" style="color: var(--rn-danger)" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
57
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-3.07M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z" />
|
|
58
|
-
</svg>
|
|
59
|
-
<h2 class="text-sm font-semibold" style="color: var(--rn-text)">User Impact (Top 5)</h2>
|
|
60
|
-
</div>
|
|
61
|
-
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">Errors ranked by unique users affected</p>
|
|
62
|
-
</div>
|
|
63
|
-
<div class="rn-table-wrap">
|
|
64
|
-
<table class="rn-table">
|
|
65
|
-
<thead>
|
|
66
|
-
<tr>
|
|
67
|
-
<th>Exception</th>
|
|
68
|
-
<th>Users Affected</th>
|
|
69
|
-
<th>Occurrences</th>
|
|
70
|
-
<th>Last Seen</th>
|
|
71
|
-
</tr>
|
|
72
|
-
</thead>
|
|
73
|
-
<tbody>
|
|
74
|
-
<% impact_data.each do |row| %>
|
|
75
|
-
<tr>
|
|
76
|
-
<td>
|
|
77
|
-
<span class="rn-badge rn-badge-danger"><%= row.exception_class %></span>
|
|
78
|
-
<span class="text-xs ml-1" style="color: var(--rn-text-muted)"><%= row.controller_name %>#<%= row.action_name %></span>
|
|
79
|
-
</td>
|
|
80
|
-
<td>
|
|
81
|
-
<span class="font-bold" style="color: var(--rn-danger)"><%= row.unique_users %></span>
|
|
82
|
-
</td>
|
|
83
|
-
<td>
|
|
84
|
-
<span style="color: var(--rn-text-secondary)"><%= row.total_occurrences %></span>
|
|
85
|
-
</td>
|
|
86
|
-
<td>
|
|
87
|
-
<span class="text-xs" style="color: var(--rn-text-muted)"><%= row.last_seen&.strftime("%b %d %H:%M") %></span>
|
|
88
|
-
</td>
|
|
89
|
-
</tr>
|
|
90
|
-
<% end %>
|
|
91
|
-
</tbody>
|
|
92
|
-
</table>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
<% end %>
|
|
96
|
-
<% end %>
|
|
97
|
-
<% rescue => e %>
|
|
98
|
-
<%# Silently ignore if user_id column doesn't exist yet %>
|
|
99
|
-
<% end %>
|
|
100
|
-
|
|
101
|
-
<%# ─── Filters Card ────────────────────────────────────────── %>
|
|
102
|
-
<div class="rn-card">
|
|
103
|
-
<%# Filter header with icon %>
|
|
104
|
-
<div class="rn-filters" style="padding-bottom: 0.5rem">
|
|
105
|
-
<div class="flex items-center gap-2">
|
|
16
|
+
<%# ─── Collapsible Filters ─────────────────────────────────── %>
|
|
17
|
+
<% pills = active_filter_pills %>
|
|
18
|
+
<section class="rn-card rn-exceptions-panel">
|
|
19
|
+
<div class="rn-exceptions-main" style="min-height: 400px">
|
|
20
|
+
<details class="rn-filter-disclosure" open>
|
|
21
|
+
<summary class="rn-filter-summary">
|
|
22
|
+
<span class="flex items-center gap-2">
|
|
106
23
|
<svg class="w-4 h-4" style="color: var(--rn-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>
|
|
107
|
-
<span class="text-
|
|
108
|
-
<% if
|
|
109
|
-
|
|
24
|
+
<span class="text-sm font-semibold" style="color: var(--rn-text)">Filters</span>
|
|
25
|
+
<% if pills.any? %>
|
|
26
|
+
<span class="rn-filter-count"><%= pills.size %> active</span>
|
|
27
|
+
<% else %>
|
|
28
|
+
<span class="text-xs" style="color: var(--rn-text-muted)">Search and narrow exceptions</span>
|
|
110
29
|
<% end %>
|
|
111
|
-
</
|
|
112
|
-
|
|
30
|
+
</span>
|
|
31
|
+
<svg class="rn-filter-chevron 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="M19.5 8.25L12 15.75 4.5 8.25" /></svg>
|
|
32
|
+
</summary>
|
|
113
33
|
|
|
114
34
|
<%# Filter form %>
|
|
115
35
|
<%= search_form_for @q, url: query_logged_exceptions_path, data: { turbo_frame: "exceptions" } do |f| %>
|
|
@@ -215,11 +135,13 @@
|
|
|
215
135
|
|
|
216
136
|
<div class="flex items-center gap-2">
|
|
217
137
|
<%= f.submit "Apply", class: "rn-btn rn-btn-primary" %>
|
|
138
|
+
<% if filtered? %>
|
|
139
|
+
<%= link_to "Clear", logged_exceptions_path(per_page: params[:per_page]), class: "rn-btn rn-btn-ghost" %>
|
|
140
|
+
<% end %>
|
|
218
141
|
</div>
|
|
219
142
|
</div>
|
|
220
143
|
|
|
221
144
|
<%# Active filter pills %>
|
|
222
|
-
<% pills = active_filter_pills %>
|
|
223
145
|
<% if pills.any? %>
|
|
224
146
|
<div class="rn-filter-pills">
|
|
225
147
|
<% pills.each do |pill| %>
|
|
@@ -231,11 +153,9 @@
|
|
|
231
153
|
</div>
|
|
232
154
|
<% end %>
|
|
233
155
|
<% end %>
|
|
234
|
-
</
|
|
156
|
+
</details>
|
|
235
157
|
|
|
236
158
|
<%# ─── Content Area ────────────────────────────────────────── %>
|
|
237
|
-
<div class="flex gap-4" style="min-height: 400px">
|
|
238
|
-
|
|
239
159
|
<%# ─── Exception List ──────────────────────────────────── %>
|
|
240
160
|
<div class="flex-1 min-w-0">
|
|
241
161
|
|
|
@@ -270,6 +190,8 @@
|
|
|
270
190
|
</div>
|
|
271
191
|
</div>
|
|
272
192
|
|
|
193
|
+
</section>
|
|
194
|
+
|
|
273
195
|
<%# ─── Keyboard Shortcuts Dialog ───────────────────────────── %>
|
|
274
196
|
<% if RailsNexus.configuration.keyboard_shortcuts %>
|
|
275
197
|
<div class="rn-shortcuts-overlay" data-rails_nexus-target="shortcutsDialog" role="dialog" aria-modal="true" aria-labelledby="rn-shortcuts-title">
|