feat: add robot duplication modal
This commit is contained in:
@@ -6,6 +6,7 @@ import { ScheduleSettings, ScheduleSettingsModal } from "../molecules/ScheduleSe
|
|||||||
import { IntegrationSettings, IntegrationSettingsModal } from "../molecules/IntegrationSettings";
|
import { IntegrationSettings, IntegrationSettingsModal } from "../molecules/IntegrationSettings";
|
||||||
import { RobotSettings, RobotSettingsModal } from "../molecules/RobotSettings";
|
import { RobotSettings, RobotSettingsModal } from "../molecules/RobotSettings";
|
||||||
import { RobotEditModal } from '../molecules/RobotEdit';
|
import { RobotEditModal } from '../molecules/RobotEdit';
|
||||||
|
import { RobotDuplicationModal } from '../molecules/RobotDuplicate';
|
||||||
|
|
||||||
interface RecordingsProps {
|
interface RecordingsProps {
|
||||||
handleEditRecording: (id: string, fileName: string) => void;
|
handleEditRecording: (id: string, fileName: string) => void;
|
||||||
@@ -20,11 +21,13 @@ export const Recordings = ({ handleEditRecording, handleRunRecording, setRecordi
|
|||||||
const [integrateSettingsAreOpen, setIntegrateSettingsAreOpen] = useState(false);
|
const [integrateSettingsAreOpen, setIntegrateSettingsAreOpen] = useState(false);
|
||||||
const [robotSettingsAreOpen, setRobotSettingsAreOpen] = useState(false);
|
const [robotSettingsAreOpen, setRobotSettingsAreOpen] = useState(false);
|
||||||
const [robotEditAreOpen, setRobotEditAreOpen] = useState(false);
|
const [robotEditAreOpen, setRobotEditAreOpen] = useState(false);
|
||||||
|
const [robotDuplicateAreOpen, setRobotDuplicateAreOpen] = useState(false);
|
||||||
const [params, setParams] = useState<string[]>([]);
|
const [params, setParams] = useState<string[]>([]);
|
||||||
const [selectedRecordingId, setSelectedRecordingId] = useState<string>('');
|
const [selectedRecordingId, setSelectedRecordingId] = useState<string>('');
|
||||||
const handleIntegrateRecording = (id: string, settings: IntegrationSettings) => {};
|
const handleIntegrateRecording = (id: string, settings: IntegrationSettings) => {};
|
||||||
const handleSettingsRecording = (id: string, settings: RobotSettings) => {};
|
const handleSettingsRecording = (id: string, settings: RobotSettings) => {};
|
||||||
const handleEditRobot = (id: string, settings: RobotSettings) => {};
|
const handleEditRobot = (id: string, settings: RobotSettings) => {};
|
||||||
|
const handleDuplicateRobot = (id: string, settings: RobotSettings) => {};
|
||||||
|
|
||||||
const handleSettingsAndIntegrate = (id: string, name: string, params: string[]) => {
|
const handleSettingsAndIntegrate = (id: string, name: string, params: string[]) => {
|
||||||
if (params.length === 0) {
|
if (params.length === 0) {
|
||||||
@@ -91,6 +94,19 @@ export const Recordings = ({ handleEditRecording, handleRunRecording, setRecordi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleDuplicateRobotOption = (id: string, name: string, params: string[]) => {
|
||||||
|
if (params.length === 0) {
|
||||||
|
setRobotDuplicateAreOpen(true);
|
||||||
|
setRecordingInfo(id, name);
|
||||||
|
setSelectedRecordingId(id);
|
||||||
|
} else {
|
||||||
|
setParams(params);
|
||||||
|
setRobotDuplicateAreOpen(true);
|
||||||
|
setRecordingInfo(id, name);
|
||||||
|
setSelectedRecordingId(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setParams([]);
|
setParams([]);
|
||||||
setRunSettingsAreOpen(false);
|
setRunSettingsAreOpen(false);
|
||||||
@@ -126,6 +142,13 @@ export const Recordings = ({ handleEditRecording, handleRunRecording, setRecordi
|
|||||||
setSelectedRecordingId('');
|
setSelectedRecordingId('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleRobotDuplicateClose = () => {
|
||||||
|
setParams([]);
|
||||||
|
setRobotDuplicateAreOpen(false);
|
||||||
|
setRecordingInfo('', '');
|
||||||
|
setSelectedRecordingId('');
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<RunSettingsModal isOpen={runSettingsAreOpen}
|
<RunSettingsModal isOpen={runSettingsAreOpen}
|
||||||
@@ -150,6 +173,10 @@ export const Recordings = ({ handleEditRecording, handleRunRecording, setRecordi
|
|||||||
handleClose={handleRobotEditClose}
|
handleClose={handleRobotEditClose}
|
||||||
handleStart={(settings) => handleEditRobot(selectedRecordingId,settings)}
|
handleStart={(settings) => handleEditRobot(selectedRecordingId,settings)}
|
||||||
/>
|
/>
|
||||||
|
<RobotDuplicationModal isOpen={robotDuplicateAreOpen}
|
||||||
|
handleClose={handleRobotDuplicateClose}
|
||||||
|
handleStart={(settings) => handleDuplicateRobot(selectedRecordingId, settings)}
|
||||||
|
/>
|
||||||
<Grid container direction="column" sx={{ padding: '30px' }}>
|
<Grid container direction="column" sx={{ padding: '30px' }}>
|
||||||
<Grid item xs>
|
<Grid item xs>
|
||||||
<RecordingsTable
|
<RecordingsTable
|
||||||
@@ -159,6 +186,7 @@ export const Recordings = ({ handleEditRecording, handleRunRecording, setRecordi
|
|||||||
handleIntegrateRecording={handleSettingsAndIntegrate}
|
handleIntegrateRecording={handleSettingsAndIntegrate}
|
||||||
handleSettingsRecording={handleRobotSettings}
|
handleSettingsRecording={handleRobotSettings}
|
||||||
handleEditRobot={handleEditRobotOption}
|
handleEditRobot={handleEditRobotOption}
|
||||||
|
handleDuplicateRobot={handleDuplicateRobotOption}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user