Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function getTasksQueryOptions() {
return {
queryFn: () => TasksService.getTasks({ page: 1, limit: 100 }),
queryKey: ["tasks"],
refetchInterval: 5_000,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import {
Dialog,
DialogContent,
Expand All @@ -31,7 +30,6 @@ export const Route = createFileRoute("/_layout/settings")({

function LoggingCard() {
const [enabled, setEnabled] = useState<boolean | null>(null)
const [loading, setLoading] = useState(false)

useEffect(() => {
fetch("/api/v1/nodes/config", { credentials: "include" })
Expand All @@ -40,24 +38,6 @@ function LoggingCard() {
.catch(() => setEnabled(true))
}, [])

const handleToggle = async (value: boolean) => {
setLoading(true)
try {
const res = await fetch("/api/v1/nodes/config", {
method: "PATCH",
credentials: "include",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ use_dedicated_log_file_per_automation: value }),
})
const data = await res.json()
setEnabled(data.use_dedicated_log_file_per_automation)
} catch {
// keep previous value on error
} finally {
setLoading(false)
}
}

return (
<Card>
<CardHeader>
Expand All @@ -70,20 +50,19 @@ function LoggingCard() {
</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-4">
<div className="flex items-center justify-between gap-4">
<div className="flex flex-col gap-1">
<Label htmlFor="per-bot-logs">Per-bot log files</Label>
<span className="text-xs text-muted-foreground">
Write a dedicated log file for each bot run in <code>logs/automations/</code>.
Changes apply immediately but reset on restart.
</span>
</div>
<Checkbox
id="per-bot-logs"
checked={enabled ?? true}
disabled={enabled === null || loading}
onCheckedChange={(v) => handleToggle(Boolean(v))}
/>
<div className="flex flex-col gap-1">
<Label>Per-bot log files</Label>
<span className="text-xs text-muted-foreground">
{enabled === null
? "Loading…"
: enabled
? "Enabled — a dedicated log file is written for each bot run."
: "Disabled — bot logs are written to the main log file."}
</span>
<span className="text-xs text-muted-foreground mt-1">
Configure via the <code>USE_DEDICATED_LOG_FILE_PER_AUTOMATION</code> environment variable
(<code>true</code> or <code>false</code>). Defaults to <code>true</code>.
</span>
</div>
</CardContent>
</Card>
Expand Down Expand Up @@ -255,7 +234,6 @@ type NodeType = "standalone" | "master"

function NodeTypeCard() {
const [nodeType, setNodeType] = useState<NodeType | null>(null)
const [loading, setLoading] = useState(false)

useEffect(() => {
fetch("/api/v1/nodes/config", { credentials: "include" })
Expand All @@ -264,25 +242,6 @@ function NodeTypeCard() {
.catch(() => setNodeType("standalone"))
}, [])

const select = async (value: NodeType) => {
if (loading || value === nodeType) return
setLoading(true)
try {
const res = await fetch("/api/v1/nodes/config", {
method: "PATCH",
credentials: "include",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ node_type: value }),
})
const data = await res.json()
setNodeType(data.node_type)
} catch {
// keep previous value on error
} finally {
setLoading(false)
}
}

return (
<Card>
<CardHeader>
Expand All @@ -291,29 +250,32 @@ function NodeTypeCard() {
Node type
</CardTitle>
<CardDescription>
Choose how this node runs.
How this node is configured to run.
</CardDescription>
</CardHeader>
<CardContent className="grid grid-cols-2 gap-3">
<button
disabled={loading || nodeType === null}
onClick={() => select("standalone")}
className={`flex flex-col items-center gap-2 rounded-lg border p-4 text-sm transition-colors ${
nodeType === "standalone"
? "border-primary bg-primary/5 text-primary"
: "hover:border-primary/40 hover:bg-muted text-muted-foreground"
}`}
>
<Server className="size-6" />
Standalone
</button>
<div className="relative flex flex-col items-center gap-2 rounded-lg border p-4 text-sm opacity-50 cursor-not-allowed text-muted-foreground">
<Network className="size-6" />
Master / Replica
<span className="absolute -top-2 right-2 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground border">
Coming soon
</span>
<CardContent className="flex flex-col gap-3">
<div className="grid grid-cols-2 gap-3">
<div
className={`flex flex-col items-center gap-2 rounded-lg border p-4 text-sm ${
nodeType === "standalone"
? "border-primary bg-primary/5 text-primary"
: "text-muted-foreground"
}`}
>
<Server className="size-6" />
Standalone
</div>
<div className="relative flex flex-col items-center gap-2 rounded-lg border p-4 text-sm opacity-50 cursor-not-allowed text-muted-foreground">
<Network className="size-6" />
Master / Replica
<span className="absolute -top-2 right-2 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground border">
Coming soon
</span>
</div>
</div>
<span className="text-xs text-muted-foreground">
The node type can only be changed from the CLI. Use the <code>--node-type</code> flag when starting the node.
</span>
</CardContent>
</Card>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,24 @@ function SetupNodeType() {
},
})

const select = (nodeType: "standalone" | "master") => {
const select = () => {
if (initMutation.isPending) return
initMutation.mutate(nodeType)
initMutation.mutate("standalone")
}

return (
<div className="flex min-h-svh items-center justify-center p-6">
<div className="flex w-full max-w-2xl flex-col gap-8">
<div className="flex flex-col items-center gap-2 text-center">
<p className="text-xs text-muted-foreground">Step 2 / 3</p>
<h1 className="text-2xl font-bold">Choose your node type</h1>
<h1 className="text-2xl font-bold">Node type</h1>
<p className="text-sm text-muted-foreground">
You can change this later in settings.
Your node will be initialized as a standalone node.
</p>
</div>

<div className="grid gap-4 sm:grid-cols-2">
<Card
className="cursor-pointer transition-colors hover:border-primary/60 hover:bg-primary/5"
onClick={() => select("standalone")}
>
<Card className="border-primary bg-primary/5">
<CardHeader>
<div className="flex justify-center pb-2">
<Server className="size-12 text-primary" />
Expand All @@ -82,8 +79,8 @@ function SetupNodeType() {
</CardDescription>
</CardHeader>
<CardContent className="flex justify-end">
<Button disabled={initMutation.isPending} onClick={(e) => { e.stopPropagation(); select("standalone") }}>
Get started
<Button disabled={initMutation.isPending} onClick={select}>
Continue
</Button>
</CardContent>
</Card>
Expand All @@ -108,6 +105,10 @@ function SetupNodeType() {
</CardContent>
</Card>
</div>

<p className="text-center text-xs text-muted-foreground">
The node type can be changed later using the <code>--node-type</code> CLI flag.
</p>
</div>
</div>
)
Expand Down
Loading