Enhance UI: Update headings for asset browsing and creation pages; add CD Drive asset model and repository

This commit is contained in:
2025-06-08 16:45:53 +02:00
parent af5cd88691
commit 7f4954a98d
6 changed files with 162 additions and 20 deletions

View File

@@ -0,0 +1,127 @@
package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Entity
@AssetInfo(
displayName = "CD Drive",
pluralName = "CD Drives",
type = "cd_drive"
)
@Table(name = "cd_drive_assets")
public class CdDriveAsset implements Asset
{
@Id
@GeneratedValue
private long id;
/// The generic asset associated with this RAM.
@OneToOne(orphanRemoval = true)
private GenericAsset asset;
@Description("Indicates if the drive supports reading CD-ROM discs.")
@Property("CD-ROM Supported")
@HideInOverview
private Boolean supportsCdRom;
@Description("Indicates if the drive supports reading CD-R discs.")
@Property("CD-R Supported")
@HideInOverview
private Boolean supportsCdR;
@Description("Indicates if the drive supports writing CD-R discs.")
@Property("CD-R Writing Supported")
@HideInOverview
private Boolean supportsCdRwriting;
@Description("Indicates if the drive supports reading CD-RW discs.")
@Property("CD-RW Supported")
@HideInOverview
private Boolean supportsCdRw;
@Description("Indicates if the drive supports writing CD-RW discs.")
@Property("CD-RW Writing Supported")
@HideInOverview
private Boolean supportsCdRwwriting;
@Description("Indicates if the drive supports reading DVD discs.")
@Property("DVD Supported")
@HideInOverview
private Boolean supportsDvd;
@Description("Indicates if the drive supports reading DVD-R discs.")
@Property("DVD-R Supported")
@HideInOverview
private Boolean supportsDvdR;
@Description("Indicates if the drive supports writing DVD-R discs.")
@Property("DVD-R Writing Supported")
@HideInOverview
private Boolean supportsDvdRwriting;
@Description("Indicates if the drive supports reading DVD-RW discs.")
@Property("DVD-RW Supported")
@HideInOverview
private Boolean supportsDvdRw;
@Description("Indicates if the drive supports writing DVD-RW discs.")
@Property("DVD-RW Writing Supported")
@HideInOverview
private Boolean supportsDvdRwwriting;
@Description("Indicates if the drive supports reading DVD+R discs.")
@Property("DVD+R Supported")
@HideInOverview
private Boolean supportsDvdPlusR;
@Description("Indicates if the drive supports writing DVD+R discs.")
@Property("DVD+R Writing Supported")
@HideInOverview
private Boolean supportsDvdPlusRwriting;
@Description("Indicates if the drive supports reading DVD+RW discs.")
@Property("DVD+RW Supported")
@HideInOverview
private Boolean supportsDvdPlusRw;
@Description("Indicates if the drive supports writing DVD+RW discs.")
@Property("DVD+RW Writing Supported")
@HideInOverview
private Boolean supportsDvdPlusRwwriting;
@Description("Indicates if the drive supports reading DVD-RAM discs.")
@Property("DVD-RAM Supported")
@HideInOverview
private Boolean supportsDvdRam;
@Description("Indicates if the drive supports reading Blu-ray discs.")
@Property("Blu-ray Supported")
@HideInOverview
private Boolean supportsBluRay;
@Description("Indicates if the drive supports reading HD DVD discs.")
@Property("HD DVD Supported")
@HideInOverview
private Boolean supportsHdDvd;
@Description("Indicates if the drive supports reading Ultra HD Blu-ray discs.")
@Property("Ultra HD Blu-ray Supported")
@HideInOverview
private Boolean supportsUltraHdBluRay;
@Description("The type of interface used by the drive. E.g.: SATA, IDE, etc.")
@Property("Interface Type")
@HideInOverview
@InputList
private String interfaceType;
@Description("The form factor of the CD drive. E.g.: 5.25\", 3.5\", etc.")
@Property("Form Factor")
@InputList
private String formFactor;
}

View File

@@ -0,0 +1,12 @@
package be.seeseepuff.pcinv.repositories;
import be.seeseepuff.pcinv.models.CdDriveAsset;
import org.springframework.data.jpa.repository.JpaRepository;
@SuppressWarnings("unused")
public interface CdDriveRepository extends JpaRepository<CdDriveAsset, Long>, AssetRepository<CdDriveAsset> {
@Override
default Class<CdDriveAsset> getAssetType() {
return CdDriveAsset.class;
}
}

View File

@@ -1,6 +1,6 @@
<body th:replace="~{fragments :: base(title='Browse assets', content=~{::content})}">
<div th:fragment="content">
View device details
<h2>View device details</h2>
<ul>
<li th:each="d : ${descriptors.getAssets()}" th:if="${d.visible}">
<a th:href="'/browse/'+${d.getType()}" th:text="${d.pluralName}"></a>

View File

@@ -1,21 +1,24 @@
<body th:replace="~{fragments :: base(title='View '+${descriptor.pluralName}, content=~{::content})}">
<div th:fragment="content">
There are <span th:text="${assets.size()}"></span> <span th:text="${descriptor.pluralName}"></span> in the database.
<table border="1" cellpadding="4">
<tr bgcolor="#d3d3d3">
<th th:each="p : ${properties}" th:if="${!p.hideInOverview}" th:text="${p.displayName}"></th>
<th>Actions</th>
</tr>
<tr th:each="a : ${assets}">
<td th:each="p : ${properties}" th:if="${!p.hideInOverview}">
<a th:if="${p.name == 'qr'}" th:href="'/view/'+${a.getQr()}" th:text="${p.renderValue(a)}"></a>
<span th:if="${p.name != 'qr'}" th:text="${p.renderValue(a)}"></span>
</td>
<td>
<a th:href="'/view/'+${a.getQr()}">View</a>
<a th:href="'/edit/'+${a.getQr()}">Edit</a>
</td>
</tr>
</table>
<h2>There are <span th:text="${assets.size()}"></span> <span th:text="${descriptor.pluralName}"></span> in the database.</h2>
<table border="1" cellpadding="4">
<tr bgcolor="#d3d3d3">
<th th:each="p : ${properties}" th:if="${!p.hideInOverview}" th:text="${p.displayName}"></th>
<th>Actions</th>
</tr>
<tr th:each="a : ${assets}">
<td th:each="p : ${properties}" th:if="${!p.hideInOverview}">
<a th:if="${p.name == 'qr'}" th:href="'/view/'+${a.getQr()}" th:text="${p.renderValue(a)}"></a>
<span th:if="${p.name != 'qr'}" th:text="${p.renderValue(a)}"></span>
</td>
<td>
<a th:href="'/view/'+${a.getQr()}">View</a>
<a th:href="'/edit/'+${a.getQr()}">Edit</a>
</td>
</tr>
</table>
<p>
<a th:href="'/create/'+${descriptor.type}">Create a new <span th:text="${descriptor.displayName}"></span></a>
</p>
</div>
</body>

View File

@@ -1,6 +1,6 @@
<body th:replace="~{fragments :: base(title='Create '+${descriptor.displayName}, content=~{::content})}">
<div th:fragment="content">
Create a <span th:text="${descriptor.displayName}"></span>
<h2>Create a <span th:text="${descriptor.displayName}"></span></h2>
<form th:action="'/'+${action}+'/'+${asset != null ? asset.getQr() : descriptor.getType()}" method="post">
<div th:each="d : ${descriptors}">
<h2 th:text="${d.displayName}"></h2>

View File

@@ -1,6 +1,6 @@
<body th:replace="~{fragments :: base(title='Select type to create', content=~{::content})}">
<div th:fragment="content">
Create a new device
<h2>Create a new device</h2>
<ul>
<li th:each="d : ${descriptors.getAssets()}" th:if="${d.visible}"><a th:href="'/create/'+${d.getType()}" th:text="${d.displayName}"></a></li>
</ul>