Skip to content

Commit 9cf8537

Browse files
authored
Merge pull request #858 from getmaxun/fix-list-limits
feat: display list names instead of generic labels while editing robots
2 parents b032de4 + a94b2c5 commit 9cf8537

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

src/components/robot/pages/RobotEditPage.tsx

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -510,27 +510,36 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
510510
{t("List Limits")}
511511
</Typography>
512512

513-
{scrapeListLimits.map((limitInfo, index) => (
514-
<TextField
515-
key={`limit-${limitInfo.pairIndex}-${limitInfo.actionIndex}`}
516-
label={`${t("List Limit")} ${index + 1}`}
517-
type="number"
518-
value={limitInfo.currentLimit || ""}
519-
onChange={(e) => {
520-
const value = parseInt(e.target.value, 10);
521-
if (value >= 1) {
522-
handleLimitChange(
523-
limitInfo.pairIndex,
524-
limitInfo.actionIndex,
525-
limitInfo.argIndex,
526-
value
527-
);
528-
}
529-
}}
530-
inputProps={{ min: 1 }}
531-
style={{ marginBottom: "20px" }}
532-
/>
533-
))}
513+
{scrapeListLimits.map((limitInfo, index) => {
514+
// Get the corresponding scrapeList action to extract its name
515+
const scrapeListAction = robot?.recording?.workflow?.[limitInfo.pairIndex]?.what?.[limitInfo.actionIndex];
516+
const actionName =
517+
scrapeListAction?.name ||
518+
(scrapeListAction?.args?.[0]?.__name) ||
519+
`List Limit ${index + 1}`;
520+
521+
return (
522+
<TextField
523+
key={`limit-${limitInfo.pairIndex}-${limitInfo.actionIndex}`}
524+
label={actionName}
525+
type="number"
526+
value={limitInfo.currentLimit || ""}
527+
onChange={(e) => {
528+
const value = parseInt(e.target.value, 10);
529+
if (value >= 1) {
530+
handleLimitChange(
531+
limitInfo.pairIndex,
532+
limitInfo.actionIndex,
533+
limitInfo.argIndex,
534+
value
535+
);
536+
}
537+
}}
538+
inputProps={{ min: 1 }}
539+
style={{ marginBottom: "20px" }}
540+
/>
541+
);
542+
})}
534543
</>
535544
);
536545
};

0 commit comments

Comments
 (0)