Removed pagination when its on the left side, fixed bug on opening parameter if the record is not a list

This commit is contained in:
Lucas Oliveira 2024-06-10 15:59:59 -03:00
commit c8ba001c54
3 changed files with 21 additions and 18 deletions

View file

@ -12,7 +12,6 @@ import { cn, toTitleCase } from "../../utils/utils";
import ForwardedIconComponent from "../genericIconComponent"; import ForwardedIconComponent from "../genericIconComponent";
import { Alert, AlertDescription, AlertTitle } from "../ui/alert"; import { Alert, AlertDescription, AlertTitle } from "../ui/alert";
import TableOptions from "./components/TableOptions"; import TableOptions from "./components/TableOptions";
import { useParams } from "react-router-dom";
import resetGrid from "./utils/reset-grid-columns"; import resetGrid from "./utils/reset-grid-columns";
interface TableComponentProps extends AgGridReactProps { interface TableComponentProps extends AgGridReactProps {
@ -21,6 +20,7 @@ interface TableComponentProps extends AgGridReactProps {
alertTitle?: string; alertTitle?: string;
alertDescription?: string; alertDescription?: string;
editable?: boolean | string[]; editable?: boolean | string[];
pagination?: boolean;
onDelete?: () => void; onDelete?: () => void;
onDuplicate?: () => void; onDuplicate?: () => void;
} }
@ -134,7 +134,6 @@ const TableComponent = forwardRef<
}} }}
columnDefs={colDef} columnDefs={colDef}
ref={realRef} ref={realRef}
pagination={true}
onGridReady={onGridReady} onGridReady={onGridReady}
onColumnMoved={onColumnMoved} onColumnMoved={onColumnMoved}
onStateUpdated={(e) => { onStateUpdated={(e) => {
@ -143,18 +142,20 @@ const TableComponent = forwardRef<
} }
}} }}
/> />
<TableOptions {props.pagination && (
stateChange={columnStateChange} <TableOptions
hasSelection={realRef.current?.api?.getSelectedRows().length > 0} stateChange={columnStateChange}
duplicateRow={props.onDuplicate ? props.onDuplicate : undefined} hasSelection={realRef.current?.api?.getSelectedRows().length > 0}
deleteRow={props.onDelete ? props.onDelete : undefined} duplicateRow={props.onDuplicate ? props.onDuplicate : undefined}
resetGrid={() => { deleteRow={props.onDelete ? props.onDelete : undefined}
resetGrid(realRef, initialColumnDefs); resetGrid={() => {
setTimeout(() => { resetGrid(realRef, initialColumnDefs);
setColumnStateChange(false); setTimeout(() => {
}, 100); setColumnStateChange(false);
}} }, 100);
/> }}
/>
)}
</div> </div>
); );
}, },

View file

@ -255,9 +255,11 @@ export default function IOFieldView({
<RecordsOutputComponent <RecordsOutputComponent
pagination={!left} pagination={!left}
rows={ rows={
flowPoolNode?.data?.artifacts?.map( Array.isArray(flowPoolNode?.data?.artifacts)
(artifact) => artifact.data ? flowPoolNode?.data?.artifacts?.map(
) ?? [] (artifact) => artifact.data,
) ?? []
: [flowPoolNode?.data?.artifacts]
} }
columnMode="union" columnMode="union"
/> />

View file

@ -288,7 +288,7 @@ export default function IOModal({
const textOutputValue = const textOutputValue =
(flowPool[node!.id] ?? [])[ (flowPool[node!.id] ?? [])[
(flowPool[node!.id]?.length ?? 1) - 1 (flowPool[node!.id]?.length ?? 1) - 1
]?.data.results.result ?? ""; ]?.data?.artifacts ?? "";
const disabled = const disabled =
textOutputValue === "" || textOutputValue === "" ||
JSON.stringify(textOutputValue) === "{}"; JSON.stringify(textOutputValue) === "{}";