Compare commits
4
Commits
v1.0.1
..
adeb21be19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
adeb21be19 | ||
|
|
335e7624b4 | ||
|
|
23a4e2ebc0 | ||
|
|
b77041cfa8 |
@@ -66,12 +66,12 @@ export default async function RunDetailPage({ params }: RunDetailPageProps) {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto flex max-w-2xl flex-col gap-4">
|
<div className="mx-auto flex max-w-5xl flex-col gap-4">
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>{run.scriptName}</CardTitle>
|
<CardTitle>{run.scriptName}</CardTitle>
|
||||||
{script && (
|
{script && (
|
||||||
<CardAction>
|
<CardAction className="row-span-1">
|
||||||
<Link
|
<Link
|
||||||
href={`/scripts/${run.scriptId}?fromRun=${run.id}`}
|
href={`/scripts/${run.scriptId}?fromRun=${run.id}`}
|
||||||
className={buttonVariants({ variant: "outline", size: "sm" })}
|
className={buttonVariants({ variant: "outline", size: "sm" })}
|
||||||
@@ -81,7 +81,7 @@ export default async function RunDetailPage({ params }: RunDetailPageProps) {
|
|||||||
</Link>
|
</Link>
|
||||||
</CardAction>
|
</CardAction>
|
||||||
)}
|
)}
|
||||||
<dl className="text-muted-foreground grid grid-cols-2 gap-x-4 gap-y-2 text-xs sm:grid-cols-3">
|
<dl className="text-muted-foreground col-span-2 grid grid-cols-2 gap-x-4 gap-y-2 text-xs sm:grid-cols-3">
|
||||||
<div>
|
<div>
|
||||||
<dt className="font-mono text-[0.7rem] font-medium tracking-widest uppercase">
|
<dt className="font-mono text-[0.7rem] font-medium tracking-widest uppercase">
|
||||||
Triggered by
|
Triggered by
|
||||||
@@ -119,7 +119,7 @@ export default async function RunDetailPage({ params }: RunDetailPageProps) {
|
|||||||
<span className="text-muted-foreground font-mono text-[0.7rem] font-medium tracking-widest uppercase">
|
<span className="text-muted-foreground font-mono text-[0.7rem] font-medium tracking-widest uppercase">
|
||||||
Variables
|
Variables
|
||||||
</span>
|
</span>
|
||||||
<dl className="grid gap-x-6 gap-y-2 rounded-md border p-3 text-xs sm:grid-cols-2">
|
<dl className="grid gap-x-6 gap-y-2 rounded-md border p-3 text-xs sm:grid-cols-2 lg:grid-cols-3">
|
||||||
{variableEntries.map(({ key, label, value }) => (
|
{variableEntries.map(({ key, label, value }) => (
|
||||||
<div key={key} className="flex flex-col gap-0.5">
|
<div key={key} className="flex flex-col gap-0.5">
|
||||||
<dt className="text-muted-foreground">{label}</dt>
|
<dt className="text-muted-foreground">{label}</dt>
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default async function ScriptPage({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto max-w-2xl">
|
<div className="mx-auto max-w-5xl">
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>{script.name}</CardTitle>
|
<CardTitle>{script.name}</CardTitle>
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ import { defaultValuesForScript } from "@/lib/config/defaults";
|
|||||||
import type { ClientScript } from "@/lib/config/serialize";
|
import type { ClientScript } from "@/lib/config/serialize";
|
||||||
import { FieldRenderer } from "./field-renderer";
|
import { FieldRenderer } from "./field-renderer";
|
||||||
|
|
||||||
|
/** Controls whose content doesn't shrink well into a narrow grid column - long-form text,
|
||||||
|
* or a group of checkboxes that reads better as a single wide list - so they span the full
|
||||||
|
* grid width instead of sharing a row with other fields. */
|
||||||
|
const WIDE_CONTROLS = new Set(["textarea", "checkboxGroup"]);
|
||||||
|
|
||||||
/** `initialValues` comes from a previous run's (already-redacted) variables when re-running -
|
/** `initialValues` comes from a previous run's (already-redacted) variables when re-running -
|
||||||
* secret fields are deliberately excluded there (their stored value is just "***", not the real
|
* secret fields are deliberately excluded there (their stored value is just "***", not the real
|
||||||
* one), so those always fall through to the normal default/empty state and have to be re-entered. */
|
* one), so those always fall through to the normal default/empty state and have to be re-entered. */
|
||||||
@@ -93,9 +98,22 @@ export function DynamicForm({
|
|||||||
This script takes no parameters.
|
This script takes no parameters.
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
{script.variables.length > 0 && (
|
||||||
|
<div className="grid grid-cols-1 gap-x-6 gap-y-5 sm:grid-cols-2 lg:grid-cols-3">
|
||||||
{script.variables.map((variable) => (
|
{script.variables.map((variable) => (
|
||||||
<FieldRenderer key={variable.name} variable={variable} />
|
<div
|
||||||
|
key={variable.name}
|
||||||
|
className={
|
||||||
|
WIDE_CONTROLS.has(variable.control)
|
||||||
|
? "sm:col-span-2 lg:col-span-3"
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<FieldRenderer variable={variable} />
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={form.formState.isSubmitting}
|
disabled={form.formState.isSubmitting}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export const XtermView = forwardRef<XtermViewHandle, XtermViewProps>(
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={containerRef}
|
ref={containerRef}
|
||||||
className="h-[60vh] overflow-hidden bg-[#101215] p-2"
|
className="aspect-video w-full overflow-hidden bg-[#101215] p-2"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ function stringifyValue(value: unknown, joinWith: string): string {
|
|||||||
return String(value);
|
return String(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Quotes a value for the human-readable `redactedCommandLine` display only - the real
|
||||||
|
* invocation always passes values as discrete argv elements/env vars (see build note below),
|
||||||
|
* so this never affects execution. Without it, a value like "Glitz and glam" renders as three
|
||||||
|
* bare words indistinguishable from separate argv entries. */
|
||||||
|
function quoteForDisplay(value: string): string {
|
||||||
|
if (value !== "" && /^[a-zA-Z0-9_@%+=:,./-]+$/.test(value)) return value;
|
||||||
|
return `"${value.replace(/([$`"\\])/g, "\\$1")}"`;
|
||||||
|
}
|
||||||
|
|
||||||
/** Builds an argv-array invocation from validated variable values. Never produces a shell string. */
|
/** Builds an argv-array invocation from validated variable values. Never produces a shell string. */
|
||||||
export function buildInvocation(
|
export function buildInvocation(
|
||||||
script: ScriptConfig,
|
script: ScriptConfig,
|
||||||
@@ -43,7 +52,10 @@ export function buildInvocation(
|
|||||||
const argName = variable.argName!;
|
const argName = variable.argName!;
|
||||||
const value = stringifyValue(raw, variable.joinWith);
|
const value = stringifyValue(raw, variable.joinWith);
|
||||||
argv.push(argName, value);
|
argv.push(argName, value);
|
||||||
redactedArgv.push(argName, variable.secret ? REDACTED : value);
|
redactedArgv.push(
|
||||||
|
argName,
|
||||||
|
variable.secret ? REDACTED : quoteForDisplay(value),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "flag": {
|
case "flag": {
|
||||||
@@ -57,7 +69,7 @@ export function buildInvocation(
|
|||||||
const value = stringifyValue(raw, variable.joinWith);
|
const value = stringifyValue(raw, variable.joinWith);
|
||||||
env[variable.envName!] = value;
|
env[variable.envName!] = value;
|
||||||
redactedEnvAssignments.push(
|
redactedEnvAssignments.push(
|
||||||
`${variable.envName}=${variable.secret ? REDACTED : value}`,
|
`${variable.envName}=${variable.secret ? REDACTED : quoteForDisplay(value)}`,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user