From ba5374f6e104d8a19f0526677f17ff18da691c84 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 16 May 2021 18:24:15 +0200 Subject: [PATCH] web: mass update API calls Signed-off-by: Jens Langhammer --- authentik/events/api/event.py | 2 +- schema.yml | 51 ++----------------- .../admin-overview/TopApplicationsTable.ts | 2 +- web/src/pages/applications/ApplicationForm.ts | 2 +- .../pages/crypto/CertificateGenerateForm.ts | 10 ++-- .../pages/crypto/CertificateKeyPairForm.ts | 10 ++-- web/src/pages/events/RuleForm.ts | 4 +- web/src/pages/events/TransportForm.ts | 4 +- web/src/pages/flows/BoundStagesList.ts | 2 +- web/src/pages/flows/FlowForm.ts | 6 +-- web/src/pages/flows/StageBindingForm.ts | 4 +- web/src/pages/groups/GroupForm.ts | 4 +- web/src/pages/outposts/OutpostForm.ts | 4 +- .../outposts/ServiceConnectionDockerForm.ts | 4 +- .../ServiceConnectionKubernetesForm.ts | 4 +- web/src/pages/policies/BoundPoliciesList.ts | 2 +- web/src/pages/policies/PolicyBindingForm.ts | 4 +- web/src/pages/policies/PolicyListPage.ts | 2 +- web/src/pages/policies/PolicyTestForm.ts | 11 ++-- .../pages/policies/dummy/DummyPolicyForm.ts | 4 +- .../event_matcher/EventMatcherPolicyForm.ts | 4 +- .../pages/policies/expiry/ExpiryPolicyForm.ts | 4 +- .../expression/ExpressionPolicyForm.ts | 4 +- .../policies/hibp/HaveIBeenPwnedPolicyForm.ts | 4 +- .../policies/password/PasswordPolicyForm.ts | 4 +- .../reputation/ReputationPolicyForm.ts | 4 +- .../PropertyMappingLDAPForm.ts | 4 +- .../PropertyMappingSAMLForm.ts | 4 +- .../PropertyMappingScopeForm.ts | 4 +- .../PropertyMappingTestForm.ts | 11 ++-- web/src/pages/providers/ProviderListPage.ts | 2 +- .../pages/providers/ldap/LDAPProviderForm.ts | 4 +- .../providers/oauth2/OAuth2ProviderForm.ts | 4 +- .../providers/proxy/ProxyProviderForm.ts | 4 +- .../pages/providers/saml/SAMLProviderForm.ts | 4 +- web/src/pages/sources/ldap/LDAPSourceForm.ts | 8 +-- .../pages/sources/ldap/LDAPSourceViewPage.ts | 2 +- .../pages/sources/oauth/OAuthSourceForm.ts | 8 +-- web/src/pages/sources/plex/PlexSourceForm.ts | 4 +- web/src/pages/sources/saml/SAMLSourceForm.ts | 4 +- web/src/pages/stages/StageListPage.ts | 2 +- .../AuthenticatorStaticStageForm.ts | 4 +- .../AuthenticatorTOTPStageForm.ts | 4 +- .../AuthenticatorValidateStageForm.ts | 4 +- .../AuthenticateWebAuthnStageForm.ts | 4 +- .../pages/stages/captcha/CaptchaStageForm.ts | 6 +-- .../pages/stages/consent/ConsentStageForm.ts | 4 +- web/src/pages/stages/deny/DenyStageForm.ts | 4 +- web/src/pages/stages/dummy/DummyStageForm.ts | 4 +- web/src/pages/stages/email/EmailStageForm.ts | 4 +- .../identification/IdentificationStageForm.ts | 4 +- .../pages/stages/invitation/InvitationForm.ts | 4 +- .../stages/invitation/InvitationStageForm.ts | 4 +- .../stages/password/PasswordStageForm.ts | 4 +- web/src/pages/stages/prompt/PromptForm.ts | 4 +- .../pages/stages/prompt/PromptStageForm.ts | 4 +- .../stages/user_delete/UserDeleteStageForm.ts | 4 +- .../stages/user_login/UserLoginStageForm.ts | 4 +- .../stages/user_logout/UserLogoutStageForm.ts | 4 +- .../stages/user_write/UserWriteStageForm.ts | 4 +- .../pages/user-settings/UserDetailsPage.ts | 2 +- .../pages/user-settings/UserSettingsPage.ts | 4 +- .../UserSettingsAuthenticatorWebAuthn.ts | 2 +- .../user-settings/tokens/UserTokenForm.ts | 4 +- 64 files changed, 136 insertions(+), 183 deletions(-) diff --git a/authentik/events/api/event.py b/authentik/events/api/event.py index 5cf5e7992..d0c4e396d 100644 --- a/authentik/events/api/event.py +++ b/authentik/events/api/event.py @@ -118,7 +118,7 @@ class EventViewSet(ReadOnlyModelViewSet): ) ], ) - @action(detail=False, methods=["GET"]) + @action(detail=False, methods=["GET"], pagination_class=None) def top_per_user(self, request: Request): """Get the top_n events grouped by user count""" filtered_action = request.query_params.get("action", EventAction.LOGIN) diff --git a/schema.yml b/schema.yml index 0d4e44d62..749e05217 100644 --- a/schema.yml +++ b/schema.yml @@ -2338,18 +2338,6 @@ paths: description: Which field to use when ordering the results. schema: type: string - - name: page - required: false - in: query - description: A page number within the paginated result set. - schema: - type: integer - - name: page_size - required: false - in: query - description: Number of results to return per page. - schema: - type: integer - name: search required: false in: query @@ -2375,7 +2363,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PaginatedEventTopPerUserList' + type: array + items: + $ref: '#/components/schemas/EventTopPerUser' description: '' /api/v2beta/events/notifications/: get: @@ -16760,41 +16750,6 @@ components: required: - pagination - results - PaginatedEventTopPerUserList: - type: object - properties: - pagination: - type: object - properties: - next: - type: number - previous: - type: number - count: - type: number - current: - type: number - total_pages: - type: number - start_index: - type: number - end_index: - type: number - required: - - next - - previous - - count - - current - - total_pages - - start_index - - end_index - results: - type: array - items: - $ref: '#/components/schemas/EventTopPerUser' - required: - - pagination - - results PaginatedExpiringBaseGrantModelList: type: object properties: diff --git a/web/src/pages/admin-overview/TopApplicationsTable.ts b/web/src/pages/admin-overview/TopApplicationsTable.ts index 9c42c8f9b..12e052ee6 100644 --- a/web/src/pages/admin-overview/TopApplicationsTable.ts +++ b/web/src/pages/admin-overview/TopApplicationsTable.ts @@ -18,7 +18,7 @@ export class TopApplicationsTable extends LitElement { } firstUpdated(): void { - new EventsApi(DEFAULT_CONFIG).eventsEventsTopPerUser({ + new EventsApi(DEFAULT_CONFIG).eventsEventsTopPerUserList({ action: "authorize_application", topN: 11, }).then((events) => { diff --git a/web/src/pages/applications/ApplicationForm.ts b/web/src/pages/applications/ApplicationForm.ts index 15dee4e2f..9070d20fd 100644 --- a/web/src/pages/applications/ApplicationForm.ts +++ b/web/src/pages/applications/ApplicationForm.ts @@ -115,7 +115,7 @@ export class ApplicationForm extends ModelForm {