solidstats 2.0.0 → 3.0.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.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -63
  3. data/README.md +27 -0
  4. data/Rakefile +3 -3
  5. data/app/assets/javascripts/solidstats/dashboard.js +0 -46
  6. data/app/assets/stylesheets/solidstats/dashboard.css +48 -0
  7. data/app/controllers/solidstats/dashboard_controller.rb +73 -61
  8. data/app/controllers/solidstats/logs_controller.rb +72 -0
  9. data/app/controllers/solidstats/performance_controller.rb +25 -0
  10. data/app/controllers/solidstats/productivity_controller.rb +39 -0
  11. data/app/controllers/solidstats/quality_controller.rb +152 -0
  12. data/app/controllers/solidstats/securities_controller.rb +30 -0
  13. data/app/helpers/solidstats/application_helper.rb +124 -11
  14. data/app/helpers/solidstats/performance_helper.rb +87 -0
  15. data/app/helpers/solidstats/productivity_helper.rb +38 -0
  16. data/app/services/solidstats/bundler_audit_service.rb +206 -0
  17. data/app/services/solidstats/coverage_compass_service.rb +335 -0
  18. data/app/services/solidstats/load_lens_service.rb +474 -0
  19. data/app/services/solidstats/log_size_monitor_service.rb +197 -66
  20. data/app/services/solidstats/my_todo_service.rb +242 -0
  21. data/app/services/solidstats/style_patrol_service.rb +319 -0
  22. data/app/views/layouts/solidstats/application.html.erb +8 -2
  23. data/app/views/layouts/solidstats/dashboard.html.erb +84 -0
  24. data/app/views/solidstats/dashboard/dashboard.html.erb +39 -0
  25. data/app/views/solidstats/logs/logs_size.html.erb +409 -0
  26. data/app/views/solidstats/performance/load_lens.html.erb +158 -0
  27. data/app/views/solidstats/productivity/_todo_list.html.erb +49 -0
  28. data/app/views/solidstats/productivity/my_todos.html.erb +84 -0
  29. data/app/views/solidstats/quality/coverage_compass.html.erb +420 -0
  30. data/app/views/solidstats/quality/style_patrol.html.erb +463 -0
  31. data/app/views/solidstats/securities/bundler_audit.html.erb +345 -0
  32. data/app/views/solidstats/shared/_dashboard_card.html.erb +160 -0
  33. data/app/views/solidstats/shared/_quick_actions.html.erb +26 -0
  34. data/config/routes.rb +31 -6
  35. data/lib/generators/solidstats/clean/clean_generator.rb +24 -0
  36. data/lib/generators/solidstats/clean/templates/README +8 -0
  37. data/lib/generators/solidstats/install/install_generator.rb +51 -10
  38. data/lib/generators/solidstats/install/templates/README +7 -0
  39. data/lib/solidstats/engine.rb +6 -71
  40. data/lib/solidstats/version.rb +1 -1
  41. data/lib/solidstats.rb +19 -303
  42. data/lib/tasks/solidstats.rake +67 -0
  43. data/lib/tasks/solidstats_performance.rake +61 -0
  44. data/lib/tasks/solidstats_tasks.rake +16 -4
  45. metadata +33 -95
  46. data/app/assets/javascripts/solidstats/gem_metadata.js +0 -554
  47. data/app/assets/stylesheets/solidstats/components/action_button.css +0 -99
  48. data/app/assets/stylesheets/solidstats/components/dashboard.css +0 -151
  49. data/app/assets/stylesheets/solidstats/components/dashboard_header.css +0 -93
  50. data/app/assets/stylesheets/solidstats/components/dashboard_layout.css +0 -97
  51. data/app/assets/stylesheets/solidstats/components/gem_metadata.css +0 -1403
  52. data/app/assets/stylesheets/solidstats/components/navigation.css +0 -80
  53. data/app/assets/stylesheets/solidstats/components/quick_navigation.css +0 -54
  54. data/app/assets/stylesheets/solidstats/components/security.css +0 -332
  55. data/app/assets/stylesheets/solidstats/components/status_badge.css +0 -58
  56. data/app/assets/stylesheets/solidstats/components/summary_card.css +0 -66
  57. data/app/assets/stylesheets/solidstats/components/tab_navigation.css +0 -95
  58. data/app/components/solidstats/base_component.rb +0 -88
  59. data/app/components/solidstats/code_quality/code_quality_section_component.html.erb +0 -0
  60. data/app/components/solidstats/code_quality/code_quality_section_component.rb +0 -0
  61. data/app/components/solidstats/code_quality/section_component.html.erb +0 -45
  62. data/app/components/solidstats/code_quality/section_component.rb +0 -34
  63. data/app/components/solidstats/dashboard_header_component.html.erb +0 -39
  64. data/app/components/solidstats/dashboard_header_component.rb +0 -33
  65. data/app/components/solidstats/previews/action_button_component_preview/button_vs_link.html.erb +0 -6
  66. data/app/components/solidstats/previews/action_button_component_preview/sizes.html.erb +0 -6
  67. data/app/components/solidstats/previews/action_button_component_preview/variants.html.erb +0 -6
  68. data/app/components/solidstats/previews/action_button_component_preview/with_icons.html.erb +0 -6
  69. data/app/components/solidstats/previews/action_button_component_preview.rb +0 -64
  70. data/app/components/solidstats/previews/navigation_component_preview.rb +0 -74
  71. data/app/components/solidstats/previews/stats_overview_component_preview.rb +0 -100
  72. data/app/components/solidstats/previews/status_badge_component_preview/sizes.html.erb +0 -6
  73. data/app/components/solidstats/previews/status_badge_component_preview/statuses.html.erb +0 -6
  74. data/app/components/solidstats/previews/status_badge_component_preview/with_icons.html.erb +0 -6
  75. data/app/components/solidstats/previews/status_badge_component_preview.rb +0 -49
  76. data/app/components/solidstats/previews/summary_card_component_preview/clickable.html.erb +0 -9
  77. data/app/components/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb +0 -9
  78. data/app/components/solidstats/previews/summary_card_component_preview/statuses.html.erb +0 -6
  79. data/app/components/solidstats/previews/summary_card_component_preview/value_formats.html.erb +0 -6
  80. data/app/components/solidstats/previews/summary_card_component_preview.rb +0 -67
  81. data/app/components/solidstats/quick_navigation_component.html.erb +0 -8
  82. data/app/components/solidstats/quick_navigation_component.rb +0 -21
  83. data/app/components/solidstats/security/gem_impact_analysis_component.html.erb +0 -44
  84. data/app/components/solidstats/security/gem_impact_analysis_component.rb +0 -45
  85. data/app/components/solidstats/security/overview_component.html.erb +0 -21
  86. data/app/components/solidstats/security/overview_component.rb +0 -104
  87. data/app/components/solidstats/security/section_component.html.erb +0 -26
  88. data/app/components/solidstats/security/section_component.rb +0 -52
  89. data/app/components/solidstats/security/timeline_component.html.erb +0 -39
  90. data/app/components/solidstats/security/timeline_component.rb +0 -43
  91. data/app/components/solidstats/tasks_section_component.html.erb +0 -17
  92. data/app/components/solidstats/tasks_section_component.rb +0 -22
  93. data/app/components/solidstats/ui/action_button_component.html.erb +0 -6
  94. data/app/components/solidstats/ui/action_button_component.rb +0 -71
  95. data/app/components/solidstats/ui/dashboard_layout_component.html.erb +0 -19
  96. data/app/components/solidstats/ui/dashboard_layout_component.rb +0 -85
  97. data/app/components/solidstats/ui/navigation_component.html.erb +0 -34
  98. data/app/components/solidstats/ui/navigation_component.rb +0 -72
  99. data/app/components/solidstats/ui/stats_overview_component.html.erb +0 -14
  100. data/app/components/solidstats/ui/stats_overview_component.rb +0 -78
  101. data/app/components/solidstats/ui/status_badge_component.html.erb +0 -6
  102. data/app/components/solidstats/ui/status_badge_component.rb +0 -42
  103. data/app/components/solidstats/ui/summary_card_component.html.erb +0 -12
  104. data/app/components/solidstats/ui/summary_card_component.rb +0 -63
  105. data/app/components/solidstats/ui/tab_navigation_component.html.erb +0 -22
  106. data/app/components/solidstats/ui/tab_navigation_component.rb +0 -79
  107. data/app/services/solidstats/audit_service.rb +0 -56
  108. data/app/services/solidstats/data_collector_service.rb +0 -83
  109. data/app/services/solidstats/gem_metadata/fetcher_service.rb +0 -136
  110. data/app/services/solidstats/todo_service.rb +0 -114
  111. data/app/views/solidstats/dashboard/_log_monitor.html.erb +0 -759
  112. data/app/views/solidstats/dashboard/_todos.html.erb +0 -151
  113. data/app/views/solidstats/dashboard/audit/_additional_styles.css +0 -22
  114. data/app/views/solidstats/dashboard/audit/_audit_badge.html.erb +0 -5
  115. data/app/views/solidstats/dashboard/audit/_audit_details.html.erb +0 -495
  116. data/app/views/solidstats/dashboard/audit/_audit_summary.html.erb +0 -26
  117. data/app/views/solidstats/dashboard/audit/_no_vulnerabilities.html.erb +0 -3
  118. data/app/views/solidstats/dashboard/audit/_security_audit.html.erb +0 -14
  119. data/app/views/solidstats/dashboard/audit/_vulnerabilities_table.html.erb +0 -1120
  120. data/app/views/solidstats/dashboard/audit/_vulnerability_details.html.erb +0 -63
  121. data/app/views/solidstats/dashboard/index.html.erb +0 -81
  122. data/app/views/solidstats/gem_metadata/_panel.html.erb +0 -419
  123. data/lib/generators/solidstats/feature/feature_generator.rb +0 -170
  124. data/lib/generators/solidstats/feature/templates/component.html.erb +0 -84
  125. data/lib/generators/solidstats/feature/templates/component.rb.erb +0 -103
  126. data/lib/generators/solidstats/feature/templates/component.scss +0 -243
  127. data/lib/generators/solidstats/feature/templates/component_test.rb.erb +0 -183
  128. data/lib/generators/solidstats/feature/templates/controller.rb.erb +0 -44
  129. data/lib/generators/solidstats/feature/templates/controller_test.rb.erb +0 -111
  130. data/lib/generators/solidstats/feature/templates/detail_view.html.erb +0 -755
  131. data/lib/generators/solidstats/feature/templates/preview.rb.erb +0 -107
  132. data/lib/generators/solidstats/feature/templates/service.rb.erb +0 -132
  133. data/lib/generators/solidstats/feature/templates/service_test.rb.erb +0 -109
  134. data/lib/generators/solidstats/install_generator.rb +0 -109
  135. data/lib/tasks/solidstats_install.rake +0 -133
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1087b955c118f56234de6e254a1c4f8fbb25184caccae8e72756d277b77d8a4d
4
- data.tar.gz: fd69b3cec25f03c5c2854b76b7ea5fe5154c762a6b22dbe50ef6e423d780aef5
3
+ metadata.gz: 81043c13f33e9684bcc3ea3d99f47f63d9bd17873c1f6792988e9bf752a7e572
4
+ data.tar.gz: dc4c6a7edd2f8720197e0beba69752deb847bc72422a4c6351670d6f448a04bd
5
5
  SHA512:
6
- metadata.gz: 45d75fb7fbbccb543628e14747177807f8fb7b652be35cb74d05a5fe65b666731c4290413ce7e0da2a5038cb9d68c265916bbe2421949b073424eb5b603018ad
7
- data.tar.gz: 8d425d7b2f9abcba38460f5ec97fa0e5021fbc1542e00442c97e7b099707bc4a11d578f53f440fc213885e8172706fa947fd57f025283abfdfe09b93d8a965e6
6
+ metadata.gz: ae9f6ca74cfe86e05cec7f9b0be6ce1b4621b3f672def7a08a1f94790fd81a8715da2c6927825ebf7c684ce3dbd84081a825a63268963af985ad0dcebbaddbc2
7
+ data.tar.gz: f856e1776b287e7ca34752b3a6ad27b2cdf842ac7b955fbf95f2e265a4bb45a9820b05bc2403f7c3d6f03301e35dca78890192f14344cfe176a952ecdcadac16
data/CHANGELOG.md CHANGED
@@ -5,73 +5,22 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [2.0.0] - 2025-05-26
8
+ ## [3.0.0] - 2025-06-11
9
9
 
10
10
  ### Added
11
- - **Complete Gem Metadata System**: Comprehensive gem dependency tracking and management
12
- - Dual-view interface with grid and table layouts
13
- - Real-time search and filtering by gem name, status, and other criteria
14
- - Smart sorting by name, status, release date, and version information
15
- - Status indicators for outdated, up-to-date, and unavailable gems
16
- - Dependency visualization with runtime dependency details
17
- - Version comparison showing current vs. latest versions
18
- - CSV export functionality for gem data analysis
19
- - Refresh capability to update gem metadata from RubyGems API
20
- - Responsive design with 3-cards-per-row grid (2 on tablet, 1 on mobile)
21
-
22
- - **View Component Architecture**: Modern component-based UI system for maintainable code
23
- - BaseComponent foundation for all UI components
24
- - Specialized components for different dashboard sections
25
- - Component preview system for development and testing
26
- - Reusable UI components (ActionButton, SummaryCard, Navigation, TabNavigation)
27
- - Clean separation of concerns between HTML, CSS, and JavaScript
28
-
29
- - **Feature Generator System**: Automated development tools for rapid feature development
30
- - `rails g solidstats:feature` generator for creating new dashboard sections
31
- - Automatic component, controller, view, and asset generation
32
- - Built-in best practices and conventions
33
- - Template-based code generation with customizable options
34
-
35
- - **CSS Component Architecture**: Modular styling system with 1,631+ lines of extracted CSS
36
- - Dedicated component stylesheets for maintainable styling
37
- - Conflict-free CSS with proper specificity management
38
- - Responsive design patterns and mobile-first approach
39
- - Consistent design tokens and reusable style patterns
11
+ - **LoadLens Performance Monitor**: A new development performance monitoring feature that parses development logs to track Rails application performance. It includes metrics for response times, database performance, view rendering, and error rates.
12
+ - **Style Patrol**: A new code quality analysis feature to enforce style guidelines and improve code health.
13
+ - **My TODOs Feature**: A new service to manage and track TODO items within the codebase, with a dedicated UI and refresh functionality.
14
+ - **Bundler Audit Security**: Added security auditing for Bundler, with a dedicated UI to display vulnerability details and remediation suggestions.
40
15
 
41
- ### Fixed
42
- - **Gem Metadata Table Layout**: Eliminated horizontal scrolling issues
43
- - Changed table wrapper from `overflow-x: auto` to `width: 100%`
44
- - Removed restrictive `white-space: nowrap` from table headers
45
- - Implemented percentage-based column widths for better responsiveness
46
- - Added proper word-wrapping for long content
47
-
48
- - **Empty State Positioning**: Perfect centering for "No matching gems found" messages
49
- - Implemented flexbox-based centering for both grid and table views
50
- - Added proper fallback support for older browsers
51
- - Enhanced visual hierarchy and user experience
52
-
53
- - **Navigation System**: Fixed section-based navigation throughout the application
54
- - Removed external routing in favor of seamless section switching
55
- - Updated all navigation components to use `data-section` attributes
56
- - Eliminated page reloads when switching between dashboard sections
57
- - Consistent navigation behavior across all components
58
-
59
- - **CSS Conflicts**: Resolved styling conflicts between component stylesheets
60
- - Fixed security.css interference with gem metadata styling
61
- - Implemented proper CSS specificity to prevent style bleeding
62
- - Added scoped styling for component isolation
63
-
64
- ### Improved
65
- - **Performance Optimizations**: Enhanced user experience with better responsiveness
66
- - Debounced search functionality to reduce unnecessary API calls
67
- - Efficient DOM manipulation and rendering
68
- - Optimized CSS delivery and reduced file sizes
69
-
70
- - **Cross-Browser Compatibility**: Enhanced support for different browsers and devices
71
- - Fallback CSS for older browser versions
72
- - Progressive enhancement patterns
73
- - Improved mobile experience and touch interactions
16
+ ### Changed
17
+ - **Dashboard Redesign**: The Solidstats dashboard has been completely redesigned with DaisyUI, providing a modern, consistent, and themeable user interface.
18
+ - **Refactored Services**: The `LogSizeMonitorService` has been refactored for enhanced log management and caching.
19
+ - **Improved Installation**: The installation process has been enhanced with automatic directory creation and `.gitignore` updates.
74
20
 
21
+ ### Fixed
22
+ - Updated route aliases and paths for better consistency across the application.
23
+ - Replaced static dashboard titles with dynamic links for improved navigation.
75
24
 
76
25
  ## [1.1.0] - 2025-05-23
77
26
 
data/README.md CHANGED
@@ -24,6 +24,7 @@ Solidstats is a local-only Rails engine that shows your project's health at `/so
24
24
  ### System Monitoring
25
25
  - Log Size Monitor for tracking and managing application log files
26
26
  - Log file truncation tool for individual or all log files
27
+ - LoadLens - Development performance monitoring with request tracking
27
28
  - Rubocop offense count and quality metrics
28
29
  - TODO/FIXME tracker with file hotspots
29
30
  - Test coverage summary
@@ -110,6 +111,32 @@ Comprehensive gem analysis and management platform featuring:
110
111
  ### Code Quality
111
112
  Displays code quality metrics, test coverage, and code health indicators.
112
113
 
114
+ ### LoadLens Performance
115
+ Monitors your Rails app's performance in development by parsing `log/development.log`:
116
+ - **Response Times**: Average response time across all requests
117
+ - **Database Performance**: ActiveRecord query timing analysis
118
+ - **View Rendering**: Template rendering performance metrics
119
+ - **Error Tracking**: HTTP status code analysis and error rates
120
+ - **Slow Request Detection**: Identifies requests taking >1000ms
121
+ - **Request History**: Recent request details with timing breakdown
122
+
123
+ LoadLens automatically tracks performance data and provides manual refresh capability. Data is stored in daily rotating JSON files and cleaned up after 7 days.
124
+
125
+ **CLI Commands:**
126
+ ```bash
127
+ # Parse development logs manually
128
+ rake solidstats:load_lens:parse_logs
129
+
130
+ # Refresh performance data
131
+ rake solidstats:load_lens:refresh
132
+
133
+ # View performance summary
134
+ rake solidstats:load_lens:summary
135
+
136
+ # Clean old data files
137
+ rake solidstats:load_lens:clean_old_data
138
+ ```
139
+
113
140
  ### Tasks
114
141
  Shows a breakdown of TODO, FIXME, and HACK annotations found in your codebase, with file hotspots and expandable details.
115
142
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require "bundler/setup"
2
-
3
- load "rails/tasks/statistics.rake"
4
-
5
2
  require "bundler/gem_tasks"
3
+
4
+ # Load solidstats-specific tasks
5
+ Dir[File.join(File.dirname(__FILE__), 'lib', 'tasks', '*.rake')].each { |f| load f }
@@ -162,52 +162,6 @@ window.SolidstatsDashboard.setupSummaryCardNavigation = function() {
162
162
  });
163
163
  };
164
164
 
165
- // Refresh functionality
166
- window.SolidstatsDashboard.refreshAudit = function() {
167
- // Show loading indicator
168
- const refreshButton = document.querySelector('.action-button');
169
- const originalText = refreshButton.innerHTML;
170
- refreshButton.innerHTML = '<span class="action-icon">⟳</span> Refreshing...';
171
- refreshButton.disabled = true;
172
-
173
- // Make AJAX call to refresh endpoint
174
- fetch('/solidstats/refresh', {
175
- method: 'GET',
176
- headers: {
177
- 'Accept': 'application/json',
178
- 'X-Requested-With': 'XMLHttpRequest'
179
- },
180
- credentials: 'same-origin'
181
- })
182
- .then(response => {
183
- if (!response.ok) {
184
- throw new Error('Network response was not ok');
185
- }
186
- return response.json();
187
- })
188
- .then(data => {
189
- // Update the dashboard with fresh data
190
- location.reload();
191
-
192
- // Show success notification
193
- window.SolidstatsDashboard.showNotification('Dashboard data refreshed successfully', 'success');
194
-
195
- // Reset button state
196
- refreshButton.innerHTML = originalText;
197
- refreshButton.disabled = false;
198
- })
199
- .catch(error => {
200
- console.error('Error refreshing data:', error);
201
-
202
- // Show error notification
203
- window.SolidstatsDashboard.showNotification('Failed to refresh data. Please try again.', 'error');
204
-
205
- // Reset button state
206
- refreshButton.innerHTML = originalText;
207
- refreshButton.disabled = false;
208
- });
209
- };
210
-
211
165
  // Notification system
212
166
  window.SolidstatsDashboard.showNotification = function(message, type) {
213
167
  // Simple notification system
@@ -0,0 +1,48 @@
1
+ /* Solidstats Dashboard with DaisyUI */
2
+
3
+ /* Custom animations for dashboard */
4
+ .dashboard-enter {
5
+ animation: fadeInUp 0.6s ease-out;
6
+ }
7
+
8
+ @keyframes fadeInUp {
9
+ from {
10
+ opacity: 0;
11
+ transform: translateY(30px);
12
+ }
13
+ to {
14
+ opacity: 1;
15
+ transform: translateY(0);
16
+ }
17
+ }
18
+
19
+ /* Gradient text for brand */
20
+ .gradient-text {
21
+ background: linear-gradient(135deg, #3b82f6, #8b5cf6);
22
+ -webkit-background-clip: text;
23
+ -webkit-text-fill-color: transparent;
24
+ background-clip: text;
25
+ }
26
+
27
+ /* Light mode improvements */
28
+ [data-theme="light"] .card {
29
+ background-color: #ffffff;
30
+ border: 1px solid #e5e7eb;
31
+ }
32
+
33
+ [data-theme="light"] .card:hover {
34
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
35
+ }
36
+
37
+ [data-theme="light"] .stat-value {
38
+ color: #1f2937;
39
+ }
40
+
41
+ [data-theme="light"] .card-title {
42
+ color: #1f2937;
43
+ }
44
+
45
+ [data-theme="light"] .navbar {
46
+ background-color: #ffffff;
47
+ border-bottom: 1px solid #e5e7eb;
48
+ }
@@ -1,80 +1,92 @@
1
1
  module Solidstats
2
2
  class DashboardController < ApplicationController
3
+ layout "solidstats/dashboard"
4
+
3
5
  TODO_CACHE_FILE = Rails.root.join("tmp", "solidstats_todos.json")
4
6
  AUDIT_CACHE_HOURS = 12 # Configure how many hours before refreshing
5
7
 
6
- def index
7
- # Use new services for data collection
8
- audit_service = AuditService.new
9
- todo_service = TodoService.new
10
- log_monitor_service = LogSizeMonitorService.new
11
-
12
- # Get full data for detailed views
13
- @audit_output = audit_service.fetch
14
- @todo_items = todo_service.fetch
15
- @log_data = log_monitor_service.collect_data
16
- @gems = Solidstats::GemMetadata::FetcherService.call
17
-
18
- # Get summary data for dashboard cards
19
- @audit_summary = audit_service.summary
20
- @todo_summary = todo_service.summary
21
8
 
22
- # TODO: Refactor these to use services as well
23
- @rubocop_output = "JSON.parse(`rubocop --format json`)"
24
- @coverage = "100"
9
+ def dashboard
10
+ # Load dashboard cards from JSON file
11
+ @dashboard_cards = load_dashboard_cards
12
+ @quick_actions = quick_actions_data
13
+ render "dashboard"
25
14
  end
26
15
 
27
- # Force refresh all dashboard data
28
16
  def refresh
29
- # Create services
30
- audit_service = AuditService.new
31
- todo_service = TodoService.new
32
- log_monitor_service = LogSizeMonitorService.new
17
+ # Refresh all services
18
+ Solidstats::LogSizeMonitorService.scan_and_cache
19
+ Solidstats::BundlerAuditService.scan_and_cache
20
+ Solidstats::MyTodoService.collect_todos
21
+ Solidstats::StylePatrolService.refresh_cache
22
+ Solidstats::CoverageCompassService.refresh_cache
23
+ Solidstats::LoadLensService.scan_and_cache
33
24
 
34
- # Force refresh of data
35
- audit_output = audit_service.fetch(true) # Force refresh
36
- todo_items = todo_service.fetch(true) # Force refresh
37
- log_data = log_monitor_service.collect_data
38
- gem_metadata = GemMetadata::FetcherService.call(nil, true) # Force refresh
39
-
40
- # Get updated summaries
41
- audit_summary = audit_service.summary
42
- todo_summary = todo_service.summary
25
+ respond_to do |format|
26
+ format.html { redirect_to solidstats_dashboard_path, notice: "Dashboard data refreshed successfully!" }
27
+ format.json { render json: { status: "success", message: "Dashboard data refreshed successfully!" } }
28
+ end
29
+ end
43
30
 
44
- # Get current time for last updated display
45
- last_updated = Time.now.strftime("%B %d, %Y at %H:%M")
31
+ private
46
32
 
47
- # Return JSON response with refreshed data
48
- render json: {
49
- audit_output: audit_output,
50
- todo_items: todo_items,
51
- audit_summary: audit_summary,
52
- todo_summary: todo_summary,
53
- log_data: log_data,
54
- gem_metadata: gem_metadata,
55
- last_updated: last_updated,
56
- status: "success"
57
- }
58
- rescue StandardError => e
59
- # Return error information
60
- render json: {
61
- status: "error",
62
- message: "Failed to refresh data: #{e.message}"
63
- }, status: :internal_server_error
33
+ def quick_actions_data
34
+ [
35
+ {
36
+ icon: "refresh-cw",
37
+ label: "Refresh Data",
38
+ color: "blue",
39
+ action: "refresh_path"
40
+ },
41
+ {
42
+ icon: "settings",
43
+ label: "Configure",
44
+ color: "purple",
45
+ action: "#"
46
+ },
47
+ {
48
+ icon: "download",
49
+ label: "Export",
50
+ color: "green",
51
+ action: "#"
52
+ },
53
+ {
54
+ icon: "bell",
55
+ label: "Alerts",
56
+ color: "orange",
57
+ action: "#"
58
+ }
59
+ ]
64
60
  end
65
61
 
66
- def truncate_log
67
- log_monitor_service = LogSizeMonitorService.new
68
- filename = params[:filename]
69
-
70
- # Add .log extension if not included in the filename
71
- if filename.present? && !filename.end_with?(".log")
72
- filename = "#{filename}.log"
73
- end
62
+ def load_dashboard_cards
63
+ json_file_path = Rails.root.join("solidstats", "summary.json")
74
64
 
75
- result = log_monitor_service.truncate_log(filename)
65
+ begin
66
+ # Read and parse the JSON file
67
+ json_data = JSON.parse(File.read(json_file_path))
76
68
 
77
- render json: result
69
+ # Transform the JSON data into the format expected by the view
70
+ json_data.map do |name, data|
71
+ {
72
+ name: name,
73
+ icon: data["icon"],
74
+ status: data["status"],
75
+ value: data["value"],
76
+ last_updated: Time.parse(data["last_updated"]),
77
+ url: data["url"],
78
+ badges: data["badges"] || []
79
+ }
80
+ end
81
+ rescue Errno::ENOENT
82
+ Rails.logger.warn("Summary JSON file not found, generating initial data...")
83
+ # Fallback to empty array if JSON is invalid
84
+ []
85
+ rescue JSON::ParserError => e
86
+ Rails.logger.error("Error parsing summary JSON: #{e.message}")
87
+ # Fallback to empty array if JSON is invalid
88
+ []
89
+ end
78
90
  end
79
91
  end
80
92
  end
@@ -0,0 +1,72 @@
1
+ module Solidstats
2
+ class LogsController < ApplicationController
3
+ layout "solidstats/dashboard"
4
+
5
+ def logs_size
6
+ @logs_data = Solidstats::LogSizeMonitorService.get_logs_data
7
+ end
8
+
9
+ def truncate
10
+ filename = params[:filename]
11
+
12
+ # Validate filename presence
13
+ if filename.blank?
14
+ return render json: {
15
+ status: "error",
16
+ message: "Filename is required"
17
+ }, status: :bad_request
18
+ end
19
+
20
+ # Remove any path traversal attempts for security
21
+ filename = File.basename(filename)
22
+
23
+ # Ensure it's a .log file
24
+ unless filename.end_with?(".log")
25
+ filename = "#{filename}.log" if filename.present?
26
+ end
27
+
28
+ # Additional security check
29
+ unless filename.end_with?(".log")
30
+ return render json: {
31
+ status: "error",
32
+ message: "Invalid file type. Only .log files can be truncated."
33
+ }, status: :bad_request
34
+ end
35
+
36
+ result = Solidstats::LogSizeMonitorService.truncate_log(filename)
37
+
38
+ if result[:status] == "success"
39
+ render json: {
40
+ status: "success",
41
+ message: result[:message] || "Log file truncated successfully",
42
+ filename: filename,
43
+ original_size: result[:original_size]
44
+ }
45
+ else
46
+ render json: result, status: :unprocessable_entity
47
+ end
48
+ rescue StandardError => e
49
+ Rails.logger.error("Failed to truncate log #{filename}: #{e.message}")
50
+ render json: {
51
+ status: "error",
52
+ message: "Failed to truncate log: #{e.message}"
53
+ }, status: :internal_server_error
54
+ end
55
+
56
+ def refresh
57
+ # Force refresh of log monitoring data
58
+ result = Solidstats::LogSizeMonitorService.scan_and_cache
59
+
60
+ render json: {
61
+ status: "success",
62
+ message: "Log data refreshed",
63
+ data: result
64
+ }
65
+ rescue StandardError => e
66
+ render json: {
67
+ status: "error",
68
+ message: "Failed to refresh log data: #{e.message}"
69
+ }, status: :internal_server_error
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Solidstats
4
+ class PerformanceController < ApplicationController
5
+ layout "solidstats/dashboard"
6
+
7
+ def load_lens
8
+ @performance_data = LoadLensService.get_performance_data
9
+ @metrics = @performance_data[:summary] || {}
10
+ @recent_requests = @performance_data[:recent_requests] || []
11
+ end
12
+
13
+ def refresh
14
+ # Parse new log entries and refresh cache
15
+ parse_result = LoadLensService.parse_log_and_save
16
+ LoadLensService.refresh_data
17
+
18
+ if parse_result[:success]
19
+ redirect_to load_lens_performance_index_path, notice: "LoadLens data refreshed! Parsed #{parse_result[:processed]} new requests."
20
+ else
21
+ redirect_to load_lens_performance_index_path, alert: "Failed to parse logs: #{parse_result[:error]}"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Solidstats
4
+ class ProductivityController < ApplicationController
5
+ layout "solidstats/dashboard"
6
+
7
+ def my_todos
8
+ @todos = MyTodoService.collect_todos
9
+ @summary = MyTodoService.get_summary
10
+
11
+ # Group todos by type for display
12
+ @todos_by_type = @todos.group_by { |todo| todo[:type] }
13
+
14
+ # Recent todos (first 10 for quick view)
15
+ @recent_todos = @todos.first(10)
16
+
17
+ # Stats for dashboard
18
+ @stats = {
19
+ total: @todos.length,
20
+ by_type: @todos_by_type.transform_values(&:count),
21
+ files_with_todos: @todos.map { |t| t[:file] }.uniq.length
22
+ }
23
+
24
+ respond_to do |format|
25
+ format.html
26
+ format.json { render json: { todos: @todos, summary: @summary, stats: @stats } }
27
+ end
28
+ end
29
+
30
+ def refresh_todos
31
+ @todos = MyTodoService.collect_todos(force_refresh: true)
32
+
33
+ respond_to do |format|
34
+ format.html { redirect_to my_todos_productivity_index_path, notice: "TODOs refreshed successfully!" }
35
+ format.json { render json: { status: "success", message: "TODOs refreshed", count: @todos.length } }
36
+ end
37
+ end
38
+ end
39
+ end