Compare commits
3 Commits
bb7931d6c8
...
40edbc3eae
| Author | SHA1 | Date | |
|---|---|---|---|
| 40edbc3eae | |||
| 2558b2e5bb | |||
| 45a0dee9ca |
@@ -46,7 +46,8 @@ const createApp = async () => {
|
||||
server: ${JSON.stringify(umamiConfig.server ?? "unknown")},
|
||||
appVersion: ${JSON.stringify(umamiConfig.appVersion ?? "dev")},
|
||||
umamiHost: ${JSON.stringify(umamiConfig.umamiHost ?? "")},
|
||||
umamiWebsiteId: ${JSON.stringify(umamiConfig.umamiWebsiteId ?? "")}
|
||||
umamiWebsiteId: ${JSON.stringify(umamiConfig.umamiWebsiteId ?? "")},
|
||||
timezone: ${JSON.stringify(process.env.TIMEZONE ?? "America/Chicago")}
|
||||
};
|
||||
`);
|
||||
});
|
||||
|
||||
@@ -17,15 +17,15 @@ export const alplaPurchaseHistory = pgTable("alpla_purchase_history", {
|
||||
status: integer("status"),
|
||||
statusText: text("status_text"),
|
||||
journalNum: integer("journal_num"),
|
||||
add_date: timestamp("add_date").defaultNow(),
|
||||
add_date: timestamp("add_date", { withTimezone: true }).defaultNow(),
|
||||
add_user: text("add_user"),
|
||||
upd_user: text("upd_user"),
|
||||
upd_date: timestamp("upd_date").defaultNow(),
|
||||
upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
|
||||
remark: text("remark"),
|
||||
approvedStatus: text("approved_status").default("new"),
|
||||
position: jsonb("position").default([]),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
updatedAt: timestamp("updated_at").defaultNow(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow(),
|
||||
});
|
||||
|
||||
export const alplaPurchaseHistorySchema =
|
||||
|
||||
@@ -3,7 +3,9 @@ import { integer, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
||||
export const analytics = pgTable("analytics", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
|
||||
method: text("method").notNull(),
|
||||
routePattern: text("route_pattern").notNull(),
|
||||
|
||||
@@ -16,13 +16,13 @@ export const jobAuditLog = pgTable(
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
jobName: text("job_name"),
|
||||
startedAt: timestamp("start_at"),
|
||||
finishedAt: timestamp("finished_at"),
|
||||
finishedAt: timestamp("finished_at", { withTimezone: true }),
|
||||
durationMs: integer("duration_ms"),
|
||||
status: text("status"), //success | error
|
||||
errorMessage: text("error_message"),
|
||||
errorStack: text("error_stack"),
|
||||
metadata: jsonb("meta_data"),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
||||
},
|
||||
(table) => {
|
||||
return {
|
||||
|
||||
@@ -15,7 +15,7 @@ export const user = pgTable("user", {
|
||||
emailVerified: boolean("email_verified").default(false).notNull(),
|
||||
image: text("image"),
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updated_at")
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true })
|
||||
.defaultNow()
|
||||
.$onUpdate(() => /* @__PURE__ */ new Date())
|
||||
.notNull(),
|
||||
|
||||
@@ -6,5 +6,5 @@ export const deploymentHistory = pgTable("deployment_history", {
|
||||
buildNumber: integer("build_number").notNull(),
|
||||
status: text("status").notNull(), // started, success, failed
|
||||
message: text("message"),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
||||
});
|
||||
|
||||
@@ -28,11 +28,15 @@ export const analyticsDaily = pgTable(
|
||||
avgDurationMs: integer("avg_duration_ms").notNull(),
|
||||
maxDurationMs: integer("max_duration_ms").notNull(),
|
||||
|
||||
firstHitAt: timestamp("first_hit_at").notNull(),
|
||||
lastHitAt: timestamp("last_hit_at").notNull(),
|
||||
firstHitAt: timestamp("first_hit_at", { withTimezone: true }).notNull(),
|
||||
lastHitAt: timestamp("last_hit_at", { withTimezone: true }).notNull(),
|
||||
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updated_at").defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
},
|
||||
(table) => [
|
||||
unique("analytics_daily_business_route_unique").on(
|
||||
|
||||
@@ -18,9 +18,9 @@ export const datamart = pgTable("datamart", {
|
||||
active: boolean("active").default(true),
|
||||
options: text("options").default(""),
|
||||
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"),
|
||||
upd_date: timestamp("upd_date").defaultNow(),
|
||||
upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
|
||||
upd_user: text("upd_user").default("lst-system"),
|
||||
});
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ export const dockDoorScanners = pgTable("dock_door_scanners", {
|
||||
dockId: text("dock_id"),
|
||||
active: boolean("active").default(true),
|
||||
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"),
|
||||
upd_date: timestamp("upd_date").defaultNow(),
|
||||
upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
|
||||
upd_user: text("upd_user").default("lst-system"),
|
||||
});
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ export const invHistoricalData = pgTable("inv_historical_data", {
|
||||
whseId: text("whse_id").default(""),
|
||||
whseName: text("whse_name").default("missing whseName"),
|
||||
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);
|
||||
|
||||
@@ -18,7 +18,7 @@ export const logs = pgTable("logs", {
|
||||
stack: jsonb("stack").default([]),
|
||||
checked: boolean("checked").default(false),
|
||||
hostname: text("hostname"),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
||||
});
|
||||
|
||||
export const logSchema = createSelectSchema(logs);
|
||||
|
||||
@@ -17,8 +17,12 @@ export const opendockApt = pgTable(
|
||||
release: integer("release").notNull().unique("opendock_apt_release_unique"),
|
||||
openDockAptId: text("open_dock_apt_id").notNull(),
|
||||
appointment: jsonb("appointment").notNull().default([]),
|
||||
upd_date: timestamp("upd_date").notNull().defaultNow(),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
upd_date: timestamp("upd_date", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
},
|
||||
(table) => ({
|
||||
openDockAptIdIdx: index("opendock_apt_opendock_id_idx").on(
|
||||
|
||||
@@ -22,9 +22,13 @@ export const opendockArticleSetup = pgTable(
|
||||
customerDescription: text("customer_description").notNull(),
|
||||
loadType: loadTypeEnum("load_type").notNull().default("drop"),
|
||||
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"),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
add_user: text("add_user").notNull().default("lst-system"),
|
||||
},
|
||||
(table) => ({
|
||||
|
||||
@@ -6,9 +6,13 @@ export const opendockDockSetup = pgTable("opendock_dock_setup", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
name: text("name").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"),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
add_user: text("add_user").notNull().default("lst-system"),
|
||||
});
|
||||
|
||||
|
||||
@@ -7,5 +7,5 @@ export const printerLog = pgTable("printer_log", {
|
||||
printerSN: text("printer_sn"),
|
||||
condition: text("condition").notNull(),
|
||||
message: text("message"),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
||||
});
|
||||
|
||||
@@ -28,8 +28,8 @@ export const printerData = pgTable(
|
||||
printDelay: integer("printDelay").default(90),
|
||||
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
|
||||
add_Date: timestamp("add_Date").defaultNow(),
|
||||
upd_date: timestamp("upd_date").defaultNow(),
|
||||
add_Date: timestamp("add_Date", { withTimezone: true }).defaultNow(),
|
||||
upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
|
||||
},
|
||||
(table) => [
|
||||
//uniqueIndex("emailUniqueIndex").on(sql`lower(${table.email})`),
|
||||
|
||||
@@ -30,8 +30,8 @@ export const scanUser = pgTable(
|
||||
role: mobileRoleEnum("role").notNull().default("user"),
|
||||
active: boolean("active").default(true),
|
||||
lastScan: timestamp("last_scan").defaultNow(),
|
||||
add_Date: timestamp("add_Date").defaultNow(),
|
||||
upd_date: timestamp("upd_date").defaultNow(),
|
||||
add_Date: timestamp("add_Date", { withTimezone: true }).defaultNow(),
|
||||
upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
|
||||
},
|
||||
(table) => ({
|
||||
userNotificationUnique: unique("scan_user_unique").on(
|
||||
|
||||
@@ -13,7 +13,7 @@ export const scanLog = pgTable("scan_log", {
|
||||
status: text("status"),
|
||||
scannerVersion: text("scanner_version").default("0"),
|
||||
lines: jsonb("lines").default([]),
|
||||
add_Date: timestamp("add_date").defaultNow(),
|
||||
add_Date: timestamp("add_date", { withTimezone: true }).defaultNow(),
|
||||
});
|
||||
|
||||
export const scanLogSchema = createSelectSchema(scanLog);
|
||||
|
||||
@@ -22,7 +22,7 @@ export const serverData = pgTable(
|
||||
contactPhone: text("contact_phone"),
|
||||
active: boolean("active").default(true),
|
||||
serverLoc: text("server_loc"),
|
||||
lastUpdated: timestamp("last_updated").defaultNow(),
|
||||
lastUpdated: timestamp("last_updated", { withTimezone: true }).defaultNow(),
|
||||
buildNumber: integer("build_number"),
|
||||
isUpgrading: boolean("is_upgrading").default(false),
|
||||
},
|
||||
|
||||
@@ -32,9 +32,9 @@ export const settings = pgTable(
|
||||
settingType: settingType(),
|
||||
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_Date: timestamp("add_Date").defaultNow(),
|
||||
add_Date: timestamp("add_Date", { withTimezone: true }).defaultNow(),
|
||||
upd_user: text("upd_User").default("LST_System").notNull(),
|
||||
upd_date: timestamp("upd_date").defaultNow(),
|
||||
upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
|
||||
},
|
||||
(table) => [
|
||||
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
||||
|
||||
@@ -12,11 +12,11 @@ import type z from "zod";
|
||||
export const appStats = pgTable("app_stats", {
|
||||
id: text("id").primaryKey().default("primary"),
|
||||
currentBuild: integer("current_build").notNull().default(1),
|
||||
lastBuildAt: timestamp("last_build_at"),
|
||||
lastDeployAt: timestamp("last_deploy_at"),
|
||||
lastBuildAt: timestamp("last_build_at", { withTimezone: true }),
|
||||
lastDeployAt: timestamp("last_deploy_at", { withTimezone: true }),
|
||||
building: boolean("building").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({}),
|
||||
});
|
||||
|
||||
|
||||
49
frontend/src/components/ui/badge.tsx
Normal file
49
frontend/src/components/ui/badge.tsx
Normal 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 }
|
||||
@@ -5,6 +5,7 @@ type RuntimeConfig = {
|
||||
appVersion: string;
|
||||
umamiHost: string;
|
||||
umamiWebsiteId: string;
|
||||
timezone: string;
|
||||
};
|
||||
|
||||
declare global {
|
||||
@@ -23,6 +24,7 @@ export const runtimeConfig: RuntimeConfig = {
|
||||
appVersion: window.LST_CONFIG?.appVersion ?? "dev",
|
||||
umamiHost: window.LST_CONFIG?.umamiHost ?? "",
|
||||
umamiWebsiteId: window.LST_CONFIG?.umamiWebsiteId ?? "",
|
||||
timezone: window.LST_CONFIG?.timezone ?? "America/Chicago",
|
||||
};
|
||||
|
||||
export function loadUmami() {
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
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 { 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")({
|
||||
beforeLoad: async ({ location }) => {
|
||||
@@ -37,117 +47,168 @@ interface LogEntry {
|
||||
[key: string]: any; // catch any extra fields
|
||||
}
|
||||
|
||||
function LevelBadge({ level }: { level: number }) {
|
||||
const config: Record<number, { label: string; className: string }> = {
|
||||
10: { label: "TRACE", className: "bg-gray-100 text-gray-600" },
|
||||
20: { label: "DEBUG", className: "bg-blue-100 text-blue-700" },
|
||||
30: { label: "INFO", className: "bg-green-100 text-green-700" },
|
||||
40: { label: "WARN", className: "bg-yellow-100 text-yellow-700" },
|
||||
50: { label: "ERROR", className: "bg-red-100 text-red-700" },
|
||||
60: { label: "FATAL", className: "bg-purple-100 text-purple-700" },
|
||||
function LevelBadge({ level }: { level: string }) {
|
||||
const config: Record<string, { label: string; className: string }> = {
|
||||
trace: { label: "TRACE", className: "bg-gray-100 text-gray-600" },
|
||||
debug: { label: "DEBUG", className: "bg-blue-50 text-blue-700" },
|
||||
info: { label: "INFO", className: "bg-green-50 text-green-700" },
|
||||
warn: { label: "WARN", className: "bg-yellow-100 text-yellow-700" },
|
||||
error: { label: "ERROR", className: "bg-red-50 text-red-700" },
|
||||
fatal: { label: "FATAL", className: "bg-purple-100 text-purple-700" },
|
||||
};
|
||||
|
||||
const { label, className } = config[level] ?? {
|
||||
label: String(level),
|
||||
className: "bg-gray-100",
|
||||
};
|
||||
const badge = config[level];
|
||||
|
||||
return (
|
||||
<span className={`px-2 py-0.5 rounded text-xs font-medium ${className}`}>
|
||||
{label}
|
||||
</span>
|
||||
<Badge
|
||||
className={`rounded px-2 py-0.5 text-xs font-medium ${
|
||||
badge?.className ?? "bg-gray-100 text-gray-600"
|
||||
}`}
|
||||
>
|
||||
{badge?.label ?? level}
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
|
||||
function RouteComponent() {
|
||||
const { data: logs, info: logsInfo } = useSocketRoom<LogEntry>("logs");
|
||||
//const { user } = Route.useRouteContext();
|
||||
//const router = useRouter();
|
||||
// const [logs, setLogs] = useState<LogEntry[]>([]);
|
||||
// const [logsInfo, setLogInfo] = useState(
|
||||
// "No logs yet — join the room to start receiving",
|
||||
// );
|
||||
const { data: logs } = useSocketRoom<LogEntry>("logs");
|
||||
const columnHelper = createColumnHelper<any>();
|
||||
|
||||
// useEffect(() => {
|
||||
// // Connect if not already connected
|
||||
// if (!socket.connected) {
|
||||
// socket.connect();
|
||||
// }
|
||||
const column = [
|
||||
columnHelper.accessor("createdAt", {
|
||||
header: ({ column }) => <SearchableHeader column={column} title="Time" />,
|
||||
filterFn: "includesString",
|
||||
cell: (i) =>
|
||||
formatInTimeZone(
|
||||
i.getValue(),
|
||||
`${window.LST_CONFIG?.timezone}`,
|
||||
"MM/dd/yyyy HH:mm:ss",
|
||||
),
|
||||
}),
|
||||
columnHelper.accessor("level", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Level" searchable={true} />
|
||||
),
|
||||
filterFn: "includesString",
|
||||
cell: (i) => <LevelBadge level={i.getValue()} />,
|
||||
}),
|
||||
columnHelper.accessor("module", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Module" />
|
||||
),
|
||||
filterFn: "includesString",
|
||||
cell: (i) => i.getValue(),
|
||||
}),
|
||||
columnHelper.accessor("subModule", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Submodule" />
|
||||
),
|
||||
filterFn: "includesString",
|
||||
cell: (i) => i.getValue(),
|
||||
}),
|
||||
columnHelper.accessor("hostname", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Client" />
|
||||
),
|
||||
filterFn: "includesString",
|
||||
cell: (i) => i.getValue(),
|
||||
}),
|
||||
columnHelper.accessor("message", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Message" />
|
||||
),
|
||||
filterFn: "includesString",
|
||||
cell: (i) => {
|
||||
return i.getValue().length > 50 ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
<p>{i.getValue().slice(0, 50)}...</p>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p className="text-wrap max-w-48">{i.getValue()}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
) : (
|
||||
i.getValue()
|
||||
);
|
||||
},
|
||||
}),
|
||||
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>;
|
||||
|
||||
// socket.on("connect", () => {
|
||||
// socket.emit("join-room", "logs");
|
||||
// });
|
||||
|
||||
// socket.emit("join-room", "logs");
|
||||
// socket.on(
|
||||
// "room-update",
|
||||
// (data: { payloads: LogEntry[]; roomId: string }) => {
|
||||
// setLogs((prev) => [...data.payloads, ...prev]);
|
||||
// },
|
||||
// );
|
||||
|
||||
// socket.on("room-error", (data) => {
|
||||
// setLogInfo(data.message);
|
||||
// });
|
||||
|
||||
// // socket.on("logs", (data) => {
|
||||
// // console.log(data);
|
||||
// // setLogs((prev) => [...data.payloads, ...prev]);
|
||||
// // });
|
||||
|
||||
// // Cleanup listeners on unmount
|
||||
// return () => {
|
||||
// socket.emit("leave-room", "logs");
|
||||
// socket.off("room-update");
|
||||
// socket.off("room-error");
|
||||
// socket.off("logs");
|
||||
// };
|
||||
// }, []);
|
||||
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"
|
||||
>
|
||||
<pre className="max-h-[500px] overflow-auto whitespace-pre-wrap rounded-md p-3 text-xs leading-relaxed">
|
||||
<code>{JSON.stringify(stack, null, 2)}</code>
|
||||
</pre>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
}),
|
||||
];
|
||||
return (
|
||||
<div>
|
||||
{/* Log Table */}
|
||||
<div className="rounded border overflow-auto max-h-[600px]">
|
||||
<table className="w-full text-sm">
|
||||
<thead className="bg-muted sticky top-0">
|
||||
<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>
|
||||
// <div>
|
||||
// {/* Log Table */}
|
||||
// <div className="rounded border overflow-auto max-h-[600px]">
|
||||
// <table className="w-full text-sm">
|
||||
// <thead className="bg-muted sticky top-0">
|
||||
// <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} />
|
||||
);
|
||||
}
|
||||
|
||||
69
migrations/0059_sparkling_joystick.sql
Normal file
69
migrations/0059_sparkling_joystick.sql
Normal 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();
|
||||
2603
migrations/meta/0059_snapshot.json
Normal file
2603
migrations/meta/0059_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -414,6 +414,13 @@
|
||||
"when": 1779846894283,
|
||||
"tag": "0058_damp_donald_blake",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 59,
|
||||
"version": "7",
|
||||
"when": 1780349486711,
|
||||
"tag": "0059_sparkling_joystick",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user