feat: debug mode
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { GenericModal } from "../atoms/GenericModal";
|
import { GenericModal } from "../atoms/GenericModal";
|
||||||
import { MenuItem, TextField, Typography } from "@mui/material";
|
import { MenuItem, TextField, Typography, Switch, FormControlLabel } from "@mui/material";
|
||||||
import { Dropdown } from "../atoms/DropdownMui";
|
import { Dropdown } from "../atoms/DropdownMui";
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import { modalStyle } from "./AddWhereCondModal";
|
import { modalStyle } from "./AddWhereCondModal";
|
||||||
@@ -21,13 +21,14 @@ export interface RunSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const RunSettingsModal = ({ isOpen, handleStart, handleClose, isTask, params }: RunSettingsProps) => {
|
export const RunSettingsModal = ({ isOpen, handleStart, handleClose, isTask, params }: RunSettingsProps) => {
|
||||||
|
const [settings, setSettings] = useState<RunSettings>({
|
||||||
const [settings, setSettings] = React.useState<RunSettings>({
|
|
||||||
maxConcurrency: 1,
|
maxConcurrency: 1,
|
||||||
maxRepeats: 1,
|
maxRepeats: 1,
|
||||||
debug: true,
|
debug: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [showInterpreterSettings, setShowInterpreterSettings] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericModal
|
<GenericModal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
@@ -40,75 +41,83 @@ export const RunSettingsModal = ({ isOpen, handleStart, handleClose, isTask, par
|
|||||||
alignItems: 'flex-start',
|
alignItems: 'flex-start',
|
||||||
marginLeft: '65px',
|
marginLeft: '65px',
|
||||||
}}>
|
}}>
|
||||||
{isTask
|
{isTask && (
|
||||||
?
|
<React.Fragment>
|
||||||
(
|
<Typography sx={{ margin: '20px 0px' }}>Recording parameters:</Typography>
|
||||||
<React.Fragment>
|
{params?.map((item, index) => (
|
||||||
<Typography sx={{ margin: '20px 0px' }} >Recording parameters:</Typography>
|
<TextField
|
||||||
{params?.map((item, index) => {
|
sx={{ marginBottom: '15px' }}
|
||||||
return <TextField
|
key={`param-${index}`}
|
||||||
sx={{ marginBottom: '15px' }}
|
type="string"
|
||||||
key={`param-${index}`}
|
label={item}
|
||||||
type="string"
|
required
|
||||||
label={item}
|
onChange={(e) =>
|
||||||
required
|
setSettings({
|
||||||
onChange={(e) => setSettings(
|
...settings,
|
||||||
{
|
params: settings.params
|
||||||
...settings,
|
? { ...settings.params, [item]: e.target.value }
|
||||||
params: settings.params
|
: { [item]: e.target.value },
|
||||||
? {
|
})
|
||||||
...settings.params,
|
}
|
||||||
[item]: e.target.value,
|
/>
|
||||||
}
|
))}
|
||||||
: {
|
</React.Fragment>
|
||||||
[item]: e.target.value,
|
)}
|
||||||
},
|
|
||||||
})}
|
<FormControlLabel
|
||||||
/>
|
control={<Switch checked={showInterpreterSettings} onChange={() => setShowInterpreterSettings(!showInterpreterSettings)} />}
|
||||||
})}
|
label="Show Interpreter Settings"
|
||||||
</React.Fragment>)
|
sx={{ margin: '20px 0px' }}
|
||||||
: null
|
|
||||||
}
|
|
||||||
<Typography sx={{ margin: '20px 0px' }} >Interpreter settings:</Typography>
|
|
||||||
<TextField
|
|
||||||
sx={{ marginBottom: '15px' }}
|
|
||||||
type="number"
|
|
||||||
label="maxConcurrency"
|
|
||||||
required
|
|
||||||
onChange={(e) => setSettings(
|
|
||||||
{
|
|
||||||
...settings,
|
|
||||||
maxConcurrency: parseInt(e.target.value),
|
|
||||||
})}
|
|
||||||
defaultValue={settings.maxConcurrency}
|
|
||||||
/>
|
/>
|
||||||
<TextField
|
|
||||||
sx={{ marginBottom: '15px' }}
|
{showInterpreterSettings && (
|
||||||
type="number"
|
<React.Fragment>
|
||||||
label="maxRepeats"
|
<Typography sx={{ margin: '20px 0px' }}>Interpreter settings:</Typography>
|
||||||
required
|
<TextField
|
||||||
onChange={(e) => setSettings(
|
sx={{ marginBottom: '15px' }}
|
||||||
{
|
type="number"
|
||||||
...settings,
|
label="Max Concurrency"
|
||||||
maxRepeats: parseInt(e.target.value),
|
required
|
||||||
})}
|
onChange={(e) =>
|
||||||
defaultValue={settings.maxRepeats}
|
setSettings({
|
||||||
/>
|
...settings,
|
||||||
<Dropdown
|
maxConcurrency: parseInt(e.target.value, 10),
|
||||||
id="debug"
|
})
|
||||||
label="debug"
|
}
|
||||||
value={settings.debug?.toString()}
|
defaultValue={settings.maxConcurrency}
|
||||||
handleSelect={(e) => setSettings(
|
/>
|
||||||
{
|
<TextField
|
||||||
...settings,
|
sx={{ marginBottom: '15px' }}
|
||||||
debug: e.target.value === "true",
|
type="number"
|
||||||
})}
|
label="Max Repeats"
|
||||||
>
|
required
|
||||||
<MenuItem value="true">true</MenuItem>
|
onChange={(e) =>
|
||||||
<MenuItem value="false">false</MenuItem>
|
setSettings({
|
||||||
</Dropdown>
|
...settings,
|
||||||
<Button onClick={() => handleStart(settings)}>Start</Button>
|
maxRepeats: parseInt(e.target.value, 10),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
defaultValue={settings.maxRepeats}
|
||||||
|
/>
|
||||||
|
<Dropdown
|
||||||
|
id="debug"
|
||||||
|
label="Debug Mode"
|
||||||
|
value={settings.debug?.toString()}
|
||||||
|
handleSelect={(e) =>
|
||||||
|
setSettings({
|
||||||
|
...settings,
|
||||||
|
debug: e.target.value === "true",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<MenuItem value="true">true</MenuItem>
|
||||||
|
<MenuItem value="false">false</MenuItem>
|
||||||
|
</Dropdown>
|
||||||
|
</React.Fragment>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Button onClick={() => handleStart(settings)} sx={{ marginTop: '20px' }}>Start</Button>
|
||||||
</div>
|
</div>
|
||||||
</GenericModal>
|
</GenericModal>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ export const UrlForm = ({
|
|||||||
setCurrentAddress(url);
|
setCurrentAddress(url);
|
||||||
lastSubmittedRef.current = url; // Update the last submitted URL
|
lastSubmittedRef.current = url; // Update the last submitted URL
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert(`ERROR: ${url} is not a valid url!`);
|
//alert(`ERROR: ${url} is not a valid url!`);
|
||||||
|
console.log(e)
|
||||||
}
|
}
|
||||||
}, [setCurrentAddress]);
|
}, [setCurrentAddress]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user