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

[NO-ISSUE] refactor how we login to jolokia #265

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

lavocatt
Copy link
Collaborator

@lavocatt lavocatt commented Aug 7, 2024

To minimize code duplication, extract the jolokia login to a new component JolokiaAuthentification. This component does the login and creates a context for its children components.

Now a developer can use this pattern to ensure the component someComponent will get in a logged in context.

const AuthenticatedComponent: FC = () => {
  const brokerName = 'someName';
  const namespace = 'someNamespace';
  const podOrdinal = 0;
  const { brokerCr } = UseGetBrokerCR(brokerName, namespace);
  return (
    <JolokiaAuthentification brokerCR={brokerCr} podOrdinal={podOrdinal}>
      <SomeComponent />
    </JolokiaAuthentification>
  );
}

src/jolokia/context.ts Outdated Show resolved Hide resolved
src/jolokia/context.ts Outdated Show resolved Hide resolved
@lavocatt lavocatt force-pushed the jolokiaExternalization branch 5 times, most recently from 7a63af8 to 6e1ae0f Compare August 12, 2024 14:43
@lavocatt lavocatt removed their assignment Aug 12, 2024
To minimize code duplication, extract the jolokia login to a new
component JolokiaAuthentification. This component does the login and
creates a context for its children components.

Now a developer can use this pattern to ensure the component
someComponent will get in a logged in context.

```typescript
const AuthenticatedComponent: FC = () => {
  const brokerName = 'someName';
  const namespace = 'someNamespace';
  const podOrdinal = 0;
  const { brokerCr } = UseGetBrokerCR(brokerName, namespace);
  return (
    <JolokiaAuthentification brokerCR={brokerCr} podOrdinal={podOrdinal}>
      <SomeComponent />
    </JolokiaAuthentification>
  );
}
```
Copy link
Collaborator

@Msarawan Msarawan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good work Thomas.

@Msarawan Msarawan merged commit 0b49579 into artemiscloud:main Aug 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants