diff --git a/src/frontend/src/components/recordsOutputComponent/index.tsx b/src/frontend/src/components/recordsOutputComponent/index.tsx index a917d00fd..65c86e859 100644 --- a/src/frontend/src/components/recordsOutputComponent/index.tsx +++ b/src/frontend/src/components/recordsOutputComponent/index.tsx @@ -1,19 +1,22 @@ import { ColDef, ColGroupDef } from "ag-grid-community"; import "ag-grid-community/styles/ag-grid.css"; // Mandatory CSS required by the grid import "ag-grid-community/styles/ag-theme-balham.css"; // Optional Theme applied to the grid -import { FlowPoolObjectType } from "../../types/chat"; -import TableComponent from "../tableComponent"; import { extractColumnsFromRows } from "../../utils/utils"; +import TableComponent from "../tableComponent"; function RecordsOutputComponent({ - flowPoolObject, pagination, + rows, + columnMode, + columnDefsRow, }: { - flowPoolObject: FlowPoolObjectType; pagination: boolean; + rows: any; + columnMode: "intersection" | "union" | "all"; + columnDefsRow?: Array; }) { - const rows = flowPoolObject?.data?.artifacts?.records ?? []; - const columns = extractColumnsFromRows(rows, "union"); + const columns = extractColumnsFromRows(columnDefsRow ?? rows, columnMode); + const columnDefs = columns.map((col, idx) => ({ ...col, resizable: idx !== columns.length - 1, diff --git a/src/frontend/src/components/tableComponent/index.tsx b/src/frontend/src/components/tableComponent/index.tsx index 6113316be..7fc687a78 100644 --- a/src/frontend/src/components/tableComponent/index.tsx +++ b/src/frontend/src/components/tableComponent/index.tsx @@ -1,7 +1,7 @@ import "ag-grid-community/styles/ag-grid.css"; // Mandatory CSS required by the grid import "ag-grid-community/styles/ag-theme-quartz.css"; // Optional Theme applied to the grid import { AgGridReact, AgGridReactProps } from "ag-grid-react"; -import { ElementRef, forwardRef, useCallback } from "react"; +import { ElementRef, forwardRef } from "react"; import { DEFAULT_TABLE_ALERT_MSG, DEFAULT_TABLE_ALERT_TITLE, @@ -59,7 +59,9 @@ const TableComponent = forwardRef< className={cn(props.className, "custom-scroll")} defaultColDef={{ minWidth: 100, + autoHeight: true, }} + tooltipInteraction={true} ref={ref} /> diff --git a/src/frontend/src/customNodes/genericNode/components/outputModal/components/switchOutputView/helpers/convert-to-table-rows.ts b/src/frontend/src/customNodes/genericNode/components/outputModal/components/switchOutputView/helpers/convert-to-table-rows.ts new file mode 100644 index 000000000..db61acaa3 --- /dev/null +++ b/src/frontend/src/customNodes/genericNode/components/outputModal/components/switchOutputView/helpers/convert-to-table-rows.ts @@ -0,0 +1,4 @@ +export const convertToTableRows = (obj: Object) => { + const tokensArray = [Object.values(obj)[0]]; + return tokensArray; +}; diff --git a/src/frontend/src/customNodes/genericNode/components/outputModal/components/switchOutputView/index.tsx b/src/frontend/src/customNodes/genericNode/components/outputModal/components/switchOutputView/index.tsx index a81aadb7a..0c91059d2 100644 --- a/src/frontend/src/customNodes/genericNode/components/outputModal/components/switchOutputView/index.tsx +++ b/src/frontend/src/customNodes/genericNode/components/outputModal/components/switchOutputView/index.tsx @@ -2,23 +2,24 @@ import RecordsOutputComponent from "../../../../../../components/recordsOutputCo import { Case } from "../../../../../../shared/components/caseComponent"; import TextOutputView from "../../../../../../shared/components/textOutputView"; import useFlowStore from "../../../../../../stores/flowStore"; +import { convertToTableRows } from "./helpers/convert-to-table-rows"; export default function SwitchOutputView(nodeId): JSX.Element { - const nodes = useFlowStore((state) => state.nodes); - const setNode = useFlowStore((state) => state.setNode); - const flowPool = useFlowStore((state) => state.flowPool); - const node = nodes.find((node) => node?.id === nodeId?.nodeId); + const nodeIdentity = nodeId.nodeId; - const flowPoolNode = (flowPool[node!.id] ?? [])[ - (flowPool[node!.id]?.length ?? 1) - 1 + const nodes = useFlowStore((state) => state.nodes); + const flowPool = useFlowStore((state) => state.flowPool); + const node = nodes.find((node) => node?.id === nodeIdentity); + + const flowPoolNode = (flowPool[nodeIdentity] ?? [])[ + (flowPool[nodeIdentity]?.length ?? 1) - 1 ]; const results = flowPoolNode?.data?.logs[0] ?? ""; + const resultType = results?.type; + const resultMessage = results?.message; - const checkType = () => { - const typeOutput = typeof results; - return typeOutput; - }; + console.log("results", resultMessage); return ( <> @@ -26,14 +27,23 @@ export default function SwitchOutputView(nodeId): JSX.Element {
NO OUTPUT
- - + + - + + + + + diff --git a/src/frontend/src/customNodes/genericNode/components/outputModal/index.tsx b/src/frontend/src/customNodes/genericNode/components/outputModal/index.tsx index fbddc0275..4185a1d50 100644 --- a/src/frontend/src/customNodes/genericNode/components/outputModal/index.tsx +++ b/src/frontend/src/customNodes/genericNode/components/outputModal/index.tsx @@ -4,7 +4,7 @@ import SwitchOutputView from "./components/switchOutputView"; export default function OutputModal({ open, setOpen, nodeId }): JSX.Element { return ( - +
Output View diff --git a/src/frontend/src/modals/IOModal/components/IOFieldView/index.tsx b/src/frontend/src/modals/IOModal/components/IOFieldView/index.tsx index f73995c7a..e841797be 100644 --- a/src/frontend/src/modals/IOModal/components/IOFieldView/index.tsx +++ b/src/frontend/src/modals/IOModal/components/IOFieldView/index.tsx @@ -49,6 +49,8 @@ export default function IOFieldView({ (flowPool[node!.id] ?? [])[(flowPool[node!.id]?.length ?? 1) - 1]?.data .results.result ?? ""; + console.log(flowPoolNode?.data?.artifacts?.records); + function handleOutputType() { if (!node) return <>"No node found!"; switch (type) { @@ -161,14 +163,7 @@ export default function IOFieldView({ case InputOutput.OUTPUT: switch (fieldType) { case "TextOutput": - return ( - - ); + return ; case "PDFOutput": return left ? (
{PDFViewConstant}
@@ -256,8 +251,9 @@ export default function IOFieldView({ return (
); diff --git a/src/frontend/src/modals/baseModal/index.tsx b/src/frontend/src/modals/baseModal/index.tsx index dbde0969e..8f2a1e84d 100644 --- a/src/frontend/src/modals/baseModal/index.tsx +++ b/src/frontend/src/modals/baseModal/index.tsx @@ -86,7 +86,8 @@ interface BaseModalProps { | "medium-h-full" | "md-thin" | "sm-thin" - | "smaller-h-full"; + | "smaller-h-full" + | "medium-log"; disable?: boolean; onChangeOpenModal?: (open?: boolean) => void; @@ -172,8 +173,13 @@ function BaseModal({ case "large-h-full": minWidth = "min-w-[80vw]"; height = "h-full max-h-[70vh]"; - break; + + case "medium-log": + minWidth = "min-w-[60vw]"; + height = "h-[30vh]"; + break; + default: minWidth = "min-w-[80vw]"; height = "h-[80vh]"; diff --git a/src/frontend/src/shared/components/textOutputView/index.tsx b/src/frontend/src/shared/components/textOutputView/index.tsx index 38d0ca498..a73c5938f 100644 --- a/src/frontend/src/shared/components/textOutputView/index.tsx +++ b/src/frontend/src/shared/components/textOutputView/index.tsx @@ -1,16 +1,13 @@ import { Textarea } from "../../../components/ui/textarea"; -const TextOutputView = ({ left, node, flowPool, value }) => { +const TextOutputView = ({ left, value }) => { return ( <>