Skip to content

[SCRUM-14] Improve admin graph lazy loading UI#131

Merged
vishalanandl177 merged 1 commit into
mainfrom
SCRUM-14-P1-Improve-advanced-query-UI
Jul 5, 2026
Merged

[SCRUM-14] Improve admin graph lazy loading UI#131
vishalanandl177 merged 1 commit into
mainfrom
SCRUM-14-P1-Improve-advanced-query-UI

Conversation

@vishalanandl177

Copy link
Copy Markdown
Owner

Summary

This PR updates the Django admin API log graphs so the changelist stays fast and the graph UI is less intrusive.

  • Makes each existing admin graph individually collapsible.
  • Fetches graph data only when that specific graph is opened.
  • Adds admin-only chart-data endpoints that reuse the current filtered changelist queryset.
  • Keeps graph cards horizontally full width and caps expanded graph height at 200px.
  • Applies a 30 second timeout only to graph data fetches in the admin chart UI.
  • Documents the lazy graph behavior and timeout.

Scope notes

  • No model changes.
  • No migrations.
  • No package build or release publication.
  • Existing unrelated untracked local files were left unstaged.

Validation

  • python -m django test tests --settings=tests.test_settings --verbosity=1 - passed, 256 tests.
  • python -m django test tests.test_admin_templates tests.test_admin_charts --settings=tests.test_settings --verbosity=2 - passed, 12 tests.
  • python -m unittest tests.test_docs_content - passed, 12 tests.
  • python -m django makemigrations drf_api_logger --check --dry-run --settings=tests.test_settings - no changes detected.
  • python test_runner_simple.py - passed, 27 tests.
  • git diff --check - passed.
  • Explicit search for advanced-query model/migration identifiers returned no matches.
  • Demo app J:\projects\drf-demo: current branch installed editable, manage.py check passed, collectstatic --noinput passed, rendered admin changelist confirmed lazy graph timeout, full width, and 200px height.

@vishalanandl177
vishalanandl177 marked this pull request as ready for review July 5, 2026 13:13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 914c6bfa02

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread drf_api_logger/admin.py
return response

def chart_data_view(self, request, chart_name):
queryset = self.get_changelist_instance(request).queryset

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enforce model permissions on chart data

When a logged-in staff user lacks the drf_api_logger.view_apilogsmodel permission, the normal changelist is blocked by Django's model-admin permission checks, but this custom endpoint is only wrapped in admin_site.admin_view and immediately builds the queryset. That lets any staff user fetch aggregate API-log volume/status/SQL data via /chart-data/.../ despite not being allowed to view API logs, so this view should check has_view_or_change_permission(request) before returning data.

Useful? React with 👍 / 👎.

@vishalanandl177
vishalanandl177 force-pushed the SCRUM-14-P1-Improve-advanced-query-UI branch from 914c6bf to ada0ce4 Compare July 5, 2026 13:18
@vishalanandl177
vishalanandl177 merged commit 3483598 into main Jul 5, 2026
6 checks passed
@vishalanandl177
vishalanandl177 deleted the SCRUM-14-P1-Improve-advanced-query-UI branch July 5, 2026 13:20
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.

1 participant