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

KsqlDB support #1324

Merged
merged 4 commits into from
Jan 22, 2023
Merged

KsqlDB support #1324

merged 4 commits into from
Jan 22, 2023

Conversation

dweber019
Copy link
Contributor

As stated in #115 it would be nice to have a KsqlDB integration.

If have a first contribution working. I think it should be extended in the future as there are more awesome feature to implement but for now the following features are implemented:

  • List streams, tables, queries
  • Show KsqlDB server info
  • Execution window for DDL
  • Simple query window for DML
  • Connect to multiple KsqlDB instances and optionally use basic auth
  • Basic set of tests incl. a KsqlDBEmbedded implementation

Here some impressions, starting with the lists
akhq-streams
akhq-tables
akhq-queries

The server info
akhq-server-info

The DDL execution window activated with the button "Execute statement"
akhq-ddl

And the DML window activated with the button "Execute query"
akhq-dml
akhq-dml-result

Looking forward to hear your feedback.

@tchiotludo
Copy link
Owner

@dweber019 amazing works !!! 👏 👏 👏
I will need to take some time to review and but I would hope some help from the community (since I'm not a user of KSQL) to have a proper review on the UX side (the code I can handle it).
THere is also some test that failed (seems to be mostly counter of topic / ... due to add of ksqldb, nothing hard as I see).

@dweber019
Copy link
Contributor Author

No worries take your time.
I will fix the tests tomorrow 😉

Copy link
Contributor

@lucapette lucapette left a comment

Choose a reason for hiding this comment

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

Really amazing work 👏

I would address the package lock comment before merging (not my call of course).

One small thing: I had to run prettier manually on most files (the build should fail now since eslint should consider those errors). There's a task npm run prettier:fix for that.

In general, it's probably easier to integrate prettier in the editor you're using (so you don't run into this).

I did some minimal testing (I'm also not a ksqlDB user so hard for me to do extensive tests) and everything I tried works great!

const { clusterId, ksqlDBId, selectedTab } = this.state;
const { history, match, location } = this.props;

switch (selectedTab) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you introduce a little mapping like:

const tabs = {
  info: KsqlDBInfo,
  streams: KsqlDBStreams,
  tables: KsqlDBTables,
  queries: KsqlDBQueries
};

Then you can get rid of the switch all together like this:

    const SelectedTab = tabs[selectedTab] || KsqlDBStreams;

    return (
      <SelectedTab
        clusterId={clusterId}
        ksqlDBId={ksqlDBId}
        history={history}
        match={match}
        location={location}
      />
    );

Probably a bit of a personal preference but I think the version with the map leads to a little more maintainable code (and it's a little shorter too)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to keep the code style the same as in the Kafka Connect implementation but your suggestion is much nicer!
Thx

Copy link
Contributor

Choose a reason for hiding this comment

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

I would have done the same! I'll go over the kafka connect code soon-ish and see what I can do

roles: JSON.parse(sessionStorage.getItem('roles')),
};

tabs = ['streams', 'tables', 'queries', 'info'];
Copy link
Contributor

Choose a reason for hiding this comment

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

this could be derived from the keys of the tab mapping I'm suggesting in the next comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used Object.keys(...) for it.

@@ -0,0 +1,83 @@
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure how to comment on the package lock file line... (sorry)

In the current dev branch we added a nmvrc so you can use nvm to select the "right" node/npm version.

This should get rid of the file change all together (or lead to a much smaller change)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be the same as I haven't changed anything. I updated my dev branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe something in the way we run the app in dev? I'll investigate.

@dweber019
Copy link
Contributor Author

Updated PR.

@tchiotludo
Copy link
Owner

@dweber019: have you still some things to do on this one? or review is required ?

@dweber019
Copy link
Contributor Author

On my side it good to merge.
@lucapette What do you think?

@lucapette
Copy link
Contributor

@dweber019 not my call (I'm just contributing little things here and there) but if it were up to me I'd revert back the change to the package lock (as I understand it, there's no need for any changes to the file anyway) before merging.

As for the rest, it looks good to me (but I'd take it with a grain of salt since I could only do some trivial testing)

@dweber019
Copy link
Contributor Author

Reverted the package lock.
I think the PR is ready, i think we can improve iteratively.

@tchiotludo tchiotludo merged commit 90c7070 into tchiotludo:dev Jan 22, 2023
@tchiotludo
Copy link
Owner

amazing work @dweber019 !! Really appreciate, let people try and send feedback 👍
And thank for closing on the oldest issue on this project 😄

tchiotludo pushed a commit that referenced this pull request Apr 4, 2023
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