|
@@ -912,7 +912,7 @@ function ConsoleView({ lines }: { lines: string[] }) {
|
|
|
|
|
|
|
|
// ─── runs tab ─────────────────────────────────────────────────────────────────
|
|
// ─── runs tab ─────────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
-function RunsTab({ project, fn }: { project: string; fn: FunctionSummary }) {
|
|
|
|
|
|
|
+function RunsTab({ project, fn, runsKept }: { project: string; fn: FunctionSummary; runsKept: number }) {
|
|
|
const [limit, setLimit] = useState(50)
|
|
const [limit, setLimit] = useState(50)
|
|
|
const [open, setOpen] = useState('')
|
|
const [open, setOpen] = useState('')
|
|
|
|
|
|
|
@@ -950,10 +950,10 @@ function RunsTab({ project, fn }: { project: string; fn: FunctionSummary }) {
|
|
|
the normal state, not a loading glitch, and an old run_id is gone for
|
|
the normal state, not a loading glitch, and an old run_id is gone for
|
|
|
good rather than momentarily missing. */}
|
|
good rather than momentarily missing. */}
|
|
|
<p className="text-xs text-slate-500">
|
|
<p className="text-xs text-slate-500">
|
|
|
- Newest first. Only the newest runs per function are kept (50 by default, set by the
|
|
|
|
|
- server's <span className="font-mono">functions.runs_kept</span>), and the log is trimmed on
|
|
|
|
|
- every write - so asking for more than that returns what is left, and a run_id from an older
|
|
|
|
|
- run stops resolving altogether.
|
|
|
|
|
|
|
+ Newest first. Only the newest {runsKept} runs per function are kept on this server (
|
|
|
|
|
+ <span className="font-mono">functions.runs_kept</span>), and the log is trimmed on every
|
|
|
|
|
+ write - so asking for more than that returns what is left, and a run_id from an older run
|
|
|
|
|
+ stops resolving altogether.
|
|
|
</p>
|
|
</p>
|
|
|
|
|
|
|
|
{isError && (
|
|
{isError && (
|
|
@@ -1059,9 +1059,11 @@ function FunctionDetailPanel({
|
|
|
onDelete,
|
|
onDelete,
|
|
|
onOpenExisting,
|
|
onOpenExisting,
|
|
|
onSaved,
|
|
onSaved,
|
|
|
|
|
+ runsKept,
|
|
|
}: {
|
|
}: {
|
|
|
project: string
|
|
project: string
|
|
|
summary: FunctionSummary
|
|
summary: FunctionSummary
|
|
|
|
|
+ runsKept: number
|
|
|
detail: FunctionDetail | null
|
|
detail: FunctionDetail | null
|
|
|
detailLoading: boolean
|
|
detailLoading: boolean
|
|
|
admin: boolean
|
|
admin: boolean
|
|
@@ -1166,7 +1168,7 @@ function FunctionDetailPanel({
|
|
|
<PolicyTab project={project} fn={summary} admin={admin} onSaved={onRefresh} />
|
|
<PolicyTab project={project} fn={summary} admin={admin} onSaved={onRefresh} />
|
|
|
)}
|
|
)}
|
|
|
{tab === 'invoke' && <InvokeTab project={project} fn={summary} />}
|
|
{tab === 'invoke' && <InvokeTab project={project} fn={summary} />}
|
|
|
- {tab === 'runs' && <RunsTab project={project} fn={summary} />}
|
|
|
|
|
|
|
+ {tab === 'runs' && <RunsTab project={project} fn={summary} runsKept={runsKept} />}
|
|
|
|
|
|
|
|
<ConfirmDialog
|
|
<ConfirmDialog
|
|
|
open={confirmDelete}
|
|
open={confirmDelete}
|
|
@@ -1217,6 +1219,12 @@ export default function Functions() {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const functions = data?.functions ?? []
|
|
const functions = data?.functions ?? []
|
|
|
|
|
+ // From the server, not a guess: a host that configured a different retention
|
|
|
|
|
+ // would otherwise be described wrongly in the runs tab.
|
|
|
|
|
+ const runsKept = data?.runs_kept ?? 50
|
|
|
|
|
+ // Runner reachability, so the page can warn BEFORE someone writes a script.
|
|
|
|
|
+ // Undefined while the listing loads - do not warn on a value we do not have.
|
|
|
|
|
+ const runners = data?.runners
|
|
|
const summary = functions.find((f) => f.function_id === selectedId) ?? null
|
|
const summary = functions.find((f) => f.function_id === selectedId) ?? null
|
|
|
|
|
|
|
|
// The selected function belongs to the project being left, so switching
|
|
// The selected function belongs to the project being left, so switching
|
|
@@ -1322,6 +1330,42 @@ export default function Functions() {
|
|
|
</ErrorPanel>
|
|
</ErrorPanel>
|
|
|
)}
|
|
)}
|
|
|
|
|
|
|
|
|
|
+ {/* Warn BEFORE someone writes a script. Without this the first signal is
|
|
|
|
|
+ a 503 on the push, after the work is done. Only rendered once the
|
|
|
|
|
+ listing has actually answered - `runners` is undefined while loading,
|
|
|
|
|
+ and warning on a value we do not have would be worse than silence. */}
|
|
|
|
|
+ {runners && runners.configured === 0 && (
|
|
|
|
|
+ <ErrorPanel title="No function runner is configured - you can write functions, but not save them.">
|
|
|
|
|
+ <p>
|
|
|
|
|
+ Installing the runner package does not switch functions on. The server has to be told
|
|
|
|
|
+ where the runners are: add a <code className="text-slate-200">functions.runners</code>{' '}
|
|
|
|
|
+ list to its <code className="text-slate-200">config.json</code> and restart it.
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <pre className="rounded-md bg-slate-950 border border-slate-700/60 px-3 py-2 overflow-x-auto text-[11px] text-slate-300">
|
|
|
|
|
+{`"functions": {
|
|
|
|
|
+ "runners": ["127.0.0.1:8090"],
|
|
|
|
|
+ "runs_kept": ${runsKept}
|
|
|
|
|
+}`}
|
|
|
|
|
+ </pre>
|
|
|
|
|
+ </ErrorPanel>
|
|
|
|
|
+ )}
|
|
|
|
|
+
|
|
|
|
|
+ {runners && runners.configured > 0 && runners.healthy === 0 && (
|
|
|
|
|
+ <ErrorPanel title="Every function runner is down - saving a function will fail.">
|
|
|
|
|
+ <p>
|
|
|
|
|
+ {runners.configured} runner{runners.configured === 1 ? ' is' : 's are'} configured and
|
|
|
|
|
+ none is answering its health check. A write is compiled on a runner before it is
|
|
|
|
|
+ stored, so nothing can be saved until one is back.
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <p>
|
|
|
|
|
+ Check that the runner service is up and that its token matches the server's
|
|
|
|
|
+ (<code className="text-slate-200">SVAPI_RUNNER_TOKEN</code> in both{' '}
|
|
|
|
|
+ <code className="text-slate-200">runner.env</code> and{' '}
|
|
|
|
|
+ <code className="text-slate-200">vectorapi.env</code>).
|
|
|
|
|
+ </p>
|
|
|
|
|
+ </ErrorPanel>
|
|
|
|
|
+ )}
|
|
|
|
|
+
|
|
|
{isLoading && (
|
|
{isLoading && (
|
|
|
<div className="rounded-xl border border-slate-700/40 bg-slate-800/30 px-6 py-10 text-center animate-pulse">
|
|
<div className="rounded-xl border border-slate-700/40 bg-slate-800/30 px-6 py-10 text-center animate-pulse">
|
|
|
<p className="text-slate-400 text-sm">Loading functions...</p>
|
|
<p className="text-slate-400 text-sm">Loading functions...</p>
|
|
@@ -1374,6 +1418,7 @@ export default function Functions() {
|
|
|
onDelete={() => void handleDelete()}
|
|
onDelete={() => void handleDelete()}
|
|
|
onOpenExisting={(id) => select(id)}
|
|
onOpenExisting={(id) => select(id)}
|
|
|
onSaved={handleSaved}
|
|
onSaved={handleSaved}
|
|
|
|
|
+ runsKept={runsKept}
|
|
|
/>
|
|
/>
|
|
|
)}
|
|
)}
|
|
|
|
|
|