Reuse proxy location when set (#1394)

This commit is contained in:
Shuchang Zheng
2024-12-16 07:50:13 -08:00
committed by GitHub
parent e2f886d9a3
commit 1b7ff69f85
2 changed files with 12 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ import { statusIsFinalized, statusIsRunningOrQueued } from "../tasks/types";
import { useWorkflowQuery } from "./hooks/useWorkflowQuery"; import { useWorkflowQuery } from "./hooks/useWorkflowQuery";
import { useWorkflowRunQuery } from "./hooks/useWorkflowRunQuery"; import { useWorkflowRunQuery } from "./hooks/useWorkflowRunQuery";
import { cn } from "@/util/utils"; import { cn } from "@/util/utils";
import { ProxyLocation } from "@/api/types";
function WorkflowRun() { function WorkflowRun() {
const { workflowRunId, workflowPermanentId } = useParams(); const { workflowRunId, workflowPermanentId } = useParams();
@@ -79,6 +80,8 @@ function WorkflowRun() {
const workflowRunIsFinalized = workflowRun && statusIsFinalized(workflowRun); const workflowRunIsFinalized = workflowRun && statusIsFinalized(workflowRun);
const parameters = workflowRun?.parameters ?? {}; const parameters = workflowRun?.parameters ?? {};
const proxyLocation =
workflowRun?.proxy_location ?? ProxyLocation.Residential;
const title = workflowIsLoading ? ( const title = workflowIsLoading ? (
<Skeleton className="h-9 w-48" /> <Skeleton className="h-9 w-48" />
@@ -189,6 +192,7 @@ function WorkflowRun() {
to={`/workflows/${workflowPermanentId}/run`} to={`/workflows/${workflowPermanentId}/run`}
state={{ state={{
data: parameters, data: parameters,
proxyLocation,
}} }}
> >
<PlayIcon className="mr-2 h-4 w-4" /> <PlayIcon className="mr-2 h-4 w-4" />

View File

@@ -27,6 +27,10 @@ function WorkflowRunParameters() {
(parameter) => parameter.parameter_type === "workflow", (parameter) => parameter.parameter_type === "workflow",
); );
const proxyLocation = location.state
? (location.state.proxyLocation as ProxyLocation)
: null;
const initialValues = location.state?.data const initialValues = location.state?.data
? location.state.data ? location.state.data
: workflowParameters?.reduce( : workflowParameters?.reduce(
@@ -95,7 +99,10 @@ function WorkflowRunParameters() {
initialValues={initialValues} initialValues={initialValues}
workflowParameters={workflowParameters} workflowParameters={workflowParameters}
initialSettings={{ initialSettings={{
proxyLocation: workflow.proxy_location ?? ProxyLocation.Residential, proxyLocation:
proxyLocation ??
workflow.proxy_location ??
ProxyLocation.Residential,
webhookCallbackUrl: workflow.webhook_callback_url ?? "", webhookCallbackUrl: workflow.webhook_callback_url ?? "",
}} }}
/> />