lato_storage 3.0.0 → 3.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d05661b7389e2ddbde1a533b1da8175cfb487df74268efaae8d36aedddfb8b7
4
- data.tar.gz: e9d0f31b63fafc2d37553733a3170cccce4c7a9d694d2e29a7f37497d7a55417
3
+ metadata.gz: 7c98133207f73ddb9455806ad91eef86517f34516d671deeecf6cd735c834ae6
4
+ data.tar.gz: 197b5bfddc6624df28e54921d3391d175e140984c979519d697acd9b45950677
5
5
  SHA512:
6
- metadata.gz: 7994b4bab09fba75f5868af1d5a71bbe6c62604438a2d96dfee8b92fab54baf2478e043e7ed79f46d2697d39f3fcccdc91c5dd7e539ea0467eb7326457b28f59
7
- data.tar.gz: a60279cc560d60620ddd78bdf7752d8a8ded7684714e4c073e7e5a69caa14b9341ffc2d01310103319ee5d3b92cfc2d6db9337c2f56b5eca19037473917fe8fc
6
+ metadata.gz: 961771f4205805ec5d4dcd2f5f01b92d0026c3d20d56dca968c89cbec99c6bbfa1f5b97ed882776b66565d10bdd4305341b19e2c76c12b2ec09d6c2c3c13f440
7
+ data.tar.gz: 07a22662aa5ffbcdff5e8d14a5d150b2ed63c5d6b9e3fb5f617c1d382da6da49ee81a6445fe07395532aa1631cfc8a51e8c1437aa15e1e3e12ac17729a93c2a2
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Lato Storage
2
2
  Manage application storage (ActiveStorage data) on Lato projects.
3
3
 
4
- 🚨 THIS GEM IN UNDER DEVELOPMENT 🚨
5
-
6
4
  NOTE: This gem is using [Active Storage Dashboard](https://github.com/giovapanasiti/active_storage_dashboard) as reference for the interface and the functionality. The idea is to provide a similar interface inside Lato.
7
5
 
8
6
  ## Installation
@@ -19,6 +19,20 @@ module LatoStorage
19
19
  @largest_blobs = ActiveStorage::Blob.order(byte_size: :desc).limit(3)
20
20
  end
21
21
 
22
+ def cleaner
23
+ @operation = Lato::Operation.generate('Lato::ActiveStorageCleanerJob', {}, @session.user_id)
24
+
25
+ respond_to do |format|
26
+ if @operation.start
27
+ format.html { redirect_to lato.operation_path(@operation) }
28
+ format.json { render json: @operation }
29
+ else
30
+ format.html { render :index, status: :unprocessable_entity }
31
+ format.json { render json: @operation.errors, status: :unprocessable_entity }
32
+ end
33
+ end
34
+ end
35
+
22
36
  protected
23
37
 
24
38
  def authenticate_lato_storage_admin
@@ -37,6 +37,10 @@
37
37
  </div>
38
38
  </div>
39
39
 
40
+ </div>
41
+
42
+ <div class="row">
43
+
40
44
  <div class="col col-12 col-lg-6 mb-3">
41
45
  <div class="card">
42
46
  <div class="card-header">
@@ -74,10 +78,14 @@
74
78
 
75
79
  <div class="col col-12 col-lg-6 mb-3">
76
80
  <div class="card mb-3">
77
- <div class="card-header">
81
+ <div class="card-header d-flex justify-content-between align-items-center">
78
82
  <h5 class="card-title mb-0">
79
83
  <%= I18n.t('lato_storage.storage_usage') %>
80
84
  </h5>
85
+
86
+ <div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
87
+ <%= link_to I18n.t('lato_storage.cta_free_space'), lato_storage.cleaner_path, class: 'btn btn-primary', data: { turbo_method: :post, turbo_confirm: I18n.t('lato_storage.confirm_free_space'), lato_action_target: 'trigger', turbo_frame: 'lato_operation' } %>
88
+ </div>
81
89
  </div>
82
90
  <div class="card-body row">
83
91
  <div class="col col-12 col-md-6 mb-3 mb-md-0">
@@ -112,7 +120,7 @@
112
120
  <% @largest_blobs.each do |blob| %>
113
121
  <a class="list-group-item list-group-item-action" href="<%= main_app.url_for(blob) %>" target="_blank" rel="noopener noreferrer" download>
114
122
  <div class="d-flex justify-content-between align-items-center">
115
- <strong><%= blob.filename %></strong>
123
+ <strong class="text-truncate"><%= blob.filename %></strong>
116
124
  <div class="d-flex align-items-center">
117
125
  <span class="badge bg-primary rounded-pill">
118
126
  <%= format_bytes blob.byte_size %>
@@ -131,4 +139,5 @@
131
139
  </div>
132
140
  </div>
133
141
  </div>
142
+
134
143
  </div>
@@ -11,4 +11,6 @@ en:
11
11
  storage_usage: "Storage Usage"
12
12
  largest_blobs: "Largest Blobs"
13
13
  no_largest_blobs: "No Blobs available"
14
- deletable_blobs: "Deletable Blobs"
14
+ deletable_blobs: "Deletable Blobs"
15
+ cta_free_space: "Free up space"
16
+ confirm_free_space: "Are you sure you want to free up space? The blobs considered deletable will be removed permanently."
@@ -12,3 +12,5 @@ it:
12
12
  largest_blobs: "Blob più grandi"
13
13
  no_largest_blobs: "Nessun blob disponibile"
14
14
  deletable_blobs: "Blob eliminabili"
15
+ cta_free_space: "Libera spazio"
16
+ confirm_free_space: "Sei sicuro di voler liberare spazio? I file considerati eliminabili verranno rimossi definitivamente."
data/config/routes.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  LatoStorage::Engine.routes.draw do
2
2
  root 'application#index'
3
+ post 'cleaner', to: 'application#cleaner', as: :cleaner
3
4
  end
@@ -1,3 +1,3 @@
1
1
  module LatoStorage
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato_storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-17 00:00:00.000000000 Z
11
+ date: 2025-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails