admin_suite 0.3.0 → 0.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/app/views/admin_suite/panels/_chart.html.erb +3 -2
- data/lib/admin_suite/version.rb +1 -1
- data/test/integration/dashboard_test.rb +40 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9bafe4fb74ddbd5bb365501f185970b270950000aeae6e5d9689f7fcf7f32c5b
|
|
4
|
+
data.tar.gz: 2490ec0b676767b12fba85bc83f36284cde983ce07008e070d0aec31d882f8e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1628a85ae6f41e1ac6d467dace94314b9db51b27e3e044938c9cde52e7ea616b3c5604b23cb694259a8eb828a321e52eb6981852d956c7a0956f8ba5bec20b1e
|
|
7
|
+
data.tar.gz: d6cb87908af3d7e20445f2b680bfecb92a0aed93736a5d1c7810f4efa85b5fda85dee4a98c585b765788e6d52950720122b3adf7575c28a68c45e982b9597acb
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.1] - 2026-08-01
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Chart panels now give percentage-height bars a definite-height container, preserve full axis labels, and keep small nonzero values visible.
|
|
15
|
+
|
|
10
16
|
## [0.3.0] - 2026-07-31
|
|
11
17
|
|
|
12
18
|
### Changed (BREAKING)
|
|
@@ -29,7 +29,8 @@ end %>
|
|
|
29
29
|
<% height_float = (value / max_value) * 100.0 %>
|
|
30
30
|
<% height_float = 0.0 if height_float.nan? || height_float.infinite? %>
|
|
31
31
|
<% height = height_float.round %>
|
|
32
|
-
|
|
32
|
+
<% height = [height, 2].max if value.positive? %>
|
|
33
|
+
<div class="flex-1 h-full flex flex-col items-center justify-end">
|
|
33
34
|
<div class="w-full rounded-t <%= bar_color %> transition-all" style="height: <%= height %>%"
|
|
34
35
|
title="<%= "#{d[:label]}: #{d[:value]}" %>"></div>
|
|
35
36
|
</div>
|
|
@@ -38,7 +39,7 @@ end %>
|
|
|
38
39
|
|
|
39
40
|
<div class="flex gap-1 mt-2">
|
|
40
41
|
<% data.each do |d| %>
|
|
41
|
-
<div class="flex-1 text-center text-xs text-slate-400"><%= d[:label]
|
|
42
|
+
<div class="flex-1 text-center text-xs text-slate-400" title="<%= d[:label] %>"><%= d[:label] %></div>
|
|
42
43
|
<% end %>
|
|
43
44
|
</div>
|
|
44
45
|
<% else %>
|
data/lib/admin_suite/version.rb
CHANGED
|
@@ -65,5 +65,45 @@ module AdminSuite
|
|
|
65
65
|
AdminSuite.config.root_dashboard_description = old_description
|
|
66
66
|
AdminSuite.reset_root_dashboard!
|
|
67
67
|
end
|
|
68
|
+
|
|
69
|
+
test "chart bars have a definite-height wrapper and preserve full labels" do
|
|
70
|
+
old_globs = AdminSuite.config.dashboard_globs
|
|
71
|
+
|
|
72
|
+
Dir.mktmpdir("admin-suite-chart") do |dir|
|
|
73
|
+
dashboard_rb = File.join(dir, "dashboard.rb")
|
|
74
|
+
|
|
75
|
+
File.write(dashboard_rb, <<~'RUBY')
|
|
76
|
+
# frozen_string_literal: true
|
|
77
|
+
|
|
78
|
+
AdminSuite.root_dashboard do
|
|
79
|
+
row do
|
|
80
|
+
chart_panel "Daily Cost", data: -> {
|
|
81
|
+
[
|
|
82
|
+
{ label: "Jul 30", value: 0.01 },
|
|
83
|
+
{ label: "Thursday", value: 10 }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
RUBY
|
|
89
|
+
|
|
90
|
+
AdminSuite.reset_root_dashboard!
|
|
91
|
+
AdminSuite.config.dashboard_globs = [ File.join(dir, "*.rb") ]
|
|
92
|
+
|
|
93
|
+
get "/internal/admin_suite"
|
|
94
|
+
assert_response :success
|
|
95
|
+
|
|
96
|
+
document = Nokogiri::HTML(response.body)
|
|
97
|
+
chart = document.at_xpath("//h3[normalize-space()='Daily Cost']/ancestor::div[contains(@class, 'rounded-xl')]")
|
|
98
|
+
assert chart
|
|
99
|
+
assert_equal 2, chart.css(".h-16 > .h-full").size
|
|
100
|
+
assert_equal ["height: 2%", "height: 100%"], chart.css(".h-16 > .h-full > div").map { |bar| bar["style"] }
|
|
101
|
+
assert_includes chart.text, "Jul 30"
|
|
102
|
+
assert_includes chart.text, "Thursday"
|
|
103
|
+
end
|
|
104
|
+
ensure
|
|
105
|
+
AdminSuite.config.dashboard_globs = old_globs
|
|
106
|
+
AdminSuite.reset_root_dashboard!
|
|
107
|
+
end
|
|
68
108
|
end
|
|
69
109
|
end
|