-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
feat(broker-configs): adjust edit button state in read-only mode #608
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi spartanns! 👋
Welcome, and thank you for opening your first PR in the repo!
Please wait for triaging by our maintainers.
Please take a look at our contributing guide.
@spartanns, there have been multiple inconsistencies across the app regarding the r/o mode. Are these all the changes we need? |
Basically, if a cluster is read only, then ALL the broker config edit functionality is disabled. Meaning nothing in broker config can be edited in cluster RO mode. |
there have been issues across the app as I mentioned in #230, so the purpose of that issue is to fix these discrepancies across the whole app |
I tested my changes with 2 clusters in the app. One was read only the other one was not... You can take a look in this video: In case I missed something, let me know and I'll fix it. |
Ahhh, okay, I didn't know that...I'll get right on it, and I'll let you know once I'm done. |
@@ -59,7 +61,7 @@ const ActionsCell: React.FC<CellContext<FullConnectorInfo, unknown>> = ({ | |||
stateMutation.mutateAsync(ConnectorAction.RESTART_FAILED_TASKS); | |||
|
|||
return ( | |||
<Dropdown> | |||
<Dropdown disabled={isReadOnly}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it's a good idea to apply this kind of rule for the whole component, as some elements in the dropdown might be allowed (like, r/o actions). There are also exclusions from r/o rule - see SAFE_ENDPOINTS
in io/kafbat/ui/config/ReadOnlyModeFilter.java:23
:
private static final Set<Pattern> SAFE_ENDPOINTS = Set.of(
Pattern.compile("/api/clusters/[^/]+/topics/[^/]+/(smartfilters|analysis)$")
);
So, actions related to topic analysis and smartfilters should be allowed despite being non-GET HTTP methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Applied additional isReadOnly check to only restart/remove connector actions.
What changes did you make? (Give an overview)
Is there anything you'd like reviewers to focus on?
Closes #230
How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)
Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)
Check out Contributing and Code of Conduct
A picture of a cute animal (not mandatory but encouraged)