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

Eventyay Common: Create an event dashboard #505

Open
wants to merge 23 commits into
base: development
Choose a base branch
from

Conversation

HungNgien
Copy link
Collaborator

@HungNgien HungNgien commented Jan 10, 2025

image
Event dashboard

image
Fix css conflict of info box

This PR resolves #455

Summary by Sourcery

Introduce an event dashboard to provide a comprehensive overview of event details, including tickets, talks, and videos, along with quick access to each component.

New Features:

  • Add an event dashboard that displays an overview of the event's key components (tickets, talks, videos) and provides links to manage each of them.

Tests:

  • Update tests to cover new dashboard features.

Copy link

sourcery-ai bot commented Jan 10, 2025

Reviewer's Guide by Sourcery

This pull request introduces an event dashboard, enhancing the user interface with a new overview page for event components (tickets, talks, videos). It also includes a fix for a CSS conflict related to the info box.

Class diagram for EventIndexView and related components

classDiagram
    class EventIndexView {
        +template_name: str
        +get_context_data()
        -_get_user_permissions()
        -_collect_dashboard_widgets()
        -_filter_log_entries()
        -_check_event_statuses()
        +rearrange(widgets)
    }

    class Event {
        +talk_schedule_url
        +talk_session_url
        +talk_speaker_url
        +talk_dashboard_url
        +talk_settings_url
    }

    class TemplateView {
        +get_context_data()
    }

    EventIndexView --|> TemplateView
    EventIndexView ..> Event: uses
Loading

File-Level Changes

Change Details Files
Creation of an event dashboard view.
  • Added a new view, EventIndexView, to render the event dashboard.
  • Implemented logic to collect and display dashboard widgets.
  • Added filtering for log entries based on user permissions.
  • Implemented checks for various event statuses, such as overpaid orders and pending refunds.
  • Added a new view, event_index_widgets_lazy, to load widgets lazily.
src/pretix/eventyay_common/views/dashboards.py
Addition of a new template for the event dashboard.
  • Created a new template to display the event dashboard.
  • Created a new template to display the dashboard widgets.
  • Created a new template to display the component links.
src/pretix/eventyay_common/templates/eventyay_common/event/index.html
src/pretix/eventyay_common/templates/eventyay_common/event/fragment_dashboard.html
src/pretix/eventyay_common/templates/eventyay_common/event/component_link.html
Modification of context processor to include new data.
  • Added logic to include talk URLs and video status in the context.
  • Added logic to include navigation items in the context.
  • Added logic to include subevent information in the context.
src/pretix/eventyay_common/context.py
CSS adjustments and addition of font-awesome.
  • Added font-awesome for icons.
  • Modified CSS to fix info box conflict.
  • Added CSS for the new dashboard layout.
src/pretix/static/eventyay-common/scss/custom.scss
Adjustments to the base template.
  • Added a context selector to the base template.
  • Modified the sidebar to include the context selector.
src/pretix/eventyay_common/templates/eventyay_common/base.html
Added new URLs for the event dashboard.
  • Added a new URL for the event dashboard view.
  • Added a new URL for the lazy loading of widgets.
src/pretix/eventyay_common/urls.py
Added new navigation helper functions.
  • Added a function to generate global navigation items.
  • Added a function to generate event navigation items.
src/pretix/eventyay_common/navigation.py
Modified the event model to include talk URLs.
  • Added properties to get the talk schedule, session, speaker, dashboard and settings URLs.
src/pretix/base/models/event.py
Added a utility function to get subevents.
  • Added a function to retrieve a subevent based on request parameters.
src/pretix/eventyay_common/utils.py
Modified the event update view to redirect to the event dashboard.
  • Modified the event creation view to redirect to the event dashboard after creation.
src/pretix/eventyay_common/views/event.py
Modified the component link template to link to the event dashboard.
  • Modified the component link template to link to the event dashboard.
src/pretix/control/templates/pretixcontrol/event/component_link.html
Modified the info box and timeline templates to use a new CSS class.
  • Modified the info box and timeline templates to use a new CSS class.
src/pretix/control/templates/pretixcontrol/event/fragment_info_box.html
src/pretix/control/templates/pretixcontrol/event/fragment_timeline.html
Modified the events index template to link to the event dashboard.
  • Modified the events index template to link to the event dashboard.
src/pretix/eventyay_common/templates/eventyay_common/events/index.html

Assessment against linked issues

Issue Objective Addressed Explanation
#455 Create an event dashboard on eventyay-common with a left sidebar containing event name and settings link
#455 After creating an event, automatically direct to the dashboard instead of settings
#455 Create 3 component boxes for Tickets, Talks and Speakers, and Video with descriptive links and dashboard redirects

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@HungNgien HungNgien marked this pull request as ready for review January 10, 2025 04:59
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @HungNgien - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

widgets.extend(result)
return self.rearrange(widgets)

def _filter_log_entries(
Copy link

Choose a reason for hiding this comment

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

suggestion (performance): Consider caching ContentType lookups as class attributes to avoid repeated database queries

Move the ContentType.objects.get_for_model() calls outside the method and store them as class attributes. This will prevent executing the same queries multiple times.

Suggested implementation:

            return []

    # Cache ContentType lookups at class level
    order_content_type = ContentType.objects.get_for_model(Order)
    invoice_content_type = ContentType.objects.get_for_model(Invoice)
    checkin_content_type = ContentType.objects.get_for_model(Checkin)
    item_content_type = ContentType.objects.get_for_model(Item)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        request = self.request

You'll also need to:

  1. Add imports for ContentType and the models (Order, Invoice, Checkin, Item) at the top of the file if not already present
  2. Update any places in the code where ContentType.objects.get_for_model() is called to use these class attributes instead
  3. Make sure these models are the correct ones being used in the log entries - adjust the model list according to what's actually being filtered in the log entries

Comment on lines +87 to 89
@media (min-width: $screen-xs-min) and (max-width: $screen-xs-max) {
.dashboard .widget-container.widget-small.no-padding.column {
margin-right: 0px;
Copy link

Choose a reason for hiding this comment

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

suggestion: Add media query for screens smaller than xs breakpoint

Consider adding a media query for screens smaller than $screen-xs-min to ensure proper layout on very small devices.

Suggested change
@media (min-width: $screen-xs-min) and (max-width: $screen-xs-max) {
.dashboard .widget-container.widget-small.no-padding.column {
margin-right: 0px;
@media (max-width: $screen-xs-min - 1) {
.dashboard .widget-container.widget-small.no-padding.column {
margin-right: 0px;
}
}
@media (min-width: $screen-xs-min) and (max-width: $screen-xs-max) {
.dashboard .widget-container.widget-small.no-padding.column {
margin-right: 0px;

@mariobehling mariobehling requested a review from hongquan January 10, 2025 05:41
src/pretix/eventyay_common/context.py Outdated Show resolved Hide resolved
src/pretix/eventyay_common/navigation.py Outdated Show resolved Hide resolved
src/pretix/eventyay_common/context.py Outdated Show resolved Hide resolved
src/pretix/eventyay_common/navigation.py Outdated Show resolved Hide resolved
src/pretix/eventyay_common/navigation.py Outdated Show resolved Hide resolved
src/pretix/eventyay_common/urls.py Show resolved Hide resolved
@HungNgien HungNgien marked this pull request as draft January 15, 2025 09:35
@HungNgien HungNgien marked this pull request as ready for review January 18, 2025 04:38
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @HungNgien - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider enhancing error handling in utility functions like get_subevent() to properly propagate errors to the UI rather than just logging them. This would improve the user experience when invalid data is provided.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@mariobehling
Copy link
Member

mariobehling commented Jan 18, 2025

Please resolve conflicts.

Also ensure the main eventyay-common dashboard "event box heading text", e.g Paypal event Jan 19... links to this event dashboard in the PR here.

Screenshot from 2025-01-18 15-06-25

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.

Eventyay Common: Create an event dashboard
3 participants