From 9fb875f74913ced7169aa6718ea479c0aaac14d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Fri, 30 Apr 2021 08:36:50 +0200 Subject: [PATCH 1/2] Add DASHBOARD_PAGE_SIZE to settings --- shynet/dashboard/views.py | 2 +- shynet/shynet/settings.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/shynet/dashboard/views.py b/shynet/dashboard/views.py index c071143a..791080fe 100644 --- a/shynet/dashboard/views.py +++ b/shynet/dashboard/views.py @@ -25,7 +25,7 @@ class DashboardView(LoginRequiredMixin, DateRangeMixin, ListView): model = Service template_name = "dashboard/pages/dashboard.html" - paginate_by = 5 + paginate_by = settings.DASHBOARD_PAGE_SIZE def get_queryset(self): return Service.objects.filter( diff --git a/shynet/shynet/settings.py b/shynet/shynet/settings.py index 9bd510e1..4abb6942 100644 --- a/shynet/shynet/settings.py +++ b/shynet/shynet/settings.py @@ -339,3 +339,5 @@ # Include date and service ID in salt? AGGRESSIVE_HASH_SALTING = os.getenv("AGGRESSIVE_HASH_SALTING", "False") == "True" + +DASHBOARD_PAGE_SIZE = os.getenv("DASHBOARD_PAGE_SIZE", 5) From d9e1ffddb16d10c3c063d3e90d8dcac609e69c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Fri, 30 Apr 2021 13:59:43 +0200 Subject: [PATCH 2/2] Add DASHBOARD_PAGE_SIZE to TEMPLATE.env and app.json --- TEMPLATE.env | 6 +++++- app.json | 5 +++++ shynet/shynet/settings.py | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/TEMPLATE.env b/TEMPLATE.env index d40ebb7e..c44ddd14 100644 --- a/TEMPLATE.env +++ b/TEMPLATE.env @@ -82,4 +82,8 @@ BLOCK_ALL_IPS=False # that IP collection is also disabled, and external keys (primary # keys) aren't supplied. It will also prevent sessions from spanning # one day to another. -AGGRESSIVE_HASH_SALTING=True \ No newline at end of file +AGGRESSIVE_HASH_SALTING=True + +# How many services should be displayed on dashboard page? +# Set to big number if you don't want pagination at all. +DASHBOARD_PAGE_SIZE=5 diff --git a/app.json b/app.json index 329ff372..754b4bf0 100644 --- a/app.json +++ b/app.json @@ -122,6 +122,11 @@ "description": "Set to 'False' if you do not want the version to be displayed on the frontend.", "value": "True", "required": false + }, + "DASHBOARD_PAGE_SIZE": { + "description": "How many services should be displayed on dashboard page?", + "value": "5", + "required": false } } } diff --git a/shynet/shynet/settings.py b/shynet/shynet/settings.py index 4abb6942..0f58fa01 100644 --- a/shynet/shynet/settings.py +++ b/shynet/shynet/settings.py @@ -340,4 +340,5 @@ # Include date and service ID in salt? AGGRESSIVE_HASH_SALTING = os.getenv("AGGRESSIVE_HASH_SALTING", "False") == "True" +# How many services should be displayed on dashboard page? DASHBOARD_PAGE_SIZE = os.getenv("DASHBOARD_PAGE_SIZE", 5)