solidstats 1.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +85 -0
- data/README.md +35 -0
- data/app/assets/javascripts/solidstats/application.js +257 -0
- data/app/assets/javascripts/solidstats/dashboard.js +225 -0
- data/app/assets/javascripts/solidstats/gem_metadata.js +554 -0
- data/app/assets/stylesheets/solidstats/application.css +6 -1
- data/app/assets/stylesheets/solidstats/components/action_button.css +99 -0
- data/app/assets/stylesheets/solidstats/components/dashboard.css +151 -0
- data/app/assets/stylesheets/solidstats/components/dashboard_header.css +93 -0
- data/app/assets/stylesheets/solidstats/components/dashboard_layout.css +97 -0
- data/app/assets/stylesheets/solidstats/components/gem_metadata.css +1403 -0
- data/app/assets/stylesheets/solidstats/components/navigation.css +80 -0
- data/app/assets/stylesheets/solidstats/components/quick_navigation.css +54 -0
- data/app/assets/stylesheets/solidstats/components/security.css +332 -0
- data/app/assets/stylesheets/solidstats/components/status_badge.css +58 -0
- data/app/assets/stylesheets/solidstats/components/summary_card.css +66 -0
- data/app/assets/stylesheets/solidstats/components/tab_navigation.css +95 -0
- data/app/components/solidstats/base_component.rb +88 -0
- data/app/components/solidstats/code_quality/code_quality_section_component.html.erb +0 -0
- data/app/components/solidstats/code_quality/code_quality_section_component.rb +0 -0
- data/app/components/solidstats/code_quality/section_component.html.erb +45 -0
- data/app/components/solidstats/code_quality/section_component.rb +34 -0
- data/app/components/solidstats/dashboard_header_component.html.erb +39 -0
- data/app/components/solidstats/dashboard_header_component.rb +33 -0
- data/app/components/solidstats/previews/action_button_component_preview/button_vs_link.html.erb +6 -0
- data/app/components/solidstats/previews/action_button_component_preview/sizes.html.erb +6 -0
- data/app/components/solidstats/previews/action_button_component_preview/variants.html.erb +6 -0
- data/app/components/solidstats/previews/action_button_component_preview/with_icons.html.erb +6 -0
- data/app/components/solidstats/previews/action_button_component_preview.rb +64 -0
- data/app/components/solidstats/previews/navigation_component_preview.rb +74 -0
- data/app/components/solidstats/previews/stats_overview_component_preview.rb +100 -0
- data/app/components/solidstats/previews/status_badge_component_preview/sizes.html.erb +6 -0
- data/app/components/solidstats/previews/status_badge_component_preview/statuses.html.erb +6 -0
- data/app/components/solidstats/previews/status_badge_component_preview/with_icons.html.erb +6 -0
- data/app/components/solidstats/previews/status_badge_component_preview.rb +49 -0
- data/app/components/solidstats/previews/summary_card_component_preview/clickable.html.erb +9 -0
- data/app/components/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb +9 -0
- data/app/components/solidstats/previews/summary_card_component_preview/statuses.html.erb +6 -0
- data/app/components/solidstats/previews/summary_card_component_preview/value_formats.html.erb +6 -0
- data/app/components/solidstats/previews/summary_card_component_preview.rb +67 -0
- data/app/components/solidstats/quick_navigation_component.html.erb +8 -0
- data/app/components/solidstats/quick_navigation_component.rb +21 -0
- data/app/components/solidstats/security/gem_impact_analysis_component.html.erb +44 -0
- data/app/components/solidstats/security/gem_impact_analysis_component.rb +45 -0
- data/app/components/solidstats/security/overview_component.html.erb +21 -0
- data/app/components/solidstats/security/overview_component.rb +104 -0
- data/app/components/solidstats/security/section_component.html.erb +26 -0
- data/app/components/solidstats/security/section_component.rb +52 -0
- data/app/components/solidstats/security/timeline_component.html.erb +39 -0
- data/app/components/solidstats/security/timeline_component.rb +43 -0
- data/app/components/solidstats/tasks_section_component.html.erb +17 -0
- data/app/components/solidstats/tasks_section_component.rb +22 -0
- data/app/components/solidstats/ui/action_button_component.html.erb +6 -0
- data/app/components/solidstats/ui/action_button_component.rb +71 -0
- data/app/components/solidstats/ui/dashboard_layout_component.html.erb +19 -0
- data/app/components/solidstats/ui/dashboard_layout_component.rb +85 -0
- data/app/components/solidstats/ui/navigation_component.html.erb +34 -0
- data/app/components/solidstats/ui/navigation_component.rb +72 -0
- data/app/components/solidstats/ui/stats_overview_component.html.erb +14 -0
- data/app/components/solidstats/ui/stats_overview_component.rb +78 -0
- data/app/components/solidstats/ui/status_badge_component.html.erb +6 -0
- data/app/components/solidstats/ui/status_badge_component.rb +42 -0
- data/app/components/solidstats/ui/summary_card_component.html.erb +12 -0
- data/app/components/solidstats/ui/summary_card_component.rb +63 -0
- data/app/components/solidstats/ui/tab_navigation_component.html.erb +22 -0
- data/app/components/solidstats/ui/tab_navigation_component.rb +79 -0
- data/app/controllers/solidstats/dashboard_controller.rb +22 -0
- data/app/controllers/solidstats/gem_metadata_controller.rb +12 -0
- data/app/helpers/solidstats/application_helper.rb +42 -0
- data/app/services/solidstats/gem_metadata/fetcher_service.rb +136 -0
- data/app/services/solidstats/log_size_monitor_service.rb +94 -0
- data/app/views/layouts/solidstats/application.html.erb +2 -1
- data/app/views/solidstats/dashboard/_log_monitor.html.erb +759 -0
- data/app/views/solidstats/dashboard/index.html.erb +67 -1323
- data/app/views/solidstats/gem_metadata/_panel.html.erb +419 -0
- data/config/routes.rb +7 -0
- data/lib/generators/solidstats/feature/feature_generator.rb +170 -0
- data/lib/generators/solidstats/feature/templates/component.html.erb +84 -0
- data/lib/generators/solidstats/feature/templates/component.rb.erb +103 -0
- data/lib/generators/solidstats/feature/templates/component.scss +243 -0
- data/lib/generators/solidstats/feature/templates/component_test.rb.erb +183 -0
- data/lib/generators/solidstats/feature/templates/controller.rb.erb +44 -0
- data/lib/generators/solidstats/feature/templates/controller_test.rb.erb +111 -0
- data/lib/generators/solidstats/feature/templates/detail_view.html.erb +755 -0
- data/lib/generators/solidstats/feature/templates/preview.rb.erb +107 -0
- data/lib/generators/solidstats/feature/templates/service.rb.erb +132 -0
- data/lib/generators/solidstats/feature/templates/service_test.rb.erb +109 -0
- data/lib/generators/solidstats/install_generator.rb +109 -0
- data/lib/generators/solidstats/templates/initializer.rb +112 -0
- data/lib/solidstats/asset_compatibility.rb +238 -0
- data/lib/solidstats/asset_manifest.rb +205 -0
- data/lib/solidstats/engine.rb +114 -9
- data/lib/solidstats/version.rb +1 -1
- data/lib/solidstats.rb +299 -2
- data/lib/tasks/solidstats_install.rake +122 -2
- metadata +99 -2
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Solidstats
|
4
|
+
# Base component class for all Solidstats ViewComponents
|
5
|
+
# Provides common functionality and conventions for the component system
|
6
|
+
class BaseComponent < ViewComponent::Base
|
7
|
+
# Common helper methods available to all Solidstats components
|
8
|
+
|
9
|
+
# Standard status classes for consistent styling
|
10
|
+
def status_class(status)
|
11
|
+
case status&.to_sym
|
12
|
+
when :good, :ok
|
13
|
+
"status-good"
|
14
|
+
when :warning
|
15
|
+
"status-warning"
|
16
|
+
when :critical, :danger
|
17
|
+
"status-critical"
|
18
|
+
when :info
|
19
|
+
"status-info"
|
20
|
+
else
|
21
|
+
"status-unknown"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Standard status icons
|
26
|
+
def status_icon(status)
|
27
|
+
case status&.to_sym
|
28
|
+
when :good, :ok
|
29
|
+
"โ
"
|
30
|
+
when :warning
|
31
|
+
"โ ๏ธ"
|
32
|
+
when :critical, :danger
|
33
|
+
"โ"
|
34
|
+
when :info
|
35
|
+
"โน๏ธ"
|
36
|
+
else
|
37
|
+
"โ"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Standard status text
|
42
|
+
def status_text(status)
|
43
|
+
case status&.to_sym
|
44
|
+
when :good, :ok
|
45
|
+
"Good"
|
46
|
+
when :warning
|
47
|
+
"Warning"
|
48
|
+
when :critical, :danger
|
49
|
+
"Critical"
|
50
|
+
when :info
|
51
|
+
"Info"
|
52
|
+
else
|
53
|
+
"Unknown"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Helper for formatting numbers with delimiters
|
58
|
+
def format_number(number)
|
59
|
+
return "0" if number.nil?
|
60
|
+
|
61
|
+
case number
|
62
|
+
when Numeric
|
63
|
+
number_with_delimiter(number)
|
64
|
+
else
|
65
|
+
number.to_s
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Helper for safe data access with fallbacks
|
70
|
+
def safe_get(data, key, fallback = nil)
|
71
|
+
return fallback if data.nil?
|
72
|
+
|
73
|
+
data.is_a?(Hash) ? data[key] || data[key.to_s] || fallback : fallback
|
74
|
+
end
|
75
|
+
|
76
|
+
# CSS class helper for dynamic classes
|
77
|
+
def css_classes(*classes)
|
78
|
+
classes.compact.reject(&:empty?).join(" ")
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
# Access to Rails number helpers
|
84
|
+
def number_with_delimiter(number, options = {})
|
85
|
+
ActionController::Base.helpers.number_with_delimiter(number, options)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<section id="code-quality" class="dashboard-section">
|
2
|
+
<h2 class="section-title">Code Quality</h2>
|
3
|
+
|
4
|
+
<%= render Solidstats::Ui::TabNavigationComponent.new(tabs: tab_items) %>
|
5
|
+
|
6
|
+
<div class="tabs-content">
|
7
|
+
<div class="tab-content active" id="quality-metrics">
|
8
|
+
<div class="stat-card">
|
9
|
+
<h2><span class="icon">๐งน</span> Code Quality</h2>
|
10
|
+
<div class="card-content">
|
11
|
+
<div class="metric">
|
12
|
+
<!-- Your code quality metrics -->
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="tab-content" id="test-coverage">
|
19
|
+
<div class="stat-card <%= coverage_status %>">
|
20
|
+
<h2><span class="icon">๐งช</span> Test Coverage</h2>
|
21
|
+
<div class="card-content">
|
22
|
+
<div class="progress-container">
|
23
|
+
<div class="progress-bar" style="width: <%= coverage %>%"></div>
|
24
|
+
</div>
|
25
|
+
<div class="metric">
|
26
|
+
<span class="metric-value"><%= coverage %>%</span>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div class="tab-content" id="code-health">
|
33
|
+
<div class="stat-card">
|
34
|
+
<h2><span class="icon">๐</span> Code Health</h2>
|
35
|
+
<div class="card-content">
|
36
|
+
<!-- Your code health metrics -->
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="tab-content" id="log-monitor">
|
42
|
+
<%= render partial: 'solidstats/dashboard/log_monitor' %>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</section>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Solidstats
|
4
|
+
module CodeQuality
|
5
|
+
class SectionComponent < BaseComponent
|
6
|
+
def initialize(coverage:, log_data:)
|
7
|
+
@coverage = coverage
|
8
|
+
@log_data = log_data
|
9
|
+
super()
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
attr_reader :coverage, :log_data
|
15
|
+
|
16
|
+
def tab_items
|
17
|
+
[
|
18
|
+
{ id: "quality-metrics", label: "Metrics", active: true },
|
19
|
+
{ id: "test-coverage", label: "Test Coverage" },
|
20
|
+
{ id: "code-health", label: "Code Health" },
|
21
|
+
{ id: "log-monitor", label: "Log Monitor", icon: "๐" }
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
def coverage_status
|
26
|
+
case coverage.to_f
|
27
|
+
when 80..Float::INFINITY then "status-ok"
|
28
|
+
when 60...80 then "status-warning"
|
29
|
+
else "status-danger"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<header class="dashboard-header">
|
2
|
+
<div class="header-content">
|
3
|
+
<div class="header-title">
|
4
|
+
<h1>Solidstats Dashboard</h1>
|
5
|
+
<div class="last-updated">
|
6
|
+
Last updated: <%= last_updated_date %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="header-actions">
|
11
|
+
<button class="action-button" onclick="refreshAudit(); return false;">
|
12
|
+
<span class="action-icon">โป</span>
|
13
|
+
Refresh
|
14
|
+
</button>
|
15
|
+
<button class="action-button action-button--disabled" disabled title="Export is currently disabled">
|
16
|
+
<span class="action-icon">โ</span>
|
17
|
+
Export
|
18
|
+
</button>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<nav class="dashboard-nav">
|
23
|
+
<ul class="nav-list">
|
24
|
+
<% navigation_items.each do |item| %>
|
25
|
+
<li>
|
26
|
+
<% if item[:external] %>
|
27
|
+
<%= link_to item[:label], item[:href], class: "nav-item #{'active' if item[:active]}" %>
|
28
|
+
<% else %>
|
29
|
+
<a href="<%= item[:href] %>"
|
30
|
+
class="nav-item <%= 'active' if item[:active] %>"
|
31
|
+
data-section="<%= item[:id] %>">
|
32
|
+
<%= item[:label] %>
|
33
|
+
</a>
|
34
|
+
<% end %>
|
35
|
+
</li>
|
36
|
+
<% end %>
|
37
|
+
</ul>
|
38
|
+
</nav>
|
39
|
+
</header>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Solidstats
|
4
|
+
class DashboardHeaderComponent < BaseComponent
|
5
|
+
def initialize(audit_output:)
|
6
|
+
@audit_output = audit_output
|
7
|
+
super()
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
attr_reader :audit_output
|
13
|
+
|
14
|
+
def last_updated_date
|
15
|
+
created_at = audit_output.dig("created_at")
|
16
|
+
if created_at
|
17
|
+
DateTime.parse(created_at).strftime("%B %d, %Y at %H:%M")
|
18
|
+
else
|
19
|
+
Time.now.strftime("%B %d, %Y at %H:%M")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def navigation_items
|
24
|
+
[
|
25
|
+
{ id: "overview", label: "Overview", href: "#overview", active: true },
|
26
|
+
{ id: "security", label: "Security", href: "#security" },
|
27
|
+
{ id: "code-quality", label: "Code Quality", href: "#code-quality" },
|
28
|
+
{ id: "tasks", label: "Tasks", href: "#tasks" },
|
29
|
+
{ id: "gem-metadata", label: "Gem Metadata", href: "#gem-metadata" }
|
30
|
+
]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/app/components/solidstats/previews/action_button_component_preview/button_vs_link.html.erb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/action_button_component_preview/button_vs_link.html.erb %>
|
2
|
+
<div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
|
3
|
+
<% elements.each do |element_config| %>
|
4
|
+
<%= render(Solidstats::Ui::ActionButtonComponent.new(**element_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/action_button_component_preview/sizes.html.erb %>
|
2
|
+
<div style="display: flex; gap: 1rem; align-items: center; padding: 1rem;">
|
3
|
+
<% buttons.each do |button_config| %>
|
4
|
+
<%= render(Solidstats::Ui::ActionButtonComponent.new(**button_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/action_button_component_preview/variants.html.erb %>
|
2
|
+
<div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
|
3
|
+
<% buttons.each do |button_config| %>
|
4
|
+
<%= render(Solidstats::Ui::ActionButtonComponent.new(**button_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/action_button_component_preview/with_icons.html.erb %>
|
2
|
+
<div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
|
3
|
+
<% buttons.each do |button_config| %>
|
4
|
+
<%= render(Solidstats::Ui::ActionButtonComponent.new(**button_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Solidstats
|
4
|
+
module Previews
|
5
|
+
# Preview for ActionButtonComponent
|
6
|
+
class ActionButtonComponentPreview < ViewComponent::Preview
|
7
|
+
# Default action button
|
8
|
+
def default
|
9
|
+
render(Solidstats::Ui::ActionButtonComponent.new(
|
10
|
+
text: "Click Me",
|
11
|
+
href: "#",
|
12
|
+
variant: :primary
|
13
|
+
))
|
14
|
+
end
|
15
|
+
|
16
|
+
# Different variants
|
17
|
+
def variants
|
18
|
+
render_with_template(locals: {
|
19
|
+
buttons: [
|
20
|
+
{ text: "Primary", href: "#", variant: :primary },
|
21
|
+
{ text: "Secondary", href: "#", variant: :secondary },
|
22
|
+
{ text: "Outline", href: "#", variant: :outline },
|
23
|
+
{ text: "Ghost", href: "#", variant: :ghost },
|
24
|
+
{ text: "Danger", href: "#", variant: :danger }
|
25
|
+
]
|
26
|
+
})
|
27
|
+
end
|
28
|
+
|
29
|
+
# Different sizes
|
30
|
+
def sizes
|
31
|
+
render_with_template(locals: {
|
32
|
+
buttons: [
|
33
|
+
{ text: "Small", href: "#", variant: :primary, size: :small },
|
34
|
+
{ text: "Medium", href: "#", variant: :primary, size: :medium },
|
35
|
+
{ text: "Large", href: "#", variant: :primary, size: :large }
|
36
|
+
]
|
37
|
+
})
|
38
|
+
end
|
39
|
+
|
40
|
+
# With icons
|
41
|
+
def with_icons
|
42
|
+
render_with_template(locals: {
|
43
|
+
buttons: [
|
44
|
+
{ text: "Download", href: "#", variant: :primary, icon: "โฌ" },
|
45
|
+
{ text: "Edit", href: "#", variant: :secondary, icon: "โ" },
|
46
|
+
{ text: "Delete", href: "#", variant: :danger, icon: "๐" },
|
47
|
+
{ text: "Refresh", href: "#", variant: :outline, icon: "๐" }
|
48
|
+
]
|
49
|
+
})
|
50
|
+
end
|
51
|
+
|
52
|
+
# As buttons vs links
|
53
|
+
def button_vs_link
|
54
|
+
render_with_template(locals: {
|
55
|
+
elements: [
|
56
|
+
{ text: "Link Button", href: "#", variant: :primary },
|
57
|
+
{ text: "Submit Button", variant: :primary, type: "submit" },
|
58
|
+
{ text: "Regular Button", variant: :secondary, type: "button" }
|
59
|
+
]
|
60
|
+
})
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Solidstats
|
4
|
+
module Previews
|
5
|
+
# Preview for NavigationComponent
|
6
|
+
class NavigationComponentPreview < ViewComponent::Preview
|
7
|
+
# Default navigation
|
8
|
+
def default
|
9
|
+
render(Solidstats::Ui::NavigationComponent.new(
|
10
|
+
current_section: "overview",
|
11
|
+
sections: default_sections,
|
12
|
+
actions: default_actions
|
13
|
+
))
|
14
|
+
end
|
15
|
+
|
16
|
+
# Navigation with different current section
|
17
|
+
def different_current_section
|
18
|
+
render(Solidstats::Ui::NavigationComponent.new(
|
19
|
+
current_section: "security",
|
20
|
+
sections: default_sections,
|
21
|
+
actions: default_actions
|
22
|
+
))
|
23
|
+
end
|
24
|
+
|
25
|
+
# Navigation without actions
|
26
|
+
def sections_only
|
27
|
+
render(Solidstats::Ui::NavigationComponent.new(
|
28
|
+
current_section: "overview",
|
29
|
+
sections: default_sections,
|
30
|
+
actions: []
|
31
|
+
))
|
32
|
+
end
|
33
|
+
|
34
|
+
# Custom sections and actions
|
35
|
+
def custom_configuration
|
36
|
+
custom_sections = [
|
37
|
+
{ id: "home", label: "Home", href: "/" },
|
38
|
+
{ id: "settings", label: "Settings", href: "/settings" },
|
39
|
+
{ id: "help", label: "Help", href: "/help" }
|
40
|
+
]
|
41
|
+
|
42
|
+
custom_actions = [
|
43
|
+
{ label: "Save", icon: "๐พ", href: "#", onclick: "save(); return false;" },
|
44
|
+
{ label: "Reset", icon: "๐", href: "#", onclick: "reset(); return false;" }
|
45
|
+
]
|
46
|
+
|
47
|
+
render(Solidstats::Ui::NavigationComponent.new(
|
48
|
+
current_section: "home",
|
49
|
+
sections: custom_sections,
|
50
|
+
actions: custom_actions
|
51
|
+
))
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def default_sections
|
57
|
+
[
|
58
|
+
{ id: "overview", label: "Overview" },
|
59
|
+
{ id: "security", label: "Security" },
|
60
|
+
{ id: "code-quality", label: "Code Quality" },
|
61
|
+
{ id: "tasks", label: "Tasks" },
|
62
|
+
{ id: "gem-metadata", label: "Gem Metadata", href: "#gem-metadata" }
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def default_actions
|
67
|
+
[
|
68
|
+
{ label: "Refresh", icon: "โป", href: "#", onclick: "refresh(); return false;" },
|
69
|
+
{ label: "Export", icon: "โ", disabled: true, disabled_reason: "Export disabled" }
|
70
|
+
]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Solidstats
|
4
|
+
module Previews
|
5
|
+
# Preview for StatsOverviewComponent
|
6
|
+
class StatsOverviewComponentPreview < ViewComponent::Preview
|
7
|
+
# Default metrics overview
|
8
|
+
def default
|
9
|
+
render(Solidstats::Ui::StatsOverviewComponent.new(
|
10
|
+
metrics: sample_metrics
|
11
|
+
))
|
12
|
+
end
|
13
|
+
|
14
|
+
# Metrics with different statuses
|
15
|
+
def different_statuses
|
16
|
+
metrics = [
|
17
|
+
{ label: "Secure Gems", value: 95, icon: "๐", status: :ok },
|
18
|
+
{ label: "Vulnerabilities", value: 3, icon: "โ ๏ธ", status: :warning },
|
19
|
+
{ label: "Critical Issues", value: 1, icon: "๐จ", status: :error },
|
20
|
+
{ label: "Outdated Gems", value: 12, icon: "๐
", status: :info }
|
21
|
+
]
|
22
|
+
|
23
|
+
render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics))
|
24
|
+
end
|
25
|
+
|
26
|
+
# Clickable metrics
|
27
|
+
def clickable_metrics
|
28
|
+
metrics = [
|
29
|
+
{
|
30
|
+
label: "Security Issues",
|
31
|
+
value: 3,
|
32
|
+
icon: "๐",
|
33
|
+
section: "security",
|
34
|
+
tab: "vulnerabilities"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
label: "TODO Items",
|
38
|
+
value: 15,
|
39
|
+
icon: "๐",
|
40
|
+
section: "tasks",
|
41
|
+
href: "#tasks"
|
42
|
+
}
|
43
|
+
]
|
44
|
+
|
45
|
+
render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics))
|
46
|
+
end
|
47
|
+
|
48
|
+
# Various value formats
|
49
|
+
def value_formats
|
50
|
+
metrics = [
|
51
|
+
{ label: "Test Coverage", value: "94%", icon: "๐งช", status: :ok },
|
52
|
+
{ label: "Build Time", value: "2.3s", icon: "โฑ๏ธ", status: :ok },
|
53
|
+
{ label: "Bundle Size", value: "1.2MB", icon: "๐ฆ", status: :warning },
|
54
|
+
{ label: "Dependencies", value: 127, icon: "๐", status: :info }
|
55
|
+
]
|
56
|
+
|
57
|
+
render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics))
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def sample_metrics
|
63
|
+
[
|
64
|
+
{
|
65
|
+
label: "Security Issues",
|
66
|
+
value: 0,
|
67
|
+
icon: "๐",
|
68
|
+
zero_is_good: true,
|
69
|
+
section: "security"
|
70
|
+
},
|
71
|
+
{
|
72
|
+
label: "Gem Dependencies",
|
73
|
+
value: 127,
|
74
|
+
icon: "๐",
|
75
|
+
status: :info
|
76
|
+
},
|
77
|
+
{
|
78
|
+
label: "TODO Items",
|
79
|
+
value: 8,
|
80
|
+
icon: "๐",
|
81
|
+
section: "tasks",
|
82
|
+
tab: "todos"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
label: "Test Coverage",
|
86
|
+
value: "94%",
|
87
|
+
icon: "๐งช",
|
88
|
+
thresholds: { excellent: 90, good: 80, warning: 60 }
|
89
|
+
},
|
90
|
+
{
|
91
|
+
label: "Log Files Size",
|
92
|
+
value: "2.3MB",
|
93
|
+
icon: "๐",
|
94
|
+
status: :ok
|
95
|
+
}
|
96
|
+
]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/status_badge_component_preview/sizes.html.erb %>
|
2
|
+
<div style="display: flex; gap: 1rem; align-items: center; padding: 1rem;">
|
3
|
+
<% sizes.each do |badge_config| %>
|
4
|
+
<%= render(Solidstats::Ui::StatusBadgeComponent.new(**badge_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/status_badge_component_preview/statuses.html.erb %>
|
2
|
+
<div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
|
3
|
+
<% statuses.each do |badge_config| %>
|
4
|
+
<%= render(Solidstats::Ui::StatusBadgeComponent.new(**badge_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/status_badge_component_preview/with_icons.html.erb %>
|
2
|
+
<div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
|
3
|
+
<% badges.each do |badge_config| %>
|
4
|
+
<%= render(Solidstats::Ui::StatusBadgeComponent.new(**badge_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Solidstats
|
4
|
+
module Previews
|
5
|
+
# Preview for StatusBadgeComponent
|
6
|
+
class StatusBadgeComponentPreview < ViewComponent::Preview
|
7
|
+
# Default status badge
|
8
|
+
def default
|
9
|
+
render(Solidstats::Ui::StatusBadgeComponent.new(status: :ok, text: "All Good"))
|
10
|
+
end
|
11
|
+
|
12
|
+
# Different status variants
|
13
|
+
def statuses
|
14
|
+
render_with_template(locals: {
|
15
|
+
statuses: [
|
16
|
+
{ status: :ok, text: "Secure" },
|
17
|
+
{ status: :warning, text: "Minor Issues" },
|
18
|
+
{ status: :error, text: "Vulnerabilities Found" },
|
19
|
+
{ status: :info, text: "Info Available" },
|
20
|
+
{ status: :critical, text: "Critical Issues" }
|
21
|
+
]
|
22
|
+
})
|
23
|
+
end
|
24
|
+
|
25
|
+
# Different sizes
|
26
|
+
def sizes
|
27
|
+
render_with_template(locals: {
|
28
|
+
sizes: [
|
29
|
+
{ size: :small, status: :ok, text: "Small" },
|
30
|
+
{ size: :medium, status: :warning, text: "Medium" },
|
31
|
+
{ size: :large, status: :error, text: "Large" }
|
32
|
+
]
|
33
|
+
})
|
34
|
+
end
|
35
|
+
|
36
|
+
# With icons
|
37
|
+
def with_icons
|
38
|
+
render_with_template(locals: {
|
39
|
+
badges: [
|
40
|
+
{ status: :ok, text: "Secure", icon: "โ" },
|
41
|
+
{ status: :warning, text: "Warning", icon: "โ " },
|
42
|
+
{ status: :error, text: "Error", icon: "โ" },
|
43
|
+
{ status: :info, text: "Info", icon: "โน" }
|
44
|
+
]
|
45
|
+
})
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/summary_card_component_preview/clickable.html.erb %>
|
2
|
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1rem;">
|
3
|
+
<% cards.each do |card_config| %>
|
4
|
+
<%= render(Solidstats::Ui::SummaryCardComponent.new(**card_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
7
|
+
<p style="padding: 1rem; font-size: 0.875rem; color: #6b7280;">
|
8
|
+
These cards are clickable and will navigate to their respective sections.
|
9
|
+
</p>
|
data/app/components/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb %>
|
2
|
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1rem; background-color: #f9fafb; border-radius: 0.5rem;">
|
3
|
+
<% metrics.each do |metric_config| %>
|
4
|
+
<%= render(Solidstats::Ui::SummaryCardComponent.new(**metric_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
7
|
+
<p style="padding: 1rem; font-size: 0.875rem; color: #6b7280;">
|
8
|
+
Example dashboard layout showing how summary cards work together to provide a comprehensive overview.
|
9
|
+
</p>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/summary_card_component_preview/statuses.html.erb %>
|
2
|
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1rem;">
|
3
|
+
<% cards.each do |card_config| %>
|
4
|
+
<%= render(Solidstats::Ui::SummaryCardComponent.new(**card_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/summary_card_component_preview/value_formats.html.erb %>
|
2
|
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1rem;">
|
3
|
+
<% cards.each do |card_config| %>
|
4
|
+
<%= render(Solidstats::Ui::SummaryCardComponent.new(**card_config)) %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|