From 5761163dea1961418be7c8c41e8273c252ca87d9 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 28 Oct 2024 20:41:16 +0530 Subject: [PATCH] feat: settings column --- src/components/molecules/ColapsibleRow.tsx | 59 ++++++++++++++++++++-- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/src/components/molecules/ColapsibleRow.tsx b/src/components/molecules/ColapsibleRow.tsx index e942910d..e600837d 100644 --- a/src/components/molecules/ColapsibleRow.tsx +++ b/src/components/molecules/ColapsibleRow.tsx @@ -2,11 +2,26 @@ import { useEffect, useRef, useState } from "react"; import * as React from "react"; import TableRow from "@mui/material/TableRow"; import TableCell from "@mui/material/TableCell"; -import { Box, Collapse, IconButton, Typography, Chip } from "@mui/material"; -import { DeleteForever, KeyboardArrowDown, KeyboardArrowUp } from "@mui/icons-material"; +import { Box, Collapse, IconButton, Typography, Chip, TextField } from "@mui/material"; +import { DeleteForever, KeyboardArrowDown, KeyboardArrowUp, Settings } from "@mui/icons-material"; import { deleteRunFromStorage } from "../../api/storage"; import { columns, Data } from "./RunsTable"; import { RunContent } from "./RunContent"; +import { GenericModal } from "../atoms/GenericModal"; +import { modalStyle } from "./AddWhereCondModal"; + +interface RunTypeChipProps { + runByUserId?: string; + runByScheduledId?: string; + runByAPI: boolean; +} + +const RunTypeChip: React.FC = ({ runByUserId, runByScheduledId, runByAPI }) => { + if (runByUserId) return ; + if (runByScheduledId) return ; + if (runByAPI) return ; + return ; +}; interface CollapsibleRowProps { row: Data; @@ -18,6 +33,14 @@ interface CollapsibleRowProps { } export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRunHandler, runningRecordingName }: CollapsibleRowProps) => { const [open, setOpen] = useState(isOpen); + const [openSettingsModal, setOpenSettingsModal] = useState(false); + const runByLabel = row.runByUserId + ? `User ID: ${row.runByUserId}` + : row.runByScheduleId + ? `Schedule ID: ${row.runByScheduleId}` + : row.runByAPI + ? 'API' + : 'Unknown'; const logEndRef = useRef(null); @@ -56,12 +79,12 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun if (value !== undefined) { return ( - {value} + {value} ); } else { switch (column.id) { - case 'robotStatus': + case 'runStatus': return ( {row.status === 'success' && } @@ -92,6 +115,34 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun } ) + case 'settings': + return ( + + setOpenSettingsModal(true)}> + + + setOpenSettingsModal(false)} + modalStyle={modalStyle} + > + <> + Run Settings + + + + Run Type: + + + + + + + ) default: return null; }