solidstats 2.0.0 → 3.0.0.beta.1

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 (138) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -63
  3. data/README.md +27 -33
  4. data/Rakefile +3 -3
  5. data/app/assets/stylesheets/solidstats/application.css +1 -6
  6. data/app/assets/stylesheets/solidstats/dashboard.css +48 -0
  7. data/app/controllers/solidstats/dashboard_controller.rb +81 -62
  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 +454 -0
  19. data/app/services/solidstats/log_size_monitor_service.rb +207 -76
  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 +32 -7
  35. data/lib/generators/solidstats/install/install_generator.rb +28 -2
  36. data/lib/generators/solidstats/install/templates/README +7 -0
  37. data/lib/solidstats/engine.rb +9 -114
  38. data/lib/solidstats/version.rb +1 -1
  39. data/lib/solidstats.rb +2 -299
  40. data/lib/tasks/solidstats_install.rake +2 -122
  41. data/lib/tasks/solidstats_performance.rake +84 -0
  42. metadata +32 -103
  43. data/app/assets/javascripts/solidstats/application.js +0 -257
  44. data/app/assets/javascripts/solidstats/dashboard.js +0 -225
  45. data/app/assets/javascripts/solidstats/gem_metadata.js +0 -554
  46. data/app/assets/stylesheets/solidstats/components/action_button.css +0 -99
  47. data/app/assets/stylesheets/solidstats/components/dashboard.css +0 -151
  48. data/app/assets/stylesheets/solidstats/components/dashboard_header.css +0 -93
  49. data/app/assets/stylesheets/solidstats/components/dashboard_layout.css +0 -97
  50. data/app/assets/stylesheets/solidstats/components/gem_metadata.css +0 -1403
  51. data/app/assets/stylesheets/solidstats/components/navigation.css +0 -80
  52. data/app/assets/stylesheets/solidstats/components/quick_navigation.css +0 -54
  53. data/app/assets/stylesheets/solidstats/components/security.css +0 -332
  54. data/app/assets/stylesheets/solidstats/components/status_badge.css +0 -58
  55. data/app/assets/stylesheets/solidstats/components/summary_card.css +0 -66
  56. data/app/assets/stylesheets/solidstats/components/tab_navigation.css +0 -95
  57. data/app/components/solidstats/base_component.rb +0 -88
  58. data/app/components/solidstats/code_quality/code_quality_section_component.html.erb +0 -0
  59. data/app/components/solidstats/code_quality/code_quality_section_component.rb +0 -0
  60. data/app/components/solidstats/code_quality/section_component.html.erb +0 -45
  61. data/app/components/solidstats/code_quality/section_component.rb +0 -34
  62. data/app/components/solidstats/dashboard_header_component.html.erb +0 -39
  63. data/app/components/solidstats/dashboard_header_component.rb +0 -33
  64. data/app/components/solidstats/previews/action_button_component_preview/button_vs_link.html.erb +0 -6
  65. data/app/components/solidstats/previews/action_button_component_preview/sizes.html.erb +0 -6
  66. data/app/components/solidstats/previews/action_button_component_preview/variants.html.erb +0 -6
  67. data/app/components/solidstats/previews/action_button_component_preview/with_icons.html.erb +0 -6
  68. data/app/components/solidstats/previews/action_button_component_preview.rb +0 -64
  69. data/app/components/solidstats/previews/navigation_component_preview.rb +0 -74
  70. data/app/components/solidstats/previews/stats_overview_component_preview.rb +0 -100
  71. data/app/components/solidstats/previews/status_badge_component_preview/sizes.html.erb +0 -6
  72. data/app/components/solidstats/previews/status_badge_component_preview/statuses.html.erb +0 -6
  73. data/app/components/solidstats/previews/status_badge_component_preview/with_icons.html.erb +0 -6
  74. data/app/components/solidstats/previews/status_badge_component_preview.rb +0 -49
  75. data/app/components/solidstats/previews/summary_card_component_preview/clickable.html.erb +0 -9
  76. data/app/components/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb +0 -9
  77. data/app/components/solidstats/previews/summary_card_component_preview/statuses.html.erb +0 -6
  78. data/app/components/solidstats/previews/summary_card_component_preview/value_formats.html.erb +0 -6
  79. data/app/components/solidstats/previews/summary_card_component_preview.rb +0 -67
  80. data/app/components/solidstats/quick_navigation_component.html.erb +0 -8
  81. data/app/components/solidstats/quick_navigation_component.rb +0 -21
  82. data/app/components/solidstats/security/gem_impact_analysis_component.html.erb +0 -44
  83. data/app/components/solidstats/security/gem_impact_analysis_component.rb +0 -45
  84. data/app/components/solidstats/security/overview_component.html.erb +0 -21
  85. data/app/components/solidstats/security/overview_component.rb +0 -104
  86. data/app/components/solidstats/security/section_component.html.erb +0 -26
  87. data/app/components/solidstats/security/section_component.rb +0 -52
  88. data/app/components/solidstats/security/timeline_component.html.erb +0 -39
  89. data/app/components/solidstats/security/timeline_component.rb +0 -43
  90. data/app/components/solidstats/tasks_section_component.html.erb +0 -17
  91. data/app/components/solidstats/tasks_section_component.rb +0 -22
  92. data/app/components/solidstats/ui/action_button_component.html.erb +0 -6
  93. data/app/components/solidstats/ui/action_button_component.rb +0 -71
  94. data/app/components/solidstats/ui/dashboard_layout_component.html.erb +0 -19
  95. data/app/components/solidstats/ui/dashboard_layout_component.rb +0 -85
  96. data/app/components/solidstats/ui/navigation_component.html.erb +0 -34
  97. data/app/components/solidstats/ui/navigation_component.rb +0 -72
  98. data/app/components/solidstats/ui/stats_overview_component.html.erb +0 -14
  99. data/app/components/solidstats/ui/stats_overview_component.rb +0 -78
  100. data/app/components/solidstats/ui/status_badge_component.html.erb +0 -6
  101. data/app/components/solidstats/ui/status_badge_component.rb +0 -42
  102. data/app/components/solidstats/ui/summary_card_component.html.erb +0 -12
  103. data/app/components/solidstats/ui/summary_card_component.rb +0 -63
  104. data/app/components/solidstats/ui/tab_navigation_component.html.erb +0 -22
  105. data/app/components/solidstats/ui/tab_navigation_component.rb +0 -79
  106. data/app/controllers/solidstats/gem_metadata_controller.rb +0 -12
  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/generators/solidstats/templates/initializer.rb +0 -112
  136. data/lib/solidstats/asset_compatibility.rb +0 -238
  137. data/lib/solidstats/asset_manifest.rb +0 -205
  138. data/lib/tasks/solidstats_tasks.rake +0 -4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MezbahAlam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-25 00:00:00.000000000 Z
11
+ date: 2025-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: view_component
42
+ name: standard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.8'
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.8'
54
+ version: '0'
55
55
  description: 'View local project health: security dashboard with vulnerability analysis,
56
56
  gem impact assessment, code quality metrics, and project task tracking.'
57
57
  email:
@@ -64,119 +64,48 @@ files:
64
64
  - MIT-LICENSE
65
65
  - README.md
66
66
  - Rakefile
67
- - app/assets/javascripts/solidstats/application.js
68
- - app/assets/javascripts/solidstats/dashboard.js
69
- - app/assets/javascripts/solidstats/gem_metadata.js
70
67
  - app/assets/stylesheets/solidstats/application.css
71
- - app/assets/stylesheets/solidstats/components/action_button.css
72
- - app/assets/stylesheets/solidstats/components/dashboard.css
73
- - app/assets/stylesheets/solidstats/components/dashboard_header.css
74
- - app/assets/stylesheets/solidstats/components/dashboard_layout.css
75
- - app/assets/stylesheets/solidstats/components/gem_metadata.css
76
- - app/assets/stylesheets/solidstats/components/navigation.css
77
- - app/assets/stylesheets/solidstats/components/quick_navigation.css
78
- - app/assets/stylesheets/solidstats/components/security.css
79
- - app/assets/stylesheets/solidstats/components/status_badge.css
80
- - app/assets/stylesheets/solidstats/components/summary_card.css
81
- - app/assets/stylesheets/solidstats/components/tab_navigation.css
82
- - app/components/solidstats/base_component.rb
83
- - app/components/solidstats/code_quality/code_quality_section_component.html.erb
84
- - app/components/solidstats/code_quality/code_quality_section_component.rb
85
- - app/components/solidstats/code_quality/section_component.html.erb
86
- - app/components/solidstats/code_quality/section_component.rb
87
- - app/components/solidstats/dashboard_header_component.html.erb
88
- - app/components/solidstats/dashboard_header_component.rb
89
- - app/components/solidstats/previews/action_button_component_preview.rb
90
- - app/components/solidstats/previews/action_button_component_preview/button_vs_link.html.erb
91
- - app/components/solidstats/previews/action_button_component_preview/sizes.html.erb
92
- - app/components/solidstats/previews/action_button_component_preview/variants.html.erb
93
- - app/components/solidstats/previews/action_button_component_preview/with_icons.html.erb
94
- - app/components/solidstats/previews/navigation_component_preview.rb
95
- - app/components/solidstats/previews/stats_overview_component_preview.rb
96
- - app/components/solidstats/previews/status_badge_component_preview.rb
97
- - app/components/solidstats/previews/status_badge_component_preview/sizes.html.erb
98
- - app/components/solidstats/previews/status_badge_component_preview/statuses.html.erb
99
- - app/components/solidstats/previews/status_badge_component_preview/with_icons.html.erb
100
- - app/components/solidstats/previews/summary_card_component_preview.rb
101
- - app/components/solidstats/previews/summary_card_component_preview/clickable.html.erb
102
- - app/components/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb
103
- - app/components/solidstats/previews/summary_card_component_preview/statuses.html.erb
104
- - app/components/solidstats/previews/summary_card_component_preview/value_formats.html.erb
105
- - app/components/solidstats/quick_navigation_component.html.erb
106
- - app/components/solidstats/quick_navigation_component.rb
107
- - app/components/solidstats/security/gem_impact_analysis_component.html.erb
108
- - app/components/solidstats/security/gem_impact_analysis_component.rb
109
- - app/components/solidstats/security/overview_component.html.erb
110
- - app/components/solidstats/security/overview_component.rb
111
- - app/components/solidstats/security/section_component.html.erb
112
- - app/components/solidstats/security/section_component.rb
113
- - app/components/solidstats/security/timeline_component.html.erb
114
- - app/components/solidstats/security/timeline_component.rb
115
- - app/components/solidstats/tasks_section_component.html.erb
116
- - app/components/solidstats/tasks_section_component.rb
117
- - app/components/solidstats/ui/action_button_component.html.erb
118
- - app/components/solidstats/ui/action_button_component.rb
119
- - app/components/solidstats/ui/dashboard_layout_component.html.erb
120
- - app/components/solidstats/ui/dashboard_layout_component.rb
121
- - app/components/solidstats/ui/navigation_component.html.erb
122
- - app/components/solidstats/ui/navigation_component.rb
123
- - app/components/solidstats/ui/stats_overview_component.html.erb
124
- - app/components/solidstats/ui/stats_overview_component.rb
125
- - app/components/solidstats/ui/status_badge_component.html.erb
126
- - app/components/solidstats/ui/status_badge_component.rb
127
- - app/components/solidstats/ui/summary_card_component.html.erb
128
- - app/components/solidstats/ui/summary_card_component.rb
129
- - app/components/solidstats/ui/tab_navigation_component.html.erb
130
- - app/components/solidstats/ui/tab_navigation_component.rb
68
+ - app/assets/stylesheets/solidstats/dashboard.css
131
69
  - app/controllers/solidstats/application_controller.rb
132
70
  - app/controllers/solidstats/dashboard_controller.rb
133
- - app/controllers/solidstats/gem_metadata_controller.rb
71
+ - app/controllers/solidstats/logs_controller.rb
72
+ - app/controllers/solidstats/performance_controller.rb
73
+ - app/controllers/solidstats/productivity_controller.rb
74
+ - app/controllers/solidstats/quality_controller.rb
75
+ - app/controllers/solidstats/securities_controller.rb
134
76
  - app/helpers/solidstats/application_helper.rb
77
+ - app/helpers/solidstats/performance_helper.rb
78
+ - app/helpers/solidstats/productivity_helper.rb
135
79
  - app/jobs/solidstats/application_job.rb
136
80
  - app/mailers/solidstats/application_mailer.rb
137
81
  - app/models/solidstats/application_record.rb
138
- - app/services/solidstats/audit_service.rb
139
- - app/services/solidstats/data_collector_service.rb
140
- - app/services/solidstats/gem_metadata/fetcher_service.rb
82
+ - app/services/solidstats/bundler_audit_service.rb
83
+ - app/services/solidstats/coverage_compass_service.rb
84
+ - app/services/solidstats/load_lens_service.rb
141
85
  - app/services/solidstats/log_size_monitor_service.rb
142
- - app/services/solidstats/todo_service.rb
86
+ - app/services/solidstats/my_todo_service.rb
87
+ - app/services/solidstats/style_patrol_service.rb
143
88
  - app/views/layouts/solidstats/application.html.erb
144
- - app/views/solidstats/dashboard/_log_monitor.html.erb
145
- - app/views/solidstats/dashboard/_todos.html.erb
146
- - app/views/solidstats/dashboard/audit/_additional_styles.css
147
- - app/views/solidstats/dashboard/audit/_audit_badge.html.erb
148
- - app/views/solidstats/dashboard/audit/_audit_details.html.erb
149
- - app/views/solidstats/dashboard/audit/_audit_summary.html.erb
150
- - app/views/solidstats/dashboard/audit/_no_vulnerabilities.html.erb
151
- - app/views/solidstats/dashboard/audit/_security_audit.html.erb
152
- - app/views/solidstats/dashboard/audit/_vulnerabilities_table.html.erb
153
- - app/views/solidstats/dashboard/audit/_vulnerability_details.html.erb
154
- - app/views/solidstats/dashboard/index.html.erb
155
- - app/views/solidstats/gem_metadata/_panel.html.erb
89
+ - app/views/layouts/solidstats/dashboard.html.erb
90
+ - app/views/solidstats/dashboard/dashboard.html.erb
91
+ - app/views/solidstats/logs/logs_size.html.erb
92
+ - app/views/solidstats/performance/load_lens.html.erb
93
+ - app/views/solidstats/productivity/_todo_list.html.erb
94
+ - app/views/solidstats/productivity/my_todos.html.erb
95
+ - app/views/solidstats/quality/coverage_compass.html.erb
96
+ - app/views/solidstats/quality/style_patrol.html.erb
97
+ - app/views/solidstats/securities/bundler_audit.html.erb
98
+ - app/views/solidstats/shared/_dashboard_card.html.erb
99
+ - app/views/solidstats/shared/_quick_actions.html.erb
156
100
  - config/routes.rb
157
- - lib/generators/solidstats/feature/feature_generator.rb
158
- - lib/generators/solidstats/feature/templates/component.html.erb
159
- - lib/generators/solidstats/feature/templates/component.rb.erb
160
- - lib/generators/solidstats/feature/templates/component.scss
161
- - lib/generators/solidstats/feature/templates/component_test.rb.erb
162
- - lib/generators/solidstats/feature/templates/controller.rb.erb
163
- - lib/generators/solidstats/feature/templates/controller_test.rb.erb
164
- - lib/generators/solidstats/feature/templates/detail_view.html.erb
165
- - lib/generators/solidstats/feature/templates/preview.rb.erb
166
- - lib/generators/solidstats/feature/templates/service.rb.erb
167
- - lib/generators/solidstats/feature/templates/service_test.rb.erb
168
101
  - lib/generators/solidstats/install/install_generator.rb
169
102
  - lib/generators/solidstats/install/templates/README
170
- - lib/generators/solidstats/install_generator.rb
171
- - lib/generators/solidstats/templates/initializer.rb
172
103
  - lib/solidstats.rb
173
- - lib/solidstats/asset_compatibility.rb
174
- - lib/solidstats/asset_manifest.rb
175
104
  - lib/solidstats/engine.rb
176
105
  - lib/solidstats/version.rb
177
106
  - lib/tasks/solidstats_install.rake
107
+ - lib/tasks/solidstats_performance.rake
178
108
  - lib/tasks/solidstats_release.rake
179
- - lib/tasks/solidstats_tasks.rake
180
109
  homepage: https://solidstats.infolily.com
181
110
  licenses:
182
111
  - MIT
@@ -192,9 +121,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
121
  version: 2.7.0
193
122
  required_rubygems_version: !ruby/object:Gem::Requirement
194
123
  requirements:
195
- - - ">="
124
+ - - ">"
196
125
  - !ruby/object:Gem::Version
197
- version: '0'
126
+ version: 1.3.1
198
127
  requirements: []
199
128
  rubygems_version: 3.4.19
200
129
  signing_key:
@@ -1,257 +0,0 @@
1
- // Solidstats JavaScript Application Manifest
2
- // This file includes all JavaScript modules for the Solidstats dashboard
3
- //
4
- //= require dashboard
5
- //= require_tree .
6
-
7
- // Initialize dashboard when DOM is ready
8
- document.addEventListener('DOMContentLoaded', function() {
9
- console.log('🚀 Solidstats Dashboard JavaScript loaded');
10
-
11
- // Ensure dashboard module is available
12
- if (typeof window.SolidstatsDashboard !== 'undefined') {
13
- console.log('✅ Dashboard module loaded successfully');
14
-
15
- // Verify key functions are available
16
- const requiredFunctions = ['init', 'navigateToSection', 'setupMainNavigation'];
17
- const missingFunctions = requiredFunctions.filter(func =>
18
- typeof window.SolidstatsDashboard[func] !== 'function'
19
- );
20
-
21
- if (missingFunctions.length === 0) {
22
- console.log('✅ All dashboard functions available');
23
- } else {
24
- console.warn('⚠️ Missing functions:', missingFunctions);
25
- }
26
- } else {
27
- console.warn('⚠️ Dashboard module not found');
28
- console.log('Available globals:', Object.keys(window).filter(k => k.includes('Solid')));
29
- }
30
- });
31
-
32
-
33
- // Dashboard JavaScript functionality
34
-
35
- // Create the Solidstats Dashboard namespace
36
- window.SolidstatsDashboard = window.SolidstatsDashboard || {};
37
-
38
- // Main dashboard initialization
39
- window.SolidstatsDashboard.init = function() {
40
- handleUrlNavigation();
41
- setupEventListeners();
42
- };
43
-
44
- document.addEventListener('DOMContentLoaded', function() {
45
- window.SolidstatsDashboard.init();
46
- });
47
-
48
- function handleUrlNavigation() {
49
- // Parse URL hash for initial navigation
50
- const hash = window.location.hash.substring(1);
51
- if (hash) {
52
- const [section, tab] = hash.split('/');
53
- if (section) {
54
- setTimeout(() => {
55
- window.SolidstatsDashboard.navigateToSection(section, tab, true);
56
- }, 100);
57
- }
58
- }
59
- }
60
-
61
- function setupEventListeners() {
62
- window.SolidstatsDashboard.setupMainNavigation();
63
- window.SolidstatsDashboard.setupTabNavigation();
64
- window.SolidstatsDashboard.setupQuickNavigation();
65
- window.SolidstatsDashboard.setupSummaryCardNavigation();
66
- }
67
-
68
- // Function to update URL hash with current state
69
- window.SolidstatsDashboard.updateUrlHash = function(section, tab = null) {
70
- let hash = '#' + section;
71
- if (tab) {
72
- hash += '/' + tab;
73
- }
74
- history.replaceState(null, null, hash);
75
- };
76
-
77
- // Function to navigate to section and tab
78
- window.SolidstatsDashboard.navigateToSection = function(section, tab = null, shouldScroll = false) {
79
- // Remove active class from all nav items and sections
80
- document.querySelectorAll('.nav-item').forEach(item => item.classList.remove('active'));
81
- document.querySelectorAll('.dashboard-section').forEach(section => section.classList.remove('active'));
82
-
83
- // Add active class to matching nav item
84
- const navItem = document.querySelector(`.nav-item[data-section="${section}"]`);
85
- if (navItem) {
86
- navItem.classList.add('active');
87
- }
88
-
89
- // Show corresponding section
90
- const sectionElement = document.getElementById(section);
91
- if (sectionElement) {
92
- sectionElement.classList.add('active');
93
-
94
- // If tab is specified, activate that tab
95
- if (tab) {
96
- const sectionEl = sectionElement;
97
- if (sectionEl) {
98
- // Deactivate all tabs first
99
- sectionEl.querySelectorAll('.tab-item').forEach(item => item.classList.remove('active'));
100
- sectionEl.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
101
-
102
- // Activate the target tab
103
- const targetTabItem = sectionEl.querySelector(`.tab-item[data-tab="${tab}"]`);
104
- const targetTabContent = sectionEl.querySelector(`#${tab}`);
105
-
106
- if (targetTabItem) targetTabItem.classList.add('active');
107
- if (targetTabContent) targetTabContent.classList.add('active');
108
- }
109
- }
110
-
111
- // Scroll to section if requested (with a small delay to ensure rendering)
112
- if (shouldScroll) {
113
- setTimeout(() => {
114
- sectionElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
115
- }, 100);
116
- }
117
-
118
- // Update URL hash
119
- window.SolidstatsDashboard.updateUrlHash(section, tab);
120
- }
121
- };
122
-
123
- // Main navigation
124
- window.SolidstatsDashboard.setupMainNavigation = function() {
125
- document.querySelectorAll('.nav-item').forEach(function(navItem) {
126
- navItem.addEventListener('click', function(e) {
127
- e.preventDefault();
128
-
129
- // Get section ID from data attribute
130
- const sectionId = this.getAttribute('data-section');
131
-
132
- // Navigate to the section
133
- window.SolidstatsDashboard.navigateToSection(sectionId);
134
- });
135
- });
136
- };
137
-
138
- // Tab navigation
139
- window.SolidstatsDashboard.setupTabNavigation = function() {
140
- document.querySelectorAll('.tab-item').forEach(function(tabItem) {
141
- if (!tabItem.hasAttribute('disabled')) {
142
- tabItem.addEventListener('click', function(e) {
143
- e.preventDefault();
144
- const tabContainer = this.closest('.dashboard-section');
145
- const tabId = this.getAttribute('data-tab');
146
-
147
- // Find the current active section
148
- const currentSection = tabContainer.id;
149
-
150
- // Remove active class from all tab items and tabs within this container
151
- tabContainer.querySelectorAll('.tab-item').forEach(item => item.classList.remove('active'));
152
- tabContainer.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
153
-
154
- // Add active class to clicked item and corresponding tab
155
- this.classList.add('active');
156
- const targetContent = tabContainer.querySelector(`#${tabId}`);
157
- if (targetContent) {
158
- targetContent.classList.add('active');
159
- }
160
-
161
- // Update URL hash with current section and tab
162
- window.SolidstatsDashboard.updateUrlHash(currentSection, tabId);
163
- });
164
- }
165
- });
166
- };
167
-
168
- // Quick navigation
169
- window.SolidstatsDashboard.setupQuickNavigation = function() {
170
- document.querySelectorAll('.quick-nav-item').forEach(function(navItem) {
171
- navItem.addEventListener('click', function(e) {
172
- e.preventDefault();
173
- const targetId = this.getAttribute('href').substring(1);
174
-
175
- // Navigate to the specified section
176
- window.SolidstatsDashboard.navigateToSection(targetId);
177
-
178
- // Close the quick nav menu
179
- document.querySelector('.quick-nav-menu').style.display = 'none';
180
- });
181
- });
182
- };
183
-
184
- // Summary card navigation
185
- window.SolidstatsDashboard.setupSummaryCardNavigation = function() {
186
- document.querySelectorAll('.summary-card').forEach(function(card) {
187
- card.addEventListener('click', function() {
188
- const section = this.getAttribute('data-section');
189
- const tab = this.getAttribute('data-tab');
190
-
191
- // Navigate to the specified section and tab, with scrolling
192
- window.SolidstatsDashboard.navigateToSection(section, tab, true);
193
- });
194
- });
195
- };
196
-
197
- // Refresh functionality
198
- window.SolidstatsDashboard.refreshAudit = function() {
199
- // Show loading indicator
200
- const refreshButton = document.querySelector('.action-button');
201
- const originalText = refreshButton.innerHTML;
202
- refreshButton.innerHTML = '<span class="action-icon">⟳</span> Refreshing...';
203
- refreshButton.disabled = true;
204
-
205
- // Make AJAX call to refresh endpoint
206
- fetch('/solidstats/refresh', {
207
- method: 'GET',
208
- headers: {
209
- 'Accept': 'application/json',
210
- 'X-Requested-With': 'XMLHttpRequest'
211
- },
212
- credentials: 'same-origin'
213
- })
214
- .then(response => {
215
- if (!response.ok) {
216
- throw new Error('Network response was not ok');
217
- }
218
- return response.json();
219
- })
220
- .then(data => {
221
- // Update the dashboard with fresh data
222
- location.reload();
223
-
224
- // Show success notification
225
- window.SolidstatsDashboard.showNotification('Dashboard data refreshed successfully', 'success');
226
-
227
- // Reset button state
228
- refreshButton.innerHTML = originalText;
229
- refreshButton.disabled = false;
230
- })
231
- .catch(error => {
232
- console.error('Error refreshing data:', error);
233
-
234
- // Show error notification
235
- window.SolidstatsDashboard.showNotification('Failed to refresh data. Please try again.', 'error');
236
-
237
- // Reset button state
238
- refreshButton.innerHTML = originalText;
239
- refreshButton.disabled = false;
240
- });
241
- };
242
-
243
- // Notification system
244
- window.SolidstatsDashboard.showNotification = function(message, type) {
245
- // Simple notification system
246
- const notification = document.createElement('div');
247
- notification.className = `notification notification-${type}`;
248
- notification.textContent = message;
249
-
250
- // Add to body
251
- document.body.appendChild(notification);
252
-
253
- // Remove after 3 seconds
254
- setTimeout(() => {
255
- notification.remove();
256
- }, 3000);
257
- };
@@ -1,225 +0,0 @@
1
- // Dashboard JavaScript functionality
2
-
3
- // Create the Solidstats Dashboard namespace
4
- window.SolidstatsDashboard = window.SolidstatsDashboard || {};
5
-
6
- // Main dashboard initialization
7
- window.SolidstatsDashboard.init = function() {
8
- handleUrlNavigation();
9
- setupEventListeners();
10
- };
11
-
12
- document.addEventListener('DOMContentLoaded', function() {
13
- window.SolidstatsDashboard.init();
14
- });
15
-
16
- function handleUrlNavigation() {
17
- // Parse URL hash for initial navigation
18
- const hash = window.location.hash.substring(1);
19
- if (hash) {
20
- const [section, tab] = hash.split('/');
21
- if (section) {
22
- setTimeout(() => {
23
- window.SolidstatsDashboard.navigateToSection(section, tab, true);
24
- }, 100);
25
- }
26
- }
27
- }
28
-
29
- function setupEventListeners() {
30
- window.SolidstatsDashboard.setupMainNavigation();
31
- window.SolidstatsDashboard.setupTabNavigation();
32
- window.SolidstatsDashboard.setupQuickNavigation();
33
- window.SolidstatsDashboard.setupSummaryCardNavigation();
34
- }
35
-
36
- // Function to update URL hash with current state
37
- window.SolidstatsDashboard.updateUrlHash = function(section, tab = null) {
38
- let hash = '#' + section;
39
- if (tab) {
40
- hash += '/' + tab;
41
- }
42
- history.replaceState(null, null, hash);
43
- };
44
-
45
- // Function to navigate to section and tab
46
- window.SolidstatsDashboard.navigateToSection = function(section, tab = null, shouldScroll = false) {
47
- // Remove active class from all nav items and sections
48
- document.querySelectorAll('.nav-item').forEach(item => item.classList.remove('active'));
49
- document.querySelectorAll('.dashboard-section').forEach(section => section.classList.remove('active'));
50
-
51
- // Add active class to matching nav item
52
- const navItem = document.querySelector(`.nav-item[data-section="${section}"]`);
53
- if (navItem) {
54
- navItem.classList.add('active');
55
- }
56
-
57
- // Show corresponding section
58
- const sectionElement = document.getElementById(section);
59
- if (sectionElement) {
60
- sectionElement.classList.add('active');
61
-
62
- // If tab is specified, activate that tab
63
- if (tab) {
64
- const sectionEl = sectionElement;
65
- if (sectionEl) {
66
- // Deactivate all tabs first
67
- sectionEl.querySelectorAll('.tab-item').forEach(item => item.classList.remove('active'));
68
- sectionEl.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
69
-
70
- // Activate the target tab
71
- const targetTabItem = sectionEl.querySelector(`.tab-item[data-tab="${tab}"]`);
72
- const targetTabContent = sectionEl.querySelector(`#${tab}`);
73
-
74
- if (targetTabItem) targetTabItem.classList.add('active');
75
- if (targetTabContent) targetTabContent.classList.add('active');
76
- }
77
- }
78
-
79
- // Scroll to section if requested (with a small delay to ensure rendering)
80
- if (shouldScroll) {
81
- setTimeout(() => {
82
- sectionElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
83
- }, 100);
84
- }
85
-
86
- // Update URL hash
87
- window.SolidstatsDashboard.updateUrlHash(section, tab);
88
- }
89
- };
90
-
91
- // Main navigation
92
- window.SolidstatsDashboard.setupMainNavigation = function() {
93
- document.querySelectorAll('.nav-item').forEach(function(navItem) {
94
- navItem.addEventListener('click', function(e) {
95
- e.preventDefault();
96
-
97
- // Get section ID from data attribute
98
- const sectionId = this.getAttribute('data-section');
99
-
100
- // Navigate to the section
101
- window.SolidstatsDashboard.navigateToSection(sectionId);
102
- });
103
- });
104
- };
105
-
106
- // Tab navigation
107
- window.SolidstatsDashboard.setupTabNavigation = function() {
108
- document.querySelectorAll('.tab-item').forEach(function(tabItem) {
109
- if (!tabItem.hasAttribute('disabled')) {
110
- tabItem.addEventListener('click', function(e) {
111
- e.preventDefault();
112
- const tabContainer = this.closest('.dashboard-section');
113
- const tabId = this.getAttribute('data-tab');
114
-
115
- // Find the current active section
116
- const currentSection = tabContainer.id;
117
-
118
- // Remove active class from all tab items and tabs within this container
119
- tabContainer.querySelectorAll('.tab-item').forEach(item => item.classList.remove('active'));
120
- tabContainer.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
121
-
122
- // Add active class to clicked item and corresponding tab
123
- this.classList.add('active');
124
- const targetContent = tabContainer.querySelector(`#${tabId}`);
125
- if (targetContent) {
126
- targetContent.classList.add('active');
127
- }
128
-
129
- // Update URL hash with current section and tab
130
- window.SolidstatsDashboard.updateUrlHash(currentSection, tabId);
131
- });
132
- }
133
- });
134
- };
135
-
136
- // Quick navigation
137
- window.SolidstatsDashboard.setupQuickNavigation = function() {
138
- document.querySelectorAll('.quick-nav-item').forEach(function(navItem) {
139
- navItem.addEventListener('click', function(e) {
140
- e.preventDefault();
141
- const targetId = this.getAttribute('href').substring(1);
142
-
143
- // Navigate to the specified section
144
- window.SolidstatsDashboard.navigateToSection(targetId);
145
-
146
- // Close the quick nav menu
147
- document.querySelector('.quick-nav-menu').style.display = 'none';
148
- });
149
- });
150
- };
151
-
152
- // Summary card navigation
153
- window.SolidstatsDashboard.setupSummaryCardNavigation = function() {
154
- document.querySelectorAll('.summary-card').forEach(function(card) {
155
- card.addEventListener('click', function() {
156
- const section = this.getAttribute('data-section');
157
- const tab = this.getAttribute('data-tab');
158
-
159
- // Navigate to the specified section and tab, with scrolling
160
- window.SolidstatsDashboard.navigateToSection(section, tab, true);
161
- });
162
- });
163
- };
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
- // Notification system
212
- window.SolidstatsDashboard.showNotification = function(message, type) {
213
- // Simple notification system
214
- const notification = document.createElement('div');
215
- notification.className = `notification notification-${type}`;
216
- notification.textContent = message;
217
-
218
- // Add to body
219
- document.body.appendChild(notification);
220
-
221
- // Remove after 3 seconds
222
- setTimeout(() => {
223
- notification.remove();
224
- }, 3000);
225
- };