From 1179ba4ef23c01e286f885223f810552779f8b03 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 16 Dec 2020 22:00:29 +0100 Subject: [PATCH] api: remove counters from overview api and allow filtering on object apis --- authentik/admin/api/overview.py | 14 -- .../templates/administration/overview.html | 163 ------------------ authentik/core/api/providers.py | 5 +- authentik/policies/api.py | 4 + 4 files changed, 8 insertions(+), 178 deletions(-) diff --git a/authentik/admin/api/overview.py b/authentik/admin/api/overview.py index e61068abc5..65411b1ad5 100644 --- a/authentik/admin/api/overview.py +++ b/authentik/admin/api/overview.py @@ -10,8 +10,6 @@ from rest_framework.viewsets import ViewSet from authentik import __version__ from authentik.admin.tasks import VERSION_CACHE_KEY, update_latest_version -from authentik.core.models import Provider -from authentik.policies.models import Policy from authentik.root.celery import CELERY_APP @@ -21,8 +19,6 @@ class AdministrationOverviewSerializer(Serializer): version = SerializerMethodField() version_latest = SerializerMethodField() worker_count = SerializerMethodField() - providers_without_application = SerializerMethodField() - policies_without_binding = SerializerMethodField() cached_policies = SerializerMethodField() cached_flows = SerializerMethodField() @@ -42,16 +38,6 @@ class AdministrationOverviewSerializer(Serializer): """Ping workers""" return len(CELERY_APP.control.ping(timeout=0.5)) - def get_providers_without_application(self, _) -> int: - """Count of providers without application""" - return len(Provider.objects.filter(application=None)) - - def get_policies_without_binding(self, _) -> int: - """Count of policies not bound or use in prompt stages""" - return len( - Policy.objects.filter(bindings__isnull=True, promptstage__isnull=True) - ) - def get_cached_policies(self, _) -> int: """Get cached policy count""" return len(cache.keys("policy_*")) diff --git a/authentik/admin/templates/administration/overview.html b/authentik/admin/templates/administration/overview.html index ee38a95757..a386bb2d29 100644 --- a/authentik/admin/templates/administration/overview.html +++ b/authentik/admin/templates/administration/overview.html @@ -11,169 +11,6 @@