feat: add translation for robot settings
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { GenericModal } from "../atoms/GenericModal";
|
import { GenericModal } from "../atoms/GenericModal";
|
||||||
import { TextField, Typography, Box } from "@mui/material";
|
import { TextField, Typography, Box } from "@mui/material";
|
||||||
import { modalStyle } from "./AddWhereCondModal";
|
import { modalStyle } from "./AddWhereCondModal";
|
||||||
@@ -50,10 +51,10 @@ interface RobotSettingsProps {
|
|||||||
handleStart: (settings: RobotSettings) => void;
|
handleStart: (settings: RobotSettings) => void;
|
||||||
handleClose: () => void;
|
handleClose: () => void;
|
||||||
initialSettings?: RobotSettings | null;
|
initialSettings?: RobotSettings | null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RobotSettingsModal = ({ isOpen, handleStart, handleClose, initialSettings }: RobotSettingsProps) => {
|
export const RobotSettingsModal = ({ isOpen, handleStart, handleClose, initialSettings }: RobotSettingsProps) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const [robot, setRobot] = useState<RobotSettings | null>(null);
|
const [robot, setRobot] = useState<RobotSettings | null>(null);
|
||||||
const [userEmail, setUserEmail] = useState<string | null>(null);
|
const [userEmail, setUserEmail] = useState<string | null>(null);
|
||||||
const { recordingId, notify } = useGlobalInfoStore();
|
const { recordingId, notify } = useGlobalInfoStore();
|
||||||
@@ -69,7 +70,7 @@ export const RobotSettingsModal = ({ isOpen, handleStart, handleClose, initialSe
|
|||||||
const robot = await getStoredRecording(recordingId);
|
const robot = await getStoredRecording(recordingId);
|
||||||
setRobot(robot);
|
setRobot(robot);
|
||||||
} else {
|
} else {
|
||||||
notify('error', 'Could not find robot details. Please try again.');
|
notify('error', t('robot_settings.errors.robot_not_found'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,13 +98,15 @@ export const RobotSettingsModal = ({ isOpen, handleStart, handleClose, initialSe
|
|||||||
modalStyle={modalStyle}
|
modalStyle={modalStyle}
|
||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
<Typography variant="h5" style={{ marginBottom: '20px' }}>Robot Settings</Typography>
|
<Typography variant="h5" style={{ marginBottom: '20px' }}>
|
||||||
|
{t('robot_settings.title')}
|
||||||
|
</Typography>
|
||||||
<Box style={{ display: 'flex', flexDirection: 'column' }}>
|
<Box style={{ display: 'flex', flexDirection: 'column' }}>
|
||||||
{
|
{
|
||||||
robot && (
|
robot && (
|
||||||
<>
|
<>
|
||||||
<TextField
|
<TextField
|
||||||
label="Robot Target URL"
|
label={t('robot_settings.target_url')}
|
||||||
key="Robot Target URL"
|
key="Robot Target URL"
|
||||||
value={targetUrl}
|
value={targetUrl}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
@@ -112,7 +115,7 @@ export const RobotSettingsModal = ({ isOpen, handleStart, handleClose, initialSe
|
|||||||
style={{ marginBottom: '20px' }}
|
style={{ marginBottom: '20px' }}
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
label="Robot ID"
|
label={t('robot_settings.robot_id')}
|
||||||
key="Robot ID"
|
key="Robot ID"
|
||||||
value={robot.recording_meta.id}
|
value={robot.recording_meta.id}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
@@ -122,17 +125,17 @@ export const RobotSettingsModal = ({ isOpen, handleStart, handleClose, initialSe
|
|||||||
/>
|
/>
|
||||||
{robot.recording.workflow?.[0]?.what?.[0]?.args?.[0]?.limit !== undefined && (
|
{robot.recording.workflow?.[0]?.what?.[0]?.args?.[0]?.limit !== undefined && (
|
||||||
<TextField
|
<TextField
|
||||||
label="Robot Limit"
|
label={t('robot_settings.robot_limit')}
|
||||||
type="number"
|
type="number"
|
||||||
value={robot.recording.workflow[0].what[0].args[0].limit || ''}
|
value={robot.recording.workflow[0].what[0].args[0].limit || ''}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
}}
|
}}
|
||||||
style={{ marginBottom: '20px' }}
|
style={{ marginBottom: '20px' }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<TextField
|
<TextField
|
||||||
label="Created By User"
|
label={t('robot_settings.created_by_user')}
|
||||||
key="Created By User"
|
key="Created By User"
|
||||||
value={userEmail ? userEmail : ''}
|
value={userEmail ? userEmail : ''}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
@@ -141,7 +144,7 @@ export const RobotSettingsModal = ({ isOpen, handleStart, handleClose, initialSe
|
|||||||
style={{ marginBottom: '20px' }}
|
style={{ marginBottom: '20px' }}
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
label="Robot Created At"
|
label={t('robot_settings.created_at')}
|
||||||
key="Robot Created At"
|
key="Robot Created At"
|
||||||
value={robot.recording_meta.createdAt}
|
value={robot.recording_meta.createdAt}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
@@ -156,4 +159,4 @@ export const RobotSettingsModal = ({ isOpen, handleStart, handleClose, initialSe
|
|||||||
</>
|
</>
|
||||||
</GenericModal>
|
</GenericModal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user