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

⚡ 🔨 Refactor and Update Email Template with Formatted Date, Time, and New Design #86

Merged

Conversation

FATEMEH-Z-HASHEMI
Copy link
Contributor

This pull request introduces enhancements to the email notification system by updating the context data with formatted date and time values and redesigning the email template with a modern look.

Key Changes:

  • Email Context Refactor:

    • Refactored EmailHandler to include formatted_date and formatted_time in the template context for enhanced readability.
    • formatted_date: Uses the format %d %B %Y, ensuring the month name is in uppercase.
    • formatted_time: Uses the format %I:%M %p.
    • Updated render_template to include these new values in the context while maintaining backward compatibility with existing log entry and request data.
  • Template Redesign:

    • Updated the email template with a new, sleek design.
    • Changed the background color to #2C333B for a darker theme, and the content area now has a light background #ECE9E1.
    • Added a new header section with logo and branding (LAZARUS), enhancing the visual identity of the email.
    • Redesigned the structure for log message, IP address, and browser information for improved clarity and readability.
    • Incorporated rounded corners and shadow effects for a more modern aesthetic.
    • Retained the automated message disclaimers for compliance.

This PR closes issue #85.

ARYAN-NIKNEZHAD and others added 30 commits August 31, 2024 17:25
Added CI workflow and Open Issues badges
Fixed address of each badge
- Added classifiers to specify the supported Python versions, license, and intended audience.
- Added URLs for documentation, source code, and issue tracker.
- Added repository URL for easy access to
- Included relevant keywords to improve package discoverability.
…il-template

⚡  Update(template) email_notifier img
Fixed skip python 3.11, 3.9, 3.8 in tox job
…hon-version

🐛  fix(CI):skip some python versions on tox
Refactored keywords to remove unneccessary keywords
Refactored classifiers to add django 5.1 framework
⚡ 🔨  refactor(docs):update quick start section
- converted the �nsicolors class to a dataclass with rozen=true, ensuring immutability and preventing accidental modification of color codes.
- Set 1.0.0 version for start point
Imporved docs structure and badges path
⚡ 📚 🔨  refactor(docs): Update readme & rst files
…ocs-and-build

🔨 📚 Refactor/docs and build
…st-docs

⚡ 🔨 📚 🎨  refactor(docs): Improve rst docs
- Added execution_tracker decorator to enhance logging capabilities by tracking performance metrics
- Functionality:
 - Execution Time: Logs the execution time of the decorated function, reporting in seconds and minutes based on duration
 - Database Queries: Optionally logs the number of database queries for decorated function if DEBUG is True and log_queries is enabled.
 - Query Threshold: Provides a warning log if the number of queries exceeds a specified threshold.
 - Error Handling: Logs any exceptions raised during function execution.
- Added validate_integer_setting to validate positive integer.
- Updated execution_tracker decorator to add validators.
- Tests Added: Implemented a suite of tests for the execution_tracker decorator, covering various scenarios including performance metrics, database queries, and error handling.
- Details:
 - Test Suite: TestExecutionTracker
  - test_execution_tracker_raises_error_on_invalid_attribute:
   - Verifies that a ValueError is raised when invalid logging levels or query thresholds are provided to the decorator.
  - test_execution_tracker_raises_error_on_invalid_log_queries:
   - Checks that a ValueError is raised when an invalid value is provided for log_queries.
  - test_execution_tracker_execution_time:
   - Validates that database queries are logged when log_queries is enabled and DEBUG is True.
  - test_execution_tracker_query_threshold_warning:
   - Ensures that a warning is logged when the number of queries exceeds the specified threshold.
  - test_execution_tracker_logs_queries_debug_false:
   - Tests that a warning is logged when log_queries is enabled but DEBUG is set to False, indicating that database queries are not tracked.
  - test_execution_tracker_error_handling:
   - Checks that errors are logged correctly when the decorated function raises an exception

Ensured compatibility with various Python versions and Django settings to reflect realistic scenarios.
Closes Lazarus-org#80
- Added documentation for the newly implemented execution_tracker decorator.
- Updated the README to include detailed information on how to use the decorator, including example usage.
- Added descriptions for the decorator's arguments
- Included example log outputs for both cases where log_queries is enabled and where DEBUG is False.
…ted date and time

- Refactored EmailHandler to add two new time formats (ormatted_date and ormatted_time) for inclusion in the email template.
- ormatted_date now uses the format %d %B %Y, with the month name in uppercase.
- ormatted_time uses the format %I:%M %p.
- Updated the context in 
ender_template to include date and 	ime for enhanced readability in the email notifications.
- Ensured backward compatibility with the existing log entry and request data.
…roved styles

- Refactored the email template for log notifications to introduce a new design with updated styles.
- Changed the background color to #2C333B for a darker theme, with the content area having a light background #ECE9E1.
- Added a new header with a logo and branding (LAZARUS) for improved visual identity.
- Included the date and 	ime in a more readable and prominent format.
- Updated the layout to have a more modern look with rounded corners and shadow effects for better visual presentation.
- Improved the structure and alignment of log message content, IP address, and browser information for clearer readability.
- Retained automated message disclaimers at the bottom of the email template.

Closes Lazarus-org#85
Copy link
Collaborator

@ARYAN-NIKNEZHAD ARYAN-NIKNEZHAD left a comment

Choose a reason for hiding this comment

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

Approved 👌

@ARYAN-NIKNEZHAD ARYAN-NIKNEZHAD merged commit b170f99 into Lazarus-org:develop Sep 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants