Skip to content

Commit 8fd3528

Browse files
committed
fix: settings limit capture list
1 parent fb3e41e commit 8fd3528

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

src/components/robot/pages/RobotSettingsPage.tsx

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,36 @@ export const RobotSettingsPage = ({ handleStart }: RobotSettingsProps) => {
152152
}}
153153
style={{ marginBottom: "20px" }}
154154
/>
155-
{robot.recording.workflow?.[0]?.what?.[0]?.args?.[0]?.limit !==
156-
undefined && (
157-
<TextField
158-
label={t("robot_settings.robot_limit")}
159-
type="number"
160-
value={
161-
robot.recording.workflow[0].what[0].args[0].limit || ""
162-
}
163-
InputProps={{
164-
readOnly: true,
165-
}}
166-
style={{ marginBottom: "20px" }}
167-
/>
168-
)}
155+
{(() => {
156+
let listCounter = 1;
157+
158+
return robot.recording.workflow.flatMap((wf, wfIndex) =>
159+
wf.what.flatMap((action, actionIndex) => {
160+
const argsWithLimit = action.args?.filter(
161+
(arg: any) => arg && typeof arg === "object" && arg.limit !== undefined
162+
);
163+
164+
if (!argsWithLimit?.length) return [];
165+
166+
return argsWithLimit.map((arg, limitIndex) => {
167+
const labelName = action.name || `List ${listCounter++}`;
168+
return (
169+
<TextField
170+
key={`limit-${wfIndex}-${actionIndex}-${limitIndex}`}
171+
label={`${t("robot_settings.robot_limit")} (${labelName})`}
172+
type="number"
173+
value={arg.limit || ""}
174+
InputProps={{
175+
readOnly: true,
176+
}}
177+
style={{ marginBottom: "20px" }}
178+
/>
179+
);
180+
});
181+
})
182+
);
183+
})()}
184+
169185
<TextField
170186
label={t("robot_settings.created_by_user")}
171187
key="Created By User"

0 commit comments

Comments
 (0)