chore: lint
This commit is contained in:
@@ -20,8 +20,8 @@ interface RobotWorkflow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface RobotEditOptions {
|
interface RobotEditOptions {
|
||||||
name: string;
|
name: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ScheduleConfig {
|
interface ScheduleConfig {
|
||||||
@@ -85,9 +85,9 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
|
|||||||
const handleLimitChange = (newLimit: number) => {
|
const handleLimitChange = (newLimit: number) => {
|
||||||
setRobot((prev) => {
|
setRobot((prev) => {
|
||||||
if (!prev) return prev;
|
if (!prev) return prev;
|
||||||
|
|
||||||
const updatedWorkflow = [...prev.recording.workflow];
|
const updatedWorkflow = [...prev.recording.workflow];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
updatedWorkflow.length > 0 &&
|
updatedWorkflow.length > 0 &&
|
||||||
updatedWorkflow[0]?.what &&
|
updatedWorkflow[0]?.what &&
|
||||||
@@ -98,33 +98,33 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
|
|||||||
) {
|
) {
|
||||||
updatedWorkflow[0].what[0].args[0].limit = newLimit;
|
updatedWorkflow[0].what[0].args[0].limit = newLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { ...prev, recording: { ...prev.recording, workflow: updatedWorkflow } };
|
return { ...prev, recording: { ...prev.recording, workflow: updatedWorkflow } };
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
if (!robot) return;
|
if (!robot) return;
|
||||||
|
|
||||||
try {
|
|
||||||
const payload = {
|
|
||||||
name: robot.recording_meta.name,
|
|
||||||
limit: robot.recording.workflow[0]?.what[0]?.args?.[0]?.limit,
|
|
||||||
};
|
|
||||||
|
|
||||||
const success = await updateRecording(robot.recording_meta.id, payload);
|
|
||||||
|
|
||||||
if (success) {
|
|
||||||
notify('success', 'Robot updated successfully.');
|
|
||||||
handleStart(robot); // Inform parent about the updated robot
|
|
||||||
handleClose(); // Close the modal
|
|
||||||
|
|
||||||
window.location.reload();
|
try {
|
||||||
} else {
|
const payload = {
|
||||||
notify('error', 'Failed to update the robot. Please try again.');
|
name: robot.recording_meta.name,
|
||||||
}
|
limit: robot.recording.workflow[0]?.what[0]?.args?.[0]?.limit,
|
||||||
|
};
|
||||||
|
|
||||||
|
const success = await updateRecording(robot.recording_meta.id, payload);
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
notify('success', 'Robot updated successfully.');
|
||||||
|
handleStart(robot); // Inform parent about the updated robot
|
||||||
|
handleClose(); // Close the modal
|
||||||
|
|
||||||
|
window.location.reload();
|
||||||
|
} else {
|
||||||
|
notify('error', 'Failed to update the robot. Please try again.');
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notify('error', 'An error occurred while updating the robot.');
|
notify('error', 'An error occurred while updating the robot.');
|
||||||
console.error('Error updating robot:', error);
|
console.error('Error updating robot:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
|
|||||||
style={{ marginBottom: '20px' }}
|
style={{ marginBottom: '20px' }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box mt={2} display="flex" justifyContent="flex-end" onClick={handleSave}>
|
<Box mt={2} display="flex" justifyContent="flex-end" onClick={handleSave}>
|
||||||
<Button variant="contained" color="primary">
|
<Button variant="contained" color="primary">
|
||||||
Save Changes
|
Save Changes
|
||||||
|
|||||||
Reference in New Issue
Block a user