Skip to content

Commit

Permalink
fix(ui): schema registry link with multiple same schema
Browse files Browse the repository at this point in the history
close #599
  • Loading branch information
tchiotludo committed Feb 13, 2021
1 parent 55a0e80 commit 9646c0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
13 changes: 8 additions & 5 deletions client/src/components/Table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 (
<>
Expand All @@ -306,7 +308,7 @@ class Table extends Component {
)}
{actions.find(el => el === constants.TABLE_DETAILS) && (
<td className="khq-row-action khq-row-action-main action-hover">
<Link to={onDetails && onDetails(row.id, row)}
<Link to={onDetails && onDetails(idColVal, row)}
id="details"
title="Details"
>
Expand All @@ -316,7 +318,7 @@ class Table extends Component {
)}
{actions.find(el => el === constants.TABLE_CONFIG) && (
<td className="khq-row-action khq-row-action-main action-hover">
<Link to={onConfig && onConfig(row.id, row)}
<Link to={onConfig && onConfig(idColVal, row)}
id="config"
title="Config"
>
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 3 additions & 5 deletions client/src/containers/Schema/SchemaList/SchemaList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit 9646c0a

Please sign in to comment.