feat(storage): show job error details in history table and output panel
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
BINARY=nasctl
|
||||
VERSION?=0.7.3
|
||||
VERSION?=0.7.4
|
||||
GO?=go
|
||||
LDFLAGS=-s -w -X github.com/darroyo/nasctl/internal/web.Version=$(VERSION) -X github.com/darroyo/nasctl/internal/web.Commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
||||
BUILD_FLAGS=CGO_ENABLED=0
|
||||
|
||||
@@ -453,6 +453,7 @@ export default function Storage() {
|
||||
<th className="pb-2">Tipo</th>
|
||||
<th className="pb-2">Estado</th>
|
||||
<th className="pb-2">Exit</th>
|
||||
<th className="pb-2">Error</th>
|
||||
<th className="pb-2">Fecha</th>
|
||||
<th className="pb-2">Duración</th>
|
||||
</tr>
|
||||
@@ -480,6 +481,13 @@ export default function Storage() {
|
||||
</span>
|
||||
</td>
|
||||
<td className="py-2 font-mono">{j.exit_code >= 0 ? j.exit_code : "—"}</td>
|
||||
<td className="py-2">
|
||||
{j.error ? (
|
||||
<span className="text-red-400" title={j.error}>
|
||||
⚠ {j.error.split("\n")[0].slice(0, 50)}{j.error.split("\n")[0].length > 50 ? "…" : ""}
|
||||
</span>
|
||||
) : null}
|
||||
</td>
|
||||
<td className="py-2">{new Date(j.created_at).toLocaleString()}</td>
|
||||
<td className="py-2">
|
||||
{j.started_at && j.finished_at
|
||||
@@ -567,6 +575,19 @@ function OutputPanel({
|
||||
<span className="text-slate-500">exit={job.exit_code}</span>
|
||||
)}
|
||||
</div>
|
||||
{job.error && (
|
||||
<div className="mb-2 rounded border border-red-700 bg-red-900/40 p-3">
|
||||
<div className="mb-1 flex items-center gap-2 text-xs font-semibold text-red-300">
|
||||
<span>⚠ Error</span>
|
||||
{job.exit_code >= 0 && (
|
||||
<span className="text-red-400/70">exit={job.exit_code}</span>
|
||||
)}
|
||||
</div>
|
||||
<pre className="whitespace-pre-wrap break-words text-xs text-red-200 font-mono">
|
||||
{job.error}
|
||||
</pre>
|
||||
</div>
|
||||
)}
|
||||
<pre
|
||||
ref={outputRef as React.RefObject<HTMLPreElement>}
|
||||
className="max-h-80 overflow-auto rounded bg-slate-900 p-3 text-xs text-slate-300 font-mono"
|
||||
@@ -574,7 +595,9 @@ function OutputPanel({
|
||||
{filtered.length === 0
|
||||
? job.output
|
||||
? job.output.split("\n").slice(-200).join("\n")
|
||||
: "iniciando…"
|
||||
: job.status === "running"
|
||||
? "iniciando…"
|
||||
: "Sin salida capturada."
|
||||
: filtered.join("\n")}
|
||||
</pre>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user