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"]
@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"""

View File

@ -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:

View File

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

View File

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

View File

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

View File

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

View File

@ -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`<ak-banner>
${t`A newer version of the frontend is available.`}
<button @click=${() => { window.location.reload(); }}>
<button @click=${() => { window.location.reload(true); }}>
${t`Reload`}
</button>
</ak-banner>`;

View File

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

View File

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

View File

@ -31,7 +31,7 @@ export class PolicyStatusChart extends AKChart<FlowMetrics> {
async apiRequest(): Promise<FlowMetrics> {
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;

View File

@ -37,7 +37,7 @@ export class OutpostStatusChart extends AKChart<OutpostStats> {
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) {

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">
<div class="pf-c-card">
<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>
</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">
<div class="pf-c-card">
<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>
</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">
<div class="pf-c-card">
<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>
</div>
</div>