dbviewer 0.9.4 → 0.9.6
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 +7 -2
- data/app/assets/javascripts/dbviewer/record_creation.js +1 -1
- data/app/controllers/dbviewer/tables_controller.rb +6 -6
- data/app/helpers/dbviewer/datatable_ui_table_helper.rb +2 -2
- data/app/views/dbviewer/tables/show.html.erb +2 -2
- data/lib/dbviewer/version.rb +1 -1
- data/lib/generators/dbviewer/templates/initializer.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf25c920189a906f475947471d189449bbd53cc01eaa90a099947797232280e4
|
4
|
+
data.tar.gz: 63117f7d913a91bfb98bbdd1cc97b9d42d14ed8a1eee97b0a0b4b28958a842cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d61565eb1c4fea25e103c771aedd1e0768fada6f8a5f7482fe15fbd740898107a4086ec0027aeaf73fd0fa19a5d53e6c6a4af5f9968ebfaef26b341a01bd4cf
|
7
|
+
data.tar.gz: b8877bfcec54128d6f932650fae3aa92d2ba0993658a605f432a7efb694745473e8f8e303f1a7ad4b5679352143c5de7a09ddc9e8139109a0ebdea2d99955a2d
|
data/README.md
CHANGED
@@ -114,7 +114,7 @@ This will create a file at `config/initializers/dbviewer.rb` with the default co
|
|
114
114
|
```ruby
|
115
115
|
# config/initializers/dbviewer.rb
|
116
116
|
Dbviewer.configure do |config|
|
117
|
-
config.per_page_options = [10, 20, 50, 100, 250]
|
117
|
+
config.per_page_options = [10, 20, 50, 100, 250] # Default pagination options
|
118
118
|
config.default_per_page = 20 # Default records per page
|
119
119
|
config.max_query_length = 10000 # Maximum SQL query length
|
120
120
|
config.cache_expiry = 300 # Cache expiration in seconds
|
@@ -130,6 +130,11 @@ Dbviewer.configure do |config|
|
|
130
130
|
config.query_log_path = "log/dbviewer.log" # Path for query log file when in :file mode
|
131
131
|
config.max_memory_queries = 1000 # Maximum number of queries to store in memory
|
132
132
|
|
133
|
+
# Data Management options
|
134
|
+
config.enable_record_deletion = true # Whether to allow record deletion functionality
|
135
|
+
config.enable_record_editing = true # Whether to allow record editing functionality
|
136
|
+
config.enable_record_creation = true # Whether to allow record creation functionality
|
137
|
+
|
133
138
|
# Authentication options
|
134
139
|
# config.admin_credentials = { username: "admin", password: "your_secure_password" } # Basic HTTP auth credentials
|
135
140
|
|
@@ -143,7 +148,7 @@ Dbviewer.configure do |config|
|
|
143
148
|
# }
|
144
149
|
|
145
150
|
# Disable DBViewer completely
|
146
|
-
# config.disabled = Rails.env.production?
|
151
|
+
# config.disabled = Rails.env.production? # Disable in production
|
147
152
|
end
|
148
153
|
```
|
149
154
|
|
@@ -22,7 +22,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|
22
22
|
modal.show();
|
23
23
|
|
24
24
|
try {
|
25
|
-
const response = await fetch(
|
25
|
+
const response = await fetch(`${window.location.pathname}/new_record`);
|
26
26
|
const html = await response.text();
|
27
27
|
modalBody.innerHTML = html;
|
28
28
|
initializeFormElements();
|
@@ -256,9 +256,9 @@ module Dbviewer
|
|
256
256
|
def check_record_creation_enabled
|
257
257
|
unless Dbviewer.configuration.enable_record_creation
|
258
258
|
respond_to do |format|
|
259
|
-
format.html {
|
259
|
+
format.html {
|
260
260
|
flash[:alert] = "Record creation is disabled in the configuration"
|
261
|
-
redirect_to table_path(@table_name)
|
261
|
+
redirect_to table_path(@table_name)
|
262
262
|
}
|
263
263
|
format.json { render json: { error: "Record creation is disabled" }, status: :forbidden }
|
264
264
|
end
|
@@ -268,9 +268,9 @@ module Dbviewer
|
|
268
268
|
def check_record_editing_enabled
|
269
269
|
unless Dbviewer.configuration.enable_record_editing
|
270
270
|
respond_to do |format|
|
271
|
-
format.html {
|
271
|
+
format.html {
|
272
272
|
flash[:alert] = "Record editing is disabled in the configuration"
|
273
|
-
redirect_to table_path(@table_name)
|
273
|
+
redirect_to table_path(@table_name)
|
274
274
|
}
|
275
275
|
format.json { render json: { error: "Record editing is disabled" }, status: :forbidden }
|
276
276
|
end
|
@@ -280,9 +280,9 @@ module Dbviewer
|
|
280
280
|
def check_record_deletion_enabled
|
281
281
|
unless Dbviewer.configuration.enable_record_deletion
|
282
282
|
respond_to do |format|
|
283
|
-
format.html {
|
283
|
+
format.html {
|
284
284
|
flash[:alert] = "Record deletion is disabled in the configuration"
|
285
|
-
redirect_to table_path(@table_name)
|
285
|
+
redirect_to table_path(@table_name)
|
286
286
|
}
|
287
287
|
format.json { render json: { error: "Record deletion is disabled" }, status: :forbidden }
|
288
288
|
end
|
@@ -138,7 +138,7 @@ module Dbviewer
|
|
138
138
|
end
|
139
139
|
|
140
140
|
# Edit Record button (only if enabled in configuration)
|
141
|
-
edit_button = if Dbviewer.configuration.enable_record_editing
|
141
|
+
edit_button = if Dbviewer.configuration.enable_record_editing && table_name != "schema_migrations"
|
142
142
|
button_tag(
|
143
143
|
type: "button",
|
144
144
|
class: "btn btn-sm btn-outline-primary edit-record-btn",
|
@@ -156,7 +156,7 @@ module Dbviewer
|
|
156
156
|
end
|
157
157
|
|
158
158
|
# Delete Record button (only if enabled in configuration)
|
159
|
-
delete_button = if Dbviewer.configuration.enable_record_deletion
|
159
|
+
delete_button = if Dbviewer.configuration.enable_record_deletion && table_name != "schema_migrations"
|
160
160
|
button_tag(
|
161
161
|
type: "button",
|
162
162
|
class: "btn btn-sm btn-outline-danger delete-record-btn",
|
@@ -200,12 +200,12 @@
|
|
200
200
|
</div>
|
201
201
|
<div class="modal-footer">
|
202
202
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
203
|
-
<% if Dbviewer.configuration.enable_record_editing %>
|
203
|
+
<% if Dbviewer.configuration.enable_record_editing && @table_name != 'schema_migrations' %>
|
204
204
|
<button type="button" class="btn btn-primary" id="recordDetailEditBtn" data-record-id="" data-primary-key="<%= @metadata[:primary_key] || 'id' %>">
|
205
205
|
<i class="bi bi-pencil me-1"></i>Edit Record
|
206
206
|
</button>
|
207
207
|
<% end %>
|
208
|
-
<% if Dbviewer.configuration.enable_record_deletion %>
|
208
|
+
<% if Dbviewer.configuration.enable_record_deletion && @table_name != 'schema_migrations' %>
|
209
209
|
<button type="button" class="btn btn-danger" id="recordDetailDeleteBtn" data-record-id="" data-primary-key="<%= @metadata[:primary_key] || 'id' %>">
|
210
210
|
<i class="bi bi-trash me-1"></i>Delete Record
|
211
211
|
</button>
|
data/lib/dbviewer/version.rb
CHANGED
@@ -15,6 +15,8 @@ Dbviewer.configure do |config|
|
|
15
15
|
|
16
16
|
# Data Management options
|
17
17
|
config.enable_record_deletion = true # Whether to allow record deletion functionality
|
18
|
+
config.enable_record_editing = true # Whether to allow record editing functionality
|
19
|
+
config.enable_record_creation = true # Whether to allow record creation functionality
|
18
20
|
|
19
21
|
# Authentication options (Basic Auth)
|
20
22
|
# config.admin_credentials = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbviewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wailan Tirajoh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|