3 Commits

Author SHA1 Message Date
7cd7d11a40 Update deploy workflow
Some checks failed
Build / build (push) Successful in 3m13s
Deploy / build (push) Failing after 4m2s
2025-06-09 08:50:31 +02:00
ab06c37a71 Add CpuAsset model and CpuRepository for CPU asset management 2025-06-09 08:46:04 +02:00
54231df858 Add ReadWrite enum and update CdDriveAsset to use ReadWrite for support properties 2025-06-09 08:42:43 +02:00
6 changed files with 137 additions and 56 deletions

View File

@@ -16,7 +16,7 @@ jobs:
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}}

View File

@@ -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;
@@ -58,6 +59,7 @@ public class AssetProperty {
BOOLEAN(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;
@@ -155,6 +157,8 @@ public class AssetProperty {
return Type.BOOLEAN; 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());
} }

View File

@@ -24,104 +24,74 @@ public class CdDriveAsset implements Asset
@OneToOne(orphanRemoval = true) @OneToOne(orphanRemoval = true)
private GenericAsset asset; private GenericAsset asset;
@Description("Indicates if the drive supports reading CD-ROM discs.") @Description("Indicates if the drive supports CD-ROM discs.")
@Property("CD-ROM Supported") @Property("CD-ROM Supported")
@HideInOverview @HideInOverview
private Boolean supportsCdRom; private ReadWrite supportsCdRom;
@Description("Indicates if the drive supports reading CD-R discs.") @Description("Indicates if the drive supports CD-R discs.")
@Property("CD-R Supported") @Property("CD-R Supported")
@HideInOverview @HideInOverview
private Boolean supportsCdR; private ReadWrite supportsCdR;
@Description("Indicates if the drive supports writing CD-R discs.") @Description("Indicates if the drive supports CD-RW discs.")
@Property("CD-R Writing Supported")
@HideInOverview
private Boolean supportsCdRwriting;
@Description("Indicates if the drive supports reading CD-RW discs.")
@Property("CD-RW Supported") @Property("CD-RW Supported")
@HideInOverview @HideInOverview
private Boolean supportsCdRw; private ReadWrite supportsCdRw;
@Description("Indicates if the drive supports writing CD-RW discs.") @Description("Indicates if the drive supports DVD discs.")
@Property("CD-RW Writing Supported")
@HideInOverview
private Boolean supportsCdRwwriting;
@Description("Indicates if the drive supports reading DVD discs.")
@Property("DVD Supported") @Property("DVD Supported")
@HideInOverview @HideInOverview
private Boolean supportsDvd; private ReadWrite supportsDvd;
@Description("Indicates if the drive supports reading DVD-R discs.") @Description("Indicates if the drive supports DVD-R discs.")
@Property("DVD-R Supported") @Property("DVD-R Supported")
@HideInOverview @HideInOverview
private Boolean supportsDvdR; private ReadWrite supportsDvdR;
@Description("Indicates if the drive supports writing DVD-R discs.") @Description("Indicates if the drive supports DVD-RW discs.")
@Property("DVD-R Writing Supported")
@HideInOverview
private Boolean supportsDvdRwriting;
@Description("Indicates if the drive supports reading DVD-RW discs.")
@Property("DVD-RW Supported") @Property("DVD-RW Supported")
@HideInOverview @HideInOverview
private Boolean supportsDvdRw; private ReadWrite supportsDvdRw;
@Description("Indicates if the drive supports writing DVD-RW discs.") @Description("Indicates if the drive supports DVD+R discs.")
@Property("DVD-RW Writing Supported")
@HideInOverview
private Boolean supportsDvdRwwriting;
@Description("Indicates if the drive supports reading DVD+R discs.")
@Property("DVD+R Supported") @Property("DVD+R Supported")
@HideInOverview @HideInOverview
private Boolean supportsDvdPlusR; private ReadWrite supportsDvdPlusR;
@Description("Indicates if the drive supports writing DVD+R discs.") @Description("Indicates if the drive supports DVD+RW discs.")
@Property("DVD+R Writing Supported")
@HideInOverview
private Boolean supportsDvdPlusRwriting;
@Description("Indicates if the drive supports reading DVD+RW discs.")
@Property("DVD+RW Supported") @Property("DVD+RW Supported")
@HideInOverview @HideInOverview
private Boolean supportsDvdPlusRw; private ReadWrite supportsDvdPlusRw;
@Description("Indicates if the drive supports writing DVD+RW discs.") @Description("Indicates if the drive supports DVD-RAM discs.")
@Property("DVD+RW Writing Supported")
@HideInOverview
private Boolean supportsDvdPlusRwwriting;
@Description("Indicates if the drive supports reading DVD-RAM discs.")
@Property("DVD-RAM Supported") @Property("DVD-RAM Supported")
@HideInOverview @HideInOverview
private Boolean supportsDvdRam; private ReadWrite supportsDvdRam;
@Description("Indicates if the drive supports reading Blu-ray discs.") @Description("Indicates if the drive supports Blu-ray discs.")
@Property("Blu-ray Supported") @Property("Blu-ray Supported")
@HideInOverview @HideInOverview
private Boolean supportsBluRay; private ReadWrite supportsBluRay;
@Description("Indicates if the drive supports reading HD DVD discs.") @Description("Indicates if the drive supports HD DVD discs.")
@Property("HD DVD Supported") @Property("HD DVD Supported")
@HideInOverview @HideInOverview
private Boolean supportsHdDvd; private ReadWrite supportsHdDvd;
@Description("Indicates if the drive supports reading Ultra HD Blu-ray discs.") @Description("Indicates if the drive supports Ultra HD Blu-ray discs.")
@Property("Ultra HD Blu-ray Supported") @Property("Ultra HD Blu-ray Supported")
@HideInOverview @HideInOverview
private Boolean supportsUltraHdBluRay; private ReadWrite supportsUltraHdBluRay;
@Description("The type of interface used by the drive. E.g.: SATA, IDE, etc.") @Description("The type of interface used by the drive. E.g.: SATA, IDE, etc.")
@Property("Interface Type") @Property("Interface Type")
@HideInOverview
@InputList @InputList
private String interfaceType; private String interfaceType;
@Description("The form factor of the CD drive. E.g.: 5.25\", 3.5\", etc.") @Description("The form factor of the CD drive. E.g.: 5.25\", 3.5\", etc.")
@Property("Form Factor") @Property("Form Factor")
@HideInOverview
@InputList @InputList
private String formFactor; private String formFactor;
} }

View 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;
}

View 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;
}
}

View File

@@ -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;
}
}