3 Commits

27 changed files with 2949 additions and 139 deletions

View File

@@ -46,7 +46,8 @@ const createApp = async () => {
server: ${JSON.stringify(umamiConfig.server ?? "unknown")}, server: ${JSON.stringify(umamiConfig.server ?? "unknown")},
appVersion: ${JSON.stringify(umamiConfig.appVersion ?? "dev")}, appVersion: ${JSON.stringify(umamiConfig.appVersion ?? "dev")},
umamiHost: ${JSON.stringify(umamiConfig.umamiHost ?? "")}, umamiHost: ${JSON.stringify(umamiConfig.umamiHost ?? "")},
umamiWebsiteId: ${JSON.stringify(umamiConfig.umamiWebsiteId ?? "")} umamiWebsiteId: ${JSON.stringify(umamiConfig.umamiWebsiteId ?? "")},
timezone: ${JSON.stringify(process.env.TIMEZONE ?? "America/Chicago")}
}; };
`); `);
}); });

View File

@@ -17,15 +17,15 @@ export const alplaPurchaseHistory = pgTable("alpla_purchase_history", {
status: integer("status"), status: integer("status"),
statusText: text("status_text"), statusText: text("status_text"),
journalNum: integer("journal_num"), journalNum: integer("journal_num"),
add_date: timestamp("add_date").defaultNow(), add_date: timestamp("add_date", { withTimezone: true }).defaultNow(),
add_user: text("add_user"), add_user: text("add_user"),
upd_user: text("upd_user"), upd_user: text("upd_user"),
upd_date: timestamp("upd_date").defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
remark: text("remark"), remark: text("remark"),
approvedStatus: text("approved_status").default("new"), approvedStatus: text("approved_status").default("new"),
position: jsonb("position").default([]), position: jsonb("position").default([]),
createdAt: timestamp("created_at").defaultNow(), createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(), updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow(),
}); });
export const alplaPurchaseHistorySchema = export const alplaPurchaseHistorySchema =

View File

@@ -3,7 +3,9 @@ import { integer, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
export const analytics = pgTable("analytics", { export const analytics = pgTable("analytics", {
id: uuid("id").defaultRandom().primaryKey(), id: uuid("id").defaultRandom().primaryKey(),
createdAt: timestamp("created_at").defaultNow().notNull(), createdAt: timestamp("created_at", { withTimezone: true })
.defaultNow()
.notNull(),
method: text("method").notNull(), method: text("method").notNull(),
routePattern: text("route_pattern").notNull(), routePattern: text("route_pattern").notNull(),

View File

@@ -16,13 +16,13 @@ export const jobAuditLog = pgTable(
id: uuid("id").defaultRandom().primaryKey(), id: uuid("id").defaultRandom().primaryKey(),
jobName: text("job_name"), jobName: text("job_name"),
startedAt: timestamp("start_at"), startedAt: timestamp("start_at"),
finishedAt: timestamp("finished_at"), finishedAt: timestamp("finished_at", { withTimezone: true }),
durationMs: integer("duration_ms"), durationMs: integer("duration_ms"),
status: text("status"), //success | error status: text("status"), //success | error
errorMessage: text("error_message"), errorMessage: text("error_message"),
errorStack: text("error_stack"), errorStack: text("error_stack"),
metadata: jsonb("meta_data"), metadata: jsonb("meta_data"),
createdAt: timestamp("created_at").defaultNow(), createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
}, },
(table) => { (table) => {
return { return {

View File

@@ -15,7 +15,7 @@ export const user = pgTable("user", {
emailVerified: boolean("email_verified").default(false).notNull(), emailVerified: boolean("email_verified").default(false).notNull(),
image: text("image"), image: text("image"),
createdAt: timestamp("created_at").defaultNow().notNull(), createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at") updatedAt: timestamp("updated_at", { withTimezone: true })
.defaultNow() .defaultNow()
.$onUpdate(() => /* @__PURE__ */ new Date()) .$onUpdate(() => /* @__PURE__ */ new Date())
.notNull(), .notNull(),

View File

@@ -6,5 +6,5 @@ export const deploymentHistory = pgTable("deployment_history", {
buildNumber: integer("build_number").notNull(), buildNumber: integer("build_number").notNull(),
status: text("status").notNull(), // started, success, failed status: text("status").notNull(), // started, success, failed
message: text("message"), message: text("message"),
createdAt: timestamp("created_at").defaultNow(), createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
}); });

View File

@@ -28,11 +28,15 @@ export const analyticsDaily = pgTable(
avgDurationMs: integer("avg_duration_ms").notNull(), avgDurationMs: integer("avg_duration_ms").notNull(),
maxDurationMs: integer("max_duration_ms").notNull(), maxDurationMs: integer("max_duration_ms").notNull(),
firstHitAt: timestamp("first_hit_at").notNull(), firstHitAt: timestamp("first_hit_at", { withTimezone: true }).notNull(),
lastHitAt: timestamp("last_hit_at").notNull(), lastHitAt: timestamp("last_hit_at", { withTimezone: true }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(), createdAt: timestamp("created_at", { withTimezone: true })
updatedAt: timestamp("updated_at").defaultNow().notNull(), .defaultNow()
.notNull(),
updatedAt: timestamp("updated_at", { withTimezone: true })
.defaultNow()
.notNull(),
}, },
(table) => [ (table) => [
unique("analytics_daily_business_route_unique").on( unique("analytics_daily_business_route_unique").on(

View File

@@ -18,9 +18,9 @@ export const datamart = pgTable("datamart", {
active: boolean("active").default(true), active: boolean("active").default(true),
options: text("options").default(""), options: text("options").default(""),
public: boolean("public_access").default(false), public: boolean("public_access").default(false),
add_date: timestamp("add_date").defaultNow(), add_date: timestamp("add_date", { withTimezone: true }).defaultNow(),
add_user: text("add_user").default("lst-system"), add_user: text("add_user").default("lst-system"),
upd_date: timestamp("upd_date").defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
upd_user: text("upd_user").default("lst-system"), upd_user: text("upd_user").default("lst-system"),
}); });

View File

@@ -9,9 +9,9 @@ export const dockDoorScanners = pgTable("dock_door_scanners", {
dockId: text("dock_id"), dockId: text("dock_id"),
active: boolean("active").default(true), active: boolean("active").default(true),
currentLoadingOrder: text("current_loading_order").default(""), currentLoadingOrder: text("current_loading_order").default(""),
add_date: timestamp("add_date").defaultNow(), add_date: timestamp("add_date", { withTimezone: true }).defaultNow(),
add_user: text("add_user").default("lst-system"), add_user: text("add_user").default("lst-system"),
upd_date: timestamp("upd_date").defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
upd_user: text("upd_user").default("lst-system"), upd_user: text("upd_user").default("lst-system"),
}); });

View File

@@ -20,7 +20,7 @@ export const invHistoricalData = pgTable("inv_historical_data", {
whseId: text("whse_id").default(""), whseId: text("whse_id").default(""),
whseName: text("whse_name").default("missing whseName"), whseName: text("whse_name").default("missing whseName"),
upd_user: text("upd_user").default("lst-system"), upd_user: text("upd_user").default("lst-system"),
upd_date: timestamp("upd_date").defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
}); });
export const invHistoricalDataSchema = createSelectSchema(invHistoricalData); export const invHistoricalDataSchema = createSelectSchema(invHistoricalData);

View File

@@ -18,7 +18,7 @@ export const logs = pgTable("logs", {
stack: jsonb("stack").default([]), stack: jsonb("stack").default([]),
checked: boolean("checked").default(false), checked: boolean("checked").default(false),
hostname: text("hostname"), hostname: text("hostname"),
createdAt: timestamp("created_at").defaultNow(), createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
}); });
export const logSchema = createSelectSchema(logs); export const logSchema = createSelectSchema(logs);

View File

@@ -17,8 +17,12 @@ export const opendockApt = pgTable(
release: integer("release").notNull().unique("opendock_apt_release_unique"), release: integer("release").notNull().unique("opendock_apt_release_unique"),
openDockAptId: text("open_dock_apt_id").notNull(), openDockAptId: text("open_dock_apt_id").notNull(),
appointment: jsonb("appointment").notNull().default([]), appointment: jsonb("appointment").notNull().default([]),
upd_date: timestamp("upd_date").notNull().defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true })
createdAt: timestamp("created_at").notNull().defaultNow(), .notNull()
.defaultNow(),
createdAt: timestamp("created_at", { withTimezone: true })
.notNull()
.defaultNow(),
}, },
(table) => ({ (table) => ({
openDockAptIdIdx: index("opendock_apt_opendock_id_idx").on( openDockAptIdIdx: index("opendock_apt_opendock_id_idx").on(

View File

@@ -22,9 +22,13 @@ export const opendockArticleSetup = pgTable(
customerDescription: text("customer_description").notNull(), customerDescription: text("customer_description").notNull(),
loadType: loadTypeEnum("load_type").notNull().default("drop"), loadType: loadTypeEnum("load_type").notNull().default("drop"),
dock: text("dock").notNull(), dock: text("dock").notNull(),
upd_date: timestamp("upd_date").notNull().defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true })
.notNull()
.defaultNow(),
upd_user: text("upd_user").notNull().default("lst-system"), upd_user: text("upd_user").notNull().default("lst-system"),
createdAt: timestamp("created_at").notNull().defaultNow(), createdAt: timestamp("created_at", { withTimezone: true })
.notNull()
.defaultNow(),
add_user: text("add_user").notNull().default("lst-system"), add_user: text("add_user").notNull().default("lst-system"),
}, },
(table) => ({ (table) => ({

View File

@@ -6,9 +6,13 @@ export const opendockDockSetup = pgTable("opendock_dock_setup", {
id: uuid("id").defaultRandom().primaryKey(), id: uuid("id").defaultRandom().primaryKey(),
name: text("name").notNull(), name: text("name").notNull(),
dockID: text("dock_id").notNull(), dockID: text("dock_id").notNull(),
upd_date: timestamp("upd_date").notNull().defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true })
.notNull()
.defaultNow(),
upd_user: text("upd_user").notNull().default("lst-system"), upd_user: text("upd_user").notNull().default("lst-system"),
createdAt: timestamp("created_at").notNull().defaultNow(), createdAt: timestamp("created_at", { withTimezone: true })
.notNull()
.defaultNow(),
add_user: text("add_user").notNull().default("lst-system"), add_user: text("add_user").notNull().default("lst-system"),
}); });

View File

@@ -7,5 +7,5 @@ export const printerLog = pgTable("printer_log", {
printerSN: text("printer_sn"), printerSN: text("printer_sn"),
condition: text("condition").notNull(), condition: text("condition").notNull(),
message: text("message"), message: text("message"),
createdAt: timestamp("created_at").defaultNow(), createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
}); });

View File

@@ -28,8 +28,8 @@ export const printerData = pgTable(
printDelay: integer("printDelay").default(90), printDelay: integer("printDelay").default(90),
processes: jsonb("processes").default([]), processes: jsonb("processes").default([]),
printDelayOverride: boolean("print_delay_override").default(false), // this will be more for if we have the lot time active but want to over ride this single line for some reason printDelayOverride: boolean("print_delay_override").default(false), // this will be more for if we have the lot time active but want to over ride this single line for some reason
add_Date: timestamp("add_Date").defaultNow(), add_Date: timestamp("add_Date", { withTimezone: true }).defaultNow(),
upd_date: timestamp("upd_date").defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
}, },
(table) => [ (table) => [
//uniqueIndex("emailUniqueIndex").on(sql`lower(${table.email})`), //uniqueIndex("emailUniqueIndex").on(sql`lower(${table.email})`),

View File

@@ -30,8 +30,8 @@ export const scanUser = pgTable(
role: mobileRoleEnum("role").notNull().default("user"), role: mobileRoleEnum("role").notNull().default("user"),
active: boolean("active").default(true), active: boolean("active").default(true),
lastScan: timestamp("last_scan").defaultNow(), lastScan: timestamp("last_scan").defaultNow(),
add_Date: timestamp("add_Date").defaultNow(), add_Date: timestamp("add_Date", { withTimezone: true }).defaultNow(),
upd_date: timestamp("upd_date").defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
}, },
(table) => ({ (table) => ({
userNotificationUnique: unique("scan_user_unique").on( userNotificationUnique: unique("scan_user_unique").on(

View File

@@ -13,7 +13,7 @@ export const scanLog = pgTable("scan_log", {
status: text("status"), status: text("status"),
scannerVersion: text("scanner_version").default("0"), scannerVersion: text("scanner_version").default("0"),
lines: jsonb("lines").default([]), lines: jsonb("lines").default([]),
add_Date: timestamp("add_date").defaultNow(), add_Date: timestamp("add_date", { withTimezone: true }).defaultNow(),
}); });
export const scanLogSchema = createSelectSchema(scanLog); export const scanLogSchema = createSelectSchema(scanLog);

View File

@@ -22,7 +22,7 @@ export const serverData = pgTable(
contactPhone: text("contact_phone"), contactPhone: text("contact_phone"),
active: boolean("active").default(true), active: boolean("active").default(true),
serverLoc: text("server_loc"), serverLoc: text("server_loc"),
lastUpdated: timestamp("last_updated").defaultNow(), lastUpdated: timestamp("last_updated", { withTimezone: true }).defaultNow(),
buildNumber: integer("build_number"), buildNumber: integer("build_number"),
isUpgrading: boolean("is_upgrading").default(false), isUpgrading: boolean("is_upgrading").default(false),
}, },

View File

@@ -32,9 +32,9 @@ export const settings = pgTable(
settingType: settingType(), settingType: settingType(),
seedVersion: integer("seed_version").default(1), // this is intended for if we want to update the settings. seedVersion: integer("seed_version").default(1), // this is intended for if we want to update the settings.
add_User: text("add_User").default("LST_System").notNull(), add_User: text("add_User").default("LST_System").notNull(),
add_Date: timestamp("add_Date").defaultNow(), add_Date: timestamp("add_Date", { withTimezone: true }).defaultNow(),
upd_user: text("upd_User").default("LST_System").notNull(), upd_user: text("upd_User").default("LST_System").notNull(),
upd_date: timestamp("upd_date").defaultNow(), upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
}, },
(table) => [ (table) => [
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`), // uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),

View File

@@ -12,11 +12,11 @@ import type z from "zod";
export const appStats = pgTable("app_stats", { export const appStats = pgTable("app_stats", {
id: text("id").primaryKey().default("primary"), id: text("id").primaryKey().default("primary"),
currentBuild: integer("current_build").notNull().default(1), currentBuild: integer("current_build").notNull().default(1),
lastBuildAt: timestamp("last_build_at"), lastBuildAt: timestamp("last_build_at", { withTimezone: true }),
lastDeployAt: timestamp("last_deploy_at"), lastDeployAt: timestamp("last_deploy_at", { withTimezone: true }),
building: boolean("building").notNull().default(false), building: boolean("building").notNull().default(false),
updating: boolean("updating").notNull().default(false), updating: boolean("updating").notNull().default(false),
lastUpdated: timestamp("last_updated").defaultNow(), lastUpdated: timestamp("last_updated", { withTimezone: true }).defaultNow(),
meta: jsonb("meta").$type<Record<string, unknown>>().default({}), meta: jsonb("meta").$type<Record<string, unknown>>().default({}),
}); });

View File

@@ -0,0 +1,49 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { Slot } from "radix-ui"
import { cn } from "@/lib/utils"
const badgeVariants = cva(
"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
secondary:
"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
destructive:
"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
outline:
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
ghost:
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
link: "text-primary underline-offset-4 hover:underline",
},
},
defaultVariants: {
variant: "default",
},
}
)
function Badge({
className,
variant = "default",
asChild = false,
...props
}: React.ComponentProps<"span"> &
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
const Comp = asChild ? Slot.Root : "span"
return (
<Comp
data-slot="badge"
data-variant={variant}
className={cn(badgeVariants({ variant }), className)}
{...props}
/>
)
}
export { Badge, badgeVariants }

View File

@@ -5,6 +5,7 @@ type RuntimeConfig = {
appVersion: string; appVersion: string;
umamiHost: string; umamiHost: string;
umamiWebsiteId: string; umamiWebsiteId: string;
timezone: string;
}; };
declare global { declare global {
@@ -23,6 +24,7 @@ export const runtimeConfig: RuntimeConfig = {
appVersion: window.LST_CONFIG?.appVersion ?? "dev", appVersion: window.LST_CONFIG?.appVersion ?? "dev",
umamiHost: window.LST_CONFIG?.umamiHost ?? "", umamiHost: window.LST_CONFIG?.umamiHost ?? "",
umamiWebsiteId: window.LST_CONFIG?.umamiWebsiteId ?? "", umamiWebsiteId: window.LST_CONFIG?.umamiWebsiteId ?? "",
timezone: window.LST_CONFIG?.timezone ?? "America/Chicago",
}; };
export function loadUmami() { export function loadUmami() {

View File

@@ -1,6 +1,16 @@
import { createFileRoute, redirect } from "@tanstack/react-router"; import { createFileRoute, redirect } from "@tanstack/react-router";
import { createColumnHelper } from "@tanstack/react-table";
import { formatInTimeZone } from "date-fns-tz";
import { useSocketRoom } from "@/hooks/socket.io.hook"; import { useSocketRoom } from "@/hooks/socket.io.hook";
import { authClient } from "@/lib/auth-client"; import { authClient } from "@/lib/auth-client";
import { Badge } from "../../components/ui/badge";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "../../components/ui/tooltip";
import LstTable from "../../lib/tableStuff/LstTable";
import SearchableHeader from "../../lib/tableStuff/SearchableHeader";
export const Route = createFileRoute("/admin/logs")({ export const Route = createFileRoute("/admin/logs")({
beforeLoad: async ({ location }) => { beforeLoad: async ({ location }) => {
@@ -37,117 +47,168 @@ interface LogEntry {
[key: string]: any; // catch any extra fields [key: string]: any; // catch any extra fields
} }
function LevelBadge({ level }: { level: number }) { function LevelBadge({ level }: { level: string }) {
const config: Record<number, { label: string; className: string }> = { const config: Record<string, { label: string; className: string }> = {
10: { label: "TRACE", className: "bg-gray-100 text-gray-600" }, trace: { label: "TRACE", className: "bg-gray-100 text-gray-600" },
20: { label: "DEBUG", className: "bg-blue-100 text-blue-700" }, debug: { label: "DEBUG", className: "bg-blue-50 text-blue-700" },
30: { label: "INFO", className: "bg-green-100 text-green-700" }, info: { label: "INFO", className: "bg-green-50 text-green-700" },
40: { label: "WARN", className: "bg-yellow-100 text-yellow-700" }, warn: { label: "WARN", className: "bg-yellow-100 text-yellow-700" },
50: { label: "ERROR", className: "bg-red-100 text-red-700" }, error: { label: "ERROR", className: "bg-red-50 text-red-700" },
60: { label: "FATAL", className: "bg-purple-100 text-purple-700" }, fatal: { label: "FATAL", className: "bg-purple-100 text-purple-700" },
}; };
const { label, className } = config[level] ?? { const badge = config[level];
label: String(level),
className: "bg-gray-100",
};
return ( return (
<span className={`px-2 py-0.5 rounded text-xs font-medium ${className}`}> <Badge
{label} className={`rounded px-2 py-0.5 text-xs font-medium ${
</span> badge?.className ?? "bg-gray-100 text-gray-600"
}`}
>
{badge?.label ?? level}
</Badge>
); );
} }
function RouteComponent() { function RouteComponent() {
const { data: logs, info: logsInfo } = useSocketRoom<LogEntry>("logs"); const { data: logs } = useSocketRoom<LogEntry>("logs");
//const { user } = Route.useRouteContext(); const columnHelper = createColumnHelper<any>();
//const router = useRouter();
// const [logs, setLogs] = useState<LogEntry[]>([]);
// const [logsInfo, setLogInfo] = useState(
// "No logs yet — join the room to start receiving",
// );
// useEffect(() => { const column = [
// // Connect if not already connected columnHelper.accessor("createdAt", {
// if (!socket.connected) { header: ({ column }) => <SearchableHeader column={column} title="Time" />,
// socket.connect(); filterFn: "includesString",
// } cell: (i) =>
formatInTimeZone(
// socket.on("connect", () => { i.getValue(),
// socket.emit("join-room", "logs"); `${window.LST_CONFIG?.timezone}`,
// }); "MM/dd/yyyy HH:mm:ss",
),
// socket.emit("join-room", "logs"); }),
// socket.on( columnHelper.accessor("level", {
// "room-update", header: ({ column }) => (
// (data: { payloads: LogEntry[]; roomId: string }) => { <SearchableHeader column={column} title="Level" searchable={true} />
// setLogs((prev) => [...data.payloads, ...prev]); ),
// }, filterFn: "includesString",
// ); cell: (i) => <LevelBadge level={i.getValue()} />,
}),
// socket.on("room-error", (data) => { columnHelper.accessor("module", {
// setLogInfo(data.message); header: ({ column }) => (
// }); <SearchableHeader column={column} title="Module" />
),
// // socket.on("logs", (data) => { filterFn: "includesString",
// // console.log(data); cell: (i) => i.getValue(),
// // setLogs((prev) => [...data.payloads, ...prev]); }),
// // }); columnHelper.accessor("subModule", {
header: ({ column }) => (
// // Cleanup listeners on unmount <SearchableHeader column={column} title="Submodule" />
// return () => { ),
// socket.emit("leave-room", "logs"); filterFn: "includesString",
// socket.off("room-update"); cell: (i) => i.getValue(),
// socket.off("room-error"); }),
// socket.off("logs"); columnHelper.accessor("hostname", {
// }; header: ({ column }) => (
// }, []); <SearchableHeader column={column} title="Client" />
return ( ),
<div> filterFn: "includesString",
{/* Log Table */} cell: (i) => i.getValue(),
<div className="rounded border overflow-auto max-h-[600px]"> }),
<table className="w-full text-sm"> columnHelper.accessor("message", {
<thead className="bg-muted sticky top-0"> header: ({ column }) => (
<tr> <SearchableHeader column={column} title="Message" />
<th className="text-left px-3 py-2">Time</th> ),
<th className="text-left px-3 py-2">Level</th> filterFn: "includesString",
<th className="text-left px-3 py-2">Module</th> cell: (i) => {
<th className="text-left px-3 py-2">Host</th> return i.getValue().length > 50 ? (
<th className="text-left px-3 py-2">Message</th> <Tooltip>
</tr> <TooltipTrigger>
</thead> <p>{i.getValue().slice(0, 50)}...</p>
<tbody> </TooltipTrigger>
{logs.length === 0 ? ( <TooltipContent>
<tr> <p className="text-wrap max-w-48">{i.getValue()}</p>
<td </TooltipContent>
colSpan={6} </Tooltip>
className="text-center py-6 text-muted-foreground"
>
{logsInfo}
</td>
</tr>
) : ( ) : (
logs.map((log, i) => ( i.getValue()
<tr );
key={`${log.id}-${i}`} },
className="border-t hover:bg-muted/50" }),
columnHelper.accessor("stack", {
header: ({ column }) => (
<SearchableHeader column={column} title="Stack" />
),
filterFn: "includesString",
cell: (i) => {
const stack = i.row.original.stack;
if (!stack) return <span className="text-muted-foreground"></span>;
return (
<Tooltip>
<TooltipTrigger>
<p className="max-w-[350px] truncate text-left font-mono text-xs text-muted-foreground hover:text-foreground">
{stack.length !== 0 ? "Hover to see stack error" : "-"}
</p>
</TooltipTrigger>
<TooltipContent
side="left"
align="start"
className="max-w-[900px] bg-zinc-950 text-zinc-50"
> >
<td className="px-3 py-2 whitespace-nowrap"> <pre className="max-h-[500px] overflow-auto whitespace-pre-wrap rounded-md p-3 text-xs leading-relaxed">
{new Date(log.createdAt).toLocaleTimeString()} <code>{JSON.stringify(stack, null, 2)}</code>
</td> </pre>
<td className="px-3 py-2"> </TooltipContent>
<LevelBadge level={log.level} /> </Tooltip>
</td> );
<td className="px-3 py-2">{log.module}</td> },
<td className="px-3 py-2">{log.hostname}</td> }),
<td className="px-3 py-2 max-w-sm truncate">{log.message}</td> ];
</tr> return (
)) // <div>
)} // {/* Log Table */}
</tbody> // <div className="rounded border overflow-auto max-h-[600px]">
</table> // <table className="w-full text-sm">
</div> // <thead className="bg-muted sticky top-0">
</div> // <tr>
// <th className="text-left px-3 py-2">Time</th>
// <th className="text-left px-3 py-2">Level</th>
// <th className="text-left px-3 py-2">Module</th>
// <th className="text-left px-3 py-2">Host</th>
// <th className="text-left px-3 py-2">Message</th>
// </tr>
// </thead>
// <tbody>
// {logs.length === 0 ? (
// <tr>
// <td
// colSpan={6}
// className="text-center py-6 text-muted-foreground"
// >
// {logsInfo}
// </td>
// </tr>
// ) : (
// logs.map((log, i) => (
// <tr
// key={`${log.id}-${i}`}
// className="border-t hover:bg-muted/50"
// >
// <td className="px-3 py-2 whitespace-nowrap">
// {new Date(log.createdAt).toLocaleTimeString()}
// </td>
// <td className="px-3 py-2">
// <LevelBadge level={log.level} />
// </td>
// <td className="px-3 py-2">{log.module}</td>
// <td className="px-3 py-2">{log.hostname}</td>
// <td className="px-3 py-2 max-w-sm truncate">{log.message}</td>
// </tr>
// ))
// )}
// </tbody>
// </table>
// </div>
// </div>
<LstTable data={logs} columns={column} pageSize={50} />
); );
} }

View File

@@ -0,0 +1,69 @@
ALTER TABLE "alpla_purchase_history" ALTER COLUMN "add_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "alpla_purchase_history" ALTER COLUMN "add_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "alpla_purchase_history" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "alpla_purchase_history" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "alpla_purchase_history" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "alpla_purchase_history" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "alpla_purchase_history" ALTER COLUMN "updated_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "alpla_purchase_history" ALTER COLUMN "updated_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "analytics" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "analytics" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "job_audit_log" ALTER COLUMN "finished_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "job_audit_log" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "job_audit_log" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "user" ALTER COLUMN "updated_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "user" ALTER COLUMN "updated_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "deployment_history" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "deployment_history" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "analytics_daily" ALTER COLUMN "first_hit_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "analytics_daily" ALTER COLUMN "last_hit_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "analytics_daily" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "analytics_daily" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "analytics_daily" ALTER COLUMN "updated_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "analytics_daily" ALTER COLUMN "updated_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "datamart" ALTER COLUMN "add_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "datamart" ALTER COLUMN "add_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "datamart" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "datamart" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "dock_door_scanners" ALTER COLUMN "add_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "dock_door_scanners" ALTER COLUMN "add_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "dock_door_scanners" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "dock_door_scanners" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "inv_historical_data" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "inv_historical_data" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "logs" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "logs" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "opendock_apt" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "opendock_apt" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "opendock_apt" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "opendock_apt" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "opendock_article_setup" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "opendock_article_setup" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "opendock_article_setup" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "opendock_article_setup" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "opendock_dock_setup" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "opendock_dock_setup" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "opendock_dock_setup" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "opendock_dock_setup" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "printer_log" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "printer_log" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "printer_data" ALTER COLUMN "add_Date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "printer_data" ALTER COLUMN "add_Date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "printer_data" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "printer_data" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "scan_log" ALTER COLUMN "add_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "scan_log" ALTER COLUMN "add_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "scan_users" ALTER COLUMN "add_Date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "scan_users" ALTER COLUMN "add_Date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "scan_users" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "scan_users" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "server_data" ALTER COLUMN "last_updated" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "server_data" ALTER COLUMN "last_updated" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "settings" ALTER COLUMN "add_Date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "settings" ALTER COLUMN "add_Date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "settings" ALTER COLUMN "upd_date" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "settings" ALTER COLUMN "upd_date" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "app_stats" ALTER COLUMN "last_build_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "app_stats" ALTER COLUMN "last_deploy_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "app_stats" ALTER COLUMN "last_updated" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "app_stats" ALTER COLUMN "last_updated" SET DEFAULT now();

File diff suppressed because it is too large Load Diff

View File

@@ -414,6 +414,13 @@
"when": 1779846894283, "when": 1779846894283,
"tag": "0058_damp_donald_blake", "tag": "0058_damp_donald_blake",
"breakpoints": true "breakpoints": true
},
{
"idx": 59,
"version": "7",
"when": 1780349486711,
"tag": "0059_sparkling_joystick",
"breakpoints": true
} }
] ]
} }