From dbb90a2220d6017ba6300da24582601bfdefcbda Mon Sep 17 00:00:00 2001 From: Chandrasekharan M Date: Wed, 29 Jul 2026 18:46:37 +0530 Subject: [PATCH] UN-3770 [FEAT] ResourceTable: extraColumns + onRowClick override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let callers inject resource-specific columns (inserted before Actions) and override the default relative row-click nav — needed so the Prompt Studio lookups table can reuse this widget while keeping its Files/Latest Version columns and its absolute, stateful navigation. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_018HXYFVCZGi7YN9qjDGyJCQ --- .../widgets/resource-table/ResourceTable.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/widgets/resource-table/ResourceTable.jsx b/frontend/src/components/widgets/resource-table/ResourceTable.jsx index 5cb3d3e3a4..8e4ca6e8ef 100644 --- a/frontend/src/components/widgets/resource-table/ResourceTable.jsx +++ b/frontend/src/components/widgets/resource-table/ResourceTable.jsx @@ -134,10 +134,12 @@ function ResourceTable({ ownerEmailsProp = "owner_emails", countProp, countLabel, + extraColumns = [], handleEdit, handleShare, handleDelete, handleCoOwner, + onRowClick, sessionDetails, showOwner = true, isClickable = true, @@ -373,6 +375,9 @@ function ResourceTable({ ); }, }, + // Resource-specific columns (e.g. Files, Latest Version) sit between the + // shared date columns and Actions. + ...extraColumns, { title: Actions, key: "actions", @@ -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, @@ -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,