Merge branch 'develop' of https://github.com/getmaxun/maxun into develop
This commit is contained in:
@@ -76,7 +76,14 @@ interface RecordingsTableProps {
|
|||||||
handleDuplicateRobot: (id: string, name: string, params: string[]) => void;
|
handleDuplicateRobot: (id: string, name: string, params: string[]) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handleScheduleRecording, handleIntegrateRecording, handleSettingsRecording, handleEditRobot, handleDuplicateRobot }: RecordingsTableProps) => {
|
export const RecordingsTable = ({
|
||||||
|
handleEditRecording,
|
||||||
|
handleRunRecording,
|
||||||
|
handleScheduleRecording,
|
||||||
|
handleIntegrateRecording,
|
||||||
|
handleSettingsRecording,
|
||||||
|
handleEditRobot,
|
||||||
|
handleDuplicateRobot }: RecordingsTableProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [page, setPage] = React.useState(0);
|
const [page, setPage] = React.useState(0);
|
||||||
const [rowsPerPage, setRowsPerPage] = React.useState(10);
|
const [rowsPerPage, setRowsPerPage] = React.useState(10);
|
||||||
@@ -109,7 +116,20 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handl
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const { notify, setRecordings, browserId, setBrowserId, setInitialUrl, recordingUrl, setRecordingUrl, isLogin, setIsLogin, recordingName, setRecordingName, recordingId, setRecordingId } = useGlobalInfoStore();
|
const {
|
||||||
|
notify,
|
||||||
|
setRecordings,
|
||||||
|
browserId,
|
||||||
|
setBrowserId,
|
||||||
|
setInitialUrl,
|
||||||
|
recordingUrl,
|
||||||
|
setRecordingUrl,
|
||||||
|
isLogin,
|
||||||
|
setIsLogin,
|
||||||
|
recordingName,
|
||||||
|
setRecordingName,
|
||||||
|
recordingId,
|
||||||
|
setRecordingId } = useGlobalInfoStore();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const handleChangePage = (event: unknown, newPage: number) => {
|
const handleChangePage = (event: unknown, newPage: number) => {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { useGlobalInfoStore } from '../../context/globalInfo';
|
|||||||
import { getStoredRecording, updateRecording } from '../../api/storage';
|
import { getStoredRecording, updateRecording } from '../../api/storage';
|
||||||
import { WhereWhatPair } from 'maxun-core';
|
import { WhereWhatPair } from 'maxun-core';
|
||||||
|
|
||||||
// Base interfaces for robot data structure
|
|
||||||
interface RobotMeta {
|
interface RobotMeta {
|
||||||
name: string;
|
name: string;
|
||||||
id: string;
|
id: string;
|
||||||
@@ -55,7 +54,6 @@ interface RobotSettingsProps {
|
|||||||
initialSettings?: RobotSettings | null;
|
initialSettings?: RobotSettings | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enhanced interfaces for credential handling
|
|
||||||
interface CredentialInfo {
|
interface CredentialInfo {
|
||||||
value: string;
|
value: string;
|
||||||
type: string;
|
type: string;
|
||||||
@@ -95,27 +93,20 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
|
|||||||
|
|
||||||
const isUsernameSelector = (selector: string): boolean => {
|
const isUsernameSelector = (selector: string): boolean => {
|
||||||
return selector.toLowerCase().includes('username') ||
|
return selector.toLowerCase().includes('username') ||
|
||||||
selector.toLowerCase().includes('user') ||
|
selector.toLowerCase().includes('user') ||
|
||||||
selector.toLowerCase().includes('email');
|
selector.toLowerCase().includes('email');
|
||||||
};
|
};
|
||||||
|
|
||||||
const determineCredentialType = (selector: string, info: CredentialInfo): 'password' | 'email' | 'username' | 'other' => {
|
const determineCredentialType = (selector: string, info: CredentialInfo): 'password' | 'email' | 'username' | 'other' => {
|
||||||
// Check for password type first
|
if (info.type === 'password' || selector.toLowerCase().includes('password')) {
|
||||||
if (info.type === 'password') {
|
|
||||||
return 'password';
|
return 'password';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for email patterns in the value or selector
|
|
||||||
if (isEmailPattern(info.value) || selector.toLowerCase().includes('email')) {
|
if (isEmailPattern(info.value) || selector.toLowerCase().includes('email')) {
|
||||||
return 'email';
|
return 'email';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for username patterns in the selector
|
|
||||||
if (isUsernameSelector(selector)) {
|
if (isUsernameSelector(selector)) {
|
||||||
return 'username';
|
return 'username';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no specific pattern is matched, classify as other
|
|
||||||
return 'other';
|
return 'other';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -161,6 +152,11 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
|
|||||||
const character: string = action.args[1];
|
const character: string = action.args[1];
|
||||||
const inputType: string = action.args[2] || '';
|
const inputType: string = action.args[2] || '';
|
||||||
|
|
||||||
|
// Detect `input[type="password"]`
|
||||||
|
if (!currentType && inputType.toLowerCase() === 'password') {
|
||||||
|
currentType = 'password';
|
||||||
|
}
|
||||||
|
|
||||||
// If we're dealing with a new selector, store the previous one
|
// If we're dealing with a new selector, store the previous one
|
||||||
if (currentSelector && selector !== currentSelector) {
|
if (currentSelector && selector !== currentSelector) {
|
||||||
if (!credentials[currentSelector]) {
|
if (!credentials[currentSelector]) {
|
||||||
@@ -281,32 +277,28 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
|
|||||||
const renderAllCredentialFields = () => {
|
const renderAllCredentialFields = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Render username credentials */}
|
|
||||||
{renderCredentialFields(
|
{renderCredentialFields(
|
||||||
credentialGroups.usernames,
|
credentialGroups.usernames,
|
||||||
t('Username Credentials'),
|
t('Username'),
|
||||||
'text' // Always show usernames as text
|
'text'
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Render email credentials */}
|
|
||||||
{renderCredentialFields(
|
{renderCredentialFields(
|
||||||
credentialGroups.emails,
|
credentialGroups.emails,
|
||||||
t('Email Credentials'),
|
t('Email'),
|
||||||
'text' // Always show emails as text
|
'text'
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Render password credentials */}
|
|
||||||
{renderCredentialFields(
|
{renderCredentialFields(
|
||||||
credentialGroups.passwords,
|
credentialGroups.passwords,
|
||||||
t('Password Credentials'),
|
t('Password'),
|
||||||
'password' // Use password masking
|
'password'
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Render other credentials */}
|
|
||||||
{renderCredentialFields(
|
{renderCredentialFields(
|
||||||
credentialGroups.others,
|
credentialGroups.others,
|
||||||
t('Other Credentials'),
|
t('Other'),
|
||||||
'text' // Show other credentials as text
|
'text'
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -317,30 +309,27 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Typography variant="h6" style={{ marginBottom: '20px'}}>
|
{/* <Typography variant="h6" style={{ marginBottom: '20px' }}>
|
||||||
{headerText}
|
{headerText}
|
||||||
</Typography>
|
</Typography> */}
|
||||||
{selectors.map((selector) => {
|
{selectors.map((selector, index) => {
|
||||||
const isVisible = showPasswords[selector];
|
const isVisible = showPasswords[selector];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TextField
|
<TextField
|
||||||
key={selector}
|
key={selector}
|
||||||
// The type changes based on visibility state
|
|
||||||
type={isVisible ? 'text' : 'password'}
|
type={isVisible ? 'text' : 'password'}
|
||||||
label={`Credential for ${selector}`}
|
label={headerText === 'Other' ? `${`Input`} ${index + 1}` : headerText}
|
||||||
value={credentials[selector]?.value || ''}
|
value={credentials[selector]?.value || ''}
|
||||||
onChange={(e) => handleCredentialChange(selector, e.target.value)}
|
onChange={(e) => handleCredentialChange(selector, e.target.value)}
|
||||||
style={{ marginBottom: '20px' }}
|
style={{ marginBottom: '20px' }}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
// Now showing visibility toggle for all fields
|
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label="toggle credential visibility"
|
aria-label="Show input"
|
||||||
onClick={() => handleClickShowPassword(selector)}
|
onClick={() => handleClickShowPassword(selector)}
|
||||||
edge="end"
|
edge="end"
|
||||||
// Optional: disable if field is empty
|
|
||||||
disabled={!credentials[selector]?.value}
|
disabled={!credentials[selector]?.value}
|
||||||
>
|
>
|
||||||
{isVisible ? <Visibility /> : <VisibilityOff />}
|
{isVisible ? <Visibility /> : <VisibilityOff />}
|
||||||
@@ -434,6 +423,9 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
|
|||||||
|
|
||||||
{(robot.isLogin || Object.keys(credentials).length > 0) && (
|
{(robot.isLogin || Object.keys(credentials).length > 0) && (
|
||||||
<>
|
<>
|
||||||
|
<Typography variant="body1" style={{ marginBottom: '20px' }}>
|
||||||
|
{t('Input Texts')}
|
||||||
|
</Typography>
|
||||||
{renderAllCredentialFields()}
|
{renderAllCredentialFields()}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user