outposts: fix schema for outposts health

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-16 18:09:53 +02:00
parent ab07113530
commit 7152d7ee01
13 changed files with 23 additions and 77 deletions

View file

@ -73,7 +73,7 @@ class OutpostViewSet(ModelViewSet):
ordering = ["name"] ordering = ["name"]
@extend_schema(responses={200: OutpostHealthSerializer(many=True)}) @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 # pylint: disable=invalid-name, unused-argument
def health(self, request: Request, pk: int) -> Response: def health(self, request: Request, pk: int) -> Response:
"""Get outposts current health""" """Get outposts current health"""

View file

@ -3960,18 +3960,6 @@ paths:
description: Which field to use when ordering the results. description: Which field to use when ordering the results.
schema: schema:
type: string 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 - in: query
name: providers__isnull name: providers__isnull
schema: schema:
@ -3999,7 +3987,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/PaginatedOutpostHealthList' type: array
items:
$ref: '#/components/schemas/OutpostHealth'
description: '' description: ''
/api/v2beta/outposts/instances/default_settings/: /api/v2beta/outposts/instances/default_settings/:
get: get:
@ -4276,18 +4266,6 @@ paths:
description: Which field to use when ordering the results. description: Which field to use when ordering the results.
schema: schema:
type: string 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 - in: query
name: providers__isnull name: providers__isnull
schema: schema:
@ -4315,7 +4293,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/PaginatedOutpostHealthList' type: array
items:
$ref: '#/components/schemas/OutpostHealth'
description: '' description: ''
/api/v2beta/outposts/outposts/default_settings/: /api/v2beta/outposts/outposts/default_settings/:
get: get:
@ -17515,41 +17495,6 @@ components:
required: required:
- pagination - pagination
- results - 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: PaginatedOutpostList:
type: object type: object
properties: properties:

View file

@ -11,7 +11,7 @@ import { DEFAULT_CONFIG } from "../../api/Config";
@customElement("ak-user-oauth-code-list") @customElement("ak-user-oauth-code-list")
export class UserOAuthCodeList extends Table<ExpiringBaseGrantModel> { export class UserOAuthCodeList extends Table<ExpiringBaseGrantModel> {
@property() @property()
userId?: string; userId?: number;
apiEndpoint(page: number): Promise<AKResponse<ExpiringBaseGrantModel>> { apiEndpoint(page: number): Promise<AKResponse<ExpiringBaseGrantModel>> {
return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesList({ return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesList({

View file

@ -11,7 +11,7 @@ import { DEFAULT_CONFIG } from "../../api/Config";
@customElement("ak-user-oauth-refresh-list") @customElement("ak-user-oauth-refresh-list")
export class UserOAuthRefreshList extends Table<ExpiringBaseGrantModel> { export class UserOAuthRefreshList extends Table<ExpiringBaseGrantModel> {
@property() @property()
userId?: string; userId?: number;
apiEndpoint(page: number): Promise<AKResponse<ExpiringBaseGrantModel>> { apiEndpoint(page: number): Promise<AKResponse<ExpiringBaseGrantModel>> {
return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensList({ return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensList({

View file

@ -21,6 +21,7 @@ export const DefaultConfig: Config = {
errorReportingEnabled: false, errorReportingEnabled: false,
errorReportingEnvironment: "", errorReportingEnvironment: "",
errorReportingSendPii: false, errorReportingSendPii: false,
uiFooterLinks: [],
}; };
@customElement("ak-sidebar-brand") @customElement("ak-sidebar-brand")

View file

@ -11,7 +11,7 @@ import { DEFAULT_CONFIG } from "../../api/Config";
@customElement("ak-user-consent-list") @customElement("ak-user-consent-list")
export class UserConsentList extends Table<UserConsent> { export class UserConsentList extends Table<UserConsent> {
@property() @property()
userId?: string; userId?: number;
apiEndpoint(page: number): Promise<AKResponse<UserConsent>> { apiEndpoint(page: number): Promise<AKResponse<UserConsent>> {
return new CoreApi(DEFAULT_CONFIG).coreUserConsentList({ return new CoreApi(DEFAULT_CONFIG).coreUserConsentList({

View file

@ -38,8 +38,8 @@ export class PlexLoginInit extends BaseStage {
const authWindow = popupCenterScreen(authInfo.authUrl, "plex auth", 550, 700); const authWindow = popupCenterScreen(authInfo.authUrl, "plex auth", 550, 700);
PlexAPIClient.pinPoll(this.challenge?.client_id || "", authInfo.pin.id).then(token => { PlexAPIClient.pinPoll(this.challenge?.client_id || "", authInfo.pin.id).then(token => {
authWindow?.close(); authWindow?.close();
new SourcesApi(DEFAULT_CONFIG).sourcesPlexRedeemToken({ new SourcesApi(DEFAULT_CONFIG).sourcesPlexRedeemTokenCreate({
data: { plexTokenRedeemRequest: {
plexToken: token, plexToken: token,
}, },
slug: this.challenge?.slug || "", slug: this.challenge?.slug || "",

View file

@ -51,11 +51,11 @@ export abstract class Interface extends LitElement {
render(): TemplateResult { render(): TemplateResult {
return html` return html`
${until(new AdminApi(DEFAULT_CONFIG).adminVersionList().then(version => { ${until(new AdminApi(DEFAULT_CONFIG).adminVersionRetrieve().then(version => {
if (version.versionCurrent !== VERSION) { if (version.versionCurrent !== VERSION) {
return html`<ak-banner> return html`<ak-banner>
${t`A newer version of the frontend is available.`} ${t`A newer version of the frontend is available.`}
<button @click=${() => { window.location.reload(); }}> <button @click=${() => { window.location.reload(true); }}>
${t`Reload`} ${t`Reload`}
</button> </button>
</ak-banner>`; </ak-banner>`;

View file

@ -8,7 +8,7 @@ import { AdminStatusCard, AdminStatus } from "./AdminStatusCard";
export class VersionStatusCard extends AdminStatusCard<Version> { export class VersionStatusCard extends AdminStatusCard<Version> {
getPrimaryValue(): Promise<Version> { getPrimaryValue(): Promise<Version> {
return new AdminApi(DEFAULT_CONFIG).adminVersionList(); return new AdminApi(DEFAULT_CONFIG).adminVersionRetrieve();
} }
getStatus(value: Version): Promise<AdminStatus> { getStatus(value: Version): Promise<AdminStatus> {

View file

@ -8,8 +8,8 @@ import { AdminStatus, AdminStatusCard } from "./AdminStatusCard";
export class WorkersStatusCard extends AdminStatusCard<number> { export class WorkersStatusCard extends AdminStatusCard<number> {
getPrimaryValue(): Promise<number> { getPrimaryValue(): Promise<number> {
return new AdminApi(DEFAULT_CONFIG).adminWorkersList({}).then((workers) => { return new AdminApi(DEFAULT_CONFIG).adminWorkersRetrieve().then((workers) => {
return workers.pagination.count; return workers.count;
}); });
} }

View file

@ -31,7 +31,7 @@ export class PolicyStatusChart extends AKChart<FlowMetrics> {
async apiRequest(): Promise<FlowMetrics> { async apiRequest(): Promise<FlowMetrics> {
const api = new FlowsApi(DEFAULT_CONFIG); 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({ const count = (await api.flowsInstancesList({
pageSize: 1 pageSize: 1
})).pagination.count; })).pagination.count;

View file

@ -37,7 +37,7 @@ export class OutpostStatusChart extends AKChart<OutpostStats> {
let outdated = 0; let outdated = 0;
let unhealthy = 0; let unhealthy = 0;
await Promise.all(outposts.results.map(async (element) => { await Promise.all(outposts.results.map(async (element) => {
const health = await api.outpostsOutpostsHealth({ const health = await api.outpostsOutpostsHealthList({
uuid: element.pk || "", uuid: element.pk || "",
}); });
if (health.length === 0) { if (health.length === 0) {

View file

@ -198,7 +198,7 @@ export class UserViewPage extends LitElement {
<section slot="page-consent" data-tab-title="${t`Explicit Consent`}" class="pf-c-page__main-section pf-m-no-padding-mobile"> <section slot="page-consent" data-tab-title="${t`Explicit Consent`}" class="pf-c-page__main-section pf-m-no-padding-mobile">
<div class="pf-c-card"> <div class="pf-c-card">
<div class="pf-c-card__body"> <div class="pf-c-card__body">
<ak-user-consent-list .userId="${(this.user.pk || 0).toString()}"> <ak-user-consent-list userId=${(this.user.pk || 0)}>
</ak-user-consent-list> </ak-user-consent-list>
</div> </div>
</div> </div>
@ -206,7 +206,7 @@ export class UserViewPage extends LitElement {
<section slot="page-oauth-code" data-tab-title="${t`OAuth Authorization Codes`}" class="pf-c-page__main-section pf-m-no-padding-mobile"> <section slot="page-oauth-code" data-tab-title="${t`OAuth Authorization Codes`}" class="pf-c-page__main-section pf-m-no-padding-mobile">
<div class="pf-c-card"> <div class="pf-c-card">
<div class="pf-c-card__body"> <div class="pf-c-card__body">
<ak-user-oauth-code-list .userId="${(this.user.pk || 0).toString()}"> <ak-user-oauth-code-list userId=${this.user.pk || 0}>
</ak-user-oauth-code-list> </ak-user-oauth-code-list>
</div> </div>
</div> </div>
@ -214,7 +214,7 @@ export class UserViewPage extends LitElement {
<section slot="page-oauth-refresh" data-tab-title="${t`OAuth Refresh Codes`}" class="pf-c-page__main-section pf-m-no-padding-mobile"> <section slot="page-oauth-refresh" data-tab-title="${t`OAuth Refresh Codes`}" class="pf-c-page__main-section pf-m-no-padding-mobile">
<div class="pf-c-card"> <div class="pf-c-card">
<div class="pf-c-card__body"> <div class="pf-c-card__body">
<ak-user-oauth-refresh-list .userId="${(this.user.pk || 0).toString()}"> <ak-user-oauth-refresh-list userId=${this.user.pk || 0}>
</ak-user-oauth-refresh-list> </ak-user-oauth-refresh-list>
</div> </div>
</div> </div>