8 Commits

Author SHA1 Message Date
7fca7c4ff0 Adding api
All checks were successful
Build / build (push) Successful in 2m43s
Deploy / build (push) Successful in 2m24s
2025-06-09 19:49:44 +02:00
3789fee73b Add CHS mapping to hard drive
All checks were successful
Build / build (push) Successful in 1m34s
Deploy / build (push) Successful in 1m53s
2025-06-09 15:41:04 +02:00
18baf239e8 Add custom device 2025-06-09 15:40:05 +02:00
c57c429dae Fix 500 problem
All checks were successful
Build / build (push) Successful in 2m56s
Deploy / build (push) Successful in 2m59s
2025-06-09 15:10:31 +02:00
5d1c65a4c5 Better capacity support
All checks were successful
Build / build (push) Successful in 2m36s
Deploy / build (push) Successful in 2m40s
2025-06-09 15:03:16 +02:00
85de1c0c9f Add BigInteger support for capacity handling and enhance UI for capacity selection 2025-06-09 14:53:23 +02:00
a4b88f6dfd Ensure casing is ignored when sorting input list 2025-06-09 10:53:22 +02:00
b9bf2f1d38 Only login into docker once needed 2025-06-09 10:09:50 +02:00
25 changed files with 291 additions and 21 deletions

View File

@@ -17,16 +17,16 @@ jobs:
java-version: '21' java-version: '21'
cache: 'gradle' cache: 'gradle'
- name: Login
with: # Set the secret as an input
package_rw: ${{ secrets.PACKAGE_RW }}
run: docker login gitea.seeseepuff.be -u seeseemelk -p ${{ secrets.PACKAGE_RW }}
- name: Build Jar - name: Build Jar
run: ./gradlew bootJar run: ./gradlew bootJar
- name: Build Container - name: Build Container
run: docker build --tag gitea.seeseepuff.be/seeseemelk/pcinv:${{github.ref_name}} . run: docker build --tag gitea.seeseepuff.be/seeseemelk/pcinv:${{github.ref_name}} .
- name: Login
with: # Set the secret as an input
package_rw: ${{ secrets.PACKAGE_RW }}
run: docker login gitea.seeseepuff.be -u seeseemelk -p ${{ secrets.PACKAGE_RW }}
- name: Push Container - name: Push Container
run: docker push gitea.seeseepuff.be/seeseemelk/pcinv:${{github.ref_name}} run: docker push gitea.seeseepuff.be/seeseemelk/pcinv:${{github.ref_name}}

View File

@@ -28,6 +28,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-thymeleaf") implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator") implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.8")
compileOnly("org.projectlombok:lombok") compileOnly("org.projectlombok:lombok")
developmentOnly("org.springframework.boot:spring-boot-devtools") developmentOnly("org.springframework.boot:spring-boot-devtools")
runtimeOnly("org.postgresql:postgresql") runtimeOnly("org.postgresql:postgresql")

View File

@@ -0,0 +1,15 @@
package be.seeseepuff.pcinv;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@EnableWebMvc
public class PcinvConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
}

View File

@@ -0,0 +1,58 @@
package be.seeseepuff.pcinv.controllers;
import be.seeseepuff.pcinv.meta.AssetDescriptor;
import be.seeseepuff.pcinv.models.Asset;
import be.seeseepuff.pcinv.services.AssetService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RequiredArgsConstructor
@RequestMapping("/api")
@RestController
public class ApiController {
private final AssetService assetService;
@Operation(summary = "Lists all types of assets available in the system.")
@GetMapping("/assetTypes")
public List<String> assets() {
return assetService.getAssetDescriptors().getAssets().stream()
.map(AssetDescriptor::getType)
.toList();
}
@Operation(summary = "Lists all information of a specific asset.")
@GetMapping("/asset/{qr}")
public Asset getAsset(
@PathVariable @Parameter(name = "qr", description = "The QR number of the asset") long qr
) {
return assetService.getAssetByQr(qr);
}
@Operation(summary = "Adds a work log entry to an asset.")
@PostMapping("/asset/worklog")
public String addWorkLogEntry(
@RequestBody Entry entry
) {
var qr = entry.qr;
var asset = assetService.getAssetByQr(qr);
if (asset == null) {
throw new IllegalArgumentException("Asset with QR code " + qr + " not found.");
}
if (entry.entry == null || entry.entry.isBlank()) {
throw new IllegalArgumentException("Work log entry comment cannot be empty.");
}
assetService.addWorkLogEntry(asset, entry.entry);
return "";
}
public static class Entry {
@Parameter(name = "qr", description = "The QR number of the asset")
public long qr;
@Parameter(name = "entry", description = "The work log entry text")
public String entry;
}
}

View File

@@ -209,7 +209,7 @@ public class AssetProperty {
} else if (type == Type.INTEGER || type == Type.STRING) { } else if (type == Type.INTEGER || type == Type.STRING) {
return value.toString(); return value.toString();
} else if (type == Type.CAPACITY) { } else if (type == Type.CAPACITY) {
return String.format("%s bytes", value); return convertCapacity((Long) value).toString();
} else if (type.isEnum) { } else if (type.isEnum) {
if (value instanceof AssetEnum assetEnum) { if (value instanceof AssetEnum assetEnum) {
return assetEnum.getDisplayName(); return assetEnum.getDisplayName();
@@ -220,6 +220,24 @@ public class AssetProperty {
} }
} }
public CapacityInfo convertCapacity(Long value) {
if (value == null) {
return null;
}
if (type != Type.CAPACITY) {
throw new IllegalStateException("Property '" + name + "' is not a capacity type.");
}
return CapacityInfo.of(value, capacityAsIEC, capacityAsSI);
}
public CapacityInfo asCapacity(@Nullable Object object) {
var value = getValue(object);
if (value == null) {
return null;
}
return convertCapacity((Long) value);
}
@Override @Override
public String toString() { public String toString() {
var enumOptions = ""; var enumOptions = "";

View File

@@ -0,0 +1,62 @@
package be.seeseepuff.pcinv.meta;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
import java.util.Comparator;
/**
* Represents a capacity in bytes, with various units for display.
* This class is used to encapsulate the capacity information and provide
* a way to represent it in different units.
*/
@Getter
@RequiredArgsConstructor
public class CapacityInfo {
private final long capacity;
private final CapacityUnit idealUnit;
public static CapacityInfo of(long capacity, CapacityUnit idealUnit) {
return new CapacityInfo(capacity, idealUnit);
}
public static CapacityInfo of(long capacity) {
return of(capacity, idealUnitForCapacity(capacity, CapacityUnit.values()));
}
public static CapacityInfo ofSI(long capacity) {
return of(capacity, idealUnitForCapacity(capacity, CapacityUnit.SI_UNITS));
}
public static CapacityInfo ofIEC(long capacity) {
return of(capacity, idealUnitForCapacity(capacity, CapacityUnit.IEC_UNITS));
}
public static CapacityInfo of(long capacity, boolean iec, boolean si) {
if (iec && !si) {
return ofIEC(capacity);
} else if (si && !iec) {
return ofSI(capacity);
} else {
return of(capacity);
}
}
public static CapacityUnit idealUnitForCapacity(long capacity, CapacityUnit[] units) {
return Arrays.stream(units)
.sorted(Comparator.comparing(CapacityUnit::getBytes).reversed())
.filter(unit -> capacity % unit.getBytes() == 0)
.findFirst()
.orElse(CapacityUnit.BYTES);
}
public long getCapacityInUnit() {
return capacity / idealUnit.getBytes();
}
@Override
public String toString() {
return String.format("%d %s", capacity / idealUnit.getBytes(), idealUnit.getDisplayName());
}
}

View File

@@ -0,0 +1,28 @@
package be.seeseepuff.pcinv.meta;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* Represents a unit of capacity, either in binary (IEC) or decimal (SI) format.
*/
@Getter
@RequiredArgsConstructor
public enum CapacityUnit {
BYTES("Bytes", 1),
KIBIBYTES("KiB", 1024),
MEBIBYTES("MiB", 1024 * 1024),
GIBIBYTES("GiB", 1024 * 1024 * 1024),
TEBIBYTES("TiB", 1024L * 1024 * 1024 * 1024),
KILOBYTES("kB", 1000),
MEGABYTES("MB", 1000 * 1000),
GIGABYTES("GB", 1000 * 1000 * 1000),
TERABYTES("TB", 1000L * 1000 * 1000 * 1000),
;
public static final CapacityUnit[] SI_UNITS = {BYTES, KILOBYTES, MEGABYTES, GIGABYTES, TERABYTES};
public static final CapacityUnit[] IEC_UNITS = {BYTES, KIBIBYTES, MEBIBYTES, GIBIBYTES, TEBIBYTES};
private final String displayName;
private final long bytes;
}

View File

@@ -4,6 +4,7 @@ import be.seeseepuff.pcinv.meta.AssetInfo;
import be.seeseepuff.pcinv.meta.Description; import be.seeseepuff.pcinv.meta.Description;
import be.seeseepuff.pcinv.meta.HideInOverview; import be.seeseepuff.pcinv.meta.HideInOverview;
import be.seeseepuff.pcinv.meta.Property; import be.seeseepuff.pcinv.meta.Property;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -21,6 +22,7 @@ public class ChassisAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
/// The generic asset associated with this RAM. /// The generic asset associated with this RAM.

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -21,6 +22,7 @@ public class CpuAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
@OneToOne(orphanRemoval = true) @OneToOne(orphanRemoval = true)

View File

@@ -0,0 +1,30 @@
package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
/**
* Represents a CPU or similar device.
*/
@Getter
@Setter
@Entity
@AssetInfo(
displayName = "Custom Device",
pluralName = "Custom Devices",
type = "custom"
)
@Table(name = "custom_assets")
public class CustomAsset implements Asset
{
@Id
@GeneratedValue
@JsonIgnore
private long id;
@OneToOne(orphanRemoval = true)
private GenericAsset asset;
}

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -18,6 +19,7 @@ public class DisplayAdapterAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
/// The generic asset associated with this RAM. /// The generic asset associated with this RAM.

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -18,6 +19,7 @@ public class FloppyDriveAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
/// The generic asset associated with this RAM. /// The generic asset associated with this RAM.

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -27,7 +28,9 @@ public class GenericAsset
{ {
public static final String TYPE = "asset"; public static final String TYPE = "asset";
@Id @GeneratedValue @Id
@GeneratedValue
@JsonIgnore
private long id; private long id;
/// The QR code attached to the asset, used for identification. /// The QR code attached to the asset, used for identification.

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -21,6 +22,7 @@ public class HddAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
@OneToOne(orphanRemoval = true) @OneToOne(orphanRemoval = true)
@@ -40,12 +42,12 @@ public class HddAsset implements Asset
@InputList @InputList
private String formFactor; private String formFactor;
@Description("The drive's RPM (Revolutions Per Minute) speed, if applicable.") @Description("The drive's RPM (Revolutions Per Minute) speed.")
@Property("RPM Speed") @Property("RPM Speed")
@HideInOverview @HideInOverview
private Long rpmSpeed; private Long rpmSpeed;
@Description("The drive's cache size, if applicable.") @Description("The drive's cache size.")
@Property("Cache Size") @Property("Cache Size")
@HideInOverview @HideInOverview
private Long cacheSize; private Long cacheSize;
@@ -54,4 +56,19 @@ public class HddAsset implements Asset
@Property("Drive Type") @Property("Drive Type")
@InputList @InputList
private String driveType; private String driveType;
@Description("Number of heads in the drive.")
@Property("Heads")
@HideInOverview
private Integer heads;
@Description("Number of cylinders in the drive.")
@Property("Cylinders")
@HideInOverview
private Integer cylinders;
@Description("Number of sectors in the drive.")
@Property("Sectors")
@HideInOverview
private Integer sectors;
} }

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -18,6 +19,7 @@ public class MotherboardAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
/// The generic asset associated with this RAM. /// The generic asset associated with this RAM.

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -18,6 +19,7 @@ public class NICAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
/// The generic asset associated with this RAM. /// The generic asset associated with this RAM.

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -18,6 +19,7 @@ public class OpticalDriveAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
/// The generic asset associated with this RAM. /// The generic asset associated with this RAM.

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -18,6 +19,7 @@ public class PowerSupplyAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
/// The generic asset associated with this RAM. /// The generic asset associated with this RAM.

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -21,6 +22,7 @@ public class RamAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
@OneToOne(orphanRemoval = true) @OneToOne(orphanRemoval = true)
@@ -37,5 +39,5 @@ public class RamAsset implements Asset
@Description("The speed of the memory in MHz.") @Description("The speed of the memory in MHz.")
@Property("Speed") @Property("Speed")
private Long speed; private Integer speed;
} }

View File

@@ -1,6 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*; import be.seeseepuff.pcinv.meta.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -18,6 +19,7 @@ public class SoundAdapterAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
/// The generic asset associated with this RAM. /// The generic asset associated with this RAM.

View File

@@ -1,5 +1,7 @@
package be.seeseepuff.pcinv.models; package be.seeseepuff.pcinv.models;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id; import jakarta.persistence.Id;
@@ -18,8 +20,10 @@ import java.time.ZonedDateTime;
public class WorkLogEntry { public class WorkLogEntry {
@Id @Id
@GeneratedValue @GeneratedValue
@JsonIgnore
private long id; private long id;
@JsonIgnore
@ManyToOne(optional = false) @ManyToOne(optional = false)
private GenericAsset asset; private GenericAsset asset;
@@ -27,5 +31,6 @@ public class WorkLogEntry {
private String comment; private String comment;
/// The date and time when the work log entry was created. /// The date and time when the work log entry was created.
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private ZonedDateTime date; private ZonedDateTime date;
} }

View File

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

View File

@@ -291,7 +291,7 @@ public class AssetService {
entries = repository.findAll(); entries = repository.findAll();
} }
Set<String> inputList = new TreeSet<>(); var inputList = new TreeSet<String>(Comparator.comparing(String::toLowerCase));
for (var entry : entries) { for (var entry : entries) {
String entryType; String entryType;
if (entry instanceof Asset asset) { if (entry instanceof Asset asset) {

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> <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> </select>
<span th:case="CAPACITY"> <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)?.getCapacityInUnit() ?: ''}"/>
<select th:id="${d.asString(p)}+'-unit'" th:name="${d.asString(p)}+'-unit'"> <select th:id="${d.asString(p)}+'-unit'" th:name="${d.asString(p)}+'-unit'">
<option value="1">Bytes</option> <option value="1" th:selected="${p.asCapacity(asset)?.getIdealUnit()?.name() == 'BYTES'}">Bytes</option>
<option th:if="${p.capacityAsSI}">kB</option> <option th:value="${1000}" th:if="${p.capacityAsSI}" th:selected="${p.asCapacity(asset)?.getIdealUnit()?.name() == 'KILOBYTES'}">kB</option>
<option th:if="${p.capacityAsIEC}">KiB</option> <option th:value="${1024}" th:if="${p.capacityAsIEC}" th:selected="${p.asCapacity(asset)?.getIdealUnit()?.name() == 'KIBIBYTES'}">KiB</option>
<option th:if="${p.capacityAsSI}">MB</option> <option th:value="${1000*1000}" th:if="${p.capacityAsSI}" th:selected="${p.asCapacity(asset)?.getIdealUnit()?.name() == 'MEGABYTES'}">MB</option>
<option th:if="${p.capacityAsIEC}">MiB</option> <option th:value="${1024*1024}" th:if="${p.capacityAsIEC}" th:selected="${p.asCapacity(asset)?.getIdealUnit()?.name() == 'MEBIBYTES'}">MiB</option>
<option th:if="${p.capacityAsSI}">GB</option> <option th:value="${1000*1000*1000}" th:if="${p.capacityAsSI}" th:selected="${p.asCapacity(asset)?.getIdealUnit()?.name() == 'GIGABYTES'}">GB</option>
<option th:if="${p.capacityAsIEC}">GiB</option> <option th:value="${1024*1024*1024}" th:if="${p.capacityAsIEC}" th:selected="${p.asCapacity(asset)?.getIdealUnit()?.name() == 'GIBIBYTES'}">GiB</option>
<option th:if="${p.capacityAsSI}">TB</option> <option value="1000000000000" th:if="${p.capacityAsSI}" th:selected="${p.asCapacity(asset)?.getIdealUnit()?.name() == 'TERABYTES'}">TB</option>
<option th:if="${p.capacityAsIEC}">TiB</option> <option value="1099511627776" th:if="${p.capacityAsIEC}" th:selected="${p.asCapacity(asset)?.getIdealUnit()?.name() == 'TEBIBYTES'}">TiB</option>
</select> </select>
</span> </span>
<b th:case="*">Bad input type for <span th:text="${d.type}+'-'+${p.type}"></span></b> <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'}"> <ul th:if="${action == 'view'}">
<li><a th:href="'/edit/'+${asset.getQr()}">Edit</a></li> <li><a th:href="'/edit/'+${asset.getQr()}">Edit</a></li>
<li><a th:href="'/delete/'+${asset.getQr()}">Delete</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> <li><a th:href="'/browse/'+${descriptor.type}">Browse all <span th:text="${descriptor.pluralName}">Hard Drives</span></a></li>
</ul> </ul>
<ul th:if="${action == 'delete'}"> <ul th:if="${action == 'delete'}">