Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion frontend/src/components/widgets/resource-table/ResourceTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,12 @@ function ResourceTable({
ownerEmailsProp = "owner_emails",
countProp,
countLabel,
extraColumns = [],
handleEdit,
handleShare,
handleDelete,
handleCoOwner,
onRowClick,
sessionDetails,
showOwner = true,
isClickable = true,
Expand Down Expand Up @@ -373,6 +375,9 @@ function ResourceTable({
);
},
},
// Resource-specific columns (e.g. Files, Latest Version) sit between the
// shared date columns and Actions.
...extraColumns,
{
title: <span className="resource-table-th static right">Actions</span>,
key: "actions",
Expand All @@ -399,7 +404,12 @@ function ResourceTable({
onChange={handleChange}
rowClassName={isClickable ? "resource-table-row-clickable" : ""}
onRow={(item) => ({
onClick: isClickable ? () => navigate(`${item?.[idProp]}`) : undefined,
// onRowClick lets callers override the default relative nav (e.g. an
// absolute org-scoped path with router state).
onClick: isClickable
? () =>
onRowClick ? onRowClick(item) : navigate(`${item?.[idProp]}`)
: undefined,
})}
pagination={{
current: pagination?.current,
Expand Down Expand Up @@ -433,10 +443,12 @@ ResourceTable.propTypes = {
ownerEmailsProp: PropTypes.string,
countProp: PropTypes.string,
countLabel: PropTypes.string,
extraColumns: PropTypes.array,
handleEdit: PropTypes.func,
handleShare: PropTypes.func,
handleDelete: PropTypes.func,
handleCoOwner: PropTypes.func,
onRowClick: PropTypes.func,
sessionDetails: PropTypes.object,
showOwner: PropTypes.bool,
isClickable: PropTypes.bool,
Expand Down