All checks were successful
Build / build (push) Successful in 2m16s
70 lines
5.2 KiB
HTML
70 lines
5.2 KiB
HTML
<body th:replace="~{fragments :: base(title='Create '+${descriptor.displayName}, content=~{::content})}">
|
|
<div th:fragment="content">
|
|
<h2>Create a <span th:text="${descriptor.displayName}"></span></h2>
|
|
<form th:action="'/'+${(action == 'duplicate') ? 'create' : action}+'/'+${(asset != null && action != 'duplicate') ? asset.getQr() : descriptor.getType()}" method="post">
|
|
<div th:each="d : ${descriptors}">
|
|
<h2 th:text="${d.displayName}"></h2>
|
|
<table border="1" cellpadding="4">
|
|
<tr th:each="p : ${d.getProperties()}">
|
|
<td bgcolor="#d3d3d3"><b><label th:text="${p.displayName}" th:for="${d.asString(p)}" th:title="${p.description}"></label></b></td>
|
|
<td th:switch="${p.type.nameOrEnum()}">
|
|
<!-- Property Type: String List -->
|
|
<span th:case="STRING">
|
|
<select th:if="${p.inputList}" th:id="${d.asString(p)+'-list'}" th:name="${d.asString(p)+'-list'}">
|
|
<option value="__new__">New...</option>
|
|
<option th:each="e : ${inputLists.get(d.asString(p))}" th:text="${e}" th:value="${e}"></option>
|
|
</select>
|
|
<span th:if="${p.inputList}"> or </span>
|
|
<input type="text" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${p.getValue(asset)}" th:placeholder="${p.displayName}" th:required="${p.required}"/>
|
|
</span>
|
|
<input th:case="STRING" type="text" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${p.getValue(asset)}" th:placeholder="${p.displayName}" th:required="${p.required}"/>
|
|
<!-- Property Type: Integer -->
|
|
<input th:case="INTEGER" type="number" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${(p.name == 'qr' && action == 'duplicate') ? null : p.getValue(asset)}" th:required="${p.required}"/>
|
|
<!-- Property Type: Boolean -->
|
|
<span th:case="BOOLEAN">
|
|
<input th:name="${d.asString(p)}" th:id="${d.asString(p)}+'-null'" type="radio" value="null" th:checked="${asset == null || (p.getValue(asset) == null)}">
|
|
<label th:for="${d.asString(p)}+'-null'">Not known</label>
|
|
<input th:name="${d.asString(p)}" th:id="${d.asString(p)}+'-true'" type="radio" value="true" th:checked="${asset != null && (p.getValue(asset) == true)}">
|
|
<label th:for="${d.asString(p)}+'-true'">Yes</label>
|
|
<input th:name="${d.asString(p)}" th:id="${d.asString(p)}+'-false'" type="radio" value="false" th:checked="${asset != null && (p.getValue(asset) == false)}">
|
|
<label th:for="${d.asString(p)}+'-false'">No</label>
|
|
</span>
|
|
<!-- Property Type: Enum -->
|
|
<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="${asset != null ? (p.getValue(asset) == o.enumConstant) : o.defaultValue}">Good</option>
|
|
</select>
|
|
<!-- Property Type: Capacity -->
|
|
<span th:case="CAPACITY">
|
|
<input type="number" th:id="${d.asString(p)+'-value'}" th:name="${d.asString(p)+'-value'}" th:required="${p.required}" th:value="${p.asCapacity(asset)?.getCapacityInUnit() ?: ''}"/>
|
|
<select th:id="${d.asString(p)}+'-unit'" th:name="${d.asString(p)}+'-unit'">
|
|
<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>
|
|
<!-- Property Type: Build-->
|
|
<span th:case="BUILD">
|
|
<select th:id="${d.asString(p)}" th:name="${d.asString(p)}">
|
|
<option value="" th:selected="${p.getValue(asset) == null}">(Unknown)</option>
|
|
<option th:each="b : ${builds}" th:value="${b.getId()}" th:selected="${p.getValue(asset) == b}" th:text="${b.getName()}">My PC Build</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 th:if="${action == 'create' || action == 'duplicate'}" type="submit" value="Create">
|
|
<input th:if="${action == 'edit'}" type="submit" value="Save Changes">
|
|
</p>
|
|
</form>
|
|
</div>
|
|
</body>
|