Merge branch 'main' into web-client-oauth-proxy-fetch
This commit is contained in:
commit
ddef72f771
3 changed files with 25 additions and 7 deletions
|
|
@ -56,9 +56,11 @@ async function startDevServer(serverOptions) {
|
||||||
echoOutput: true,
|
echoOutput: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
// For Windows, we need to use stdin: 'ignore' to simulate < NUL
|
// For Windows, we need to ignore stdin to simulate < NUL
|
||||||
|
// spawn-rx's 'stdin' option expects an Observable, not 'ignore'
|
||||||
|
// Use Node's stdio option instead
|
||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
spawnOptions.stdin = "ignore";
|
spawnOptions.stdio = ["ignore", "pipe", "pipe"];
|
||||||
}
|
}
|
||||||
|
|
||||||
const server = spawn(serverCommand, serverArgs, spawnOptions);
|
const server = spawn(serverCommand, serverArgs, spawnOptions);
|
||||||
|
|
@ -140,13 +142,21 @@ async function startDevClient(clientOptions) {
|
||||||
const clientCommand = "npx";
|
const clientCommand = "npx";
|
||||||
const host = process.env.HOST || "localhost";
|
const host = process.env.HOST || "localhost";
|
||||||
const clientArgs = ["vite", "--port", CLIENT_PORT, "--host", host];
|
const clientArgs = ["vite", "--port", CLIENT_PORT, "--host", host];
|
||||||
|
const isWindows = process.platform === "win32";
|
||||||
|
|
||||||
const client = spawn(clientCommand, clientArgs, {
|
const spawnOptions = {
|
||||||
cwd: resolve(__dirname, ".."),
|
cwd: resolve(__dirname, ".."),
|
||||||
env: { ...process.env, CLIENT_PORT },
|
env: { ...process.env, CLIENT_PORT },
|
||||||
signal: abort.signal,
|
signal: abort.signal,
|
||||||
echoOutput: true,
|
echoOutput: true,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// For Windows, we need to ignore stdin to prevent hanging
|
||||||
|
if (isWindows) {
|
||||||
|
spawnOptions.stdio = ["ignore", "pipe", "pipe"];
|
||||||
|
}
|
||||||
|
|
||||||
|
const client = spawn(clientCommand, clientArgs, spawnOptions);
|
||||||
|
|
||||||
const url = getClientUrl(
|
const url = getClientUrl(
|
||||||
CLIENT_PORT,
|
CLIENT_PORT,
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ interface DynamicJsonFormProps {
|
||||||
|
|
||||||
export interface DynamicJsonFormRef {
|
export interface DynamicJsonFormRef {
|
||||||
validateJson: () => { isValid: boolean; error: string | null };
|
validateJson: () => { isValid: boolean; error: string | null };
|
||||||
|
hasJsonError: () => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isTypeSupported = (
|
const isTypeSupported = (
|
||||||
|
|
@ -129,6 +130,10 @@ const DynamicJsonForm = forwardRef<DynamicJsonFormRef, DynamicJsonFormProps>(
|
||||||
// on every keystroke which would be inefficient and error-prone
|
// on every keystroke which would be inefficient and error-prone
|
||||||
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
|
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
|
||||||
|
|
||||||
|
const hasJsonError = () => {
|
||||||
|
return !!jsonError;
|
||||||
|
};
|
||||||
|
|
||||||
// Debounce JSON parsing and parent updates to handle typing gracefully
|
// Debounce JSON parsing and parent updates to handle typing gracefully
|
||||||
const debouncedUpdateParent = useCallback(
|
const debouncedUpdateParent = useCallback(
|
||||||
(jsonString: string) => {
|
(jsonString: string) => {
|
||||||
|
|
@ -253,6 +258,7 @@ const DynamicJsonForm = forwardRef<DynamicJsonFormRef, DynamicJsonFormProps>(
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
validateJson,
|
validateJson,
|
||||||
|
hasJsonError,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const renderFormFields = (
|
const renderFormFields = (
|
||||||
|
|
|
||||||
|
|
@ -102,9 +102,11 @@ const ToolsTab = ({
|
||||||
const { copied, setCopied } = useCopy();
|
const { copied, setCopied } = useCopy();
|
||||||
|
|
||||||
// Function to check if any form has validation errors
|
// Function to check if any form has validation errors
|
||||||
const checkValidationErrors = () => {
|
const checkValidationErrors = (validateChildren: boolean = false) => {
|
||||||
const errors = Object.values(formRefs.current).some(
|
const errors = Object.values(formRefs.current).some(
|
||||||
(ref) => ref && !ref.validateJson().isValid,
|
(ref) =>
|
||||||
|
ref &&
|
||||||
|
(validateChildren ? !ref.validateJson().isValid : ref.hasJsonError()),
|
||||||
);
|
);
|
||||||
setHasValidationErrors(errors);
|
setHasValidationErrors(errors);
|
||||||
return errors;
|
return errors;
|
||||||
|
|
@ -675,7 +677,7 @@ const ToolsTab = ({
|
||||||
<Button
|
<Button
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
// Validate JSON inputs before calling tool
|
// Validate JSON inputs before calling tool
|
||||||
if (checkValidationErrors()) return;
|
if (checkValidationErrors(true)) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setIsToolRunning(true);
|
setIsToolRunning(true);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue