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

feat(broker-configs): adjust edit button state in read-only mode #608

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

spartanns
Copy link

  • Breaking change? (if so, please describe the impact and migration path for existing application instances)

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)

  • No need to
  • Manually (please, describe, if necessary)
  • Unit checks
  • Integration checks
  • Covered by existing automation

Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. ENVIRONMENT VARIABLES)
  • My changes generate no new warnings (e.g. Sonar is happy)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Check out Contributing and Code of Conduct

A picture of a cute animal (not mandatory but encouraged)

@spartanns spartanns requested a review from a team as a code owner October 13, 2024 16:05
@kapybro kapybro bot added status/triage Issues pending maintainers triage status/triage/manual Manual triage in progress status/triage/completed Automatic triage completed and removed status/triage Issues pending maintainers triage labels Oct 13, 2024
Copy link

@github-actions github-actions bot left a 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.

@Haarolean Haarolean added the hacktoberfest-accepted PRs accepted towards hacktoberfest goal and will be counted as approved label Oct 16, 2024
@Haarolean
Copy link
Member

Haarolean commented Oct 16, 2024

@spartanns, there have been multiple inconsistencies across the app regarding the r/o mode. Are these all the changes we need?

@Haarolean Haarolean added the scope/frontend Related to frontend changes label Oct 16, 2024
@spartanns
Copy link
Author

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.

@Haarolean
Copy link
Member

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

@spartanns
Copy link
Author

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:
Untitled Video October 16, 2024 11_18 PM.webm

In case I missed something, let me know and I'll fix it.

@Haarolean
Copy link
Member

Once again -- the issue is not just about broker configs, it's about all the possible buttons in all the places.
For instance, in a r/o cluster restart/remove connectors options are available (they shouldn't be):
image
We have to check for all these things.

@spartanns
Copy link
Author

Ahhh, okay, I didn't know that...I'll get right on it, and I'll let you know once I'm done.

@spartanns
Copy link
Author

Okay, so I disabled the ActionsCell in connectors table in cluster RO mode:
Screenshot from 2024-10-17 15-10-12
Broker config edits are disabled as well as all topic configs. Connector creation is also disabled in RO mode.

If there's anything else, just let me know ;p

@@ -59,7 +61,7 @@ const ActionsCell: React.FC<CellContext<FullConnectorInfo, unknown>> = ({
stateMutation.mutateAsync(ConnectorAction.RESTART_FAILED_TASKS);

return (
<Dropdown>
<Dropdown disabled={isReadOnly}>
Copy link
Member

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.

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted PRs accepted towards hacktoberfest goal and will be counted as approved scope/frontend Related to frontend changes status/triage/completed Automatic triage completed status/triage/manual Manual triage in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FE: Adjust button states w/ r/o mode
2 participants