solid_litequeen 0.4.3 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1c6bcc2a70af068acb685dab8e79b066d64b01b9f7e54bab03f1795be655d07
4
- data.tar.gz: d9d685c019cfa91e2e2f588938064c64e4b76024c23f020d03e0f8e17e1c0cd3
3
+ metadata.gz: b7e11d8184f06b31b866092724d25b56560b29ca30ae6636a1c303107ce72d84
4
+ data.tar.gz: 79bdd3ca71f952457de0a9477cf9726abb3e89ece501f41b87cf1db80c057913
5
5
  SHA512:
6
- metadata.gz: fd19e4e09f35d7d47c2746827208e35bf63491bf459a3aa53f0505efa3c1053c4645f28db3cb4c668f992b6e77528b624ce30bc9474ec02bba1aebcb642ae48f
7
- data.tar.gz: 62c69b58509289ba6d2aa9b5634d71338cb24f1ed07abb1381ccc962465cdc7186a137cad159a3a415bcff487fad69c7d9bb7cc13e821daeddcdc0a6c60a0df5
6
+ metadata.gz: 932064fe04cf99a1307dd45620be29c0c7cf46070f1bafe266feab83e1a236a1cb8d99f1965105ea0cf7bd6539cc31d2732e4bb7e513142be96fa40eea8c408b
7
+ data.tar.gz: 2b4dab95ffce9080d36d013a1166d01ba1f774cf09bec3858b8ac2b3c0b2fed298e26e24425e091cefa18ce436ee0b231083363da74fbfaeabb8bbf37e910d21
@@ -0,0 +1 @@
1
+ //= link_tree ../javascripts/solid_litequeen .js
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-info"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path></svg>
@@ -0,0 +1,2 @@
1
+ document.querySelector("h1").innerText = "hi, i'm your engine";
2
+ console.log("hi, again");
@@ -41,5 +41,25 @@ module SolidLitequeen
41
41
 
42
42
  @data = DynamicDatabase.connection.select_all("SELECT * FROM #{@table_name} LIMIT 50")
43
43
  end
44
+
45
+ def download
46
+ database_id = params.expect(:id)
47
+ database_location = Base64.urlsafe_decode64(database_id)
48
+
49
+ # Verify the file exists
50
+ unless File.exist?(database_location)
51
+ flash[:error] = "Database file not found"
52
+ redirect_to databases_path and return
53
+ end
54
+
55
+ # Get the filename from the path
56
+ filename = File.basename(database_location)
57
+
58
+ # Send the file as a download
59
+ send_file database_location,
60
+ filename: filename,
61
+ type: "application/x-sqlite3",
62
+ disposition: "attachment"
63
+ end
44
64
  end
45
65
  end
@@ -5,7 +5,6 @@
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
 
8
- <%= yield :head %>
9
8
 
10
9
  <%= stylesheet_link_tag "solid_litequeen/application", media: "all" %>
11
10
  <script src="https://unpkg.com/@tailwindcss/browser@4"></script>
@@ -16,9 +15,20 @@
16
15
  --color-clifford: #da373d;
17
16
  }
18
17
  </style>
18
+
19
+ <%# Only include the importmap tags if we're not in a host application %>
20
+
21
+ <%= javascript_importmap_tags %>
22
+
23
+
24
+ <%# Always include the engine's JavaScript module %>
25
+ <%= javascript_import_module_tag "solid_litequeen/application" %>
26
+
27
+ <%= yield :head %>
19
28
  </head>
20
29
  <body class="">
21
30
 
31
+
22
32
  <%= yield %>
23
33
 
24
34
  </body>
@@ -35,4 +35,5 @@
35
35
  </tbody>
36
36
  </table>
37
37
  </div>
38
+ <%= link_to "Download Database", database_download_path(@database_id), class: "btn btn-primary text-xs mt-4" %>
38
39
  </div>
@@ -17,8 +17,8 @@
17
17
 
18
18
  <div class="bg-white rounded-lg shadow overflow-x-auto">
19
19
  <div class="min-w-full inline-block align-middle">
20
- <table class="min-w-full">
21
- <thead>
20
+ <table class="min-w-full relative">
21
+ <thead class="">
22
22
  <tr class="bg-gray-100 border-b border-gray-200">
23
23
  <% @data.columns.each do |column| %>
24
24
  <th class="px-6 py-3 text-left text-sm font-medium text-gray-700 whitespace-nowrap"><%= column %></th>
@@ -29,7 +29,20 @@
29
29
  <% @data.rows.each do |row| %>
30
30
  <tr class="hover:bg-gray-50">
31
31
  <% row.each do |item| %>
32
- <td class="px-6 py-4 text-sm text-gray-800 whitespace-nowrap"><%= item %></td>
32
+ <% truncated_item = item&.truncate(80) %>
33
+ <td class="px-6 py-4 text-sm text-gray-800 whitespace-nowrap" >
34
+
35
+ <div class="flex justify-between">
36
+
37
+ <span><%= truncated_item %></span>
38
+
39
+ <% if truncated_item&.to_s&.ends_with?("...") %>
40
+ <span title="<%= item %>" class="cursor-pointer size-4">
41
+ <%= image_tag "solid_litequeen/icons/info.svg", class: "size-4" %>
42
+ </span>
43
+ <% end %>
44
+ </div>
45
+ </td>
33
46
  <% end %>
34
47
  </tr>
35
48
  <% end %>
@@ -0,0 +1,3 @@
1
+ # NOTE: this pin works because `my_engine/app/assets/javascripts
2
+ # is in the `Rails.application.config.assets.paths`
3
+ pin "solid_litequeen/application"
data/config/routes.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  SolidLitequeen::Engine.routes.draw do
2
2
  resources :databases, only: [ :index, :show ] do
3
3
  get "/tables/:table", to: "databases#table_rows", as: :table_rows
4
+ get "databases/:id/download", to: "databases#download", as: "download"
4
5
  end
5
6
  root to: "databases#index"
6
7
  end
@@ -1,5 +1,25 @@
1
+ require "importmap-rails"
2
+
1
3
  module SolidLitequeen
2
4
  class Engine < ::Rails::Engine
3
5
  isolate_namespace SolidLitequeen
6
+
7
+ initializer "solid_litequeen.importmap", before: "importmap" do |app|
8
+ # NOTE: this will add pins from this engine to the main app
9
+ # https://github.com/rails/importmap-rails#composing-import-maps
10
+ app.config.importmap.paths << root.join("config/importmap.rb")
11
+
12
+ # Add the engine's JavaScript directory to the asset paths
13
+ app.config.assets.paths << root.join("app/assets/javascripts")
14
+
15
+ # NOTE: something about cache; I did not look into it.
16
+ # https://github.com/rails/importmap-rails#sweeping-the-cache-in-development-and-test
17
+ app.config.importmap.cache_sweepers << root.join("app/assets/javascripts")
18
+ end
19
+
20
+ # NOTE: add engine manifest to precompile assets in production
21
+ initializer "solid_litequeen.assets" do |app|
22
+ app.config.assets.precompile += %w[solid_litequeen_manifest]
23
+ end
4
24
  end
5
25
  end
@@ -1,3 +1,3 @@
1
1
  module SolidLitequeen
2
- VERSION = "0.4.3"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_litequeen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vik Borges
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-26 00:00:00.000000000 Z
11
+ date: 2025-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -147,9 +147,12 @@ files:
147
147
  - MIT-LICENSE
148
148
  - README.md
149
149
  - Rakefile
150
+ - app/assets/config/solid_litequeen_manifest.js
150
151
  - app/assets/images/solid_litequeen/icons/chevron-left.svg
151
152
  - app/assets/images/solid_litequeen/icons/chevron-right.svg
152
153
  - app/assets/images/solid_litequeen/icons/database.svg
154
+ - app/assets/images/solid_litequeen/icons/info.svg
155
+ - app/assets/javascripts/solid_litequeen/application.js
153
156
  - app/assets/stylesheets/solid_litequeen/application.css
154
157
  - app/controllers/solid_litequeen/application_controller.rb
155
158
  - app/controllers/solid_litequeen/databases_controller.rb
@@ -162,6 +165,7 @@ files:
162
165
  - app/views/solid_litequeen/databases/index.html.erb
163
166
  - app/views/solid_litequeen/databases/show.html.erb
164
167
  - app/views/solid_litequeen/databases/table_rows.html.erb
168
+ - config/importmap.rb
165
169
  - config/routes.rb
166
170
  - lib/solid_litequeen.rb
167
171
  - lib/solid_litequeen/engine.rb