ops_backups 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/ops_backups/application_controller.rb +13 -0
- data/app/models/ops_backups/backup.rb +0 -4
- data/app/views/ops_backups/backups/index.html.erb +11 -3
- data/lib/generators/ops_backups/activeadmin/templates/backup.rb +10 -0
- data/lib/ops_backups/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 676b08b7df0898e0bc8fbc2572b8aa7801f09c74cba43f5544836d6111a27cfe
|
4
|
+
data.tar.gz: 6377a44547eb4a34e97d13ccdf16db48a3739ca2c61ed43c5f8cf371be6fbfe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d03c15b798b0fe5cef8ced86cbb27ff14cf657ceb9052883e88e6e24d132cf28e712797ac87c3f436a2e04da5fc4c1dfc65540877648615c9c9fade12658da8
|
7
|
+
data.tar.gz: f3cbf7c12f6f54feaeca3a05fed9c667fbcc559936b36eb2b81408f02bd802c1e6354a9b7574e42c236427de6700acb47965180d57b26809e9262cd5fa38e33f
|
@@ -1,4 +1,17 @@
|
|
1
1
|
module OpsBackups
|
2
2
|
class ApplicationController < ActionController::Base
|
3
|
+
before_action :set_locale
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def set_locale
|
8
|
+
# set the locale only if the locale is available
|
9
|
+
locale = extract_locale
|
10
|
+
I18n.locale = locale if I18n.available_locales.map(&:to_s).include?(locale)
|
11
|
+
end
|
12
|
+
|
13
|
+
def extract_locale
|
14
|
+
request.env["HTTP_ACCEPT_LANGUAGE"].split(",")&.first&.split(";")&.first.to_s
|
15
|
+
end
|
3
16
|
end
|
4
17
|
end
|
@@ -8,10 +8,6 @@ module OpsBackups
|
|
8
8
|
|
9
9
|
default_scope { order(updated_at: :desc) }
|
10
10
|
|
11
|
-
def self.ransackable_attributes(auth_object = nil)
|
12
|
-
[ "created_at", "id", "name", "new_id", "tag", "updated_at" ]
|
13
|
-
end
|
14
|
-
|
15
11
|
def size
|
16
12
|
backup_file.attached? ? number_to_human_size(backup_file.byte_size) : "N/A"
|
17
13
|
end
|
@@ -18,7 +18,7 @@
|
|
18
18
|
}
|
19
19
|
& ops-backup {
|
20
20
|
display: grid;
|
21
|
-
grid-template-columns: 3em
|
21
|
+
grid-template-columns: 3em 3fr 2fr 6em 6em 12em 6em;
|
22
22
|
gap: 0.5em;
|
23
23
|
padding: 0.25em;
|
24
24
|
& ops-backup-index,
|
@@ -91,10 +91,10 @@
|
|
91
91
|
<ops-backup id="ops-backup-<%= i %>">
|
92
92
|
<ops-backup-index><%= i %></ops-backup-index>
|
93
93
|
<ops-backup-name><%= backup.name %></ops-backup-name>
|
94
|
-
<ops-backup-tag><%= backup.
|
94
|
+
<ops-backup-tag><%= backup.tag %></ops-backup-tag>
|
95
95
|
<ops-backup-size><%= backup.size %></ops-backup-size>
|
96
96
|
<ops-backup-duration><%= backup.duration %></ops-backup-duration>
|
97
|
-
<ops-backup-created_at><%= backup.created_at %></ops-backup-created_at>
|
97
|
+
<ops-backup-created_at data-time="<%= backup.created_at.iso8601 %>"><%= l backup.created_at, format: :short %></ops-backup-created_at>
|
98
98
|
<ops-backup-actions>
|
99
99
|
<% if backup.backup_file.attached? %>
|
100
100
|
<%= button_to "📎", download_backup_path(backup), method: :get %>
|
@@ -109,3 +109,11 @@
|
|
109
109
|
<div class="alert alert-<%= key %>"><%= value %></div>
|
110
110
|
<% end %>
|
111
111
|
</div>
|
112
|
+
<script>
|
113
|
+
// document.addEventListener("DOMContentLoaded", function() {
|
114
|
+
// document.querySelectorAll("ops-backup-created_at").forEach(function(element) {
|
115
|
+
// const time = new Date(element.getAttribute("data-time"));
|
116
|
+
// element.textContent = time.toLocaleString();
|
117
|
+
// });
|
118
|
+
// });
|
119
|
+
</script>
|
@@ -1,3 +1,13 @@
|
|
1
|
+
# monkey patch the Backup model to allow for ransackable_attributes
|
2
|
+
module OpsBackups
|
3
|
+
class Backup < ActiveRecord::Base
|
4
|
+
def self.ransackable_attributes(auth_object = nil)
|
5
|
+
[ "created_at", "id", "name", "new_id", "tag", "updated_at" ]
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# ActiveAdmin resource for OpsBackups::Backup
|
1
11
|
ActiveAdmin.register OpsBackups::Backup do
|
2
12
|
menu parent: "Ops", label: I18n.t("admin.ops.backup")
|
3
13
|
|
data/lib/ops_backups/version.rb
CHANGED