Validate json and don't allow null parameter values when running workflow (#866)
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { getClient } from "@/api/AxiosClient";
|
import { getClient } from "@/api/AxiosClient";
|
||||||
import { WorkflowParameter } from "@/api/types";
|
|
||||||
import { Form, FormControl, FormField, FormItem } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem } from "@/components/ui/form";
|
||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
@@ -22,6 +21,7 @@ import fetchToCurl from "fetch-to-curl";
|
|||||||
import { apiBaseUrl } from "@/util/env";
|
import { apiBaseUrl } from "@/util/env";
|
||||||
import { useApiCredential } from "@/hooks/useApiCredential";
|
import { useApiCredential } from "@/hooks/useApiCredential";
|
||||||
import { copyText } from "@/util/copyText";
|
import { copyText } from "@/util/copyText";
|
||||||
|
import { WorkflowParameter } from "./types/workflowTypes";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
workflowParameters: Array<WorkflowParameter>;
|
workflowParameters: Array<WorkflowParameter>;
|
||||||
@@ -152,6 +152,9 @@ function RunWorkflowForm({ workflowParameters, initialValues }: Props) {
|
|||||||
return "Invalid JSON";
|
return "Invalid JSON";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (value === null) {
|
||||||
|
return "This field is required";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
render={({ field }) => {
|
render={({ field }) => {
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import { getClient } from "@/api/AxiosClient";
|
import { getClient } from "@/api/AxiosClient";
|
||||||
import { WorkflowApiResponse, WorkflowParameterValueType } from "@/api/types";
|
|
||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { useLocation, useParams } from "react-router-dom";
|
import { useLocation, useParams } from "react-router-dom";
|
||||||
import { RunWorkflowForm } from "./RunWorkflowForm";
|
import { RunWorkflowForm } from "./RunWorkflowForm";
|
||||||
|
import {
|
||||||
|
WorkflowApiResponse,
|
||||||
|
WorkflowParameterValueType,
|
||||||
|
} from "./types/workflowTypes";
|
||||||
|
|
||||||
function defaultValue(type: WorkflowParameterValueType) {
|
function defaultValue(type: WorkflowParameterValueType) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user