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

Modular configurable message panel #197

Merged
merged 8 commits into from
Nov 7, 2024
Merged

Modular configurable message panel #197

merged 8 commits into from
Nov 7, 2024

Conversation

jamesturner246
Copy link
Contributor

@jamesturner246 jamesturner246 commented Nov 1, 2024

Description

Refactors the messages partial for use with both process manager and controller. The Kafka topic of messages to be displayed can be set by using with when including the messages partial template -- e.g. {% include "main/messages.html" with topic="PROCMAN" %} -- using the topic key defined in settings.py.

Issues:

  • CSS is copied verbatim. Could probably do with being refactored out into dedicated CSS files.
  • Have not yet incorporated panel hiding etcetera to controller.

Fixes #162

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))

@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.95%. Comparing base (0f5fc3e) to head (31377c7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #197      +/-   ##
==========================================
+ Coverage   81.53%   81.95%   +0.41%     
==========================================
  Files          29       31       +2     
  Lines         390      399       +9     
==========================================
+ Hits          318      327       +9     
  Misses         72       72              

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

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.

Looks good to me. Majority of the duplicated css in the controller index page can be removed but that's all..

@@ -2,3 +2,121 @@
{% block title %}
Controller
{% endblock title %}
{% block extra_css %}
<style>
Copy link
Contributor

Choose a reason for hiding this comment

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

Most of the things copied over don't do anything in this context. I've marked those that do, we can remove the rest.

Copy link
Contributor

Choose a reason for hiding this comment

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

All of this copied over CSS is what I mentioned in this comment on the PR that introduced it. We should probably find a better way to include it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened #214.

controller/templates/controller/index.html Show resolved Hide resolved
controller/templates/controller/index.html Show resolved Hide resolved
Comment on lines +158 to +159
# ALL matches all topics.
"ALL": "^.*$",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this used anywhere?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's used as the default value for topic in messages.html

@@ -0,0 +1,30 @@
{% load tz %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think this is needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a {% now "e (O)" as server_time %} that I think needs this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think now is one of the tags provided by tz - https://docs.djangoproject.com/en/5.1/topics/i18n/timezones/#template-tags

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing seems to break if I remove it. I'll take it out for now.

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.

LGTM!

I'll use this as the starting point for my issues on the controller.

@@ -0,0 +1,30 @@
{% load tz %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a {% now "e (O)" as server_time %} that I think needs this.

Copy link
Contributor

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

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

This looks good to me! I have some questions, but it seems to work (I can't fully confirm because I have no ERS messages in my feed)

@@ -2,3 +2,121 @@
{% block title %}
Controller
{% endblock title %}
{% block extra_css %}
<style>
Copy link
Contributor

Choose a reason for hiding this comment

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

All of this copied over CSS is what I mentioned in this comment on the PR that introduced it. We should probably find a better way to include it.

Comment on lines +158 to +159
# ALL matches all topics.
"ALL": "^.*$",
Copy link
Contributor

Choose a reason for hiding this comment

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

It's used as the default value for topic in messages.html

tests/main/views/test_partial_views.py Show resolved Hide resolved
Copy link
Contributor

@TinyMarsh TinyMarsh left a comment

Choose a reason for hiding this comment

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

LGTM. Just a missing curly bracket is all.

controller/templates/controller/index.html Outdated Show resolved Hide resolved
Copy link
Contributor

@Sahil590 Sahil590 left a comment

Choose a reason for hiding this comment

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

Code LGTM. I noticed that the decorator I added in #195 is not merged with this, so that would need to be done. MY current work also alters the partials file, so this would need to be updated before I can continue working on my issue.

@jamesturner246
Copy link
Contributor Author

jamesturner246 commented Nov 7, 2024

@AdrianDAlessandro, I added a django command to populate arbitrary messages to arbitrary topics, if you want to have a check.

Run it using e.g.:

docker compose exec app python manage.py store_message -m "My test message." -t "erskafka-reporting"

@jamesturner246
Copy link
Contributor Author

This should be ready to merge whenever you wish to.

@Sahil590, I have moved your error wrapper into main/views/utils, and did the same with tests. This is because the message panel (uses the wrapper) is now a main partial. Looks like a big diff, but just file moving.

Copy link
Contributor

@Sahil590 Sahil590 left a comment

Choose a reason for hiding this comment

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

LGTM

@cc-a cc-a merged commit ee2a2eb into main Nov 7, 2024
4 checks passed
@cc-a cc-a deleted the refactor_msg_pane branch November 7, 2024 16:23
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.

Overview page drunc logs
8 participants