Skip to content

Commit

Permalink
fix(ui): Disabled edit access topic configs when role has reader mode (
Browse files Browse the repository at this point in the history
  • Loading branch information
GnanaJeyam authored Nov 6, 2022
1 parent af5ca0d commit 66b3340
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions client/src/components/Table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class Table extends Component {
<td
key={`tableCol${index}${colIndex}`}
style={column.expand ? { cursor: 'pointer' } : {}}
className={column.readOnly ? 'not-allowed' : ''}
onDoubleClick={() => {
if (
actions &&
Expand All @@ -184,6 +185,7 @@ class Table extends Component {
<td
key={`tableCol${index}${colIndex}`}
style={column.expand ? { cursor: 'pointer' } : {}}
className={column.readOnly ? 'not-allowed' : ''}
onDoubleClick={() => {
if (
actions &&
Expand Down Expand Up @@ -496,6 +498,7 @@ Table.propTypes = {
accessor: PropTypes.string,
colName: PropTypes.string,
type: PropTypes.string,
readOnly: PropTypes.bool,
cell: PropTypes.function
})
),
Expand Down
7 changes: 7 additions & 0 deletions client/src/components/Table/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ td {
position: relative;
}

.not-allowed {
cursor: not-allowed;
input {
pointer-events: none;
}
}

.close-container {
position: absolute;
z-index: 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class TopicConfigs extends Form {
render() {
const { data, loading } = this.state;
const roles = this.state.roles || {};
const isUpdatable = roles.topic && roles.topic['topic/config/update'];
return (
<form
encType="multipart/form-data"
Expand All @@ -237,6 +238,7 @@ class TopicConfigs extends Form {
accessor: 'value',
colName: 'Value',
type: 'text',
readOnly: !isUpdatable,
cell: obj => {
return this.getInput(
this.state.formData[obj.name],
Expand All @@ -262,7 +264,7 @@ class TopicConfigs extends Form {
}}
noContent={'No acl for configs for current kafka user.'}
/>
{roles.topic && roles.topic['topic/config/update'] && !this.props.internal ? (
{isUpdatable && !this.props.internal ? (
<aside>
{this.renderButton('Update configs', this.handleSubmit, undefined, 'submit')}
</aside>
Expand Down

0 comments on commit 66b3340

Please sign in to comment.