Enhance asset display by handling null builds and sorting assets by QR code
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package be.seeseepuff.pcinv.controllers;
|
package be.seeseepuff.pcinv.controllers;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.models.Asset;
|
||||||
import be.seeseepuff.pcinv.models.WorkLogEntry;
|
import be.seeseepuff.pcinv.models.WorkLogEntry;
|
||||||
import be.seeseepuff.pcinv.services.AssetService;
|
import be.seeseepuff.pcinv.services.AssetService;
|
||||||
import be.seeseepuff.pcinv.services.BuildService;
|
import be.seeseepuff.pcinv.services.BuildService;
|
||||||
@@ -94,7 +95,9 @@ public class WebController {
|
|||||||
model.addAttribute(DESCRIPTOR, assetService.getAssetDescriptor(type));
|
model.addAttribute(DESCRIPTOR, assetService.getAssetDescriptor(type));
|
||||||
model.addAttribute(DESCRIPTORS, tree);
|
model.addAttribute(DESCRIPTORS, tree);
|
||||||
model.addAttribute(PROPERTIES, tree.stream().flatMap(d -> d.getProperties().stream()).toList());
|
model.addAttribute(PROPERTIES, tree.stream().flatMap(d -> d.getProperties().stream()).toList());
|
||||||
model.addAttribute(ASSETS, assetService.getAssetsByType(type));
|
var assets = assetService.getAssetsByType(type);
|
||||||
|
assets.sort(Comparator.comparing(Asset::getQr));
|
||||||
|
model.addAttribute(ASSETS, assets);
|
||||||
return "browse_type";
|
return "browse_type";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,10 @@
|
|||||||
<table border="1" cellpadding="4">
|
<table border="1" cellpadding="4">
|
||||||
<tr th:each="p : ${d.properties}">
|
<tr th:each="p : ${d.properties}">
|
||||||
<th bgcolor="lightgray"><b th:text="${p.displayName}"></b></th>
|
<th bgcolor="lightgray"><b th:text="${p.displayName}"></b></th>
|
||||||
<td th:if="${p.name == 'build'}"><a th:href="'/build/' + ${asset.getAsset().getBuild().id}" th:text="${p.renderValue(asset)}"></a></td>
|
<td th:if="${p.name == 'build'}">
|
||||||
|
<a th:if="${asset.getAsset().getBuild() != null}" th:href="'/build/' + ${asset.getAsset().getBuild().id}" th:text="${p.renderValue(asset)}"></a>
|
||||||
|
<span th:if="${asset.getAsset().getBuild() == null}" th:text="${p.renderValue(asset)}"></span>
|
||||||
|
</td>
|
||||||
<td th:if="${p.name != 'build'}" th:text="${p.renderValue(asset)}"></td>
|
<td th:if="${p.name != 'build'}" th:text="${p.renderValue(asset)}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user