feat: disable sheets and airtable scrape robot
This commit is contained in:
@@ -110,10 +110,7 @@ const TableRowMemoized = memo(({ row, columns, handlers }: any) => {
|
||||
case 'integrate':
|
||||
return (
|
||||
<MemoizedTableCell key={column.id} align={column.align}>
|
||||
<MemoizedIntegrateButton
|
||||
handleIntegrate={() => handlers.handleIntegrateRecording(row.id, row.name, row.params || [])}
|
||||
robotType={row.type}
|
||||
/>
|
||||
<MemoizedIntegrateButton handleIntegrate={() => handlers.handleIntegrateRecording(row.id, row.name, row.params || [])} />
|
||||
</MemoizedTableCell>
|
||||
);
|
||||
case 'options':
|
||||
@@ -713,22 +710,13 @@ const ScheduleButton = ({ handleSchedule }: ScheduleButtonProps) => {
|
||||
|
||||
interface IntegrateButtonProps {
|
||||
handleIntegrate: () => void;
|
||||
robotType: string;
|
||||
}
|
||||
|
||||
const IntegrateButton = ({ handleIntegrate, robotType }: IntegrateButtonProps) => {
|
||||
const isDisabled = robotType === 'scrape';
|
||||
|
||||
const IntegrateButton = ({ handleIntegrate }: IntegrateButtonProps) => {
|
||||
return (
|
||||
<IconButton
|
||||
aria-label="integrate"
|
||||
size="small"
|
||||
onClick={isDisabled ? undefined : handleIntegrate}
|
||||
disabled={isDisabled}
|
||||
sx={{
|
||||
opacity: isDisabled ? 0.4 : 1,
|
||||
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
||||
}}
|
||||
<IconButton aria-label="add" size="small" onClick={() => {
|
||||
handleIntegrate();
|
||||
}}
|
||||
>
|
||||
<Power />
|
||||
</IconButton>
|
||||
|
||||
@@ -128,6 +128,8 @@ export const RobotIntegrationPage = ({
|
||||
"googleSheets" | "airtable" | "webhook" | null
|
||||
>(integrationType);
|
||||
|
||||
const isScrapeRobot = recording?.recording_meta?.type === "scrape";
|
||||
|
||||
const authenticateWithGoogle = () => {
|
||||
if (!recordingId) {
|
||||
console.error("Cannot authenticate: recordingId is null");
|
||||
@@ -729,26 +731,55 @@ export const RobotIntegrationPage = ({
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<Button variant="outlined" onClick={() => {
|
||||
if (!recordingId) return;
|
||||
setSelectedIntegrationType("googleSheets");
|
||||
setSettings({ ...settings, integrationType: "googleSheets" });
|
||||
const basePath = robotPath === "prebuilt-robots" ? "/prebuilt-robots" : "/robots";
|
||||
navigate(`${basePath}/${recordingId}/integrate/googleSheets`);
|
||||
}} style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
disabled={isScrapeRobot}
|
||||
onClick={() => {
|
||||
if (isScrapeRobot) return;
|
||||
if (!recordingId) return;
|
||||
setSelectedIntegrationType("googleSheets");
|
||||
setSettings({ ...settings, integrationType: "googleSheets" });
|
||||
const basePath = robotPath === "prebuilt-robots" ? "/prebuilt-robots" : "/robots";
|
||||
navigate(`${basePath}/${recordingId}/integrate/googleSheets`);
|
||||
}}
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
background: 'white',
|
||||
color: isScrapeRobot ? "#aaa" : "#ff00c3",
|
||||
opacity: isScrapeRobot ? 0.5 : 1,
|
||||
cursor: isScrapeRobot ? "not-allowed" : "pointer",
|
||||
}}
|
||||
>
|
||||
<img src="https://ik.imagekit.io/ys1blv5kv/gsheet.svg" alt="Google Sheets" style={{ margin: "6px" }} />
|
||||
Google Sheets
|
||||
</Button>
|
||||
<Button variant="outlined" onClick={() => {
|
||||
if (!recordingId) return;
|
||||
setSelectedIntegrationType("airtable");
|
||||
setSettings({ ...settings, integrationType: "airtable" });
|
||||
const basePath = robotPath === "prebuilt-robots" ? "/prebuilt-robots" : "/robots";
|
||||
navigate(`${basePath}/${recordingId}/integrate/airtable`);
|
||||
}} style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
disabled={isScrapeRobot}
|
||||
onClick={() => {
|
||||
if (isScrapeRobot) return;
|
||||
if (!recordingId) return;
|
||||
setSelectedIntegrationType("airtable");
|
||||
setSettings({ ...settings, integrationType: "airtable" });
|
||||
const basePath = robotPath === "prebuilt-robots" ? "/prebuilt-robots" : "/robots";
|
||||
navigate(`${basePath}/${recordingId}/integrate/airtable`);
|
||||
}}
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
background: 'white',
|
||||
color: isScrapeRobot ? "#aaa" : "#ff00c3",
|
||||
opacity: isScrapeRobot ? 0.5 : 1,
|
||||
cursor: isScrapeRobot ? "not-allowed" : "pointer",
|
||||
}}
|
||||
>
|
||||
<img src="https://ik.imagekit.io/ys1blv5kv/airtable.svg" alt="Airtable" style={{ margin: "6px" }} />
|
||||
Airtable
|
||||
</Button>
|
||||
|
||||
<Button variant="outlined" onClick={() => {
|
||||
if (!recordingId) return;
|
||||
setSelectedIntegrationType("webhook");
|
||||
|
||||
Reference in New Issue
Block a user