2 Commits

2 changed files with 14 additions and 21 deletions

View File

@@ -1,20 +1,9 @@
FROM oven/bun:1.0.25-slim as builder FROM oven/bun:1.0.25-slim as builder
WORKDIR /app WORKDIR /app
# Copy package files COPY dist dist
COPY package*.json ./ COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY bun.lockb ./
# Install dependencies
RUN bun install
# Copy source files
COPY . .
# Build the application
RUN bun run build
# Production stage
FROM nginx:alpine FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf

View File

@@ -22,6 +22,7 @@ export const SystemView = () => {
} }
const saveSignature = async (signature: Signature): Promise<void> => { const saveSignature = async (signature: Signature): Promise<void> => {
console.log(signature);
try { try {
// Check if signature already exists // Check if signature already exists
let existingRecord: SignatureRecord | null = null; let existingRecord: SignatureRecord | null = null;
@@ -34,7 +35,7 @@ export const SystemView = () => {
const newScannedPercentage = parseScannedPercentage(signature.scanned); const newScannedPercentage = parseScannedPercentage(signature.scanned);
if (existingRecord) { if (existingRecord) {
const updatedSignature: Pick<SignatureRecord, 'updated' | 'type' | 'name' | 'scanned'> = { const updatedSignature: Pick<SignatureRecord, 'updated' | 'type' | 'name' | 'scanned' | 'note'> = {
updated: new Date().toISOString() updated: new Date().toISOString()
} }
// Existing record has no type and our new signature has a type // Existing record has no type and our new signature has a type
@@ -47,6 +48,8 @@ export const SystemView = () => {
const existingScannedPercentage = parseScannedPercentage(existingRecord.scanned); const existingScannedPercentage = parseScannedPercentage(existingRecord.scanned);
if (newScannedPercentage >= existingScannedPercentage) if (newScannedPercentage >= existingScannedPercentage)
updatedSignature.scanned = signature.scanned; updatedSignature.scanned = signature.scanned;
if (!!!existingRecord.note && !!signature.note)
updatedSignature.note = signature.note;
await pb.collection('signature').update(existingRecord.id, updatedSignature); await pb.collection('signature').update(existingRecord.id, updatedSignature);
console.log(`Updated signature ${signature.identifier}: ${existingScannedPercentage}% -> ${newScannedPercentage}%`); console.log(`Updated signature ${signature.identifier}: ${existingScannedPercentage}% -> ${newScannedPercentage}%`);
} else { } else {
@@ -57,7 +60,8 @@ export const SystemView = () => {
name: signature.signame, name: signature.signame,
type: signature.type, type: signature.type,
dangerous: signature.dangerous, dangerous: signature.dangerous,
scanned: signature.scanned scanned: signature.scanned,
note: signature.note
}); });
console.log(`Created new signature ${signature.identifier} with ${newScannedPercentage}% scan`); console.log(`Created new signature ${signature.identifier} with ${newScannedPercentage}% scan`);
} }
@@ -70,10 +74,10 @@ export const SystemView = () => {
const deleteSignature = async (signatureId: string): Promise<void> => { const deleteSignature = async (signatureId: string): Promise<void> => {
try { try {
await pb.collection('signature').delete(signatureId); await pb.collection('signature').delete(signatureId);
// Invalidate queries to refresh the data // Invalidate queries to refresh the data
queryClient.invalidateQueries({ queryKey: ['signatures', system] }); queryClient.invalidateQueries({ queryKey: ['signatures', system] });
toast({ toast({
title: "Signature Deleted", title: "Signature Deleted",
description: "The signature has been successfully deleted.", description: "The signature has been successfully deleted.",
@@ -93,14 +97,14 @@ export const SystemView = () => {
try { try {
// Get the system ID for the current system // Get the system ID for the current system
const systemId = await getSystemId(system); const systemId = await getSystemId(system);
console.log('Updating signature:', { console.log('Updating signature:', {
identifier: updatedSignature.identifier, identifier: updatedSignature.identifier,
systemId, systemId,
system, system,
updatedSignature updatedSignature
}); });
// Find the signature by identifier and system // Find the signature by identifier and system
const existingRecord = await pb.collection('signature').getFirstListItem( const existingRecord = await pb.collection('signature').getFirstListItem(
`identifier='${updatedSignature.identifier}' && system='${systemId}'` `identifier='${updatedSignature.identifier}' && system='${systemId}'`
@@ -132,10 +136,10 @@ export const SystemView = () => {
console.log('Update data:', updateData); console.log('Update data:', updateData);
await pb.collection('signature').update(existingRecord.id, updateData); await pb.collection('signature').update(existingRecord.id, updateData);
// Invalidate queries to refresh the data // Invalidate queries to refresh the data
queryClient.invalidateQueries({ queryKey: ['signatures', system] }); queryClient.invalidateQueries({ queryKey: ['signatures', system] });
toast({ toast({
title: "Signature Updated", title: "Signature Updated",
description: "The signature has been successfully updated.", description: "The signature has been successfully updated.",