solid_litequeen 0.14.0 → 0.15.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 +4 -4
- data/README.md +4 -5
- data/app/assets/images/solid_litequeen/favicon.ico +0 -0
- data/app/controllers/solid_litequeen/databases_controller.rb +25 -2
- data/app/views/layouts/solid_litequeen/application.html.erb +15 -0
- data/app/views/solid_litequeen/databases/table_rows.html.erb +94 -3
- data/lib/solid_litequeen/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f112dd52c78339931b6851d91130de3a386300e29b4ca84470d637a0d8cfdbb9
|
4
|
+
data.tar.gz: ffcaffbfa3caad295dd82ee7fd1aa86f0d7d5e24915badd9498b828afb18543c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e62a30f4f3995a3de6ec1ecd64abe9794ad06178375ed2773e0735d015bcb7aa9bb6799eda79af0440bb271fab816f4d72d8765311565af1631b797f4ddf409d
|
7
|
+
data.tar.gz: a6fab70afc4519c9cf039c96581937a6f85b1d704b4c84e88ed7cbef0629743f1803daef3a7a60144e920c61706aff20f06eeace1e96d2fdb864ee528635b7b4
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# SolidLitequeen
|
2
|
-
|
2
|
+
Lite Queen is a Rails engine that allows you to manage SQLite databases in your Rails application. It provides a user-friendly interface to view and maintain your SQLite data directly from your app.
|
3
|
+
|
3
4
|
|
4
|
-
## Usage
|
5
|
-
How to use my plugin.
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
Add this line to your application's Gemfile:
|
@@ -23,10 +22,10 @@ $ gem install solid_litequeen
|
|
23
22
|
|
24
23
|
After we need to mount in `routes.rb`:
|
25
24
|
```ruby
|
26
|
-
mount SolidLitequeen::Engine => "/
|
25
|
+
mount SolidLitequeen::Engine => "/sqlite"
|
27
26
|
```
|
28
27
|
|
29
|
-
You can now navigate to `/
|
28
|
+
You can now navigate to `/sqlite` to access the application
|
30
29
|
|
31
30
|
|
32
31
|
|
Binary file
|
@@ -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] = {
|
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
|
|
@@ -15,6 +15,7 @@
|
|
15
15
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/dagre/0.8.5/dagre.min.js"></script>
|
16
16
|
<style type="text/tailwindcss">
|
17
17
|
@plugins "form";
|
18
|
+
|
18
19
|
|
19
20
|
@theme {
|
20
21
|
--color-clifford: #da373d;
|
@@ -24,6 +25,20 @@
|
|
24
25
|
filter: invert(32%) sepia(65%) saturate(6380%) hue-rotate(219deg) brightness(98%) contrast(102%);
|
25
26
|
}
|
26
27
|
|
28
|
+
|
29
|
+
/* popover fix for safari */
|
30
|
+
@media screen and (-webkit-min-device-pixel-ratio: 0) {
|
31
|
+
/* Safari-only CSS here */
|
32
|
+
_::-webkit-full-page-media, _:future, :root div[popover] {
|
33
|
+
position: fixed !important;
|
34
|
+
top: 50% !important;
|
35
|
+
left: 50% !important;
|
36
|
+
transform: translate(-50%, -50%) !important;
|
37
|
+
margin: 0 !important;
|
38
|
+
max-width: 90vw;
|
39
|
+
z-index: 1000;
|
40
|
+
}
|
41
|
+
}
|
27
42
|
|
28
43
|
</style>
|
29
44
|
|
@@ -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
|
-
|
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" style="anchor-name: --anchor_<%= popover_id %>;">
|
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 bg-gray-100 border-gray-400 border p-4 rounded-md" style="position-anchor: --anchor_<%= popover_id%>; top: anchor(--anchor_<%= popover_id%> bottom); left: anchor(--anchor_<%= popover_id%> right);">
|
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
|
+
>
|
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,
|
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
|
+
version: 0.15.1
|
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-
|
11
|
+
date: 2025-04-15 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
|