diff --git a/authentik/admin/api/tasks.py b/authentik/admin/api/tasks.py index 43b77810e..cfce015ee 100644 --- a/authentik/admin/api/tasks.py +++ b/authentik/admin/api/tasks.py @@ -4,6 +4,7 @@ from importlib import import_module from django.contrib import messages from django.http.response import Http404 from django.utils.translation import gettext_lazy as _ +from drf_spectacular.types import OpenApiTypes from drf_spectacular.utils import OpenApiResponse, extend_schema from rest_framework.decorators import action from rest_framework.fields import CharField, ChoiceField, DateTimeField, ListField @@ -57,11 +58,12 @@ class TaskViewSet(ViewSet): return Response(TaskSerializer(tasks, many=True).data) @extend_schema( + request=OpenApiTypes.NONE, responses={ 204: OpenApiResponse(description="Task retried successfully"), 404: OpenApiResponse(description="Task not found"), 500: OpenApiResponse(description="Failed to retry task"), - } + }, ) @action(detail=True, methods=["post"]) # pylint: disable=invalid-name diff --git a/authentik/admin/api/workers.py b/authentik/admin/api/workers.py index 7563b8f9a..4433fecd9 100644 --- a/authentik/admin/api/workers.py +++ b/authentik/admin/api/workers.py @@ -1,9 +1,9 @@ """authentik administration overview""" from drf_spectacular.utils import extend_schema, inline_serializer +from rest_framework.fields import IntegerField from rest_framework.permissions import IsAdminUser from rest_framework.request import Request from rest_framework.response import Response -from rest_framework.fields import IntegerField from rest_framework.views import APIView from authentik.root.celery import CELERY_APP @@ -15,12 +15,8 @@ class WorkerView(APIView): permission_classes = [IsAdminUser] @extend_schema( - responses=inline_serializer("Workers", fields={ - "count": IntegerField() - }) + responses=inline_serializer("Workers", fields={"count": IntegerField()}) ) def get(self, request: Request) -> Response: """Get currently connected worker count.""" - return Response( - {"count": len(CELERY_APP.control.ping(timeout=0.5))} - ) + return Response({"count": len(CELERY_APP.control.ping(timeout=0.5))}) diff --git a/authentik/api/v2/urls.py b/authentik/api/v2/urls.py index 9517bd879..54666fe63 100644 --- a/authentik/api/v2/urls.py +++ b/authentik/api/v2/urls.py @@ -194,7 +194,11 @@ urlpatterns = ( ] + router.urls + [ - path("admin/metrics/", AdministrationMetricsViewSet.as_view(), name="admin_metrics"), + path( + "admin/metrics/", + AdministrationMetricsViewSet.as_view(), + name="admin_metrics", + ), path("admin/version/", VersionView.as_view(), name="admin_version"), path("admin/workers/", WorkerView.as_view(), name="admin_workers"), path("root/config/", ConfigView.as_view(), name="config"), diff --git a/schema.yml b/schema.yml index 6cb8a97dd..de394e77b 100644 --- a/schema.yml +++ b/schema.yml @@ -97,18 +97,6 @@ paths: required: true tags: - admin - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/TaskRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/TaskRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/TaskRequest' - required: true security: - authentik: [] - cookieAuth: [] @@ -21666,28 +21654,6 @@ components: - task_description - task_finish_timestamp - task_name - TaskRequest: - type: object - description: Serialize TaskInfo and TaskResult - properties: - task_name: - type: string - task_description: - type: string - task_finish_timestamp: - type: string - format: date-time - status: - $ref: '#/components/schemas/StatusEnum' - messages: - type: array - items: {} - required: - - messages - - status - - task_description - - task_finish_timestamp - - task_name Token: type: object description: Token Serializer diff --git a/web/src/pages/system-tasks/SystemTaskListPage.ts b/web/src/pages/system-tasks/SystemTaskListPage.ts index 9f3dba017..ed33ff181 100644 --- a/web/src/pages/system-tasks/SystemTaskListPage.ts +++ b/web/src/pages/system-tasks/SystemTaskListPage.ts @@ -105,8 +105,8 @@ export class SystemTaskListPage extends TablePage { this.taskStatus(item), html` { - return new AdminApi(DEFAULT_CONFIG).adminSystemTasksRetry({ - id: item.taskName + return new AdminApi(DEFAULT_CONFIG).adminSystemTasksRetryCreate({ + id: item.taskName, }); }}> ${t`Retry Task`}