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

View file

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

View file

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