Skip to content

Commit

Permalink
Use more common units and names for expressing file size (#205)
Browse files Browse the repository at this point in the history
* Use 'Size' instead of 'Weight' in the topic list UI, and rename the existing column to 'Count'
* Use SI binary units (B, Kibibyte, Mebibyte, ...) instead of the 1000/octet-based numbers
  • Loading branch information
ankon authored Jan 31, 2020
1 parent c510490 commit 612cd18
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/views/includes/functions.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<#assign order = num?round?c?length />
<#assign thousands = ((order - 1) / 3)?floor />
<#if (thousands < 0)><#assign thousands = 0 /></#if>
<#assign siMap = [ {"factor": 1, "unit": " b"}, {"factor": 1000, "unit": " ko"}, {"factor": 1000000, "unit": " mo"}, {"factor": 1000000000, "unit":" go"}, {"factor": 1000000000000, "unit": " to"} ]/>
<#assign siMap = [ {"factor": 1, "unit": " B"}, {"factor": 1024, "unit": " KiB"}, {"factor": 1024 * 1024, "unit": " MiB"}, {"factor": 1024 * 1024 * 1024, "unit":" GiB"}, {"factor": 1024 * 1024 * 1024 * 1024, "unit": " TiB"} ]/>
<#assign siStr = (num / (siMap[thousands].factor))?string("0.#") + siMap[thousands].unit />
<#return siStr />
</#function>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/views/topicList.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<thead class="thead-dark">
<tr>
<th class="text-nowrap">Name</th>
<th class="text-nowrap">Count</th>
<th class="text-nowrap">Size</th>
<th class="text-nowrap">Weight</th>
<th class="text-nowrap">Total</th>
<!--
<th class="text-nowrap">Available</th>
Expand Down

0 comments on commit 612cd18

Please sign in to comment.