solid_litequeen 0.13.1 → 0.15.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: 52bfc6916fed8002c0b9151366f26b381ebf6a24209457fe6e77bf2035778cc4
4
- data.tar.gz: 379b3b67db8b7f081c70567c2e86427a3307e99f673380ca61a51c47415f5202
3
+ metadata.gz: 686ed29322a1c0f9087555ef3aaae940cec628cfe12924821b7fcaa07574f412
4
+ data.tar.gz: 21f1e4de62d85d782b54d8c1fca1b865298630bf6871a42504e67a57cb68d7d4
5
5
  SHA512:
6
- metadata.gz: 1c981a17c29cf6d884644a989e15f96f495f0cd93a2a050ebac3ecf7ff1092035f24069100f008454364a57359d19c219b58c9433549a5563ed50bfe024b6c5e
7
- data.tar.gz: f7edab2c355f6870cd4a86aeec2800119bbffbf57a7172e8ba49ef0152a2f897f64d7927ad353a9a2498f845d54309c837fe4c3aa9244a746d547e6c815682fc
6
+ metadata.gz: 808bbb57b82887b1b68d8de4d5307c415a18a75573f91ce9e32c6167172f70b635db4b1cd4efc94fbee8b8a8c047523db394b45f9aa2ca5a986213763587afcf
7
+ data.tar.gz: 7ccb9a625eecc5a084bc5737f5a7868d0d2342682ab46d74989d11305daef64324db08272dfe85e5950af49a0e3583fe4aa772b60ba1c33d1305c73b7ce39189
@@ -95,11 +95,29 @@ module SolidLitequeen
95
95
 
96
96
  foreign_keys = DynamicDatabase.connection.foreign_keys(@table_name)
97
97
 
98
+ primary_key_column_name = DynamicDatabase.connection.primary_key(@table_name)
99
+
100
+
98
101
  # Build a mapping from column name to its foreign key details
99
102
  fk_info = {}
100
103
  foreign_keys.each do |fk|
101
104
  # Depending on your Rails version, you might access these properties as below:
102
- fk_info[fk.column] = { to_table: fk.to_table, primary_key: fk.primary_key }
105
+ fk_info[fk.column] = {
106
+ to_table: fk.to_table,
107
+ primary_key: fk.primary_key,
108
+ on_update: fk.options.dig(:on_update),
109
+ on_delete: fk.options.dig(:on_delete)
110
+ }
111
+ end
112
+
113
+ # Retrieve index info
114
+ indexes = DynamicDatabase.connection.indexes(@table_name)
115
+ index_data = {}
116
+ indexes.each do |index|
117
+ index.columns.each do |column_name|
118
+ index_data[column_name] ||= []
119
+ index_data[column_name] << { name: index.name, unique: index.unique }
120
+ end
103
121
  end
104
122
 
105
123
  @columns_info = table_columns.each_with_object({}) do |column, hash|
@@ -110,13 +128,18 @@ module SolidLitequeen
110
128
  precision: column.sql_type_metadata.precision,
111
129
  scale: column.sql_type_metadata.scale,
112
130
  null: column.null,
113
- default: column.default
131
+ default: column.default,
132
+ is_primary_key: primary_key_column_name == column.name
114
133
  }
115
134
 
116
135
  # Append foreign key info if available for this column
117
136
  if fk_info[column.name]
118
137
  info[:foreign_key] = fk_info[column.name]
119
138
  end
139
+
140
+ # Append index info if available for this column
141
+ info[:indexes] = index_data[column.name] if index_data[column.name]
142
+
120
143
  hash[column.name] = info
121
144
  end
122
145
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  <meta name="turbo-refresh-method" content="morph">
9
9
  <meta name="turbo-refresh-scroll" content="preserve">
10
+ <meta name="view-transition" content="same-origin">
10
11
 
11
12
  <%= stylesheet_link_tag "solid_litequeen/application", media: "all", "data-turbo-track": "reload" %>
12
13
  <script src="https://unpkg.com/@tailwindcss/browser@4"></script>
@@ -15,7 +15,6 @@
15
15
  <p class="text-gray-600"><%= pluralize(@row_count, "row") %> found</p>
16
16
  </div>
17
17
 
18
-
19
18
  <div class="bg-white rounded-lg shadow overflow-x-auto">
20
19
  <div class="min-w-full inline-block align-middle">
21
20
  <table
@@ -33,9 +32,101 @@
33
32
  data-column-name="<%= column %>"
34
33
  class="hover:cursor-move px-6 py-3 text-left text-sm font-medium text-gray-700 whitespace-nowrap data-[is-dragging]:bg-orange-300/30 data-[column-order-about-to-be-swapped]:bg-green-300/30"
35
34
  >
36
- <%#= column %>
37
35
 
38
- <%= link_to column,
36
+ <%# popover the the column info %>
37
+ <% popover_id = "popover_#{column}_#{SecureRandom.hex(8)}" %>
38
+
39
+ <button popovertarget="<%= popover_id %>" class="mr-1 p-1 hover:cursor-pointer">
40
+ <%= image_tag "solid_litequeen/icons/info.svg", class: "size-3.5" %>
41
+ </button>
42
+
43
+ <div popover id="<%= popover_id %>" class="max-w-lg min-h-10 m-auto bg-gray-100 border-gray-400 border p-4 rounded-md">
44
+ <table class="min-w-full divide-y divide-gray-200 border border-gray-200">
45
+
46
+ <tbody class="bg-white divide-y divide-gray-200">
47
+ <% column_info = @columns_info[column] %>
48
+
49
+ <tr>
50
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold">Type</td>
51
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 "><%= column_info&.dig(:sql_type) %></td>
52
+ </tr>
53
+
54
+ <tr>
55
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold">Primary Key</td>
56
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 "><%= column_info&.dig(:is_primary_key) %></td>
57
+ </tr>
58
+
59
+ <tr>
60
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold">Nullable</td>
61
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 "><%= column_info&.dig(:null) %></td>
62
+ </tr>
63
+
64
+ <tr>
65
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold">Default</td>
66
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 "><%= column_info&.dig(:default) %></td>
67
+ </tr>
68
+
69
+ <% if column_info&.dig(:foreign_key).present? %>
70
+
71
+ <tr>
72
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold"></td>
73
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 "> </td>
74
+ </tr>
75
+
76
+ <tr>
77
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold">Foreign Key</td>
78
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
79
+ <%= column_info&.dig(:foreign_key).dig(:to_table) %>
80
+ &gt;
81
+ <%= column_info&.dig(:foreign_key).dig(:primary_key) %>
82
+ </td>
83
+ </tr>
84
+
85
+ <tr>
86
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold">ON_UPDATE</td>
87
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800"><%= column_info&.dig(:foreign_key).dig(:on_update) %></td>
88
+ </tr>
89
+
90
+ <tr>
91
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold">ON_DELETE</td>
92
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800"><%= column_info&.dig(:foreign_key).dig(:on_delete) %></td>
93
+ </tr>
94
+
95
+ <% end %>
96
+
97
+ <% if column_info&.dig(:indexes).present? %>
98
+
99
+ <tr>
100
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold"></td>
101
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 "> </td>
102
+ </tr>
103
+
104
+ <% column_info&.dig(:indexes).each do |index| %>
105
+ <tr>
106
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold">Index Name</td>
107
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
108
+ <%= index[:name] %>
109
+ </td>
110
+ </tr>
111
+ <tr>
112
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 font-semibold">Unique</td>
113
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
114
+ <%= index[:unique] %>
115
+ </td>
116
+ </tr>
117
+ <% end %>
118
+
119
+
120
+ <% end %>
121
+
122
+
123
+
124
+ </tbody>
125
+ </table>
126
+ </div>
127
+
128
+ <%# link to sort the columns %>
129
+ <%= link_to column,
39
130
  database_table_rows_path(
40
131
  database_id: @database_id,
41
132
  table: @table_name,
@@ -103,14 +194,13 @@
103
194
  </tbody>
104
195
 
105
196
  <dialog id="foreign-key-data" data-controller="dialog" class="w-[900px] m-auto overscroll-y-contain">
106
- <form method="submit" class="">
107
197
  <div class="flex flex-row-reverse">
108
- <button formmethod="dialog" class="cursor-pointer mr-4 mt-2 outline-none">
109
- <%= image_tag "solid_litequeen/icons/x.svg", class: "size-5" %>
110
- </button>
111
-
198
+ <form method="submit">
199
+ <button formmethod="dialog" class="cursor-pointer mr-4 mt-2 outline-none">
200
+ <%= image_tag "solid_litequeen/icons/x.svg", class: "size-5" %>
201
+ </button>
202
+ </form>
112
203
  </div>
113
- </form>
114
204
 
115
205
  <div class="overflow-x-auto relative">
116
206
  <turbo-frame id="foreign-key-data-frame" class="peer">
@@ -1,3 +1,3 @@
1
1
  module SolidLitequeen
2
- VERSION = "0.13.1"
2
+ VERSION = "0.15.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.13.1
4
+ version: 0.15.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-03-25 00:00:00.000000000 Z
11
+ date: 2025-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -162,6 +162,7 @@ files:
162
162
  - README.md
163
163
  - Rakefile
164
164
  - app/assets/config/solid_litequeen_manifest.js
165
+ - app/assets/images/solid_litequeen/favicon.ico
165
166
  - app/assets/images/solid_litequeen/icons/chevron-left.svg
166
167
  - app/assets/images/solid_litequeen/icons/chevron-right.svg
167
168
  - app/assets/images/solid_litequeen/icons/circle-elipsis.svg