feat: !show developer mode settings

This commit is contained in:
amhsirak
2025-01-26 23:48:21 +05:30
parent dde130106c
commit b509e40dce

View File

@@ -1,4 +1,4 @@
import React, { useState } from 'react'; import React, { useState } from "react";
import { GenericModal } from "../ui/GenericModal"; import { GenericModal } from "../ui/GenericModal";
import { MenuItem, TextField, Typography, Switch, FormControlLabel } from "@mui/material"; import { MenuItem, TextField, Typography, Switch, FormControlLabel } from "@mui/material";
import { Dropdown } from "../ui/DropdownMui"; import { Dropdown } from "../ui/DropdownMui";
@@ -29,24 +29,38 @@ export const RunSettingsModal = ({ isOpen, handleStart, handleClose, isTask, par
const [showInterpreterSettings, setShowInterpreterSettings] = useState(false); const [showInterpreterSettings, setShowInterpreterSettings] = useState(false);
const startImmediately = () => {
handleStart(settings); // Start functionality directly
};
// Start directly without opening the modal
if (!showInterpreterSettings) {
startImmediately();
return null; // Do not render the modal
}
return ( return (
<GenericModal <GenericModal
isOpen={isOpen} isOpen={isOpen}
onClose={handleClose} onClose={handleClose}
modalStyle={modalStyle} modalStyle={modalStyle}
> >
<div style={{ <div
display: 'flex', style={{
flexDirection: 'column', display: "flex",
alignItems: 'flex-start', flexDirection: "column",
marginLeft: '65px', alignItems: "flex-start",
}}> marginLeft: "65px",
}}
>
{isTask && ( {isTask && (
<React.Fragment> <React.Fragment>
<Typography sx={{ margin: '20px 0px' }}>Recording parameters:</Typography> <Typography sx={{ margin: "20px 0px" }}>
Recording parameters:
</Typography>
{params?.map((item, index) => ( {params?.map((item, index) => (
<TextField <TextField
sx={{ marginBottom: '15px' }} sx={{ marginBottom: "15px" }}
key={`param-${index}`} key={`param-${index}`}
type="string" type="string"
label={item} label={item}
@@ -65,15 +79,22 @@ export const RunSettingsModal = ({ isOpen, handleStart, handleClose, isTask, par
)} )}
<FormControlLabel <FormControlLabel
control={<Switch checked={showInterpreterSettings} onChange={() => setShowInterpreterSettings(!showInterpreterSettings)} />} control={
<Switch
checked={showInterpreterSettings}
onChange={() =>
setShowInterpreterSettings(!showInterpreterSettings)
}
/>
}
label="Developer Mode Settings" label="Developer Mode Settings"
sx={{ margin: '20px 0px' }} sx={{ margin: "20px 0px" }}
/> />
{showInterpreterSettings && ( {showInterpreterSettings && (
<React.Fragment> <React.Fragment>
<TextField <TextField
sx={{ marginBottom: '15px' }} sx={{ marginBottom: "15px" }}
type="number" type="number"
label="Max Concurrency" label="Max Concurrency"
required required
@@ -86,7 +107,7 @@ export const RunSettingsModal = ({ isOpen, handleStart, handleClose, isTask, par
defaultValue={settings.maxConcurrency} defaultValue={settings.maxConcurrency}
/> />
<TextField <TextField
sx={{ marginBottom: '15px' }} sx={{ marginBottom: "15px" }}
type="number" type="number"
label="Max Repeats" label="Max Repeats"
required required
@@ -115,7 +136,13 @@ export const RunSettingsModal = ({ isOpen, handleStart, handleClose, isTask, par
</React.Fragment> </React.Fragment>
)} )}
<Button variant="contained" onClick={() => handleStart(settings)} sx={{ marginTop: '20px' }}>Run Robot</Button> <Button
variant="contained"
onClick={() => handleStart(settings)}
sx={{ marginTop: "20px" }}
>
Run Robot
</Button>
</div> </div>
</GenericModal> </GenericModal>
); );