Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae010a0e21 | |||
| b47b3abbab | |||
| 309bc72405 | |||
| 7cd7d11a40 | |||
| ab06c37a71 | |||
| 54231df858 | |||
| 5e902dd8b0 | |||
| 7f4954a98d | |||
| af5cd88691 | |||
| c1af87f82a |
@@ -1,5 +1,8 @@
|
|||||||
name: Build
|
name: Build
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: standard-latest
|
runs-on: standard-latest
|
||||||
|
|||||||
@@ -10,13 +10,20 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||||
|
java-version: '21'
|
||||||
|
cache: 'gradle'
|
||||||
|
|
||||||
- name: Login
|
- name: Login
|
||||||
with: # Set the secret as an input
|
with: # Set the secret as an input
|
||||||
package_rw: ${{ secrets.PACKAGE_RW }}
|
package_rw: ${{ secrets.PACKAGE_RW }}
|
||||||
run: docker login gitea.seeseepuff.be -u seeseemelk -p ${{ secrets.PACKAGE_RW }}
|
run: docker login gitea.seeseepuff.be -u seeseemelk -p ${{ secrets.PACKAGE_RW }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: docker build -t gitea.seeseepuff.be/seeseemelk/pcinv:${{github.ref_name}} .
|
run: ./gradlew bootBuildImage --no-daemon --imageName=gitea.seeseepuff.be/seeseemelk/pcinv:${{github.ref_name}}
|
||||||
|
|
||||||
- name: Push
|
- name: Push
|
||||||
run: docker push gitea.seeseepuff.be/seeseemelk/pcinv:${{github.ref_name}}
|
run: docker push gitea.seeseepuff.be/seeseemelk/pcinv:${{github.ref_name}}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package be.seeseepuff.pcinv.meta;
|
|||||||
import be.seeseepuff.pcinv.models.Asset;
|
import be.seeseepuff.pcinv.models.Asset;
|
||||||
import be.seeseepuff.pcinv.models.AssetCondition;
|
import be.seeseepuff.pcinv.models.AssetCondition;
|
||||||
import be.seeseepuff.pcinv.models.GenericAsset;
|
import be.seeseepuff.pcinv.models.GenericAsset;
|
||||||
|
import be.seeseepuff.pcinv.models.ReadWrite;
|
||||||
import jakarta.annotation.Nonnull;
|
import jakarta.annotation.Nonnull;
|
||||||
import jakarta.annotation.Nullable;
|
import jakarta.annotation.Nullable;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -55,8 +56,10 @@ public class AssetProperty {
|
|||||||
public enum Type {
|
public enum Type {
|
||||||
STRING(false),
|
STRING(false),
|
||||||
INTEGER(false),
|
INTEGER(false),
|
||||||
|
BOOLEAN(false),
|
||||||
CAPACITY(false),
|
CAPACITY(false),
|
||||||
CONDITION(true),
|
CONDITION(true),
|
||||||
|
READWRITE(true),
|
||||||
;
|
;
|
||||||
/// Set to `true` if the type is an enum, `false` otherwise.
|
/// Set to `true` if the type is an enum, `false` otherwise.
|
||||||
public final boolean isEnum;
|
public final boolean isEnum;
|
||||||
@@ -150,8 +153,12 @@ public class AssetProperty {
|
|||||||
return Type.CAPACITY;
|
return Type.CAPACITY;
|
||||||
} else if (property.getType() == Integer.class || property.getType() == int.class || property.getType() == Long.class || property.getType() == long.class) {
|
} else if (property.getType() == Integer.class || property.getType() == int.class || property.getType() == Long.class || property.getType() == long.class) {
|
||||||
return Type.INTEGER;
|
return Type.INTEGER;
|
||||||
|
} else if (property.getType() == Boolean.class || property.getType() == boolean.class) {
|
||||||
|
return Type.BOOLEAN;
|
||||||
} else if (property.getType() == AssetCondition.class) {
|
} else if (property.getType() == AssetCondition.class) {
|
||||||
return Type.CONDITION;
|
return Type.CONDITION;
|
||||||
|
} else if (property.getType() == ReadWrite.class) {
|
||||||
|
return Type.READWRITE;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unsupported property type: " + property.getType());
|
throw new IllegalArgumentException("Unsupported property type: " + property.getType());
|
||||||
}
|
}
|
||||||
@@ -197,6 +204,8 @@ public class AssetProperty {
|
|||||||
var value = getValue(asset);
|
var value = getValue(asset);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
|
} else if (type == Type.BOOLEAN) {
|
||||||
|
return (boolean) value ? "Yes" : "No";
|
||||||
} 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) {
|
||||||
|
|||||||
65
src/main/java/be/seeseepuff/pcinv/models/CpuAsset.java
Normal file
65
src/main/java/be/seeseepuff/pcinv/models/CpuAsset.java
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package be.seeseepuff.pcinv.models;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.meta.*;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a CPU or similar device.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@AssetInfo(
|
||||||
|
displayName = "Central Processing Unit",
|
||||||
|
pluralName = "Central Processing Units",
|
||||||
|
type = "cpu"
|
||||||
|
)
|
||||||
|
@Table(name = "cpu_assets")
|
||||||
|
public class CpuAsset implements Asset
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@OneToOne(orphanRemoval = true)
|
||||||
|
private GenericAsset asset;
|
||||||
|
|
||||||
|
@Description("The number of cores in the CPU.")
|
||||||
|
@Property("Cores")
|
||||||
|
private int cores;
|
||||||
|
|
||||||
|
@Description("The number of threads in the CPU.")
|
||||||
|
@Property("Threads")
|
||||||
|
private int threads;
|
||||||
|
|
||||||
|
@Description("The base clock speed of the CPU in MHz.")
|
||||||
|
@Property("Base Clock Speed (MHz)")
|
||||||
|
private int baseClockSpeed;
|
||||||
|
|
||||||
|
@Description("The boost clock speed of the CPU in MHz.")
|
||||||
|
@Property("Boost Clock Speed (MHz)")
|
||||||
|
@HideInOverview
|
||||||
|
private int boostClockSpeed;
|
||||||
|
|
||||||
|
@Description("The thermal design power (TDP) of the CPU in watts.")
|
||||||
|
@Property("Thermal Design Power (TDP) (W)")
|
||||||
|
private int tdp;
|
||||||
|
|
||||||
|
@Description("The socket type of the CPU.")
|
||||||
|
@Property("Socket Type")
|
||||||
|
@InputList
|
||||||
|
private String socketType;
|
||||||
|
|
||||||
|
@Description("The architecture of the CPU, e.g., x86, ARM, etc.")
|
||||||
|
@Property("Architecture")
|
||||||
|
@HideInOverview
|
||||||
|
@InputList
|
||||||
|
private String architecture;
|
||||||
|
|
||||||
|
@Description("The manufacturing process of the CPU in nanometers.")
|
||||||
|
@Property("Manufacturing Process (nm)")
|
||||||
|
@HideInOverview
|
||||||
|
private int manufacturingProcess;
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package be.seeseepuff.pcinv.models;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.meta.*;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@AssetInfo(
|
||||||
|
displayName = "Floppy Drive",
|
||||||
|
pluralName = "Floppy Drives",
|
||||||
|
type = "floppy_drive"
|
||||||
|
)
|
||||||
|
@Table(name = "floppy_drive_assets")
|
||||||
|
public class FloppyDriveAsset implements Asset
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
/// The generic asset associated with this RAM.
|
||||||
|
@OneToOne(orphanRemoval = true)
|
||||||
|
private GenericAsset asset;
|
||||||
|
|
||||||
|
@Description("Indicates if the floppy drive supports double density (DD) disks.")
|
||||||
|
@Property("doubleDensitySupported")
|
||||||
|
@HideInOverview
|
||||||
|
private Boolean supportsDoubleDensity;
|
||||||
|
|
||||||
|
@Description("Indicates if the floppy drive supports high density (HD) disks.")
|
||||||
|
@Property("highDensitySupported")
|
||||||
|
@HideInOverview
|
||||||
|
private Boolean supportsHighDensity;
|
||||||
|
|
||||||
|
@Description("Indicates if the floppy drive supports extra high density (ED) disks.")
|
||||||
|
@Property("extraHighDensitySupported")
|
||||||
|
@HideInOverview
|
||||||
|
private Boolean supportsExtraHighDensity;
|
||||||
|
|
||||||
|
@Description("The type of interface used by the floppy drive. E.g.: 34-pin, 50-pin, etc.")
|
||||||
|
@Property("Interface Type")
|
||||||
|
@HideInOverview
|
||||||
|
@InputList
|
||||||
|
private String interfaceType;
|
||||||
|
|
||||||
|
@Description("The form factor of the floppy drive. E.g.: 3.5\", 5.25\", etc.")
|
||||||
|
@Property("Form Factor")
|
||||||
|
@InputList
|
||||||
|
private String formFactor;
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ import jakarta.persistence.*;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a generic asset in the inventory system.
|
* Represents a generic asset in the inventory system.
|
||||||
*/
|
*/
|
||||||
@@ -65,4 +67,7 @@ public class GenericAsset
|
|||||||
@Property("Warranty Expiration Date")
|
@Property("Warranty Expiration Date")
|
||||||
@HideInOverview
|
@HideInOverview
|
||||||
private String warrantyExpirationDate;
|
private String warrantyExpirationDate;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "asset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
|
private List<WorkLogEntry> workLog;
|
||||||
}
|
}
|
||||||
|
|||||||
37
src/main/java/be/seeseepuff/pcinv/models/NICAsset.java
Normal file
37
src/main/java/be/seeseepuff/pcinv/models/NICAsset.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package be.seeseepuff.pcinv.models;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.meta.*;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@AssetInfo(
|
||||||
|
displayName = "Network Interface Controller",
|
||||||
|
pluralName = "Network Interface Controllers",
|
||||||
|
type = "nic"
|
||||||
|
)
|
||||||
|
@Table(name = "nic_assets")
|
||||||
|
public class NICAsset implements Asset
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
/// The generic asset associated with this RAM.
|
||||||
|
@OneToOne(orphanRemoval = true)
|
||||||
|
private GenericAsset asset;
|
||||||
|
|
||||||
|
@Description("The MAC address of the network interface controller.")
|
||||||
|
@Property("MAC Address")
|
||||||
|
@HideInOverview
|
||||||
|
private String macAddress;
|
||||||
|
|
||||||
|
@Description("The type of interface used by the drive. E.g.: SATA, IDE, etc.")
|
||||||
|
@Property("Interface Type")
|
||||||
|
@HideInOverview
|
||||||
|
@InputList
|
||||||
|
private String interfaceType;
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package be.seeseepuff.pcinv.models;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.meta.*;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@AssetInfo(
|
||||||
|
displayName = "Optical Drive",
|
||||||
|
pluralName = "Optical Drives",
|
||||||
|
type = "optical_drive"
|
||||||
|
)
|
||||||
|
@Table(name = "optical_drive_assets")
|
||||||
|
public class OpticalDriveAsset 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 CD-ROM discs.")
|
||||||
|
@Property("CD-ROM Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsCdRom;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports CD-R discs.")
|
||||||
|
@Property("CD-R Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsCdR;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports CD-RW discs.")
|
||||||
|
@Property("CD-RW Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsCdRw;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports DVD discs.")
|
||||||
|
@Property("DVD Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsDvd;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports DVD-R discs.")
|
||||||
|
@Property("DVD-R Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsDvdR;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports DVD-RW discs.")
|
||||||
|
@Property("DVD-RW Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsDvdRw;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports DVD+R discs.")
|
||||||
|
@Property("DVD+R Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsDvdPlusR;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports DVD+RW discs.")
|
||||||
|
@Property("DVD+RW Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsDvdPlusRw;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports DVD-RAM discs.")
|
||||||
|
@Property("DVD-RAM Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsDvdRam;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports Blu-ray discs.")
|
||||||
|
@Property("Blu-ray Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsBluRay;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports HD DVD discs.")
|
||||||
|
@Property("HD DVD Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsHdDvd;
|
||||||
|
|
||||||
|
@Description("Indicates if the drive supports Ultra HD Blu-ray discs.")
|
||||||
|
@Property("Ultra HD Blu-ray Supported")
|
||||||
|
@HideInOverview
|
||||||
|
private ReadWrite supportsUltraHdBluRay;
|
||||||
|
|
||||||
|
@Description("The type of interface used by the drive. E.g.: SATA, IDE, etc.")
|
||||||
|
@Property("Interface Type")
|
||||||
|
@InputList
|
||||||
|
private String interfaceType;
|
||||||
|
|
||||||
|
@Description("The form factor of the CD drive. E.g.: 5.25\", 3.5\", etc.")
|
||||||
|
@Property("Form Factor")
|
||||||
|
@HideInOverview
|
||||||
|
@InputList
|
||||||
|
private String formFactor;
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package be.seeseepuff.pcinv.models;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.meta.*;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@AssetInfo(
|
||||||
|
displayName = "Power Supply",
|
||||||
|
pluralName = "Power Supplies",
|
||||||
|
type = "psu"
|
||||||
|
)
|
||||||
|
@Table(name = "psu_assets")
|
||||||
|
public class PowerSupplyAsset implements Asset
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
/// The generic asset associated with this RAM.
|
||||||
|
@OneToOne(orphanRemoval = true)
|
||||||
|
private GenericAsset asset;
|
||||||
|
|
||||||
|
@Description("The wattage rating of the power supply in watts.")
|
||||||
|
@Property("Wattage")
|
||||||
|
private int wattage;
|
||||||
|
|
||||||
|
@Description("The efficiency rating of the power supply, e.g., 80 Plus Bronze, Silver, Gold, Platinum, Titanium.")
|
||||||
|
@Property("Efficiency Rating")
|
||||||
|
@InputList
|
||||||
|
private String efficiencyRating;
|
||||||
|
|
||||||
|
@Description("The form factor of the power supply, e.g., ATX, SFX, etc.")
|
||||||
|
@Property("Form Factor")
|
||||||
|
@InputList
|
||||||
|
private String formFactor;
|
||||||
|
|
||||||
|
@Description("The number number of Molex connectors.")
|
||||||
|
@Property("4-pin Molex Connectors")
|
||||||
|
private int molexConnectors;
|
||||||
|
|
||||||
|
@Description("The number of 4-pin floppy connectors.")
|
||||||
|
@Property("4-pin Floppy Connectors")
|
||||||
|
private int floppyConnectors;
|
||||||
|
|
||||||
|
@Description("The number of SATA power connectors.")
|
||||||
|
@Property("15-pin SATA Connectors")
|
||||||
|
private int sataConnectors;
|
||||||
|
|
||||||
|
@Description("The number of 6-pin PCIe connectors.")
|
||||||
|
@Property("6-pin PCIe Connectors")
|
||||||
|
private int pcie6Connectors;
|
||||||
|
|
||||||
|
@Description("The number of 8-pin PCIe connectors.")
|
||||||
|
@Property("8-pin PCIe Connectors")
|
||||||
|
private int pcie8Connectors;
|
||||||
|
|
||||||
|
@Description("The number of 4-pin ATX 12V connectors.")
|
||||||
|
@Property("4-pin ATX 12V Connectors")
|
||||||
|
private int atx12vConnectors;
|
||||||
|
}
|
||||||
30
src/main/java/be/seeseepuff/pcinv/models/ReadWrite.java
Normal file
30
src/main/java/be/seeseepuff/pcinv/models/ReadWrite.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package be.seeseepuff.pcinv.models;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.meta.AssetEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An enum representing the read/write capabilities of a device.
|
||||||
|
* This is used to indicate whether a device can read, write, or both.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum ReadWrite implements AssetEnum {
|
||||||
|
/// The capacbilities are unknown.
|
||||||
|
UNKNOWN("unknown", "Unknown"),
|
||||||
|
/// The device can only read data.
|
||||||
|
READ("read", "Read Only"),
|
||||||
|
/// The device can only write data.
|
||||||
|
WRITE("write", "Write Only"),
|
||||||
|
/// The device can both read and write data.
|
||||||
|
READ_WRITE("read_write", "Read and Write")
|
||||||
|
;
|
||||||
|
private final String value;
|
||||||
|
private final String displayName;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDefaultValue() {
|
||||||
|
return this == UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
src/main/java/be/seeseepuff/pcinv/models/WorkLogEntry.java
Normal file
27
src/main/java/be/seeseepuff/pcinv/models/WorkLogEntry.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package be.seeseepuff.pcinv.models;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a work log entry in the system.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
public class WorkLogEntry {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
private GenericAsset asset;
|
||||||
|
|
||||||
|
/// The description of the work log entry.
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/// The date and time when the work log entry was created.
|
||||||
|
private ZonedDateTime date;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package be.seeseepuff.pcinv.repositories;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.models.CpuAsset;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface CpuRepository extends JpaRepository<CpuAsset, Long>, AssetRepository<CpuAsset> {
|
||||||
|
@Override
|
||||||
|
default Class<CpuAsset> getAssetType() {
|
||||||
|
return CpuAsset.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package be.seeseepuff.pcinv.repositories;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.models.FloppyDriveAsset;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface FloppyDriveRepository extends JpaRepository<FloppyDriveAsset, Long>, AssetRepository<FloppyDriveAsset> {
|
||||||
|
@Override
|
||||||
|
default Class<FloppyDriveAsset> getAssetType() {
|
||||||
|
return FloppyDriveAsset.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package be.seeseepuff.pcinv.repositories;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.models.NICAsset;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface NICRepository extends JpaRepository<NICAsset, Long>, AssetRepository<NICAsset> {
|
||||||
|
@Override
|
||||||
|
default Class<NICAsset> getAssetType() {
|
||||||
|
return NICAsset.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package be.seeseepuff.pcinv.repositories;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.models.OpticalDriveAsset;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface OpticalDriveRepository extends JpaRepository<OpticalDriveAsset, Long>, AssetRepository<OpticalDriveAsset> {
|
||||||
|
@Override
|
||||||
|
default Class<OpticalDriveAsset> getAssetType() {
|
||||||
|
return OpticalDriveAsset.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package be.seeseepuff.pcinv.repositories;
|
||||||
|
|
||||||
|
import be.seeseepuff.pcinv.models.PowerSupplyAsset;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface PowerSupplyRepository extends JpaRepository<PowerSupplyAsset, Long>, AssetRepository<PowerSupplyAsset> {
|
||||||
|
@Override
|
||||||
|
default Class<PowerSupplyAsset> getAssetType() {
|
||||||
|
return PowerSupplyAsset.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -216,6 +216,12 @@ public class AssetService {
|
|||||||
return Integer.parseInt(stringValue);
|
return Integer.parseInt(stringValue);
|
||||||
} else if (property.getType() == AssetProperty.Type.STRING) {
|
} else if (property.getType() == AssetProperty.Type.STRING) {
|
||||||
return stringValue;
|
return stringValue;
|
||||||
|
} else if (property.getType() == AssetProperty.Type.BOOLEAN) {
|
||||||
|
return switch (stringValue.toLowerCase()) {
|
||||||
|
case "true" -> true;
|
||||||
|
case "false" -> false;
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
} else if (property.getType().isEnum) {
|
} else if (property.getType().isEnum) {
|
||||||
for (var option : property.getOptions()) {
|
for (var option : property.getOptions()) {
|
||||||
if (option.getValue().equals(stringValue)) {
|
if (option.getValue().equals(stringValue)) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<body th:replace="~{fragments :: base(title='Browse assets', content=~{::content})}">
|
<body th:replace="~{fragments :: base(title='Browse assets', content=~{::content})}">
|
||||||
<div th:fragment="content">
|
<div th:fragment="content">
|
||||||
View device details
|
<h2>View device details</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li th:each="d : ${descriptors.getAssets()}" th:if="${d.visible}">
|
<li th:each="d : ${descriptors.getAssets()}" th:if="${d.visible}">
|
||||||
<a th:href="'/browse/'+${d.getType()}" th:text="${d.pluralName}"></a>
|
<a th:href="'/browse/'+${d.getType()}" th:text="${d.pluralName}"></a>
|
||||||
|
|||||||
@@ -1,21 +1,24 @@
|
|||||||
<body th:replace="~{fragments :: base(title='View '+${descriptor.pluralName}, content=~{::content})}">
|
<body th:replace="~{fragments :: base(title='View '+${descriptor.pluralName}, content=~{::content})}">
|
||||||
<div th:fragment="content">
|
<div th:fragment="content">
|
||||||
There are <span th:text="${assets.size()}"></span> <span th:text="${descriptor.pluralName}"></span> in the database.
|
<h2>There are <span th:text="${assets.size()}"></span> <span th:text="${descriptor.pluralName}"></span> in the database.</h2>
|
||||||
<table border="1" cellpadding="4">
|
<table border="1" cellpadding="4">
|
||||||
<tr bgcolor="#d3d3d3">
|
<tr bgcolor="#d3d3d3">
|
||||||
<th th:each="p : ${properties}" th:if="${!p.hideInOverview}" th:text="${p.displayName}"></th>
|
<th th:each="p : ${properties}" th:if="${!p.hideInOverview}" th:text="${p.displayName}"></th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr th:each="a : ${assets}">
|
<tr th:each="a : ${assets}">
|
||||||
<td th:each="p : ${properties}" th:if="${!p.hideInOverview}">
|
<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>
|
<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>
|
<span th:if="${p.name != 'qr'}" th:text="${p.renderValue(a)}"></span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a th:href="'/view/'+${a.getQr()}">View</a>
|
<a th:href="'/view/'+${a.getQr()}">View</a>
|
||||||
<a th:href="'/edit/'+${a.getQr()}">Edit</a>
|
<a th:href="'/edit/'+${a.getQr()}">Edit</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<p>
|
||||||
|
<a th:href="'/create/'+${descriptor.type}">Create a new <span th:text="${descriptor.displayName}"></span></a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<body th:replace="~{fragments :: base(title='Create '+${descriptor.displayName}, content=~{::content})}">
|
<body th:replace="~{fragments :: base(title='Create '+${descriptor.displayName}, content=~{::content})}">
|
||||||
<div th:fragment="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">
|
<form th:action="'/'+${action}+'/'+${asset != null ? asset.getQr() : descriptor.getType()}" method="post">
|
||||||
<div th:each="d : ${descriptors}">
|
<div th:each="d : ${descriptors}">
|
||||||
<h2 th:text="${d.displayName}"></h2>
|
<h2 th:text="${d.displayName}"></h2>
|
||||||
@@ -18,6 +18,15 @@
|
|||||||
</span>
|
</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}"/>
|
<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}"/>
|
||||||
<input th:case="INTEGER" type="number" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${p.getValue(asset)}" th:required="${p.required}"/>
|
<input th:case="INTEGER" type="number" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${p.getValue(asset)}" th:required="${p.required}"/>
|
||||||
|
<!-- <input th:case="BOOLEAN" type="checkbox" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="true" th:checked="${asset != null ? p.getValue(asset) : p.defaultValue}"/>-->
|
||||||
|
<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>
|
||||||
<select th:case="enum" th:id="${d.asString(p)}" th:name="${d.asString(p)}">
|
<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>
|
<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>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<body th:replace="~{fragments :: base(title='Select type to create', content=~{::content})}">
|
<body th:replace="~{fragments :: base(title='Select type to create', content=~{::content})}">
|
||||||
<div th:fragment="content">
|
<div th:fragment="content">
|
||||||
Create a new device
|
<h2>Create a new device</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li th:each="d : ${descriptors.getAssets()}" th:if="${d.visible}"><a th:href="'/create/'+${d.getType()}" th:text="${d.displayName}"></a></li>
|
<li th:each="d : ${descriptors.getAssets()}" th:if="${d.visible}"><a th:href="'/create/'+${d.getType()}" th:text="${d.displayName}"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
package be.seeseepuff.pcinv;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
|
|
||||||
@SpringBootTest
|
|
||||||
class PcinvApplicationTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void contextLoads() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user