feat: show user email for run by user
This commit is contained in:
@@ -9,6 +9,7 @@ import { columns, Data } from "./RunsTable";
|
|||||||
import { RunContent } from "./RunContent";
|
import { RunContent } from "./RunContent";
|
||||||
import { GenericModal } from "../atoms/GenericModal";
|
import { GenericModal } from "../atoms/GenericModal";
|
||||||
import { modalStyle } from "./AddWhereCondModal";
|
import { modalStyle } from "./AddWhereCondModal";
|
||||||
|
import { getUserById } from "../../api/auth";
|
||||||
|
|
||||||
interface RunTypeChipProps {
|
interface RunTypeChipProps {
|
||||||
runByUserId?: string;
|
runByUserId?: string;
|
||||||
@@ -34,8 +35,9 @@ interface CollapsibleRowProps {
|
|||||||
export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRunHandler, runningRecordingName }: CollapsibleRowProps) => {
|
export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRunHandler, runningRecordingName }: CollapsibleRowProps) => {
|
||||||
const [open, setOpen] = useState(isOpen);
|
const [open, setOpen] = useState(isOpen);
|
||||||
const [openSettingsModal, setOpenSettingsModal] = useState(false);
|
const [openSettingsModal, setOpenSettingsModal] = useState(false);
|
||||||
|
const [userEmail, setUserEmail] = useState<string | null>(null);
|
||||||
const runByLabel = row.runByUserId
|
const runByLabel = row.runByUserId
|
||||||
? `${row.runByUserId}`
|
? `${userEmail}`
|
||||||
: row.runByScheduleId
|
: row.runByScheduleId
|
||||||
? `${row.runByScheduleId}`
|
? `${row.runByScheduleId}`
|
||||||
: row.runByAPI
|
: row.runByAPI
|
||||||
@@ -58,6 +60,18 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun
|
|||||||
scrollToLogBottom();
|
scrollToLogBottom();
|
||||||
}, [currentLog])
|
}, [currentLog])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchUserEmail = async () => {
|
||||||
|
if (row.runByUserId) {
|
||||||
|
const userData = await getUserById(row.runByUserId);
|
||||||
|
if (userData && userData.user) {
|
||||||
|
setUserEmail(userData.user.email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fetchUserEmail();
|
||||||
|
}, [row.runByUserId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }} hover role="checkbox" tabIndex={-1} key={row.id}>
|
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }} hover role="checkbox" tabIndex={-1} key={row.id}>
|
||||||
|
|||||||
Reference in New Issue
Block a user