Files
seaweedFS/weed
Chris Lu 95ef041bfb Fix EC Volumes page header styling to match admin theme (#7780)
* Fix EC Volumes page header styling to match admin theme

Fixes #7779

The EC Volumes page was rendering with bright Bootstrap default colors
instead of the admin dark theme because it was structured as a standalone
HTML document with its own DOCTYPE, head, and body tags.

This fix converts the template to be a content fragment (like other
properly styled templates such as cluster_ec_shards.templ) so it
correctly inherits the admin.css styling when rendered within the layout.

* Address review comments: fix URL interpolation and falsy value check

- Fix collection filter link to use templ.URL() for proper interpolation
- Change updateUrl() falsy check from 'if (params[key])' to
  'if (params[key] != null)' to handle 0 and false values correctly

* Address additional review comments

- Use erasure_coding.TotalShardsCount constant instead of hardcoded '14'
  for shard count displays (lines 88 and 214)
- Improve error handling in repairVolume() to check response.ok before
  parsing JSON, preventing confusing errors on non-JSON responses
- Remove unused totalSize variable in formatShardRangesWithSizes()
- Simplify redundant pagination conditions

* Remove unused code: displayShardLocationsHTML, groupShardsByServerWithSizes, formatShardRangesWithSizes

These functions and templates were defined but never called anywhere
in the codebase. Removing them reduces code maintenance burden.

* Address review feedback: improve code quality

- Add defensive JSON response validation in repairVolume function
- Replace O(n²) bubble sorts with Go's standard sort.Ints and sort.Slice
- Document volume status thresholds explaining EC recovery logic:
  * Critical: unrecoverable (more than DataShardsCount missing)
  * Degraded: high risk (more than half DataShardsCount missing)
  * Incomplete: reduced redundancy (more than half ParityShardsCount missing)
  * Minor: fully recoverable with good margin

* Fix redundant shard count display in Healthy Volumes card

Changed from 'Complete (14/14 shards)' to 'All 14 shards present' since
the numerator and denominator were always the same value.

* Use templ.URL for default collection link for consistency

* Fix Clear Filter link to stay on EC Volumes page

Changed href from /cluster/ec-shards to /cluster/ec-volumes so clearing
the filter stays on the current page instead of navigating away.
2025-12-15 20:49:20 -08:00
..
2025-10-13 18:05:17 -07:00
2024-06-25 09:18:11 -07:00
2024-02-14 08:26:38 -08:00
2025-12-15 01:06:55 -08:00
2025-03-17 23:13:27 -07:00