Skip to content

Commit

Permalink
fix(ui): handle no acls for topic data (#510)
Browse files Browse the repository at this point in the history
close #498
  • Loading branch information
polarising-java authored Nov 15, 2020
1 parent 5f2728e commit bceec35
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/src/containers/Topic/Topic/Topic.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Topic extends Root {
{
clusterId,
topicId,
selectedTab: roles.topic && roles.topic['topic/data/read'] ? tabSelected : 'partitions',
selectedTab: roles.topic && roles.topic['topic/data/read'] ? tabSelected : 'configs',
topicInternal: this.props.location.internal
},
() => {
Expand Down
18 changes: 12 additions & 6 deletions client/src/containers/Topic/TopicList/TopicList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,16 @@ class TopicList extends Root {
{colName: 'Replications', colSpan: 2},
{colName: 'Consumer Groups', colSpan: 1}
];
let onDetailsFunction = undefined;

const actions = [constants.TABLE_CONFIG];
if(roles.topic && roles.topic['topic/data/read']) {
actions.push(constants.TABLE_DETAILS);
onDetailsFunction = (id) => `/ui/${selectedCluster}/topic/${id}/data`;
}
if(roles.topic && roles.topic['topic/delete']) {
actions.push(constants.TABLE_DELETE);
}

return (
<div>
Expand Down Expand Up @@ -406,13 +416,9 @@ class TopicList extends Root {
onDelete={topic => {
this.handleOnDelete(topic);
}}
onDetails={(id) => `/ui/${selectedCluster}/topic/${id}/data`}
onDetails={onDetailsFunction}
onConfig={(id) => `/ui/${selectedCluster}/topic/${id}/configs`}
actions={
roles.topic && roles.topic['topic/delete']
? [constants.TABLE_DELETE, constants.TABLE_DETAILS, constants.TABLE_CONFIG]
: [constants.TABLE_DETAILS, constants.TABLE_CONFIG]
}
actions={actions}
/>

{roles.topic['topic/insert'] && (
Expand Down

0 comments on commit bceec35

Please sign in to comment.