dbviewer 0.3.2 → 0.3.3

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: bf5af06afd4454013148e7f43eaa347b3726383bd9094fbe74b5e3394482d6e6
4
- data.tar.gz: 8a64dc26217a82eda9d7db0723279b24a7d8f0e6f877f97e149e2cb421e8f195
3
+ metadata.gz: 8e6fcb0f5760c3daa24b0bbcd6f7f39d308890386eb7bae0e99b59c5027c0853
4
+ data.tar.gz: 486266a6f7d882f28b2411860466cb271b7e5d32ca65a25f04bf27601a6fb4c7
5
5
  SHA512:
6
- metadata.gz: d15ebd1b469850e457d3ebd5043d26df998b6921c51d83dc6d8fdb6b45bd6dc3f00f8179bb5d39542e26e202607af5c8bde45712ee33a59c2ffed0534d9171a6
7
- data.tar.gz: e2addc067f7646dd9d30b80f68552db53a955f8fd9cbbb36e785dda08e3e5ce62b38e23321cdfc98df451f4e50a1ecd32b486ef4a970d28cf20ca36f940b465c
6
+ metadata.gz: 362be7d7fed295db73faad72e0b339d7b1f824d945e7c141c2cb43305d9d31c109526c05fe612135c6cfafc74e618621125a03bab3127ac52ec57a58bfcabbf0
7
+ data.tar.gz: 0a7289d157e0911d0e5e932c7ebbd964536ade2b125d4de7308fb518516793a6162f690a6d7c0dbc3cb88087754a3b2593265c5c6fa48c9980bb6ca0375cf91c
@@ -41,8 +41,8 @@ module Dbviewer
41
41
  def fetch_tables_with_stats(include_record_counts = false)
42
42
  database_manager.tables.map do |table_name|
43
43
  table_stats = {
44
- name: table_name,
45
- columns_count: database_manager.column_count(table_name)
44
+ name: table_name
45
+ # columns_count: database_manager.column_count(table_name)
46
46
  }
47
47
 
48
48
  # Only fetch record counts if explicitly requested
@@ -61,9 +61,7 @@ module Dbviewer
61
61
  analytics = {
62
62
  total_tables: tables.size,
63
63
  total_records: tables.sum { |t| t[:record_count] },
64
- total_columns: tables.sum { |t| t[:columns_count] },
65
- largest_tables: tables.sort_by { |t| -t[:record_count] }.first(5),
66
- widest_tables: tables.sort_by { |t| -t[:columns_count] }.first(5),
64
+ largest_tables: tables.sort_by { |t| -t[:record_count] }.first(10),
67
65
  empty_tables: tables.select { |t| t[:record_count] == 0 }
68
66
  }
69
67
 
@@ -3,7 +3,7 @@ module Dbviewer
3
3
  include Dbviewer::PaginationConcern
4
4
 
5
5
  def index
6
- @tables = fetch_tables_with_stats
6
+ @tables = fetch_tables_with_stats(include_record_counts: true)
7
7
  end
8
8
 
9
9
  def show
@@ -65,7 +65,6 @@
65
65
  <tr>
66
66
  <th>Table Name</th>
67
67
  <th class="text-end">Records</th>
68
- <th class="text-end">Columns</th>
69
68
  </tr>
70
69
  </thead>
71
70
  <tbody>
@@ -77,7 +76,6 @@
77
76
  </a>
78
77
  </td>
79
78
  <td class="text-end"><%= number_with_delimiter(table[:record_count]) %></td>
80
- <td class="text-end"><%= table[:columns_count] %></td>
81
79
  </tr>
82
80
  <% end %>
83
81
  </tbody>
@@ -92,47 +90,7 @@
92
90
  </div>
93
91
  </div>
94
92
 
95
- <div class="col-md-6 mb-4">
96
- <div class="card h-100 shadow-sm">
97
- <div class="card-header">
98
- <h5 class="card-title mb-0">Tables with Most Columns</h5>
99
- </div>
100
- <div class="card-body">
101
- <% if @analytics[:widest_tables].any? %>
102
- <div class="table-responsive">
103
- <table class="table table-sm table-hover">
104
- <thead>
105
- <tr>
106
- <th>Table Name</th>
107
- <th class="text-end">Columns</th>
108
- <th class="text-end">Records</th>
109
- </tr>
110
- </thead>
111
- <tbody>
112
- <% @analytics[:widest_tables].each do |table| %>
113
- <tr>
114
- <td>
115
- <a href="<%= dbviewer.table_path(table[:name]) %>">
116
- <%= table[:name] %>
117
- </a>
118
- </td>
119
- <td class="text-end"><%= table[:columns_count] %></td>
120
- <td class="text-end"><%= number_with_delimiter(table[:record_count]) %></td>
121
- </tr>
122
- <% end %>
123
- </tbody>
124
- </table>
125
- </div>
126
- <% else %>
127
- <div class="text-center my-4 empty-data-message">
128
- <p>No table data available</p>
129
- </div>
130
- <% end %>
131
- </div>
132
- </div>
133
- </div>
134
-
135
- <div class="col-12 mb-4">
93
+ <div class="col-6 mb-4">
136
94
  <div class="card shadow-sm">
137
95
  <div class="card-header d-flex justify-content-between align-items-center">
138
96
  <h5 class="card-title mb-0">Recent SQL Queries</h5>
@@ -141,7 +99,7 @@
141
99
  <div class="card-body p-0">
142
100
  <% begin %>
143
101
  <% require_dependency "dbviewer/logger" %>
144
- <% queries = Dbviewer::Logger.instance.recent_queries(limit: 5) %>
102
+ <% queries = Dbviewer::Logger.instance.recent_queries(limit: 10) %>
145
103
 
146
104
  <% if queries.any? %>
147
105
  <div class="table-responsive">
@@ -36,7 +36,7 @@
36
36
  <thead>
37
37
  <tr>
38
38
  <th>Table Name</th>
39
- <th class="text-center">Columns</th>
39
+ <th class="text-end">Records</th>
40
40
  <th>Actions</th>
41
41
  </tr>
42
42
  </thead>
@@ -46,8 +46,8 @@
46
46
  <td class="fw-medium">
47
47
  <%= link_to table[:name], table_path(table[:name]), class: "text-decoration-none" %>
48
48
  </td>
49
- <td class="text-center">
50
- <span class="badge bg-secondary-subtle"><%= table[:columns_count] %></span>
49
+ <td class="text-end">
50
+ <span class="badge bg-secondary-subtle"><%= table[:record_count] %></span>
51
51
  </td>
52
52
  <td>
53
53
  <%= link_to raw('<i class="bi bi-eye"></i>'), table_path(table[:name]), class: "btn btn-sm btn-outline-primary", title: "View" %>
@@ -1,3 +1,3 @@
1
1
  module Dbviewer
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
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.3.2
4
+ version: 0.3.3
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-05-18 00:00:00.000000000 Z
11
+ date: 2025-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails