Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(topicconfig): Disabled edit access for topic config screen for reader mode #1237

Merged
merged 1 commit into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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