Add BigInteger support for capacity handling and enhance UI for capacity selection

This commit is contained in:
2025-06-09 14:53:23 +02:00
parent a4b88f6dfd
commit 85de1c0c9f
7 changed files with 146 additions and 14 deletions

View File

@@ -31,17 +31,17 @@
<option th:each="o : ${p.options}" th:value="${o.value}" th:text="${o.displayName}" th:selected="${asset != null ? (p.getValue(asset) == o.enumConstant) : o.defaultValue}">Good</option>
</select>
<span th:case="CAPACITY">
<input type="number" th:id="${d.asString(p)+'-value'}" th:name="${d.asString(p)+'-value'}" th:required="${p.required}"/>
<input type="number" th:id="${d.asString(p)+'-value'}" th:name="${d.asString(p)+'-value'}" th:required="${p.required}" th:value="${p.asCapacity(asset).getCapacity()}"/>
<select th:id="${d.asString(p)}+'-unit'" th:name="${d.asString(p)}+'-unit'">
<option value="1">Bytes</option>
<option th:if="${p.capacityAsSI}">kB</option>
<option th:if="${p.capacityAsIEC}">KiB</option>
<option th:if="${p.capacityAsSI}">MB</option>
<option th:if="${p.capacityAsIEC}">MiB</option>
<option th:if="${p.capacityAsSI}">GB</option>
<option th:if="${p.capacityAsIEC}">GiB</option>
<option th:if="${p.capacityAsSI}">TB</option>
<option th:if="${p.capacityAsIEC}">TiB</option>
<option value="1" th:selected="${p.asCapacity(asset).getIdealUnit().name() == 'BYTES'}">Bytes</option>
<option th:value="${1000}" th:if="${p.capacityAsSI}" th:selected="${p.asCapacity(asset).getIdealUnit().name() == 'KILOBYTES'}">kB</option>
<option th:value="${1024}" th:if="${p.capacityAsIEC}" th:selected="${p.asCapacity(asset).getIdealUnit().name() == 'KIBIBYTES'}">KiB</option>
<option th:value="${1000*1000}" th:if="${p.capacityAsSI}" th:selected="${p.asCapacity(asset).getIdealUnit().name() == 'MEGABYTES'}">MB</option>
<option th:value="${1024*1024}" th:if="${p.capacityAsIEC}" th:selected="${p.asCapacity(asset).getIdealUnit().name() == 'MEBIBYTES'}">MiB</option>
<option th:value="${1000*1000*1000}" th:if="${p.capacityAsSI}" th:selected="${p.asCapacity(asset).getIdealUnit().name() == 'GIGABYTES'}">GB</option>
<option th:value="${1024*1024*1024}" th:if="${p.capacityAsIEC}" th:selected="${p.asCapacity(asset).getIdealUnit().name() == 'GIBIBYTES'}">GiB</option>
<option value="1000000000000" th:if="${p.capacityAsSI}" th:selected="${p.asCapacity(asset).getIdealUnit().name() == 'TERABYTES'}">TB</option>
<option value="1099511627776" th:if="${p.capacityAsIEC}" th:selected="${p.asCapacity(asset).getIdealUnit().name() == 'TEBIBYTES'}">TiB</option>
</select>
</span>
<b th:case="*">Bad input type for <span th:text="${d.type}+'-'+${p.type}"></span></b>

View File

@@ -15,6 +15,7 @@
<ul th:if="${action == 'view'}">
<li><a th:href="'/edit/'+${asset.getQr()}">Edit</a></li>
<li><a th:href="'/delete/'+${asset.getQr()}">Delete</a></li>
<li><a th:href="'/create/'+${asset.getAsset().type}">Create another <span th:text="${descriptor.displayName}">Hard Drive</span> </a></li>
<li><a th:href="'/browse/'+${descriptor.type}">Browse all <span th:text="${descriptor.pluralName}">Hard Drives</span></a></li>
</ul>
<ul th:if="${action == 'delete'}">