Files
pcinv/src/main/resources/templates/create_asset.html
Sebastiaan de Schaetzen 3a70613023
Some checks failed
Build / build (push) Failing after 19s
Close to the same feature set as the Go interface
2025-06-08 07:02:13 +02:00

41 lines
2.1 KiB
HTML

<body th:replace="~{fragments :: base(title='Create '+${descriptor.displayName}, content=~{::content})}">
<div th:fragment="content">
Create a <span th:text="${descriptor.displayName}"></span>
<form th:action="'/create/'+${descriptor.getType()}" method="post">
<div th:each="d : ${descriptors}">
<h2 th:text="${d.displayName}"></h2>
<table border="1">
<tr th:each="p : ${d.getProperties()}">
<td><label th:text="${p.displayName}" th:for="${d.asString(p)}"></label></td>
<td th:switch="${p.type.nameOrEnum()}">
<input th:case="STRING" type="text" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:placeholder="${p.displayName}" th:required="${p.required}"/>
<input th:case="INTEGER" type="number" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:required="${p.required}"/>
<select th:case="enum" th:id="${d.asString(p)}" th:name="${d.asString(p)}">
<option th:each="o : ${p.options}" th:value="${o.value}" th:text="${o.displayName}" th:selected="${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}"/>
<select th:id="${d.asString(p)}+'-unit'" th:name="${d.asString(p)}+'-unit'">
<option value="1">Bytes</option>
<option th:if="${p.capacityAsSI}" value="1000">kB</option>
<option th:if="${p.capacityAsIEC}" value="1024">KiB</option>
<option th:if="${p.capacityAsSI}" value="1000000">MB</option>
<option th:if="${p.capacityAsIEC}" value="1048576">MiB</option>
<option th:if="${p.capacityAsSI}" value="1000000000">GB</option>
<option th:if="${p.capacityAsIEC}" value="1073741824">GiB</option>
<option th:if="${p.capacityAsSI}" value="1000000000000">TB</option>
<option th:if="${p.capacityAsIEC}" value="1099511627776">TiB</option>
</select>
</span>
<b th:case="*">Bad input type for <span th:text="${d.type}+'-'+${p.type}"></span></b>
</td>
</tr>
</table>
</div>
<p>
<input type="submit" value="Create">
</p>
</form>
</div>
</body>