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

Kafka message sidebar panel #109

Merged
merged 10 commits into from
Sep 27, 2024
Merged

Kafka message sidebar panel #109

merged 10 commits into from
Sep 27, 2024

Conversation

jamesturner246
Copy link
Contributor

@jamesturner246 jamesturner246 commented Sep 25, 2024

Description

Adds a panel on the right to display Kafka messages.

Messages are scrollable when they won't fit.

I wasn't able to reliably set max-size to something that fits the window, so I just set it to 85% viewport height. I think the issue is the main container, which includes the main table, does not yet have its height fixed, so I cannot inherit it's max height minus top bars, padding, etcetera. Is this something you want tackled now, or later?

Else all good to go.

Screenshot from 2024-09-25 16-48-08

Fixes #92

Type of change

  • Documentation (non-breaking change that adds or improves the documentation)
  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass (eg. python -m pytest)
  • The documentation builds and looks OK (eg. python -m sphinx -b html docs docs/build)
  • Pre-commit hooks run successfully (eg. pre-commit run --all-files)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

@jamesturner246 jamesturner246 changed the title Basic Kafka message panel. Kafka message sidebar panel Sep 25, 2024
@jamesturner246 jamesturner246 marked this pull request as ready for review September 25, 2024 15:38
Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I'd suggest we add Prettier code formatter to VScode and the following lines to the settings - for those using it.

  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },

And also to think on a pre-commit hook for HTML. Now that we have more "complex" HTML, we need to worry about its format as well.

@@ -8,6 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% bootstrap_css %}
{% bootstrap_javascript %}
{% block extra_css %}{% endblock %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this empty extra css block here?

Copy link
Contributor Author

@jamesturner246 jamesturner246 Sep 26, 2024

Choose a reason for hiding this comment

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

This is where I injected the custom CSS into the head in the index template. The contents of extra_css in index.html are substituted into extra_css in the <main> section of base.html.

Not sure if there's a more proper way to do it.

@jamesturner246
Copy link
Contributor Author

Oopp. I think .vscode/settings.json is gone now. I'll add it to .pre-commit-config.yaml instead.

{% load static %}
{% load django_bootstrap5 %}
<!DOCTYPE html>
{% load static %} {% load django_bootstrap5 %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd suggest to revert running prettrier and add a few tags to tell it to ignore some parts. This headers just look much better if each is int its line. So, leave this as:

Suggested change
{% load static %} {% load django_bootstrap5 %}
<!-- prettier-ignore -->
{% load static %}
{% load django_bootstrap5 %}

And the same with the other HTML files. These {%... lines are just not understood by prettier as HTML because they are django stuff. Check this commit in Paricia where I've done the change and avoided the reformatting of the django tags.

ImperialCollegeLondon/paricia@8357eec

@cc-a
Copy link
Contributor

cc-a commented Sep 26, 2024 via email

@alexdewar
Copy link
Contributor

The prettier pre-commit hook is kinda dead, which is why we had to change to other hooks 😞.

I'm wondering whether I should revive it though... Don't think it would take much work and I do like the results better than the other hooks. Maybe could be a Hacktoberfest project?

@cc-a
Copy link
Contributor

cc-a commented Sep 26, 2024

@jamesturner246
Copy link
Contributor Author

prettier-plugin-jinja-template looks like it may have the same problem in reverse, where style tags must be ignored.

I'll try out djLint. If not I'll just use ignores as in @dalonsoa's comment.

For now it's reverted.

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (45c5789) to head (897d347).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #109   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines           44        44           
=========================================
  Hits            44        44           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jamesturner246
Copy link
Contributor Author

Playing around with djLint and the layout is not bad. Had to add some extra stuff to keep it happy, such as meta fields.

A couple of nags I hid for now:

  • It doesn't like inline CSS, like that in logs.html
  • A false-positive for an orphaned tag (upstream bug)

One final note to factor in is the repo doesn't look especially busy.

Copy link
Contributor

@cc-a cc-a left a comment

Choose a reason for hiding this comment

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

Good stuff. I like having linting for the templates is a real step forward. I had a play and that orphaned tag one is caused by that stray comma in the form tag.

Curious what others think but because the nature of html leads to lots of indentation I'd prefer to just use 2 spaces instead of 4.

Otherwise this looks like a good first stab at the layout.

@jamesturner246
Copy link
Contributor Author

Stray comma gone. I went ahead and turn indentation down to 2 also.

Copy link
Contributor

@cc-a cc-a left a comment

Choose a reason for hiding this comment

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

Nice. I'm afraid the pedant in me can't help but suggest that it would be slightly nicer to put the indent config in pyproject.toml. In case anyone wants to run it outside of pre-commit.

@jamesturner246
Copy link
Contributor Author

All good. Will wait a bit and merge later in case someone else wants a looksee.

Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

Looks good to me - and have stolen the djlint stuff for Paricia :)

@jamesturner246 jamesturner246 merged commit e3249e4 into main Sep 27, 2024
4 checks passed
@jamesturner246 jamesturner246 deleted the msg_panel branch September 27, 2024 08:53
@cc-a cc-a mentioned this pull request Sep 27, 2024
10 tasks
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.

Kafka messages in UI
5 participants