From 9646c0a7294a68323b300b4c16918cc1d0b05259 Mon Sep 17 00:00:00 2001 From: tchiotludo Date: Sat, 13 Feb 2021 14:54:16 +0100 Subject: [PATCH] fix(ui): schema registry link with multiple same schema close #599 --- client/src/components/Table/Table.jsx | 13 ++++++++----- .../src/containers/Schema/SchemaList/SchemaList.jsx | 8 +++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/client/src/components/Table/Table.jsx b/client/src/components/Table/Table.jsx index 4118a0f3c..35dc93f44 100644 --- a/client/src/components/Table/Table.jsx +++ b/client/src/components/Table/Table.jsx @@ -118,10 +118,10 @@ class Table extends Component { } onDoubleClick(onDetails, row) { - const { history } = this.props; + const { history, idCol } = this.props; if (onDetails) { - let url = onDetails(row.id, row); + let url = onDetails(idCol ? row[this.props.idCol] : row.id, row); if (url) { history.push({ pathname: url, @@ -288,7 +288,9 @@ class Table extends Component { } renderActions(row) { - const { actions, onAdd, onDetails, onConfig, onDelete, onEdit, onRestart, onShare } = this.props; + const { actions, onAdd, onDetails, onConfig, onDelete, onEdit, onRestart, onShare, idCol } = this.props; + + let idColVal = idCol ? row[this.props.idCol] : row.id; return ( <> @@ -306,7 +308,7 @@ class Table extends Component { )} {actions.find(el => el === constants.TABLE_DETAILS) && ( - @@ -316,7 +318,7 @@ class Table extends Component { )} {actions.find(el => el === constants.TABLE_CONFIG) && ( - @@ -473,6 +475,7 @@ Table.propTypes = { onDetails: PropTypes.func, onConfig: PropTypes.func, onDelete: PropTypes.func, + idCol: PropTypes.string, toPresent: PropTypes.array, noContent: PropTypes.any, handleExtraExpand: PropTypes.func, diff --git a/client/src/containers/Schema/SchemaList/SchemaList.jsx b/client/src/containers/Schema/SchemaList/SchemaList.jsx index 096e26ea6..64f85e86f 100644 --- a/client/src/containers/Schema/SchemaList/SchemaList.jsx +++ b/client/src/containers/Schema/SchemaList/SchemaList.jsx @@ -251,11 +251,9 @@ class SchemaList extends Root { onDelete={schema => { this.handleOnDelete(schema); }} - onDetails={schemaId => { - let schema = this.state.schemasRegistry.find(schema => { - return schema.id === schemaId; - }); - return `/ui/${selectedCluster}/schema/details/${schema.subject}`; + idCol="subject" + onDetails={subject => { + return `/ui/${selectedCluster}/schema/details/${subject}`; }} actions={ roles.registry && roles.registry['registry/delete']