dbviewer 0.6.7 → 0.6.8

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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/dbviewer/entity_relationship_diagram.js +553 -0
  3. data/app/assets/javascripts/dbviewer/home.js +287 -0
  4. data/app/assets/javascripts/dbviewer/layout.js +194 -0
  5. data/app/assets/javascripts/dbviewer/query.js +277 -0
  6. data/app/assets/javascripts/dbviewer/table.js +1563 -0
  7. data/app/assets/stylesheets/dbviewer/application.css +1460 -21
  8. data/app/assets/stylesheets/dbviewer/entity_relationship_diagram.css +181 -0
  9. data/app/assets/stylesheets/dbviewer/home.css +229 -0
  10. data/app/assets/stylesheets/dbviewer/logs.css +64 -0
  11. data/app/assets/stylesheets/dbviewer/query.css +171 -0
  12. data/app/assets/stylesheets/dbviewer/table.css +1144 -0
  13. data/app/views/dbviewer/connections/index.html.erb +0 -30
  14. data/app/views/dbviewer/entity_relationship_diagrams/index.html.erb +14 -713
  15. data/app/views/dbviewer/home/index.html.erb +9 -499
  16. data/app/views/dbviewer/logs/index.html.erb +5 -220
  17. data/app/views/dbviewer/tables/index.html.erb +0 -65
  18. data/app/views/dbviewer/tables/query.html.erb +129 -565
  19. data/app/views/dbviewer/tables/show.html.erb +4 -2429
  20. data/app/views/layouts/dbviewer/application.html.erb +13 -1544
  21. data/lib/dbviewer/version.rb +1 -1
  22. metadata +12 -7
  23. data/app/assets/javascripts/dbviewer/connections.js +0 -70
  24. data/app/assets/stylesheets/dbviewer/dbviewer.css +0 -0
  25. data/app/assets/stylesheets/dbviewer/enhanced.css +0 -0
  26. data/app/views/dbviewer/connections/new.html.erb +0 -79
  27. data/app/views/dbviewer/tables/mini_erd.html.erb +0 -517
@@ -1,5 +1,10 @@
1
1
  <% content_for :title, "SQL Query Logs" %>
2
2
 
3
+ <% content_for :head do %>
4
+ <%= stylesheet_link_tag "dbviewer/logs", "data-turbo-track": "reload" %>
5
+ <% end %>
6
+
7
+
3
8
  <div class="container-fluid">
4
9
  <% unless Rails.env.development? %>
5
10
  <div class="alert alert-warning mb-3">
@@ -404,223 +409,3 @@
404
409
  </div>
405
410
  </div>
406
411
  </div>
407
-
408
- <% if @stats[:tables_queried].present? %>
409
- <script>
410
- document.addEventListener('DOMContentLoaded', function() {
411
- const ctx = document.getElementById('tablesChart').getContext('2d');
412
- const tableData = <%= raw @stats[:tables_queried].to_json %>;
413
- const labels = Object.keys(tableData);
414
- const values = Object.values(tableData);
415
-
416
- // Get theme-compatible colors
417
- const isDarkMode = document.documentElement.getAttribute('data-bs-theme') === 'dark';
418
- const chartBgColor = isDarkMode ? 'rgba(75, 192, 192, 0.4)' : 'rgba(75, 192, 192, 0.6)';
419
- const chartBorderColor = isDarkMode ? 'rgba(75, 192, 192, 0.8)' : 'rgba(75, 192, 192, 1)';
420
-
421
- const chart = new Chart(ctx, {
422
- type: 'bar',
423
- data: {
424
- labels: labels,
425
- datasets: [{
426
- label: 'Query Count',
427
- data: values,
428
- backgroundColor: chartBgColor,
429
- borderColor: chartBorderColor,
430
- borderWidth: 1
431
- }]
432
- },
433
- options: {
434
- scales: {
435
- y: {
436
- beginAtZero: true,
437
- ticks: {
438
- precision: 0,
439
- color: getComputedStyle(document.documentElement).getPropertyValue('--bs-body-color')
440
- },
441
- grid: {
442
- color: getComputedStyle(document.documentElement).getPropertyValue('--bs-border-color-translucent')
443
- }
444
- },
445
- x: {
446
- ticks: {
447
- color: getComputedStyle(document.documentElement).getPropertyValue('--bs-body-color')
448
- },
449
- grid: {
450
- color: getComputedStyle(document.documentElement).getPropertyValue('--bs-border-color-translucent')
451
- }
452
- }
453
- },
454
- plugins: {
455
- legend: {
456
- display: false,
457
- labels: {
458
- color: getComputedStyle(document.documentElement).getPropertyValue('--bs-body-color')
459
- }
460
- },
461
- title: {
462
- display: true,
463
- text: 'Number of Queries by Table',
464
- color: getComputedStyle(document.documentElement).getPropertyValue('--bs-body-color')
465
- },
466
- tooltip: {
467
- callbacks: {
468
- label: function(context) {
469
- return `${context.parsed.y} queries`;
470
- }
471
- }
472
- }
473
- }
474
- });
475
-
476
- // Update chart when theme changes
477
- document.addEventListener('dbviewerThemeChanged', function(e) {
478
- const isDarkMode = e.detail.theme === 'dark';
479
- const chartBgColor = isDarkMode ? 'rgba(75, 192, 192, 0.4)' : 'rgba(75, 192, 192, 0.6)';
480
- const chartBorderColor = isDarkMode ? 'rgba(75, 192, 192, 0.8)' : 'rgba(75, 192, 192, 1)';
481
-
482
- chart.data.datasets[0].backgroundColor = chartBgColor;
483
- chart.data.datasets[0].borderColor = chartBorderColor;
484
-
485
- // Update text colors
486
- chart.options.scales.y.ticks.color = getComputedStyle(document.documentElement).getPropertyValue('--bs-body-color');
487
- chart.options.scales.x.ticks.color = getComputedStyle(document.documentElement).getPropertyValue('--bs-body-color');
488
- chart.options.scales.y.grid.color = getComputedStyle(document.documentElement).getPropertyValue('--bs-border-color-translucent');
489
- chart.options.scales.x.grid.color = getComputedStyle(document.documentElement).getPropertyValue('--bs-border-color-translucent');
490
- chart.options.plugins.title.color = getComputedStyle(document.documentElement).getPropertyValue('--bs-body-color');
491
-
492
- chart.update();
493
- });
494
- });
495
- </script>
496
- <% end %>
497
-
498
- <style>
499
- .sql-query {
500
- white-space: pre-wrap;
501
- word-wrap: break-word;
502
- max-height: 100px;
503
- overflow-y: auto;
504
- font-size: 0.85rem;
505
- background-color: #f8f9fa;
506
- border-radius: 3px;
507
- padding: 0.5rem;
508
- }
509
-
510
- .request-group-header {
511
- border-top: 2px solid #dee2e6;
512
- }
513
-
514
- .request-group-header:first-child {
515
- border-top: none;
516
- }
517
-
518
- details summary {
519
- cursor: pointer;
520
- }
521
-
522
- .cursor-pointer {
523
- cursor: pointer;
524
- }
525
-
526
- /* Rotate icon when expanded */
527
- .collapsed-section[aria-expanded="true"] .bi-chevron-down {
528
- transform: rotate(180deg);
529
- transition: transform 0.3s ease;
530
- }
531
-
532
- .collapsed-section[aria-expanded="false"] .bi-chevron-down {
533
- transform: rotate(0deg);
534
- transition: transform 0.3s ease;
535
- }
536
- </style>
537
-
538
- <style>
539
- /* SQL query styling with dark mode support */
540
- .sql-query {
541
- white-space: pre-wrap;
542
- word-wrap: break-word;
543
- max-height: 100px;
544
- overflow-y: auto;
545
- font-size: 0.85rem;
546
- border-radius: 3px;
547
- padding: 0.5rem;
548
- }
549
-
550
- /* Dark mode compatible styling */
551
- .sql-code-block {
552
- background-color: var(--bs-secondary-bg);
553
- }
554
-
555
- [data-bs-theme="dark"] .sql-code-block {
556
- background-color: var(--bs-tertiary-bg);
557
- }
558
-
559
- /* Request group header styling */
560
- .request-group-header {
561
- border-top: 2px solid var(--bs-border-color);
562
- }
563
-
564
- .request-header-bg {
565
- background-color: var(--bs-secondary-bg);
566
- }
567
-
568
- .request-group-header:first-child {
569
- border-top: none;
570
- }
571
-
572
- /* Collapsed section styling */
573
- details summary {
574
- cursor: pointer;
575
- }
576
-
577
- .cursor-pointer {
578
- cursor: pointer;
579
- }
580
-
581
- /* Rotate icon when expanded */
582
- .collapsed-section[aria-expanded="true"] .bi-chevron-down {
583
- transform: rotate(180deg);
584
- transition: transform 0.3s ease;
585
- }
586
-
587
- .collapsed-section[aria-expanded="false"] .bi-chevron-down {
588
- transform: rotate(0deg);
589
- transition: transform 0.3s ease;
590
- }
591
-
592
- /* Code styling */
593
- .pattern-code, .query-binds {
594
- background-color: var(--bs-secondary-bg);
595
- border: 1px solid var(--bs-border-color);
596
- }
597
-
598
- /* Empty data message */
599
- .empty-data-message {
600
- color: var(--bs-secondary-color);
601
- }
602
- </style>
603
-
604
- <script>
605
- document.addEventListener('DOMContentLoaded', function() {
606
- // Add Bootstrap collapse event handlers to animate icons
607
- const n1CollapseTrigger = document.querySelector('[data-bs-target="#n1QueriesCollapse"]');
608
- const slowestCollapseTrigger = document.querySelector('[data-bs-target="#slowestQueriesCollapse"]');
609
-
610
- if (n1CollapseTrigger) {
611
- n1CollapseTrigger.classList.add('collapsed-section');
612
- n1CollapseTrigger.addEventListener('click', function() {
613
- const isExpanded = this.getAttribute('aria-expanded') === 'true';
614
- this.setAttribute('aria-expanded', !isExpanded);
615
- });
616
- }
617
-
618
- if (slowestCollapseTrigger) {
619
- slowestCollapseTrigger.classList.add('collapsed-section');
620
- slowestCollapseTrigger.addEventListener('click', function() {
621
- const isExpanded = this.getAttribute('aria-expanded') === 'true';
622
- this.setAttribute('aria-expanded', !isExpanded);
623
- });
624
- }
625
- });
626
- </script>
@@ -49,68 +49,3 @@
49
49
  </div>
50
50
  </div>
51
51
  </div>
52
-
53
- <script>
54
- document.addEventListener('DOMContentLoaded', function() {
55
- // Table search functionality
56
- const searchInput = document.getElementById('tableSearch');
57
- if (searchInput) {
58
- searchInput.addEventListener('keyup', function() {
59
- const filter = this.value.toLowerCase();
60
- const tableRows = document.querySelectorAll('tbody tr');
61
-
62
- tableRows.forEach(function(row) {
63
- const tableName = row.querySelector('td:first-child').textContent.toLowerCase();
64
- if (tableName.includes(filter)) {
65
- row.style.display = '';
66
- } else {
67
- row.style.display = 'none';
68
- }
69
- });
70
- });
71
- }
72
-
73
- // Update table styling when theme changes
74
- function updateTableStyling() {
75
- const isDarkMode = document.documentElement.getAttribute('data-bs-theme') === 'dark';
76
- const tables = document.querySelectorAll('.table');
77
-
78
- tables.forEach(table => {
79
- if (isDarkMode) {
80
- table.classList.add('table-dark');
81
- } else {
82
- table.classList.remove('table-dark');
83
- }
84
- });
85
- }
86
-
87
- // Initial styling
88
- updateTableStyling();
89
-
90
- // Listen for theme changes
91
- document.addEventListener('dbviewerThemeChanged', function(event) {
92
- updateTableStyling();
93
- });
94
- });
95
- </script>
96
-
97
- <style>
98
- /* Dark mode table styles */
99
- [data-bs-theme="dark"] .table {
100
- --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
101
- --bs-table-hover-bg: rgba(255, 255, 255, 0.075);
102
- }
103
-
104
- /* Fix badge styling for dark mode */
105
- [data-bs-theme="dark"] .bg-secondary-subtle {
106
- background-color: rgba(255, 255, 255, 0.15) !important;
107
- color: #e9ecef !important;
108
- }
109
-
110
- [data-bs-theme="light"] .bg-secondary-subtle {
111
- background-color: #e9ecef !important;
112
- color: #212529 !important;
113
- }
114
- </style>
115
-
116
-