rails_nexus 2.0.3 → 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 +103 -6
- data/app/assets/stylesheets/rails_nexus/application.css +418 -42
- data/app/controllers/rails_nexus/backup_controller.rb +27 -19
- data/app/helpers/rails_nexus/application_helper.rb +5 -0
- data/app/javascript/controllers/rails_nexus_controller.js +8 -2
- data/app/javascript/controllers/rails_nexus_sidebar_controller.js +84 -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 +84 -16
- data/app/services/rails_nexus/backup_service.rb +521 -115
- data/app/views/layouts/rails_nexus/_sidebar_navigation.html.erb +113 -0
- data/app/views/layouts/rails_nexus/application.html.erb +132 -26
- data/app/views/rails_nexus/backup/_form.html.erb +186 -37
- 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 +24 -55
- data/app/views/rails_nexus/logged_exceptions/index.html.erb +24 -102
- data/db/seeds/backup_configs.rb +140 -0
- data/lib/generators/rails_nexus/templates/migration.rb +32 -6
- data/lib/rails_nexus/version.rb +1 -1
- data/lib/tasks/rails_nexus.rake +14 -4
- metadata +4 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<%= form_for @config, url: (@config.persisted? ? backup_path(@config) :
|
|
1
|
+
<%= form_for @config, url: (@config.persisted? ? backup_path(@config) : backup_path), class: "space-y-6" do |f| %>
|
|
2
2
|
<% if @config.errors.any? %>
|
|
3
3
|
<div class="rn-card" style="border-left: 3px solid var(--rn-danger)">
|
|
4
4
|
<div class="p-4">
|
|
5
5
|
<p class="text-sm font-semibold" style="color: var(--rn-danger)"><%= @config.errors.count %> error(s) prevented this config from being saved:</p>
|
|
6
6
|
<ul class="mt-2 text-xs" style="color: var(--rn-text-secondary)">
|
|
7
7
|
<% @config.errors.full_messages.each do |msg| %>
|
|
8
|
-
<li
|
|
8
|
+
<li>• <%= msg %></li>
|
|
9
9
|
<% end %>
|
|
10
10
|
</ul>
|
|
11
11
|
</div>
|
|
@@ -27,8 +27,10 @@
|
|
|
27
27
|
<%= f.text_field :description, class: "rn-input", placeholder: "e.g. TTI Daily Backup" %>
|
|
28
28
|
</div>
|
|
29
29
|
<div class="rn-filter-group">
|
|
30
|
-
<label>
|
|
31
|
-
|
|
30
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
31
|
+
<%= f.check_box :enabled %>
|
|
32
|
+
Enabled
|
|
33
|
+
</label>
|
|
32
34
|
</div>
|
|
33
35
|
</div>
|
|
34
36
|
</div>
|
|
@@ -41,7 +43,13 @@
|
|
|
41
43
|
<div class="p-4 grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
42
44
|
<div class="rn-filter-group">
|
|
43
45
|
<label>Adapter *</label>
|
|
44
|
-
<%= f.select :adapter, options_for_select([
|
|
46
|
+
<%= f.select :adapter, options_for_select([
|
|
47
|
+
["MySQL", "mysql"],
|
|
48
|
+
["PostgreSQL", "postgresql"],
|
|
49
|
+
["SQLite", "sqlite"],
|
|
50
|
+
["MongoDB", "mongodb"],
|
|
51
|
+
["Redis", "redis"]
|
|
52
|
+
], @config.adapter), {}, class: "rn-select" %>
|
|
45
53
|
</div>
|
|
46
54
|
<div class="rn-filter-group">
|
|
47
55
|
<label>Database Name *</label>
|
|
@@ -61,11 +69,12 @@
|
|
|
61
69
|
</div>
|
|
62
70
|
<div class="rn-filter-group">
|
|
63
71
|
<label>Password</label>
|
|
64
|
-
<%= f.password_field :password, class: "rn-input", placeholder: "
|
|
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>
|
|
65
74
|
</div>
|
|
66
75
|
<div class="rn-filter-group md:col-span-3">
|
|
67
76
|
<label>Skip Tables (comma-separated)</label>
|
|
68
|
-
<%=
|
|
77
|
+
<%= f.text_field :skip_tables, value: @config.skip_tables_list.join(", "), class: "rn-input", placeholder: "e.g. sessions, versions, internal_logs" %>
|
|
69
78
|
</div>
|
|
70
79
|
</div>
|
|
71
80
|
</div>
|
|
@@ -87,56 +96,158 @@
|
|
|
87
96
|
</div>
|
|
88
97
|
</div>
|
|
89
98
|
|
|
90
|
-
<%# ───
|
|
99
|
+
<%# ─── Archives ────────────────────────────────────────────── %>
|
|
91
100
|
<div class="rn-card">
|
|
92
101
|
<div class="p-4" style="border-bottom: 1px solid var(--rn-border-light)">
|
|
93
|
-
<h2 class="text-sm font-semibold" style="color: var(--rn-text)">
|
|
102
|
+
<h2 class="text-sm font-semibold" style="color: var(--rn-text)">Archives (File/Directory Backup)</h2>
|
|
94
103
|
</div>
|
|
95
104
|
<div class="p-4 grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
96
105
|
<div class="rn-filter-group">
|
|
97
|
-
<label
|
|
98
|
-
|
|
106
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
107
|
+
<%= f.check_box :archive_enabled %>
|
|
108
|
+
Enable Archives
|
|
109
|
+
</label>
|
|
110
|
+
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">Include additional files/directories in the backup tar</p>
|
|
99
111
|
</div>
|
|
100
|
-
<div class="rn-filter-group">
|
|
101
|
-
<label>
|
|
102
|
-
<%= f.
|
|
112
|
+
<div class="rn-filter-group md:col-span-2" id="archive-paths-group">
|
|
113
|
+
<label>Archive Paths (comma-separated)</label>
|
|
114
|
+
<%= f.text_field :archive_paths, value: @config.archive_paths_list.join(", "), class: "rn-input", placeholder: "e.g. /var/log, /etc/nginx, /home/app/uploads" %>
|
|
103
115
|
</div>
|
|
104
|
-
<div class="rn-filter-group
|
|
105
|
-
<label>
|
|
106
|
-
<%= f.
|
|
116
|
+
<div class="rn-filter-group md:col-span-2" id="archive-excludes-group">
|
|
117
|
+
<label>Exclude Patterns</label>
|
|
118
|
+
<%= f.text_field :archive_excludes, value: @config.archive_excludes_list.join(", "), class: "rn-input", placeholder: "e.g. *.log, tmp/*, node_modules" %>
|
|
107
119
|
</div>
|
|
108
120
|
</div>
|
|
109
121
|
</div>
|
|
110
122
|
|
|
111
|
-
<%# ───
|
|
123
|
+
<%# ─── Compression & Encryption ────────────────────────────── %>
|
|
112
124
|
<div class="rn-card">
|
|
113
125
|
<div class="p-4" style="border-bottom: 1px solid var(--rn-border-light)">
|
|
114
|
-
<h2 class="text-sm font-semibold" style="color: var(--rn-text)">
|
|
126
|
+
<h2 class="text-sm font-semibold" style="color: var(--rn-text)">Compression & Encryption</h2>
|
|
115
127
|
</div>
|
|
116
128
|
<div class="p-4 grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
117
129
|
<div class="rn-filter-group">
|
|
118
|
-
<label
|
|
119
|
-
|
|
130
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
131
|
+
<%= f.check_box :compress %>
|
|
132
|
+
Gzip Compression
|
|
133
|
+
</label>
|
|
120
134
|
</div>
|
|
121
135
|
<div class="rn-filter-group">
|
|
122
|
-
<label>
|
|
123
|
-
|
|
136
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
137
|
+
<%= f.check_box :bzip2_compress %>
|
|
138
|
+
Bzip2 Compression
|
|
139
|
+
</label>
|
|
140
|
+
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">Better ratio but slower than Gzip</p>
|
|
124
141
|
</div>
|
|
125
142
|
<div class="rn-filter-group">
|
|
126
|
-
<label>
|
|
127
|
-
|
|
143
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
144
|
+
<%= f.check_box :encrypted %>
|
|
145
|
+
OpenSSL AES-256 Encryption
|
|
146
|
+
</label>
|
|
147
|
+
</div>
|
|
148
|
+
<div class="rn-filter-group" id="encrypt-password-group" style="<%= 'display:none' unless @config.encrypted? %>">
|
|
149
|
+
<label>Encryption Password</label>
|
|
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>
|
|
152
|
+
</div>
|
|
153
|
+
<div class="rn-filter-group">
|
|
154
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
155
|
+
<%= f.check_box :gpg_enabled %>
|
|
156
|
+
GPG Encryption
|
|
157
|
+
</label>
|
|
158
|
+
</div>
|
|
159
|
+
<div class="rn-filter-group" id="gpg-password-group" style="<%= 'display:none' unless @config.gpg_enabled? %>">
|
|
160
|
+
<label>GPG Password</label>
|
|
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>
|
|
128
163
|
</div>
|
|
129
164
|
<div class="rn-filter-group">
|
|
130
|
-
<label
|
|
131
|
-
|
|
165
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
166
|
+
<%= f.check_box :split_chunks %>
|
|
167
|
+
Split into Chunks (50MB)
|
|
168
|
+
</label>
|
|
169
|
+
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">Split large backups into 50MB files</p>
|
|
132
170
|
</div>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
<%# ─── Remote Sync (RSync) ────────────────────────────────── %>
|
|
175
|
+
<div class="rn-card">
|
|
176
|
+
<div class="p-4" style="border-bottom: 1px solid var(--rn-border-light)">
|
|
177
|
+
<h2 class="text-sm font-semibold" style="color: var(--rn-text)">Remote Sync (RSync)</h2>
|
|
178
|
+
</div>
|
|
179
|
+
<div class="p-4 grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
133
180
|
<div class="rn-filter-group">
|
|
134
|
-
<label
|
|
135
|
-
|
|
181
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
182
|
+
<%= f.check_box :rsync_enabled %>
|
|
183
|
+
Enable RSync
|
|
184
|
+
</label>
|
|
185
|
+
</div>
|
|
186
|
+
<div class="rn-filter-group" id="rsync-fields" style="<%= 'display:none' unless @config.rsync_enabled? %>">
|
|
187
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
188
|
+
<div>
|
|
189
|
+
<label>Host</label>
|
|
190
|
+
<%= f.text_field :rsync_host, class: "rn-input", placeholder: "192.168.1.100" %>
|
|
191
|
+
</div>
|
|
192
|
+
<div>
|
|
193
|
+
<label>Port</label>
|
|
194
|
+
<%= f.number_field :rsync_port, class: "rn-input", value: @config.rsync_port || 22 %>
|
|
195
|
+
</div>
|
|
196
|
+
<div>
|
|
197
|
+
<label>SSH User</label>
|
|
198
|
+
<%= f.text_field :rsync_user, class: "rn-input", placeholder: "backup" %>
|
|
199
|
+
</div>
|
|
200
|
+
<div>
|
|
201
|
+
<label>Remote Path</label>
|
|
202
|
+
<%= f.text_field :rsync_path, class: "rn-input", placeholder: "/backups" %>
|
|
203
|
+
</div>
|
|
204
|
+
<div>
|
|
205
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
206
|
+
<%= f.check_box :rsync_mirror %>
|
|
207
|
+
Mirror Mode
|
|
208
|
+
</label>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
136
211
|
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
<%# ─── S3 Storage ──────────────────────────────────────────── %>
|
|
216
|
+
<div class="rn-card">
|
|
217
|
+
<div class="p-4" style="border-bottom: 1px solid var(--rn-border-light)">
|
|
218
|
+
<h2 class="text-sm font-semibold" style="color: var(--rn-text)">S3 Storage</h2>
|
|
219
|
+
</div>
|
|
220
|
+
<div class="p-4 grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
137
221
|
<div class="rn-filter-group">
|
|
138
|
-
<label
|
|
139
|
-
|
|
222
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
223
|
+
<%= f.check_box :s3_enabled %>
|
|
224
|
+
Enable S3 Upload
|
|
225
|
+
</label>
|
|
226
|
+
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">Requires aws-cli or s3cmd installed</p>
|
|
227
|
+
</div>
|
|
228
|
+
<div class="rn-filter-group md:col-span-2" id="s3-fields" style="<%= 'display:none' unless @config.s3_enabled? %>">
|
|
229
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
230
|
+
<div>
|
|
231
|
+
<label>Access Key *</label>
|
|
232
|
+
<%= f.text_field :s3_access_key, class: "rn-input", placeholder: "AKIA..." %>
|
|
233
|
+
</div>
|
|
234
|
+
<div>
|
|
235
|
+
<label>Secret Key *</label>
|
|
236
|
+
<%= f.password_field :s3_secret_key, class: "rn-input", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" %>
|
|
237
|
+
</div>
|
|
238
|
+
<div>
|
|
239
|
+
<label>Bucket *</label>
|
|
240
|
+
<%= f.text_field :s3_bucket, class: "rn-input", placeholder: "my-backups-bucket" %>
|
|
241
|
+
</div>
|
|
242
|
+
<div>
|
|
243
|
+
<label>Region</label>
|
|
244
|
+
<%= f.text_field :s3_region, class: "rn-input", placeholder: "us-east-1", value: @config.s3_region || "us-east-1" %>
|
|
245
|
+
</div>
|
|
246
|
+
<div>
|
|
247
|
+
<label>Key Prefix</label>
|
|
248
|
+
<%= f.text_field :s3_prefix, class: "rn-input", placeholder: "backups/production" %>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
140
251
|
</div>
|
|
141
252
|
</div>
|
|
142
253
|
</div>
|
|
@@ -148,17 +259,31 @@
|
|
|
148
259
|
</div>
|
|
149
260
|
<div class="p-4 grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
150
261
|
<div class="rn-filter-group md:col-span-2">
|
|
151
|
-
<label>Notify Command</label>
|
|
262
|
+
<label>Notify Command (Webhook / Script)</label>
|
|
152
263
|
<%= f.text_field :notify_command, class: "rn-input", placeholder: "e.g. curl -X POST https://hooks.slack.com/..." %>
|
|
153
264
|
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">Variables: {STATUS}, {MODEL}, {ERROR}, {TIME}</p>
|
|
154
265
|
</div>
|
|
155
266
|
<div class="rn-filter-group">
|
|
156
|
-
<label
|
|
157
|
-
|
|
267
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
268
|
+
<%= f.check_box :notify_on_success %>
|
|
269
|
+
Notify on Success
|
|
270
|
+
</label>
|
|
158
271
|
</div>
|
|
159
272
|
<div class="rn-filter-group">
|
|
160
|
-
<label
|
|
161
|
-
|
|
273
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
274
|
+
<%= f.check_box :notify_on_failure %>
|
|
275
|
+
Notify on Failure
|
|
276
|
+
</label>
|
|
277
|
+
</div>
|
|
278
|
+
<div class="rn-filter-group">
|
|
279
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
280
|
+
<%= f.check_box :email_notify %>
|
|
281
|
+
Email Notifications
|
|
282
|
+
</label>
|
|
283
|
+
</div>
|
|
284
|
+
<div class="rn-filter-group" id="email-to-group" style="<%= 'display:none' unless @config.email_notify? %>">
|
|
285
|
+
<label>Email To</label>
|
|
286
|
+
<%= f.text_field :email_to, class: "rn-input", placeholder: "admin@example.com" %>
|
|
162
287
|
</div>
|
|
163
288
|
</div>
|
|
164
289
|
</div>
|
|
@@ -172,7 +297,7 @@
|
|
|
172
297
|
<div class="rn-filter-group" style="max-width: 300px">
|
|
173
298
|
<label>Cron Expression</label>
|
|
174
299
|
<%= f.text_field :schedule_cron, class: "rn-input", placeholder: "e.g. 0 2 * * * (daily at 2am)" %>
|
|
175
|
-
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">min hour day month wday
|
|
300
|
+
<p class="text-xs mt-1" style="color: var(--rn-text-muted)">min hour day month wday — leave blank for manual only</p>
|
|
176
301
|
</div>
|
|
177
302
|
</div>
|
|
178
303
|
</div>
|
|
@@ -183,3 +308,27 @@
|
|
|
183
308
|
<%= link_to "Cancel", backup_path, class: "rn-btn rn-btn-ghost" %>
|
|
184
309
|
</div>
|
|
185
310
|
<% end %>
|
|
311
|
+
|
|
312
|
+
<script>
|
|
313
|
+
document.addEventListener("DOMContentLoaded", function() {
|
|
314
|
+
// Toggle visibility for dependent sections based on checkboxes
|
|
315
|
+
function setupToggle(checkboxId, targetId) {
|
|
316
|
+
var cb = document.getElementById(checkboxId);
|
|
317
|
+
var target = document.getElementById(targetId);
|
|
318
|
+
if (!cb || !target) return;
|
|
319
|
+
cb.addEventListener("change", function() {
|
|
320
|
+
target.style.display = cb.checked ? "" : "none";
|
|
321
|
+
});
|
|
322
|
+
// Set initial state
|
|
323
|
+
target.style.display = cb.checked ? "" : "none";
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
setupToggle("backup_config_encrypted", "encrypt-password-group");
|
|
327
|
+
setupToggle("backup_config_gpg_enabled", "gpg-password-group");
|
|
328
|
+
setupToggle("backup_config_rsync_enabled", "rsync-fields");
|
|
329
|
+
setupToggle("backup_config_s3_enabled", "s3-fields");
|
|
330
|
+
setupToggle("backup_config_email_notify", "email-to-group");
|
|
331
|
+
setupToggle("backup_config_archive_enabled", "archive-paths-group");
|
|
332
|
+
setupToggle("backup_config_archive_enabled", "archive-excludes-group");
|
|
333
|
+
});
|
|
334
|
+
</script>
|
|
@@ -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)">
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
<% else %>
|
|
16
16
|
<%# ─── Table Header Bar ───────────────────────────────────── %>
|
|
17
|
-
<div class="
|
|
18
|
-
<div class="
|
|
17
|
+
<div class="rn-exceptions-toolbar" style="background: var(--rn-bg-secondary); border-bottom: 1px solid var(--rn-border-light)">
|
|
18
|
+
<div class="rn-exceptions-toolbar-summary">
|
|
19
19
|
<span class="text-xs font-medium" style="color: var(--rn-text-secondary)">
|
|
20
|
-
<span class="font-semibold" style="color: var(--rn-text)"><%= number_with_delimiter(@pagy.count) %></span>
|
|
20
|
+
<span class="font-semibold" style="color: var(--rn-text)"><%= number_with_delimiter(@pagy.count) %></span>
|
|
21
|
+
<%= "exception".pluralize(@pagy.count) %>
|
|
21
22
|
<% if filtered? %>
|
|
22
23
|
<span style="color: var(--rn-text-muted)">(filtered)</span>
|
|
23
24
|
<% end %>
|
|
@@ -35,9 +36,9 @@
|
|
|
35
36
|
</div>
|
|
36
37
|
</div>
|
|
37
38
|
|
|
38
|
-
<div class="
|
|
39
|
+
<div class="rn-exceptions-toolbar-actions">
|
|
39
40
|
<%# Keyboard hint %>
|
|
40
|
-
<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)">
|
|
41
42
|
<span class="rn-kbd">?</span> shortcuts
|
|
42
43
|
</span>
|
|
43
44
|
|
|
@@ -54,13 +55,10 @@
|
|
|
54
55
|
<%# ─── Exception Table ────────────────────────────────────── %>
|
|
55
56
|
<div class="rn-table-wrap">
|
|
56
57
|
<table class="rn-table rn-exceptions-table">
|
|
58
|
+
<caption class="sr-only">Logged application exceptions</caption>
|
|
57
59
|
<thead>
|
|
58
60
|
<tr>
|
|
59
|
-
<th class="rn-col-severity"><span class="sr-only">Severity</span></th>
|
|
60
61
|
<th class="rn-col-exception <%= sort_header_class(:exception_class) %>"><%= sort_link @q, :exception_class, "Exception" %></th>
|
|
61
|
-
<% if exception_feature?(:platform) %>
|
|
62
|
-
<th class="rn-col-platform <%= sort_header_class(:platform) %>"><%= sort_link @q, :platform, "Platform" %></th>
|
|
63
|
-
<% end %>
|
|
64
62
|
<th class="rn-col-source <%= sort_header_class(:controller_name) %>"><%= sort_link @q, :controller_name, "Source" %></th>
|
|
65
63
|
<th class="rn-col-message <%= sort_header_class(:message) %>"><%= sort_link @q, :message, "Message" %></th>
|
|
66
64
|
<% if exception_feature?(:occurrence_count) %>
|
|
@@ -68,9 +66,6 @@
|
|
|
68
66
|
<% else %>
|
|
69
67
|
<th class="rn-col-count">Count</th>
|
|
70
68
|
<% end %>
|
|
71
|
-
<th class="rn-col-workflow <%= sort_header_class(:priority) if exception_feature?(:priority) && exception_searchable?(:priority) %>">
|
|
72
|
-
<%= exception_feature?(:priority) && exception_searchable?(:priority) ? sort_link(@q, :priority, "Workflow") : "Workflow" %>
|
|
73
|
-
</th>
|
|
74
69
|
<th class="rn-col-time <%= sort_header_class(:created_at) %>"><%= sort_link @q, :created_at, "Last Seen" %></th>
|
|
75
70
|
<th class="rn-col-actions"><span class="sr-only">Actions</span></th>
|
|
76
71
|
</tr>
|
|
@@ -79,36 +74,26 @@
|
|
|
79
74
|
<% @exceptions.each_with_index do |exception, index| %>
|
|
80
75
|
<tr id="<%= dom_id(exception) %>"
|
|
81
76
|
class="group"
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
tabindex="0"
|
|
78
|
+
aria-label="View <%= exception.exception_class %>: <%= exception.message.presence || 'No message' %>"
|
|
79
|
+
data-action="click->rails_nexus#selectRow keydown.enter->rails_nexus#selectRow keydown.space->rails_nexus#selectRow"
|
|
84
80
|
data-url="<%= logged_exception_path(exception) %>"
|
|
85
81
|
data-index="<%= index %>"
|
|
86
82
|
data-rails_nexus-index-param="<%= index %>">
|
|
87
83
|
|
|
88
|
-
<%#
|
|
89
|
-
<td>
|
|
90
|
-
<span class="rn-count-indicator rn-badge-<%= severity_for(exception) %>"
|
|
91
|
-
style="background: var(--rn-<%= severity_for(exception) %>-light); color: var(--rn-<%= severity_for(exception) %>); width: 0.5rem; height: 0.5rem; min-width: 0; padding: 0; border-radius: 50%">
|
|
92
|
-
</span>
|
|
93
|
-
</td>
|
|
94
|
-
|
|
95
|
-
<%# Exception class with severity badge %>
|
|
84
|
+
<%# Exception class with severity indicator %>
|
|
96
85
|
<td class="rn-col-exception">
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
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>
|
|
101
95
|
</td>
|
|
102
96
|
|
|
103
|
-
<%# Platform badge %>
|
|
104
|
-
<% if exception_feature?(:platform) %>
|
|
105
|
-
<td class="rn-col-platform">
|
|
106
|
-
<span class="rn-badge rn-badge-<%= exception.platform == 'ios' ? 'success' : exception.platform == 'android' ? 'warning' : exception.platform == 'api' ? 'info' : exception.platform == 'bot' ? 'muted' : 'primary' %>">
|
|
107
|
-
<%= exception.platform&.upcase || 'WEB' %>
|
|
108
|
-
</span>
|
|
109
|
-
</td>
|
|
110
|
-
<% end %>
|
|
111
|
-
|
|
112
97
|
<%# Source (controller + action) %>
|
|
113
98
|
<td class="rn-col-source">
|
|
114
99
|
<div class="rn-source" title="<%= [exception.controller_name, exception.action_name].compact.join('#') %>">
|
|
@@ -128,31 +113,15 @@
|
|
|
128
113
|
|
|
129
114
|
<%# Occurrence count %>
|
|
130
115
|
<td class="rn-col-count">
|
|
131
|
-
<span class="rn-
|
|
132
|
-
</td>
|
|
133
|
-
|
|
134
|
-
<%# Workflow indicators %>
|
|
135
|
-
<td class="rn-col-workflow">
|
|
136
|
-
<% status_label, status_style = exception_status(exception) %>
|
|
137
|
-
<div class="rn-workflow-state">
|
|
138
|
-
<span class="rn-badge rn-badge-xs rn-badge-<%= status_style %>"><%= status_label %></span>
|
|
139
|
-
<% if exception.respond_to?(:priority) && exception.priority.present? %>
|
|
140
|
-
<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>
|
|
141
|
-
<% end %>
|
|
142
|
-
<% if exception.respond_to?(:assigned_to) && exception.assigned_to.present? %>
|
|
143
|
-
<span class="rn-row-meta" title="Assigned to <%= exception.assigned_to %>">👤 <%= exception.assigned_to %></span>
|
|
144
|
-
<% elsif exception.respond_to?(:comments_count) && exception.comments_count.to_i > 0 %>
|
|
145
|
-
<span class="rn-row-meta"><%= exception.comments_count %> comments</span>
|
|
146
|
-
<% end %>
|
|
147
|
-
</div>
|
|
116
|
+
<span class="rn-occurrence-count" title="<%= pluralize(exception_occurrence_count(exception), 'occurrence') %>"><%= number_with_delimiter(exception_occurrence_count(exception)) %></span>
|
|
148
117
|
</td>
|
|
149
118
|
|
|
150
119
|
<%# Time (relative) %>
|
|
151
|
-
<td class="rn-date"><%= pretty_exception_date(exception) %></td>
|
|
120
|
+
<td class="rn-col-time rn-date"><%= pretty_exception_date(exception) %></td>
|
|
152
121
|
|
|
153
122
|
<%# Actions (delete on hover) %>
|
|
154
123
|
<td class="rn-col-actions" style="text-align: right">
|
|
155
|
-
<div class="
|
|
124
|
+
<div class="rn-row-actions">
|
|
156
125
|
<%= link_to logged_exception_path(exception),
|
|
157
126
|
class: "rn-icon-btn",
|
|
158
127
|
style: "color: var(--rn-text-muted)",
|