From 7152d7ee01e073250300e4daa018af74f404aee4 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 16 May 2021 18:09:53 +0200 Subject: [PATCH] outposts: fix schema for outposts health Signed-off-by: Jens Langhammer --- authentik/outposts/api/outposts.py | 2 +- schema.yml | 67 ++----------------- web/src/elements/oauth/UserCodeList.ts | 2 +- web/src/elements/oauth/UserRefreshList.ts | 2 +- web/src/elements/sidebar/SidebarBrand.ts | 1 + web/src/elements/user/UserConsentList.ts | 2 +- web/src/flows/sources/plex/PlexLoginInit.ts | 4 +- web/src/interfaces/Interface.ts | 4 +- .../admin-overview/cards/VersionStatusCard.ts | 2 +- .../admin-overview/cards/WorkerStatusCard.ts | 4 +- .../admin-overview/charts/FlowStatusChart.ts | 2 +- .../charts/OutpostStatusChart.ts | 2 +- web/src/pages/users/UserViewPage.ts | 6 +- 13 files changed, 23 insertions(+), 77 deletions(-) diff --git a/authentik/outposts/api/outposts.py b/authentik/outposts/api/outposts.py index af862891d..2def9d3da 100644 --- a/authentik/outposts/api/outposts.py +++ b/authentik/outposts/api/outposts.py @@ -73,7 +73,7 @@ class OutpostViewSet(ModelViewSet): ordering = ["name"] @extend_schema(responses={200: OutpostHealthSerializer(many=True)}) - @action(methods=["GET"], detail=True) + @action(methods=["GET"], detail=True, pagination_class=None) # pylint: disable=invalid-name, unused-argument def health(self, request: Request, pk: int) -> Response: """Get outposts current health""" diff --git a/schema.yml b/schema.yml index 071ade43d..0d4e44d62 100644 --- a/schema.yml +++ b/schema.yml @@ -3960,18 +3960,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 - in: query name: providers__isnull schema: @@ -3999,7 +3987,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PaginatedOutpostHealthList' + type: array + items: + $ref: '#/components/schemas/OutpostHealth' description: '' /api/v2beta/outposts/instances/default_settings/: get: @@ -4276,18 +4266,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 - in: query name: providers__isnull schema: @@ -4315,7 +4293,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PaginatedOutpostHealthList' + type: array + items: + $ref: '#/components/schemas/OutpostHealth' description: '' /api/v2beta/outposts/outposts/default_settings/: get: @@ -17515,41 +17495,6 @@ components: required: - pagination - results - PaginatedOutpostHealthList: - 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/OutpostHealth' - required: - - pagination - - results PaginatedOutpostList: type: object properties: diff --git a/web/src/elements/oauth/UserCodeList.ts b/web/src/elements/oauth/UserCodeList.ts index ad75e690a..cc2ec6a83 100644 --- a/web/src/elements/oauth/UserCodeList.ts +++ b/web/src/elements/oauth/UserCodeList.ts @@ -11,7 +11,7 @@ import { DEFAULT_CONFIG } from "../../api/Config"; @customElement("ak-user-oauth-code-list") export class UserOAuthCodeList extends Table { @property() - userId?: string; + userId?: number; apiEndpoint(page: number): Promise> { return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesList({ diff --git a/web/src/elements/oauth/UserRefreshList.ts b/web/src/elements/oauth/UserRefreshList.ts index 413db9219..8049126bd 100644 --- a/web/src/elements/oauth/UserRefreshList.ts +++ b/web/src/elements/oauth/UserRefreshList.ts @@ -11,7 +11,7 @@ import { DEFAULT_CONFIG } from "../../api/Config"; @customElement("ak-user-oauth-refresh-list") export class UserOAuthRefreshList extends Table { @property() - userId?: string; + userId?: number; apiEndpoint(page: number): Promise> { return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensList({ diff --git a/web/src/elements/sidebar/SidebarBrand.ts b/web/src/elements/sidebar/SidebarBrand.ts index 201a28f1e..fb20160d9 100644 --- a/web/src/elements/sidebar/SidebarBrand.ts +++ b/web/src/elements/sidebar/SidebarBrand.ts @@ -21,6 +21,7 @@ export const DefaultConfig: Config = { errorReportingEnabled: false, errorReportingEnvironment: "", errorReportingSendPii: false, + uiFooterLinks: [], }; @customElement("ak-sidebar-brand") diff --git a/web/src/elements/user/UserConsentList.ts b/web/src/elements/user/UserConsentList.ts index 15be03cfe..262924e57 100644 --- a/web/src/elements/user/UserConsentList.ts +++ b/web/src/elements/user/UserConsentList.ts @@ -11,7 +11,7 @@ import { DEFAULT_CONFIG } from "../../api/Config"; @customElement("ak-user-consent-list") export class UserConsentList extends Table { @property() - userId?: string; + userId?: number; apiEndpoint(page: number): Promise> { return new CoreApi(DEFAULT_CONFIG).coreUserConsentList({ diff --git a/web/src/flows/sources/plex/PlexLoginInit.ts b/web/src/flows/sources/plex/PlexLoginInit.ts index 3d9351e81..f78c7329d 100644 --- a/web/src/flows/sources/plex/PlexLoginInit.ts +++ b/web/src/flows/sources/plex/PlexLoginInit.ts @@ -38,8 +38,8 @@ export class PlexLoginInit extends BaseStage { const authWindow = popupCenterScreen(authInfo.authUrl, "plex auth", 550, 700); PlexAPIClient.pinPoll(this.challenge?.client_id || "", authInfo.pin.id).then(token => { authWindow?.close(); - new SourcesApi(DEFAULT_CONFIG).sourcesPlexRedeemToken({ - data: { + new SourcesApi(DEFAULT_CONFIG).sourcesPlexRedeemTokenCreate({ + plexTokenRedeemRequest: { plexToken: token, }, slug: this.challenge?.slug || "", diff --git a/web/src/interfaces/Interface.ts b/web/src/interfaces/Interface.ts index e4c15fbaa..5f43deff2 100644 --- a/web/src/interfaces/Interface.ts +++ b/web/src/interfaces/Interface.ts @@ -51,11 +51,11 @@ export abstract class Interface extends LitElement { render(): TemplateResult { return html` - ${until(new AdminApi(DEFAULT_CONFIG).adminVersionList().then(version => { + ${until(new AdminApi(DEFAULT_CONFIG).adminVersionRetrieve().then(version => { if (version.versionCurrent !== VERSION) { return html` ${t`A newer version of the frontend is available.`} - `; diff --git a/web/src/pages/admin-overview/cards/VersionStatusCard.ts b/web/src/pages/admin-overview/cards/VersionStatusCard.ts index 499efe3ba..f8cdde1ad 100644 --- a/web/src/pages/admin-overview/cards/VersionStatusCard.ts +++ b/web/src/pages/admin-overview/cards/VersionStatusCard.ts @@ -8,7 +8,7 @@ import { AdminStatusCard, AdminStatus } from "./AdminStatusCard"; export class VersionStatusCard extends AdminStatusCard { getPrimaryValue(): Promise { - return new AdminApi(DEFAULT_CONFIG).adminVersionList(); + return new AdminApi(DEFAULT_CONFIG).adminVersionRetrieve(); } getStatus(value: Version): Promise { diff --git a/web/src/pages/admin-overview/cards/WorkerStatusCard.ts b/web/src/pages/admin-overview/cards/WorkerStatusCard.ts index f93dc1402..5b97b4a28 100644 --- a/web/src/pages/admin-overview/cards/WorkerStatusCard.ts +++ b/web/src/pages/admin-overview/cards/WorkerStatusCard.ts @@ -8,8 +8,8 @@ import { AdminStatus, AdminStatusCard } from "./AdminStatusCard"; export class WorkersStatusCard extends AdminStatusCard { getPrimaryValue(): Promise { - return new AdminApi(DEFAULT_CONFIG).adminWorkersList({}).then((workers) => { - return workers.pagination.count; + return new AdminApi(DEFAULT_CONFIG).adminWorkersRetrieve().then((workers) => { + return workers.count; }); } diff --git a/web/src/pages/admin-overview/charts/FlowStatusChart.ts b/web/src/pages/admin-overview/charts/FlowStatusChart.ts index 483664279..b064e567c 100644 --- a/web/src/pages/admin-overview/charts/FlowStatusChart.ts +++ b/web/src/pages/admin-overview/charts/FlowStatusChart.ts @@ -31,7 +31,7 @@ export class PolicyStatusChart extends AKChart { async apiRequest(): Promise { const api = new FlowsApi(DEFAULT_CONFIG); - const cached = (await api.flowsInstancesCacheInfo()).count || 0; + const cached = (await api.flowsInstancesCacheInfoRetrieve()).count || 0; const count = (await api.flowsInstancesList({ pageSize: 1 })).pagination.count; diff --git a/web/src/pages/admin-overview/charts/OutpostStatusChart.ts b/web/src/pages/admin-overview/charts/OutpostStatusChart.ts index 073f68654..1168a62d0 100644 --- a/web/src/pages/admin-overview/charts/OutpostStatusChart.ts +++ b/web/src/pages/admin-overview/charts/OutpostStatusChart.ts @@ -37,7 +37,7 @@ export class OutpostStatusChart extends AKChart { let outdated = 0; let unhealthy = 0; await Promise.all(outposts.results.map(async (element) => { - const health = await api.outpostsOutpostsHealth({ + const health = await api.outpostsOutpostsHealthList({ uuid: element.pk || "", }); if (health.length === 0) { diff --git a/web/src/pages/users/UserViewPage.ts b/web/src/pages/users/UserViewPage.ts index a2efca172..374713074 100644 --- a/web/src/pages/users/UserViewPage.ts +++ b/web/src/pages/users/UserViewPage.ts @@ -198,7 +198,7 @@ export class UserViewPage extends LitElement {
- +
@@ -206,7 +206,7 @@ export class UserViewPage extends LitElement {
- +
@@ -214,7 +214,7 @@ export class UserViewPage extends LitElement {
- +