solidstats 1.1.0 → 2.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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -0
  3. data/README.md +33 -0
  4. data/app/assets/javascripts/solidstats/application.js +257 -0
  5. data/app/assets/javascripts/solidstats/dashboard.js +225 -0
  6. data/app/assets/javascripts/solidstats/gem_metadata.js +554 -0
  7. data/app/assets/stylesheets/solidstats/application.css +6 -1
  8. data/app/assets/stylesheets/solidstats/components/action_button.css +99 -0
  9. data/app/assets/stylesheets/solidstats/components/dashboard.css +151 -0
  10. data/app/assets/stylesheets/solidstats/components/dashboard_header.css +93 -0
  11. data/app/assets/stylesheets/solidstats/components/dashboard_layout.css +97 -0
  12. data/app/assets/stylesheets/solidstats/components/gem_metadata.css +1403 -0
  13. data/app/assets/stylesheets/solidstats/components/navigation.css +80 -0
  14. data/app/assets/stylesheets/solidstats/components/quick_navigation.css +54 -0
  15. data/app/assets/stylesheets/solidstats/components/security.css +332 -0
  16. data/app/assets/stylesheets/solidstats/components/status_badge.css +58 -0
  17. data/app/assets/stylesheets/solidstats/components/summary_card.css +66 -0
  18. data/app/assets/stylesheets/solidstats/components/tab_navigation.css +95 -0
  19. data/app/components/solidstats/base_component.rb +88 -0
  20. data/app/components/solidstats/code_quality/code_quality_section_component.html.erb +0 -0
  21. data/app/components/solidstats/code_quality/code_quality_section_component.rb +0 -0
  22. data/app/components/solidstats/code_quality/section_component.html.erb +45 -0
  23. data/app/components/solidstats/code_quality/section_component.rb +34 -0
  24. data/app/components/solidstats/dashboard_header_component.html.erb +39 -0
  25. data/app/components/solidstats/dashboard_header_component.rb +33 -0
  26. data/app/components/solidstats/previews/action_button_component_preview/button_vs_link.html.erb +6 -0
  27. data/app/components/solidstats/previews/action_button_component_preview/sizes.html.erb +6 -0
  28. data/app/components/solidstats/previews/action_button_component_preview/variants.html.erb +6 -0
  29. data/app/components/solidstats/previews/action_button_component_preview/with_icons.html.erb +6 -0
  30. data/app/components/solidstats/previews/action_button_component_preview.rb +64 -0
  31. data/app/components/solidstats/previews/navigation_component_preview.rb +74 -0
  32. data/app/components/solidstats/previews/stats_overview_component_preview.rb +100 -0
  33. data/app/components/solidstats/previews/status_badge_component_preview/sizes.html.erb +6 -0
  34. data/app/components/solidstats/previews/status_badge_component_preview/statuses.html.erb +6 -0
  35. data/app/components/solidstats/previews/status_badge_component_preview/with_icons.html.erb +6 -0
  36. data/app/components/solidstats/previews/status_badge_component_preview.rb +49 -0
  37. data/app/components/solidstats/previews/summary_card_component_preview/clickable.html.erb +9 -0
  38. data/app/components/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb +9 -0
  39. data/app/components/solidstats/previews/summary_card_component_preview/statuses.html.erb +6 -0
  40. data/app/components/solidstats/previews/summary_card_component_preview/value_formats.html.erb +6 -0
  41. data/app/components/solidstats/previews/summary_card_component_preview.rb +67 -0
  42. data/app/components/solidstats/quick_navigation_component.html.erb +8 -0
  43. data/app/components/solidstats/quick_navigation_component.rb +21 -0
  44. data/app/components/solidstats/security/gem_impact_analysis_component.html.erb +44 -0
  45. data/app/components/solidstats/security/gem_impact_analysis_component.rb +45 -0
  46. data/app/components/solidstats/security/overview_component.html.erb +21 -0
  47. data/app/components/solidstats/security/overview_component.rb +104 -0
  48. data/app/components/solidstats/security/section_component.html.erb +26 -0
  49. data/app/components/solidstats/security/section_component.rb +52 -0
  50. data/app/components/solidstats/security/timeline_component.html.erb +39 -0
  51. data/app/components/solidstats/security/timeline_component.rb +43 -0
  52. data/app/components/solidstats/tasks_section_component.html.erb +17 -0
  53. data/app/components/solidstats/tasks_section_component.rb +22 -0
  54. data/app/components/solidstats/ui/action_button_component.html.erb +6 -0
  55. data/app/components/solidstats/ui/action_button_component.rb +71 -0
  56. data/app/components/solidstats/ui/dashboard_layout_component.html.erb +19 -0
  57. data/app/components/solidstats/ui/dashboard_layout_component.rb +85 -0
  58. data/app/components/solidstats/ui/navigation_component.html.erb +34 -0
  59. data/app/components/solidstats/ui/navigation_component.rb +72 -0
  60. data/app/components/solidstats/ui/stats_overview_component.html.erb +14 -0
  61. data/app/components/solidstats/ui/stats_overview_component.rb +78 -0
  62. data/app/components/solidstats/ui/status_badge_component.html.erb +6 -0
  63. data/app/components/solidstats/ui/status_badge_component.rb +42 -0
  64. data/app/components/solidstats/ui/summary_card_component.html.erb +12 -0
  65. data/app/components/solidstats/ui/summary_card_component.rb +63 -0
  66. data/app/components/solidstats/ui/tab_navigation_component.html.erb +22 -0
  67. data/app/components/solidstats/ui/tab_navigation_component.rb +79 -0
  68. data/app/controllers/solidstats/dashboard_controller.rb +8 -5
  69. data/app/controllers/solidstats/gem_metadata_controller.rb +12 -0
  70. data/app/helpers/solidstats/application_helper.rb +42 -0
  71. data/app/services/solidstats/gem_metadata/fetcher_service.rb +136 -0
  72. data/app/services/solidstats/log_size_monitor_service.rb +10 -10
  73. data/app/views/layouts/solidstats/application.html.erb +2 -1
  74. data/app/views/solidstats/dashboard/index.html.erb +67 -1337
  75. data/app/views/solidstats/gem_metadata/_panel.html.erb +419 -0
  76. data/config/routes.rb +5 -2
  77. data/lib/generators/solidstats/feature/feature_generator.rb +170 -0
  78. data/lib/generators/solidstats/feature/templates/component.html.erb +84 -0
  79. data/lib/generators/solidstats/feature/templates/component.rb.erb +103 -0
  80. data/lib/generators/solidstats/feature/templates/component.scss +243 -0
  81. data/lib/generators/solidstats/feature/templates/component_test.rb.erb +183 -0
  82. data/lib/generators/solidstats/feature/templates/controller.rb.erb +44 -0
  83. data/lib/generators/solidstats/feature/templates/controller_test.rb.erb +111 -0
  84. data/lib/generators/solidstats/feature/templates/detail_view.html.erb +755 -0
  85. data/lib/generators/solidstats/feature/templates/preview.rb.erb +107 -0
  86. data/lib/generators/solidstats/feature/templates/service.rb.erb +132 -0
  87. data/lib/generators/solidstats/feature/templates/service_test.rb.erb +109 -0
  88. data/lib/generators/solidstats/install_generator.rb +109 -0
  89. data/lib/generators/solidstats/templates/initializer.rb +112 -0
  90. data/lib/solidstats/asset_compatibility.rb +238 -0
  91. data/lib/solidstats/asset_manifest.rb +205 -0
  92. data/lib/solidstats/engine.rb +114 -9
  93. data/lib/solidstats/version.rb +1 -1
  94. data/lib/solidstats.rb +299 -2
  95. data/lib/tasks/solidstats_install.rake +122 -2
  96. metadata +97 -2
@@ -1,1351 +1,81 @@
1
+ <%# Modern Component-Based Dashboard %>
2
+ <%# Refactored from 1,368-line monolithic file to clean ViewComponent architecture %>
3
+
1
4
  <div class="solidstats-dashboard">
2
- <header class="dashboard-header">
3
- <div class="header-main">
4
- <h1><span class="icon">🚥</span> Solidstats Dashboard</h1>
5
- <% created_at = @audit_output.dig("created_at") %>
6
- <span class="audit-date">Last updated: <%= created_at ? DateTime.parse(created_at).strftime("%B %d, %Y at %H:%M") : Time.now.strftime("%B %d, %Y at %H:%M") %></span>
7
- </div>
8
-
9
- <nav class="dashboard-nav">
10
- <ul>
11
- <li><a href="#overview" class="nav-item active" data-section="overview">Overview</a></li>
12
- <li><a href="#security" class="nav-item" data-section="security">Security</a></li>
13
- <li><a href="#code-quality" class="nav-item" data-section="code-quality">Code Quality</a></li>
14
- <li><a href="#tasks" class="nav-item" data-section="tasks">Tasks</a></li>
15
- </ul>
16
-
17
- <div class="dashboard-actions">
18
- <a href="#" class="action-button" onclick="refreshAudit(); return false;">
19
- <span class="action-icon">↻</span> Refresh
20
- </a>
21
- <button class="action-button" disabled title="Export is currently disabled" style="cursor: not-allowed;">
22
- <span class="action-icon">↓</span> Export
23
- </button>
24
- </div>
25
- </nav>
26
- </header>
5
+ <%# Dashboard Header with Navigation and Actions %>
6
+ <%= render Solidstats::DashboardHeaderComponent.new(audit_output: @audit_output) %>
27
7
 
28
- <!-- Overview Section with Key Metrics -->
8
+ <%# Overview Section with Key Metrics Summary Cards %>
29
9
  <section id="overview" class="dashboard-section active">
30
10
  <h2 class="section-title">Overview</h2>
31
11
 
32
12
  <div class="stats-summary">
33
- <div class="summary-card <%= @audit_output.dig('results').present? ? 'status-warning' : 'status-ok' %>" data-section="security" data-tab="security-overview">
34
- <div class="summary-icon">🔒</div>
35
- <div class="summary-data">
36
- <div class="summary-value"><%= @audit_output.dig('results')&.size || 0 %></div>
37
- <div class="summary-label">Security Issues</div>
38
- </div>
39
- </div>
40
-
41
- <div class="summary-card <%= @todo_items&.present? ? 'status-warning' : 'status-ok' %>" data-section="tasks" data-tab="todos">
42
- <div class="summary-icon">📝</div>
43
- <div class="summary-data">
44
- <div class="summary-value"><%= @todo_items&.count || 0 %></div>
45
- <div class="summary-label">TODO Items</div>
46
- </div>
47
- </div>
48
-
49
- <div class="summary-card <%= @coverage.to_f > 80 ? 'status-ok' : (@coverage.to_f > 60 ? 'status-warning' : 'status-danger') %>" data-section="code-quality" data-tab="test-coverage">
50
- <div class="summary-icon">🧪</div>
51
- <div class="summary-data">
52
- <div class="summary-value"><%= @coverage %>%</div>
53
- <div class="summary-label">Test Coverage</div>
54
- </div>
55
- </div>
56
-
57
- <div class="summary-card status-<%= @log_data[:status] %>" data-section="code-quality" data-tab="log-monitor">
58
- <div class="summary-icon">📊</div>
59
- <div class="summary-data">
60
- <div class="summary-value"><%= @log_data[:total_size_mb] %> MB</div>
61
- <div class="summary-label">Log Files Size</div>
62
- </div>
63
- </div>
64
- </div>
65
- </section>
13
+ <%# Security Issues Summary Card %>
14
+ <%= render Solidstats::Ui::SummaryCardComponent.new(
15
+ title: "Security Issues",
16
+ value: @audit_output.dig('results')&.size || 0,
17
+ status: :warning,
18
+ icon: "🔒",
19
+ section: "security",
20
+ tab: "security-overview"
21
+ ) %>
66
22
 
67
- <!-- Security Section -->
68
- <section id="security" class="dashboard-section">
69
- <h2 class="section-title">Security</h2>
70
-
71
- <div class="security-overview">
72
- <% results = @audit_output.dig("results") || [] %>
73
- <% vulnerabilities_count = results.size %>
74
- <% high_severity = results.count { |r| %w[high critical].include?(r.dig("advisory", "criticality").to_s.downcase) } %>
75
- <% affected_gems = results.map { |r| r.dig("gem", "name") }.uniq.size %>
76
-
77
- <div class="security-score-container">
78
- <div class="security-score <%= vulnerabilities_count == 0 ? 'score-excellent' : (high_severity > 0 ? 'score-critical' : 'score-warning') %>">
79
- <div class="score-value"><%= vulnerabilities_count == 0 ? 'A+' : (high_severity > 0 ? 'C' : 'B') %></div>
80
- <div class="score-label">Security<br>Rating</div>
81
- </div>
82
-
83
- <div class="security-metrics">
84
- <div class="metric-item <%= high_severity > 0 ? 'metric-critical' : '' %>">
85
- <div class="metric-icon">⚠️</div>
86
- <div class="metric-data">
87
- <div class="metric-value"><%= high_severity %></div>
88
- <div class="metric-label">Critical Issues</div>
89
- </div>
90
- </div>
91
-
92
- <div class="metric-item <%= vulnerabilities_count > 0 ? 'metric-warning' : '' %>">
93
- <div class="metric-icon">🔍</div>
94
- <div class="metric-data">
95
- <div class="metric-value"><%= vulnerabilities_count %></div>
96
- <div class="metric-label">Total Vulnerabilities</div>
97
- </div>
98
- </div>
99
-
100
- <div class="metric-item <%= affected_gems > 0 ? 'metric-warning' : '' %>">
101
- <div class="metric-icon">💎</div>
102
- <div class="metric-data">
103
- <div class="metric-value"><%= affected_gems %></div>
104
- <div class="metric-label">Affected Gems</div>
105
- </div>
106
- </div>
107
- </div>
108
- </div>
109
- </div>
110
-
111
- <div class="tabs-container">
112
- <div class="tabs-header security-tabs">
113
- <button class="tab-button active" data-tab="security-overview">
114
- <span class="tab-icon">📊</span> Overview
115
- </button>
116
- <button class="tab-button" data-tab="security-gems">
117
- <span class="tab-icon">💎</span> Affected Gems
118
- </button>
119
- <button class="tab-button" data-tab="security-timeline">
120
- <span class="tab-icon">📈</span> Timeline
121
- </button>
122
- </div>
123
-
124
- <div class="tabs-content">
125
- <div class="tab-content active" id="security-overview">
126
- <%= render partial: 'solidstats/dashboard/audit/security_audit', locals: { results: results } %>
127
- </div>
128
- <div class="tab-content" id="security-gems">
129
- <div class="gem-impact-analysis">
130
- <h3>Gem Impact Analysis</h3>
131
- <% results = @audit_output.dig("results") || [] %>
132
- <% if results.any? %>
133
- <div class="gems-container">
134
- <% results.map { |r| r.dig("gem", "name") }.uniq.each do |gem_name| %>
135
- <% gem_vulns = results.select { |r| r.dig("gem", "name") == gem_name } %>
136
- <% highest_severity = gem_vulns.map { |v| v.dig("advisory", "criticality").to_s.downcase }.select { |c| %w[critical high medium low].include?(c) }.min_by { |s| %w[critical high medium low].index(s) || 999 } || "unknown" %>
137
-
138
- <div class="gem-card severity-<%= highest_severity %>">
139
- <div class="gem-header">
140
- <div class="gem-name"><%= gem_name %></div>
141
- <div class="gem-severity <%= highest_severity %>"><%= highest_severity.capitalize %></div>
142
- </div>
143
- <div class="gem-details">
144
- <div class="gem-versions">
145
- <div class="current-version">
146
- <span class="version-label">Current:</span>
147
- <span class="version-value"><%= gem_vulns.first.dig("gem", "version") rescue "Unknown" %></span>
148
- </div>
149
- <div class="target-version">
150
- <span class="version-label">Target:</span>
151
- <span class="version-value"><%= gem_vulns.first.dig("advisory", "patched_versions")&.first || "N/A" %></span>
152
- </div>
153
- </div>
154
- <div class="gem-vulnerabilities-count">
155
- <%= gem_vulns.size %> <%= "vulnerability".pluralize(gem_vulns.size) %> found
156
- </div>
157
- </div>
158
- <div class="gem-actions">
159
- <button class="action-button gem-update-button">
160
- <span class="action-icon">↑</span> Update Gem
161
- </button>
162
- </div>
163
- </div>
164
- <% end %>
165
- </div>
166
- <% else %>
167
- <div class="empty-state">
168
- <div class="empty-icon">✅</div>
169
- <div class="empty-message">No vulnerable gems found</div>
170
- <div class="empty-description">Your application is secure. Keep up with regular security audits!</div>
171
- </div>
172
- <% end %>
173
- </div>
174
- </div>
175
- <div class="tab-content" id="security-timeline">
176
- <div class="security-timeline-container">
177
- <h3>Security Timeline</h3>
178
- <div class="timeline-chart-placeholder">
179
- <div class="chart-header">
180
- <div class="chart-title">Vulnerability History</div>
181
- <div class="chart-legend">
182
- <div class="legend-item">
183
- <span class="legend-color" style="background-color: #dc3545;"></span>
184
- <span class="legend-label">Critical</span>
185
- </div>
186
- <div class="legend-item">
187
- <span class="legend-color" style="background-color: #ffc107;"></span>
188
- <span class="legend-label">Medium</span>
189
- </div>
190
- <div class="legend-item">
191
- <span class="legend-color" style="background-color: #28a745;"></span>
192
- <span class="legend-label">Low</span>
193
- </div>
194
- </div>
195
- </div>
196
- <div class="chart-visualization">
197
- <!-- Placeholder for the actual chart -->
198
- <div class="chart-timeline">
199
- <div class="timeline-point" style="left: 10%;">
200
- <div class="timeline-marker critical"></div>
201
- <div class="timeline-date">Jan 2025</div>
202
- </div>
203
- <div class="timeline-point" style="left: 30%;">
204
- <div class="timeline-marker medium"></div>
205
- <div class="timeline-date">Feb 2025</div>
206
- </div>
207
- <div class="timeline-point" style="left: 65%;">
208
- <div class="timeline-marker low"></div>
209
- <div class="timeline-date">Apr 2025</div>
210
- </div>
211
- <div class="timeline-point" style="left: 85%;">
212
- <div class="timeline-marker critical"></div>
213
- <div class="timeline-date">May 2025</div>
214
- </div>
215
- </div>
216
- </div>
217
- </div>
218
- <div class="timeline-insights">
219
- <div class="insight-card">
220
- <div class="insight-header">Key Insights</div>
221
- <div class="insight-content">
222
- <div class="insight-item">
223
- <div class="insight-title">Notable Trend</div>
224
- <div class="insight-description">4 vulnerabilities discovered in the last 3 months.</div>
225
- </div>
226
- <div class="insight-item">
227
- <div class="insight-title">Recent Activity</div>
228
- <div class="insight-description">Last security scan: <%= Time.now.strftime("%B %d, %Y") %></div>
229
- </div>
230
- </div>
231
- </div>
232
- </div>
233
- </div>
234
- </div>
235
- </div>
236
- </div>
237
- </section>
23
+ <%# Gem Count Summary Card %>
24
+ <%= render Solidstats::Ui::SummaryCardComponent.new(
25
+ title: "Total Gems",
26
+ value: (Solidstats::GemMetadata::FetcherService.call.size rescue 0),
27
+ status: :info,
28
+ icon: "💎",
29
+ section: "gem-metadata"
30
+ ) %>
238
31
 
239
- <!-- Code Quality Section -->
240
- <section id="code-quality" class="dashboard-section">
241
- <h2 class="section-title">Code Quality</h2>
242
-
243
- <div class="tabs-container">
244
- <div class="tabs-header">
245
- <button class="tab-button active" data-tab="quality-metrics">Metrics</button>
246
- <button class="tab-button" data-tab="test-coverage">Test Coverage</button>
247
- <button class="tab-button" data-tab="code-health">Code Health</button>
248
- <button class="tab-button" data-tab="log-monitor">
249
- <span class="tab-icon">📊</span> Log Monitor
250
- </button>
251
- </div>
252
-
253
- <div class="tabs-content">
254
- <div class="tab-content active" id="quality-metrics">
255
- <div class="stat-card">
256
- <h2><span class="icon">🧹</span> Code Quality</h2>
257
- <div class="card-content">
258
- <div class="metric">
259
- <!-- Your code quality metrics -->
260
- </div>
261
- </div>
262
- </div>
263
- </div>
264
- <div class="tab-content" id="test-coverage">
265
- <div class="stat-card <%= @coverage.to_f > 80 ? 'status-ok' : (@coverage.to_f > 60 ? 'status-warning' : 'status-danger') %>">
266
- <h2><span class="icon">🧪</span> Test Coverage</h2>
267
- <div class="card-content">
268
- <div class="progress-container">
269
- <div class="progress-bar" style="width: <%= @coverage %>%"></div>
270
- </div>
271
- <div class="metric">
272
- <span class="metric-value"><%= @coverage %>%</span>
273
- </div>
274
- </div>
275
- </div>
276
- </div>
277
- <div class="tab-content" id="code-health">
278
- <div class="stat-card">
279
- <h2><span class="icon">📝</span> Code Health</h2>
280
- <div class="card-content">
281
- <!-- Your code health metrics -->
282
- </div>
283
- </div>
284
- </div>
285
- <div class="tab-content" id="log-monitor">
286
- <%= render partial: 'solidstats/dashboard/log_monitor' %>
287
- </div>
288
- </div>
289
- </div>
290
- </section>
32
+ <%# TODO Items Summary Card %>
33
+ <%= render Solidstats::Ui::SummaryCardComponent.new(
34
+ title: "TODO Items",
35
+ value: @todo_items&.count || 0,
36
+ status: ((@todo_items&.count || 0) > 10 ? :warning : :ok),
37
+ icon: "📝",
38
+ section: "tasks",
39
+ tab: "todos"
40
+ ) %>
291
41
 
292
- <!-- Tasks Section -->
293
- <section id="tasks" class="dashboard-section">
294
- <h2 class="section-title">Tasks</h2>
295
-
296
- <div class="tabs-container">
297
- <div class="tabs-header">
298
- <button class="tab-button active" data-tab="todos">TODO Items</button>
299
- <button class="tab-button" data-tab="fixmes">FIXMEs</button>
300
- <button class="tab-button" data-tab="hacks">HACKs</button>
301
- </div>
302
-
303
- <div class="tabs-content">
304
- <div class="tab-content active" id="todos">
305
- <%= render partial: 'todos' %>
306
- </div>
307
- <div class="tab-content" id="fixmes">
308
- <!-- FIXME specific content -->
309
- </div>
310
- <div class="tab-content" id="hacks">
311
- <!-- HACK specific content -->
312
- </div>
313
- </div>
42
+ <%# Test Coverage Summary Card %>
43
+ <%= render Solidstats::Ui::SummaryCardComponent.new(
44
+ title: "Test Coverage",
45
+ value: "#{@coverage.to_f.round(1)}%",
46
+ status: (@coverage.to_f >= 80 ? :ok : :warning),
47
+ icon: "📊",
48
+ section: "code-quality",
49
+ tab: "test-coverage"
50
+ ) %>
51
+
52
+ <%# Log Size Summary Card %>
53
+ <%= render Solidstats::Ui::SummaryCardComponent.new(
54
+ title: "Log Size",
55
+ value: "#{@log_data[:total_size_mb]} MB",
56
+ status: @log_data[:status]&.to_sym || :ok,
57
+ icon: "📋",
58
+ section: "code-quality",
59
+ tab: "log-monitor"
60
+ ) %>
314
61
  </div>
315
62
  </section>
316
-
317
- <!-- Floating quick navigation -->
318
- <div class="quick-nav">
319
- <button class="quick-nav-toggle">↑</button>
320
- <div class="quick-nav-menu">
321
- <a href="#overview" class="quick-nav-item">Overview</a>
322
- <a href="#security" class="quick-nav-item">Security</a>
323
- <a href="#code-quality" class="quick-nav-item">Code Quality</a>
324
- <a href="#tasks" class="quick-nav-item">Tasks</a>
325
- </div>
326
- </div>
327
- </div>
328
63
 
329
- <style>
330
- /* Base styles for dashboard */
331
- .solidstats-dashboard {
332
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
333
- color: #333;
334
- max-width: 1200px;
335
- margin: 0 auto;
336
- padding: 20px;
337
- }
338
-
339
- /* Header and Navigation styles */
340
- .dashboard-header {
341
- margin-bottom: 2rem;
342
- position: sticky;
343
- top: 0;
344
- z-index: 100;
345
- background-color: #fff;
346
- padding: 15px 0;
347
- border-bottom: 1px solid #eaeaea;
348
- }
349
-
350
- .header-main {
351
- display: flex;
352
- justify-content: space-between;
353
- align-items: baseline;
354
- margin-bottom: 1rem;
355
- }
356
-
357
- .dashboard-header h1 {
358
- font-size: 1.8rem;
359
- font-weight: 600;
360
- margin: 0;
361
- }
362
-
363
- .dashboard-last-updated {
364
- color: #666;
365
- margin: 0;
366
- font-size: 0.9rem;
367
- }
368
-
369
- .dashboard-nav {
370
- display: flex;
371
- justify-content: space-between;
372
- align-items: center;
373
- }
374
-
375
- .dashboard-nav ul {
376
- display: flex;
377
- list-style-type: none;
378
- margin: 0;
379
- padding: 0;
380
- gap: 1rem;
381
- }
382
-
383
- .nav-item {
384
- padding: 0.5rem 1rem;
385
- text-decoration: none;
386
- color: #555;
387
- border-radius: 4px;
388
- font-weight: 500;
389
- transition: all 0.2s;
390
- }
391
-
392
- .nav-item:hover {
393
- background-color: #f5f5f5;
394
- color: #000;
395
- }
396
-
397
- .nav-item.active {
398
- background-color: #e9f5ff;
399
- color: #0366d6;
400
- }
401
-
402
- /* Section styling */
403
- .dashboard-section {
404
- margin-bottom: 3rem;
405
- display: none;
406
- }
407
-
408
- .dashboard-section.active {
409
- display: block;
410
- }
411
-
412
- .section-title {
413
- font-size: 1.5rem;
414
- margin-bottom: 1.5rem;
415
- padding-bottom: 0.5rem;
416
- border-bottom: 1px solid #eee;
417
- }
418
-
419
- /* Overview summary cards */
420
- .stats-summary {
421
- display: grid;
422
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
423
- gap: 1rem;
424
- margin-bottom: 2rem;
425
- }
426
-
427
- .summary-card {
428
- display: flex;
429
- align-items: center;
430
- padding: 1.5rem;
431
- background: #fff;
432
- border-radius: 8px;
433
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
434
- transition: transform 0.2s;
435
- cursor: pointer;
436
- }
437
-
438
- .summary-card:hover {
439
- transform: translateY(-2px);
440
- }
441
-
442
- .summary-icon {
443
- font-size: 2rem;
444
- margin-right: 1rem;
445
- }
446
-
447
- .summary-data {
448
- flex-grow: 1;
449
- }
450
-
451
- .summary-value {
452
- font-size: 1.8rem;
453
- font-weight: 700;
454
- line-height: 1;
455
- margin-bottom: 0.25rem;
456
- }
457
-
458
- .summary-label {
459
- color: #666;
460
- font-size: 0.9rem;
461
- }
462
-
463
- /* Tabs container */
464
- .tabs-container {
465
- background: #fff;
466
- border-radius: 8px;
467
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
468
- overflow: hidden;
469
- }
470
-
471
- .tabs-header {
472
- display: flex;
473
- background-color: #f8f9fa;
474
- border-bottom: 1px solid #dee2e6;
475
- overflow-x: auto;
476
- }
477
-
478
- .tab-button {
479
- padding: 0.75rem 1.25rem;
480
- background: none;
481
- border: none;
482
- font-size: 0.9rem;
483
- font-weight: 500;
484
- color: #555;
485
- cursor: pointer;
486
- white-space: nowrap;
487
- }
488
-
489
- .tab-button:hover {
490
- color: #000;
491
- background-color: #f1f1f1;
492
- }
493
-
494
- .tab-button.active {
495
- color: #0366d6;
496
- border-bottom: 2px solid #0366d6;
497
- background-color: white;
498
- }
499
-
500
- .tabs-content {
501
- padding: 1.5rem;
502
- }
503
-
504
- .tab-content {
505
- display: none;
506
- }
507
-
508
- .tab-content.active {
509
- display: block;
510
- }
511
-
512
- /* Card grid layout - modified for tabs */
513
- .stats-cards {
514
- display: grid;
515
- grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
516
- gap: 1.5rem;
517
- margin-bottom: 2rem;
518
- }
519
-
520
- /* Quick navigation floating button */
521
- .quick-nav {
522
- position: fixed;
523
- bottom: 2rem;
524
- right: 2rem;
525
- z-index: 99;
526
- }
527
-
528
- .quick-nav-toggle {
529
- width: 50px;
530
- height: 50px;
531
- border-radius: 50%;
532
- background-color: #0366d6;
533
- color: white;
534
- border: none;
535
- font-size: 1.5rem;
536
- cursor: pointer;
537
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
538
- transition: all 0.3s;
539
- }
540
-
541
- .quick-nav-toggle:hover {
542
- transform: scale(1.05);
543
- }
544
-
545
- .quick-nav-menu {
546
- position: absolute;
547
- bottom: 60px;
548
- right: 0;
549
- background-color: white;
550
- border-radius: 8px;
551
- width: 150px;
552
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
553
- display: none;
554
- flex-direction: column;
555
- }
556
-
557
- .quick-nav-item {
558
- padding: 0.75rem 1rem;
559
- text-decoration: none;
560
- color: #333;
561
- transition: background-color 0.2s;
562
- }
563
-
564
- .quick-nav-item:hover {
565
- background-color: #f5f5f5;
566
- }
567
-
568
- .quick-nav:hover .quick-nav-menu {
569
- display: flex;
570
- }
571
-
572
- /* Action buttons */
573
- .dashboard-actions {
574
- display: flex;
575
- gap: 0.5rem;
576
- }
577
-
578
- .action-button {
579
- display: inline-flex;
580
- align-items: center;
581
- padding: 0.5rem 1rem;
582
- background-color: #f8f9fa;
583
- border: 1px solid #dee2e6;
584
- color: #333;
585
- text-decoration: none;
586
- border-radius: 4px;
587
- font-size: 0.9rem;
588
- cursor: pointer;
589
- transition: all 0.2s;
590
- }
591
-
592
- .action-button:hover {
593
- background-color: #e9ecef;
594
- }
595
-
596
- .action-icon {
597
- margin-right: 0.25rem;
598
- }
599
-
600
- /* Fix for audit card to span full width when details are shown */
601
- .audit-card {
602
- position: relative;
603
- transition: all 0.3s ease;
604
- }
605
-
606
- /* Card styles - simplified for tabs */
607
- .stat-card {
608
- background: transparent;
609
- padding: 0;
610
- box-shadow: none;
611
- overflow: visible;
612
- }
613
-
614
- .stat-card h2 {
615
- font-size: 1.2rem;
616
- font-weight: 600;
617
- margin: 0 0 1rem 0;
618
- display: flex;
619
- align-items: center;
620
- gap: 0.5rem;
621
- }
622
-
623
- /* Security section specific styles */
624
- .security-overview {
625
- margin-bottom: 1.5rem;
626
- background-color: #fff;
627
- border-radius: 8px;
628
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
629
- padding: 1.5rem;
630
- }
631
-
632
- .security-score-container {
633
- display: flex;
634
- align-items: center;
635
- gap: 2rem;
636
- }
637
-
638
- .security-score {
639
- width: 120px;
640
- height: 120px;
641
- border-radius: 50%;
642
- display: flex;
643
- flex-direction: column;
644
- align-items: center;
645
- justify-content: center;
646
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
647
- }
648
-
649
- .score-value {
650
- font-size: 3rem;
651
- font-weight: 700;
652
- line-height: 1;
653
- }
654
-
655
- .score-label {
656
- font-size: 0.85rem;
657
- text-align: center;
658
- margin-top: 0.25rem;
659
- }
660
-
661
- .score-excellent {
662
- background-color: #e9f7ef;
663
- color: #27ae60;
664
- border: 3px solid #27ae60;
665
- }
666
-
667
- .score-warning {
668
- background-color: #fcf3cf;
669
- color: #f39c12;
670
- border: 3px solid #f39c12;
671
- }
672
-
673
- .score-critical {
674
- background-color: #fdedeb;
675
- color: #e74c3c;
676
- border: 3px solid #e74c3c;
677
- }
678
-
679
- .security-metrics {
680
- display: flex;
681
- flex-grow: 1;
682
- gap: 2rem;
683
- }
684
-
685
- .metric-item {
686
- flex: 1;
687
- display: flex;
688
- align-items: center;
689
- gap: 1rem;
690
- padding: 1rem;
691
- background-color: #f9fafb;
692
- border-radius: 8px;
693
- transition: transform 0.2s;
694
- }
695
-
696
- .metric-item:hover {
697
- transform: translateY(-2px);
698
- }
699
-
700
- .metric-critical {
701
- border-left: 4px solid #e74c3c;
702
- }
703
-
704
- .metric-warning {
705
- border-left: 4px solid #f39c12;
706
- }
707
-
708
- .metric-icon {
709
- font-size: 1.8rem;
710
- opacity: 0.8;
711
- }
712
-
713
- .metric-data {
714
- flex-grow: 1;
715
- }
716
-
717
- .metric-value {
718
- font-size: 1.8rem;
719
- font-weight: 700;
720
- line-height: 1;
721
- }
722
-
723
- .metric-label {
724
- font-size: 0.85rem;
725
- color: #666;
726
- margin-top: 0.25rem;
727
- }
728
-
729
- .security-tabs .tab-button {
730
- position: relative;
731
- }
732
-
733
- .security-tabs .tab-button .tab-icon {
734
- margin-right: 0.5rem;
735
- }
736
-
737
- .gem-impact-analysis {
738
- padding: 1rem 0;
739
- }
740
-
741
- .gems-container {
742
- display: grid;
743
- grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
744
- gap: 1rem;
745
- margin-top: 1.5rem;
746
- }
747
-
748
- .gem-card {
749
- background-color: #fff;
750
- border-radius: 8px;
751
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
752
- overflow: hidden;
753
- transition: transform 0.2s;
754
- }
755
-
756
- .gem-card:hover {
757
- transform: translateY(-2px);
758
- }
759
-
760
- .gem-card.severity-critical {
761
- border-top: 4px solid #e74c3c;
762
- }
763
-
764
- .gem-card.severity-high {
765
- border-top: 4px solid #fd7e14;
766
- }
767
-
768
- .gem-card.severity-medium {
769
- border-top: 4px solid #f39c12;
770
- }
771
-
772
- .gem-card.severity-low {
773
- border-top: 4px solid #27ae60;
774
- }
775
-
776
- .gem-header {
777
- padding: 1rem;
778
- display: flex;
779
- justify-content: space-between;
780
- align-items: center;
781
- border-bottom: 1px solid #eeeeee;
782
- }
783
-
784
- .gem-name {
785
- font-weight: 600;
786
- color: #333;
787
- }
788
-
789
- .gem-severity {
790
- font-size: 0.85rem;
791
- padding: 0.2rem 0.75rem;
792
- border-radius: 12px;
793
- }
794
-
795
- .gem-severity.critical {
796
- background-color: rgba(231, 76, 60, 0.15);
797
- color: #e74c3c;
798
- }
799
-
800
- .gem-severity.high {
801
- background-color: rgba(253, 126, 20, 0.15);
802
- color: #fd7e14;
803
- }
804
-
805
- .gem-severity.medium {
806
- background-color: rgba(243, 156, 18, 0.15);
807
- color: #f39c12;
808
- }
809
-
810
- .gem-severity.low {
811
- background-color: rgba(39, 174, 96, 0.15);
812
- color: #27ae60;
813
- }
814
-
815
- .gem-severity.unknown {
816
- background-color: rgba(173, 181, 189, 0.15);
817
- color: #6c757d;
818
- }
819
-
820
- .gem-details {
821
- padding: 1rem;
822
- background-color: #f9fafb;
823
- }
824
-
825
- .gem-versions {
826
- display: flex;
827
- justify-content: space-between;
828
- margin-bottom: 0.75rem;
829
- font-size: 0.9rem;
830
- }
831
-
832
- .version-label {
833
- color: #666;
834
- }
835
-
836
- .version-value {
837
- font-family: monospace;
838
- }
839
-
840
- .gem-vulnerabilities-count {
841
- font-size: 0.85rem;
842
- color: #666;
843
- }
844
-
845
- .gem-actions {
846
- padding: 1rem;
847
- display: flex;
848
- justify-content: center;
849
- }
850
-
851
- .empty-state {
852
- text-align: center;
853
- padding: 3rem 1rem;
854
- }
855
-
856
- .empty-icon {
857
- font-size: 3rem;
858
- margin-bottom: 1rem;
859
- color: #27ae60;
860
- }
861
-
862
- .empty-message {
863
- font-size: 1.2rem;
864
- font-weight: 600;
865
- margin-bottom: 0.5rem;
866
- }
867
-
868
- .empty-description {
869
- color: #666;
870
- }
871
-
872
- .security-timeline-container {
873
- padding: 1rem 0;
874
- }
875
-
876
- .timeline-chart-placeholder {
877
- background-color: #fff;
878
- border-radius: 8px;
879
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
880
- padding: 1.5rem;
881
- margin-top: 1.5rem;
882
- }
883
-
884
- .chart-header {
885
- display: flex;
886
- justify-content: space-between;
887
- align-items: center;
888
- margin-bottom: 1.5rem;
889
- }
890
-
891
- .chart-title {
892
- font-weight: 600;
893
- font-size: 1.1rem;
894
- }
895
-
896
- .chart-legend {
897
- display: flex;
898
- gap: 1rem;
899
- }
900
-
901
- .legend-item {
902
- display: flex;
903
- align-items: center;
904
- gap: 0.5rem;
905
- font-size: 0.85rem;
906
- }
907
-
908
- .legend-color {
909
- width: 12px;
910
- height: 12px;
911
- border-radius: 2px;
912
- }
913
-
914
- .chart-visualization {
915
- height: 200px;
916
- position: relative;
917
- margin-bottom: 1.5rem;
918
- }
919
-
920
- .chart-timeline {
921
- height: 80px;
922
- background-color: #f8f9fa;
923
- border-radius: 4px;
924
- position: relative;
925
- margin-top: 40px;
926
- }
927
-
928
- .timeline-point {
929
- position: absolute;
930
- bottom: 0;
931
- transform: translateX(-50%);
932
- }
933
-
934
- .timeline-marker {
935
- width: 12px;
936
- height: 12px;
937
- border-radius: 50%;
938
- position: relative;
939
- }
940
-
941
- .timeline-marker::before {
942
- content: '';
943
- position: absolute;
944
- bottom: 100%;
945
- left: 50%;
946
- transform: translateX(-50%);
947
- width: 1px;
948
- height: 30px;
949
- background-color: rgba(0,0,0,0.1);
950
- }
951
-
952
- .timeline-marker.critical {
953
- background-color: #dc3545;
954
- }
955
-
956
- .timeline-marker.medium {
957
- background-color: #ffc107;
958
- }
959
-
960
- .timeline-marker.low {
961
- background-color: #28a745;
962
- }
963
-
964
- .timeline-date {
965
- position: absolute;
966
- bottom: 100%;
967
- left: 50%;
968
- transform: translateX(-50%);
969
- white-space: nowrap;
970
- font-size: 0.85rem;
971
- color: #666;
972
- margin-bottom: 0.5rem;
973
- }
974
-
975
- .timeline-insights {
976
- margin-top: 1.5rem;
977
- }
978
-
979
- .insight-card {
980
- background-color: #fff;
981
- border-radius: 8px;
982
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
983
- overflow: hidden;
984
- }
985
-
986
- .insight-header {
987
- background-color: #f8f9fa;
988
- padding: 1rem;
989
- font-weight: 600;
990
- border-bottom: 1px solid #eeeeee;
991
- }
992
-
993
- .insight-content {
994
- padding: 1rem;
995
- }
996
-
997
- .insight-item {
998
- margin-bottom: 1rem;
999
- }
1000
-
1001
- .insight-item:last-child {
1002
- margin-bottom: 0;
1003
- }
1004
-
1005
- .insight-title {
1006
- font-weight: 600;
1007
- font-size: 0.95rem;
1008
- margin-bottom: 0.5rem;
1009
- }
1010
-
1011
- .insight-description {
1012
- color: #555;
1013
- font-size: 0.9rem;
1014
- }
1015
-
1016
- /* Responsive adjustments */
1017
- @media (max-width: 768px) {
1018
- .dashboard-nav {
1019
- flex-direction: column;
1020
- gap: 1rem;
1021
- }
1022
-
1023
- .dashboard-nav ul {
1024
- width: 100%;
1025
- overflow-x: auto;
1026
- padding-bottom: 0.5rem;
1027
- }
1028
-
1029
- .dashboard-actions {
1030
- width: 100%;
1031
- }
1032
-
1033
- .action-button {
1034
- flex: 1;
1035
- justify-content: center;
1036
- }
1037
-
1038
- .tabs-header {
1039
- padding: 0;
1040
- }
1041
-
1042
- .tab-button {
1043
- padding: 0.75rem 1rem;
1044
- }
1045
- }
1046
-
1047
- /* Keep compatibility with existing styles */
1048
- /* Details panel styling */
1049
- .details-panel {
1050
- background: #f9f9f9;
1051
- border-top: 1px solid #eaeaea;
1052
- padding: 1.5rem;
1053
- margin-top: 1.5rem;
1054
- border-radius: 0 0 8px 8px;
1055
- overflow: visible;
1056
- }
1057
-
1058
- .details-panel.hidden {
1059
- display: none;
1060
- }
1061
-
1062
- .details-panel:not(.hidden) {
1063
- display: block;
1064
- }
1065
-
1066
- /* Toggle details button */
1067
- .toggle-details {
1068
- display: inline-block;
1069
- color: #007bff;
1070
- cursor: pointer;
1071
- font-size: 0.9rem;
1072
- text-decoration: none;
1073
- }
1074
-
1075
- .toggle-details:hover {
1076
- text-decoration: underline;
1077
- }
1078
-
1079
- /* Status colors */
1080
- .status-ok {
1081
- border-left: 4px solid #28a745;
1082
- }
1083
-
1084
- .status-warning {
1085
- border-left: 4px solid #ffc107;
1086
- }
1087
-
1088
- .status-danger {
1089
- border-left: 4px solid #dc3545;
1090
- }
1091
-
1092
- /* Toast notifications styling */
1093
- .toast-notification {
1094
- position: fixed;
1095
- bottom: 20px;
1096
- left: 50%;
1097
- transform: translateX(-50%) translateY(100%);
1098
- background-color: white;
1099
- box-shadow: 0 4px 12px rgba(0,0,0,0.15);
1100
- border-radius: 4px;
1101
- padding: 0.75rem 1.5rem;
1102
- font-size: 0.9rem;
1103
- z-index: 1000;
1104
- transition: transform 0.3s ease;
1105
- opacity: 0;
1106
- }
1107
-
1108
- .toast-notification.visible {
1109
- transform: translateX(-50%) translateY(0);
1110
- opacity: 1;
1111
- }
1112
-
1113
- .toast-notification.success {
1114
- border-left: 4px solid #28a745;
1115
- }
1116
-
1117
- .toast-notification.info {
1118
- border-left: 4px solid #17a2b8;
1119
- }
1120
-
1121
- .toast-notification.warning {
1122
- border-left: 4px solid #ffc107;
1123
- }
1124
-
1125
- .toast-notification.error {
1126
- border-left: 4px solid #dc3545;
1127
- }
1128
- </style>
64
+ <%# Security Section - Component-Based Architecture %>
65
+ <%= render Solidstats::Security::SectionComponent.new(audit_output: @audit_output) %>
1129
66
 
1130
- <script>
1131
- document.addEventListener('DOMContentLoaded', function() {
1132
- // Check for hash in URL and navigate accordingly
1133
- function handleHashNavigation() {
1134
- if (location.hash) {
1135
- const hashParts = location.hash.substring(1).split('/');
1136
- const section = hashParts[0];
1137
- const tab = hashParts[1] || null;
1138
-
1139
- if (section && document.getElementById(section)) {
1140
- // On page load, don't scroll - this prevents jumping around
1141
- // For manual hash changes, do scroll
1142
- const isPageLoad = !window.hasPageLoaded;
1143
- navigateToSection(section, tab, !isPageLoad);
1144
- return true;
1145
- }
1146
- }
1147
- return false;
1148
- }
1149
-
1150
- // Track if page has loaded fully
1151
- window.hasPageLoaded = false;
1152
-
1153
- // Try to handle hash navigation, if it fails (no hash or invalid section),
1154
- // the default 'overview' section will remain active
1155
- const hashNavigated = handleHashNavigation();
1156
- if (!hashNavigated) {
1157
- // If no hash navigation happened, set default hash to #overview
1158
- updateUrlHash('overview');
1159
- }
1160
-
1161
- // Listen for hash changes
1162
- window.addEventListener('hashchange', handleHashNavigation);
1163
-
1164
- // Mark page as fully loaded after a short delay
1165
- setTimeout(() => {
1166
- window.hasPageLoaded = true;
1167
- }, 500);
1168
-
1169
- // Toggle details panels
1170
- document.querySelectorAll('.toggle-details').forEach(function(toggle) {
1171
- toggle.addEventListener('click', function(e) {
1172
- e.preventDefault();
1173
- const targetId = this.getAttribute('data-target');
1174
- const panel = document.getElementById(targetId);
1175
- const card = this.closest('.stat-card');
1176
-
1177
- panel.classList.toggle('hidden');
1178
- card.classList.toggle('expanded');
1179
-
1180
- this.textContent = panel.classList.contains('hidden') ? 'Show Details' : 'Hide Details';
1181
-
1182
- // If showing details, scroll to it for better visibility
1183
- if (!panel.classList.contains('hidden')) {
1184
- setTimeout(() => {
1185
- panel.scrollIntoView({ behavior: 'smooth', block: 'start' });
1186
- }, 100);
1187
- }
1188
- });
1189
- });
1190
-
1191
- // Function to update URL hash with current state
1192
- function updateUrlHash(section, tab = null) {
1193
- let hash = '#' + section;
1194
- if (tab) {
1195
- hash += '/' + tab;
1196
- }
1197
- history.replaceState(null, null, hash);
1198
- }
1199
-
1200
- // Function to navigate to section and tab
1201
- function navigateToSection(section, tab = null, shouldScroll = false) {
1202
- // Remove active class from all nav items and sections
1203
- document.querySelectorAll('.nav-item').forEach(item => item.classList.remove('active'));
1204
- document.querySelectorAll('.dashboard-section').forEach(section => section.classList.remove('active'));
1205
-
1206
- // Add active class to matching nav item
1207
- const navItem = document.querySelector(`.nav-item[data-section="${section}"]`);
1208
- if (navItem) {
1209
- navItem.classList.add('active');
1210
- }
1211
-
1212
- // Show corresponding section
1213
- const sectionElement = document.getElementById(section);
1214
- if (sectionElement) {
1215
- sectionElement.classList.add('active');
1216
-
1217
- // If tab is specified, activate that tab
1218
- if (tab) {
1219
- const tabsContainer = sectionElement.querySelector('.tabs-container');
1220
- if (tabsContainer) {
1221
- // Deactivate all tabs first
1222
- tabsContainer.querySelectorAll('.tab-button').forEach(button => button.classList.remove('active'));
1223
- tabsContainer.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
1224
-
1225
- // Activate the target tab
1226
- const targetTabButton = tabsContainer.querySelector(`.tab-button[data-tab="${tab}"]`);
1227
- const targetTabContent = tabsContainer.querySelector(`#${tab}`);
1228
-
1229
- if (targetTabButton) targetTabButton.classList.add('active');
1230
- if (targetTabContent) targetTabContent.classList.add('active');
1231
- }
1232
- }
1233
-
1234
- // Scroll to section if requested (with a small delay to ensure rendering)
1235
- if (shouldScroll) {
1236
- setTimeout(() => {
1237
- sectionElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
1238
- }, 100);
1239
- }
1240
-
1241
- // Update URL hash
1242
- updateUrlHash(section, tab);
1243
- }
1244
- }
1245
-
1246
- // Main navigation
1247
- document.querySelectorAll('.nav-item').forEach(function(navItem) {
1248
- navItem.addEventListener('click', function(e) {
1249
- e.preventDefault();
1250
-
1251
- // Get section ID from data attribute
1252
- const sectionId = this.getAttribute('data-section');
1253
-
1254
- // Navigate to the section
1255
- navigateToSection(sectionId);
1256
- });
1257
- });
1258
-
1259
- // Tab navigation
1260
- document.querySelectorAll('.tab-button').forEach(function(tabButton) {
1261
- tabButton.addEventListener('click', function() {
1262
- const tabContainer = this.closest('.tabs-container');
1263
- const tabId = this.getAttribute('data-tab');
1264
-
1265
- // Find the current active section
1266
- const currentSection = document.querySelector('.dashboard-section.active').id;
1267
-
1268
- // Remove active class from all buttons and tabs within this container
1269
- tabContainer.querySelectorAll('.tab-button').forEach(button => button.classList.remove('active'));
1270
- tabContainer.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
1271
-
1272
- // Add active class to clicked button and corresponding tab
1273
- this.classList.add('active');
1274
- tabContainer.querySelector(`#${tabId}`).classList.add('active');
1275
-
1276
- // Update URL hash with current section and tab
1277
- updateUrlHash(currentSection, tabId);
1278
- });
1279
- });
1280
-
1281
- // Quick navigation
1282
- document.querySelectorAll('.quick-nav-item').forEach(function(navItem) {
1283
- navItem.addEventListener('click', function(e) {
1284
- e.preventDefault();
1285
- const targetId = this.getAttribute('href').substring(1);
1286
-
1287
- // Navigate to the specified section
1288
- navigateToSection(targetId);
1289
-
1290
- // Close the quick nav menu
1291
- document.querySelector('.quick-nav-menu').style.display = 'none';
1292
- });
1293
- });
1294
-
1295
- // Summary card navigation
1296
- document.querySelectorAll('.summary-card').forEach(function(card) {
1297
- card.addEventListener('click', function() {
1298
- const section = this.getAttribute('data-section');
1299
- const tab = this.getAttribute('data-tab');
1300
-
1301
- // Navigate to the specified section and tab, with scrolling
1302
- navigateToSection(section, tab, true);
1303
- });
1304
- });
1305
- });
67
+ <%# Code Quality Section - Component-Based Architecture %>
68
+ <%= render Solidstats::CodeQuality::SectionComponent.new(coverage: @coverage, log_data: @log_data) %>
1306
69
 
1307
- function refreshAudit() {
1308
- // Show loading indicator
1309
- const refreshButton = document.querySelector('.action-button');
1310
- const originalText = refreshButton.innerHTML;
1311
- refreshButton.innerHTML = '<span class="action-icon">⟳</span> Refreshing...';
1312
- refreshButton.disabled = true;
1313
-
1314
- // Make AJAX call to refresh endpoint
1315
- fetch('/solidstats/refresh', {
1316
- method: 'GET',
1317
- headers: {
1318
- 'Accept': 'application/json',
1319
- 'X-Requested-With': 'XMLHttpRequest'
1320
- },
1321
- credentials: 'same-origin'
1322
- })
1323
- .then(response => {
1324
- if (!response.ok) {
1325
- throw new Error('Network response was not ok');
1326
- }
1327
- return response.json();
1328
- })
1329
- .then(data => {
1330
- // Update the dashboard with fresh data
1331
- location.reload();
1332
-
1333
- // Show success notification
1334
- showNotification('Dashboard data refreshed successfully', 'success');
1335
-
1336
- // Reset button state
1337
- refreshButton.innerHTML = originalText;
1338
- refreshButton.disabled = false;
1339
- })
1340
- .catch(error => {
1341
- console.error('Error refreshing data:', error);
1342
-
1343
- // Show error notification
1344
- showNotification('Failed to refresh data. Please try again.', 'error');
1345
-
1346
- // Reset button state
1347
- refreshButton.innerHTML = originalText;
1348
- refreshButton.disabled = false;
1349
- });
1350
- }
1351
- </script>
70
+ <%# Gem Metadata Section %>
71
+ <section id="gem-metadata" class="dashboard-section">
72
+ <h2 class="section-title">Gem Dependencies</h2>
73
+ <%= render partial: 'solidstats/gem_metadata/panel' %>
74
+ </section>
75
+
76
+ <%# Tasks Section - Component-Based Architecture %>
77
+ <%= render Solidstats::TasksSectionComponent.new(todo_items: @todo_items) %>
78
+
79
+ <%# Quick Navigation - Component-Based Architecture %>
80
+ <%= render Solidstats::QuickNavigationComponent.new %>
81
+ </div>