web/admin: add debug page

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-02-04 17:55:54 +01:00
parent 146d54813c
commit c960601a1e
No known key found for this signature in database
3 changed files with 104 additions and 0 deletions

View File

@ -92,6 +92,32 @@ paths:
schema:
$ref: '#/components/schemas/GenericError'
description: ''
post:
operationId: admin_system_create
description: Get system information.
tags:
- admin
security:
- authentik: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/System'
description: ''
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
description: ''
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: ''
/admin/system_tasks/:
get:
operationId: admin_system_tasks_list

View File

@ -0,0 +1,74 @@
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
import { MessageLevel } from "@goauthentik/common/messages";
import { AKElement } from "@goauthentik/elements/Base";
import "@goauthentik/elements/PageHeader";
import { showMessage } from "@goauthentik/elements/messages/MessageContainer";
import * as Sentry from "@sentry/browser";
import { CSSResult, TemplateResult, html } from "lit";
import { customElement } from "lit/decorators.js";
import AKGlobal from "@goauthentik/common/styles/authentik.css";
import PFButton from "@patternfly/patternfly/components/Button/button.css";
import PFCard from "@patternfly/patternfly/components/Card/card.css";
import PFPage from "@patternfly/patternfly/components/Page/page.css";
import PFGrid from "@patternfly/patternfly/layouts/Grid/grid.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css";
import { AdminApi } from "@goauthentik/api";
@customElement("ak-admin-debug-page")
export class DebugPage extends AKElement {
static get styles(): CSSResult[] {
return [PFBase, PFCard, PFPage, PFGrid, PFButton, AKGlobal];
}
render(): TemplateResult {
return html`
<ak-page-header icon="pf-icon pf-icon-user" header="Debug"> </ak-page-header>
<section class="pf-c-page__main-section">
<div class="pf-l-grid pf-m-gutter">
<div class="pf-l-grid__item pf-m-3-col pf-c-card">
<div class="pf-c-card__title">Sentry</div>
<div class="pf-c-card__body">
<button
class="pf-c-button pf-m-primary"
@click=${() => {
Sentry.captureException(new Error("test error"));
}}
>
Send test error
</button>
</div>
</div>
<div class="pf-l-grid__item pf-m-3-col pf-c-card">
<div class="pf-c-card__title">Misc</div>
<div class="pf-c-card__body">
<button
class="pf-c-button pf-m-primary"
@click=${() => {
new AdminApi(DEFAULT_CONFIG)
.adminSystemCreate()
.then(() => {
showMessage({
level: MessageLevel.success,
message: "Success",
});
})
.catch((exc) => {
showMessage({
level: MessageLevel.error,
message: exc,
});
});
}}
>
POST System
</button>
</div>
</div>
</div>
</section>
`;
}
}

View File

@ -132,4 +132,8 @@ export const ROUTES: Route[] = [
await import("@goauthentik/admin/blueprints/BlueprintListPage");
return html`<ak-blueprint-list></ak-blueprint-list>`;
}),
new Route(new RegExp("^/debug$"), async () => {
await import("@goauthentik/admin/DebugPage");
return html`<ak-admin-debug-page></ak-admin-debug-page>`;
}),
];