Skip to content

Commit

Permalink
chore/remove plotly dash (#1322)
Browse files Browse the repository at this point in the history
* remove plotly dash

* Remove frontend Plotly files

* removed middlewear

* formatting

---------

Co-authored-by: Kevin Etchells <kevetchells@hotmail.com>
  • Loading branch information
gecBurton and KevinEtchells authored Jan 23, 2025
1 parent cbdf62c commit 40a2042
Show file tree
Hide file tree
Showing 12 changed files with 1,358 additions and 1,415 deletions.
4 changes: 0 additions & 4 deletions django_app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
{
"distDir": "./dist/js/libs",
"staticPath": "./src/js/libs"
},
{
"distDir": "./dist/dash/component/plotly/package_data",
"staticPath": "./src/js/admin/plotly.min.js"
}
],
"scripts": {
Expand Down
8 changes: 0 additions & 8 deletions django_app/frontend/src/js/admin/plotly.min.js

This file was deleted.

4 changes: 0 additions & 4 deletions django_app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ django-q2 = "^1.6.2"
blessed = "^1.20.0"
croniter = "^3.0.3"
djangorestframework = "^3.15.2"
django-plotly-dash = "^2.3.1"
django-adminplus = "^0.6"
pandas = "^2.2.2"
django-waffle = "^4.1.0"
opensearch-py = "^2.7.1"
scikit-learn = "^1.5.2"
markitdown = "^0.0.1a3"

[tool.poetry.group.dev.dependencies]
Expand Down
6 changes: 0 additions & 6 deletions django_app/redbox_app/redbox_core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from django.contrib import admin
from django.contrib.auth import get_user_model
from django.shortcuts import render
from import_export.admin import ExportMixin, ImportExportMixin

from . import models
Expand Down Expand Up @@ -217,13 +216,8 @@ class FileAdmin(ExportMixin, admin.ModelAdmin):
search_fields = ["user__email"]


def reporting_dashboard(request):
return render(request, "report.html", {}, using="django")


admin.site.register(User, UserAdmin)
admin.site.register(models.Chat, ChatAdmin)
admin.site.register(models.AISettings)
admin.site.register(models.ChatLLMBackend, ChatLLMBackendAdmin)
admin.site.register(models.File, FileAdmin)
admin.site.register_view("report/", view=reporting_dashboard, name="Site report")
Empty file.
112 changes: 0 additions & 112 deletions django_app/redbox_app/redbox_core/dash_apps/report_app.py

This file was deleted.

22 changes: 0 additions & 22 deletions django_app/redbox_app/redbox_core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,3 @@ def middleware(request: HttpRequest) -> HttpResponse:
return response

return middleware


@sync_and_async_middleware
def plotly_no_csp_no_xframe_middleware(get_response):
if iscoroutinefunction(get_response):

async def middleware(request: HttpRequest) -> HttpResponse:
response = await get_response(request)
if "admin/report" in request.path:
response.headers.pop("Content-Security-Policy", None)
response.headers.pop("X-Frame-Options", None)
return response
else:

def middleware(request: HttpRequest) -> HttpResponse:
response = get_response(request)
if "admin/report" in request.path:
response.headers.pop("Content-Security-Policy", None)
response.headers.pop("X-Frame-Options", None)
return response

return middleware
2 changes: 0 additions & 2 deletions django_app/redbox_app/redbox_core/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from redbox_app.redbox_core.dash_apps import report_app
from redbox_app.redbox_core.views.auth_views import sign_in_link_sent_view, sign_in_view, signed_out_view
from redbox_app.redbox_core.views.chat_views import (
ChatsTitleView,
Expand Down Expand Up @@ -48,7 +47,6 @@
"Signup2",
"Signup3",
"Signup4",
"report_app",
"UpdateChatFeedback",
"DeleteChat",
]
3 changes: 0 additions & 3 deletions django_app/redbox_app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"import_export",
"django_q",
"rest_framework",
"django_plotly_dash.apps.DjangoPlotlyDashConfig",
"adminplus",
"waffle",
]
Expand All @@ -82,13 +81,11 @@
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"redbox_app.redbox_core.middleware.plotly_no_csp_no_xframe_middleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django_permissions_policy.PermissionsPolicyMiddleware",
"csp.middleware.CSPMiddleware",
"redbox_app.redbox_core.middleware.nocache_middleware",
"redbox_app.redbox_core.middleware.security_header_middleware",
"django_plotly_dash.middleware.BaseMiddleware",
"waffle.middleware.WaffleMiddleware",
]

Expand Down
38 changes: 0 additions & 38 deletions django_app/redbox_app/templates/report.html

This file was deleted.

1 change: 0 additions & 1 deletion django_app/redbox_app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
]

admin_urlpatterns = [
path("admin/report/", include("django_plotly_dash.urls")),
path("admin/", admin.site.urls),
]

Expand Down
Loading

0 comments on commit 40a2042

Please sign in to comment.