root: fix formatting

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-08-06 00:11:24 +02:00
parent 8044818a4d
commit 2d5094fdf7
11 changed files with 99 additions and 61 deletions

View File

@ -18,7 +18,10 @@ class Migration(migrations.Migration):
), ),
), ),
migrations.AlterModelOptions( migrations.AlterModelOptions(
name='authenticatedsession', name="authenticatedsession",
options={'verbose_name': 'Authenticated Session', 'verbose_name_plural': 'Authenticated Sessions'}, options={
"verbose_name": "Authenticated Session",
"verbose_name_plural": "Authenticated Sessions",
},
), ),
] ]

View File

@ -12,7 +12,12 @@ import PFContent from "@patternfly/patternfly/components/Content/content.css";
import AKGlobal from "../authentik.css"; import AKGlobal from "../authentik.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css";
import PFButton from "@patternfly/patternfly/components/Button/button.css"; import PFButton from "@patternfly/patternfly/components/Button/button.css";
import { EVENT_API_DRAWER_TOGGLE, EVENT_NOTIFICATION_DRAWER_TOGGLE, EVENT_SIDEBAR_TOGGLE, TITLE_DEFAULT } from "../constants"; import {
EVENT_API_DRAWER_TOGGLE,
EVENT_NOTIFICATION_DRAWER_TOGGLE,
EVENT_SIDEBAR_TOGGLE,
TITLE_DEFAULT,
} from "../constants";
import { DEFAULT_CONFIG, tenant } from "../api/Config"; import { DEFAULT_CONFIG, tenant } from "../api/Config";
import { EventsApi } from "../../api/dist"; import { EventsApi } from "../../api/dist";
@ -154,7 +159,6 @@ export class PageHeader extends LitElement {
}} }}
> >
<i class="fas fa-bell"></i> <i class="fas fa-bell"></i>
</button> </button> `;
`;
} }
} }

View File

@ -5,7 +5,6 @@ import { MessageLevel } from "../messages/Message";
@customElement("ak-action-button") @customElement("ak-action-button")
export class ActionButton extends SpinnerButton { export class ActionButton extends SpinnerButton {
@property({ attribute: false }) @property({ attribute: false })
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
apiRequest: () => Promise<any> = () => { apiRequest: () => Promise<any> = () => {

View File

@ -16,7 +16,6 @@ import { ERROR_CLASS, PRIMARY_CLASS, PROGRESS_CLASS, SUCCESS_CLASS } from "../..
@customElement("ak-spinner-button") @customElement("ak-spinner-button")
export class SpinnerButton extends LitElement { export class SpinnerButton extends LitElement {
@property({ type: Boolean }) @property({ type: Boolean })
isRunning = false; isRunning = false;

View File

@ -1,5 +1,13 @@
import { Middleware, ResponseContext } from "authentik-api"; import { Middleware, ResponseContext } from "authentik-api";
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
TemplateResult,
} from "lit-element";
import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css";
import PFNotificationDrawer from "@patternfly/patternfly/components/NotificationDrawer/notification-drawer.css"; import PFNotificationDrawer from "@patternfly/patternfly/components/NotificationDrawer/notification-drawer.css";
import PFDropdown from "@patternfly/patternfly/components/Dropdown/dropdown.css"; import PFDropdown from "@patternfly/patternfly/components/Dropdown/dropdown.css";
@ -16,7 +24,6 @@ export interface RequestInfo {
} }
export class APIMiddleware implements Middleware { export class APIMiddleware implements Middleware {
post?(context: ResponseContext): Promise<Response | void> { post?(context: ResponseContext): Promise<Response | void> {
const request: RequestInfo = { const request: RequestInfo = {
method: (context.init.method || "GET").toUpperCase(), method: (context.init.method || "GET").toUpperCase(),
@ -32,31 +39,37 @@ export class APIMiddleware implements Middleware {
); );
return Promise.resolve(context.response); return Promise.resolve(context.response);
} }
} }
@customElement("ak-api-drawer") @customElement("ak-api-drawer")
export class APIDrawer extends LitElement { export class APIDrawer extends LitElement {
@property({ attribute: false })
@property({attribute: false})
requests: RequestInfo[] = []; requests: RequestInfo[] = [];
static get styles(): CSSResult[] { static get styles(): CSSResult[] {
return [PFBase, PFNotificationDrawer, PFButton, PFContent, PFDropdown, AKGlobal, css` return [
.pf-c-notification-drawer__header { PFBase,
height: 114px; PFNotificationDrawer,
align-items: center; PFButton,
} PFContent,
.pf-c-notification-drawer__header-action, PFDropdown,
.pf-c-notification-drawer__header-action-close, AKGlobal,
.pf-c-notification-drawer__header-action-close > .pf-c-button.pf-m-plain { css`
height: 100%; .pf-c-notification-drawer__header {
} height: 114px;
.pf-c-notification-drawer__list-item-description { align-items: center;
white-space: pre-wrap; }
font-family: monospace; .pf-c-notification-drawer__header-action,
} .pf-c-notification-drawer__header-action-close,
`]; .pf-c-notification-drawer__header-action-close > .pf-c-button.pf-m-plain {
height: 100%;
}
.pf-c-notification-drawer__list-item-description {
white-space: pre-wrap;
font-family: monospace;
}
`,
];
} }
constructor() { constructor() {
@ -73,9 +86,13 @@ export class APIDrawer extends LitElement {
renderItem(item: RequestInfo): TemplateResult { renderItem(item: RequestInfo): TemplateResult {
return html`<li class="pf-c-notification-drawer__list-item pf-m-read"> return html`<li class="pf-c-notification-drawer__list-item pf-m-read">
<div class="pf-c-notification-drawer__list-item-header"> <div class="pf-c-notification-drawer__list-item-header">
<h2 class="pf-c-notification-drawer__list-item-header-title">${item.method}: ${item.status}</h2> <h2 class="pf-c-notification-drawer__list-item-header-title">
${item.method}: ${item.status}
</h2>
</div> </div>
<a class="pf-c-notification-drawer__list-item-description" href=${item.path}>${item.path}</a> <a class="pf-c-notification-drawer__list-item-description" href=${item.path}
>${item.path}</a
>
</li>`; </li>`;
} }

View File

@ -24,7 +24,12 @@ import "../elements/messages/MessageContainer";
import "../elements/notifications/NotificationDrawer"; import "../elements/notifications/NotificationDrawer";
import "../elements/sidebar/Sidebar"; import "../elements/sidebar/Sidebar";
import { until } from "lit-html/directives/until"; import { until } from "lit-html/directives/until";
import { EVENT_API_DRAWER_TOGGLE, EVENT_NOTIFICATION_DRAWER_TOGGLE, EVENT_SIDEBAR_TOGGLE, VERSION } from "../constants"; import {
EVENT_API_DRAWER_TOGGLE,
EVENT_NOTIFICATION_DRAWER_TOGGLE,
EVENT_SIDEBAR_TOGGLE,
VERSION,
} from "../constants";
import { AdminApi } from "authentik-api"; import { AdminApi } from "authentik-api";
import { DEFAULT_CONFIG } from "../api/Config"; import { DEFAULT_CONFIG } from "../api/Config";
import { WebsocketClient } from "../common/ws"; import { WebsocketClient } from "../common/ws";
@ -106,8 +111,16 @@ export class AdminInterface extends LitElement {
</main> </main>
</div> </div>
</div> </div>
${this.notificationOpen ? html`<ak-notification-drawer class="pf-c-drawer__panel pf-m-width-33"></ak-notification-drawer>` : html``} ${this.notificationOpen
${this.apiDrawerOpen ? html`<ak-api-drawer class="pf-c-drawer__panel pf-m-width-33"></ak-api-drawer>` : html``} ? html`<ak-notification-drawer
class="pf-c-drawer__panel pf-m-width-33"
></ak-notification-drawer>`
: html``}
${this.apiDrawerOpen
? html`<ak-api-drawer
class="pf-c-drawer__panel pf-m-width-33"
></ak-api-drawer>`
: html``}
</div> </div>
</div> </div>
</div> </div>

View File

@ -39,16 +39,7 @@ export class ApplicationViewPage extends LitElement {
application!: Application; application!: Application;
static get styles(): CSSResult[] { static get styles(): CSSResult[] {
return [ return [PFBase, PFPage, PFContent, PFButton, PFDescriptionList, PFGrid, PFCard, AKGlobal];
PFBase,
PFPage,
PFContent,
PFButton,
PFDescriptionList,
PFGrid,
PFCard,
AKGlobal,
];
} }
render(): TemplateResult { render(): TemplateResult {
@ -73,7 +64,9 @@ export class ApplicationViewPage extends LitElement {
class="pf-c-page__main-section pf-m-no-padding-mobile" class="pf-c-page__main-section pf-m-no-padding-mobile"
> >
<div class="pf-l-grid pf-m-gutter"> <div class="pf-l-grid pf-m-gutter">
<div class="pf-c-card pf-l-grid__item pf-m-12-col pf-m-2-col-on-xl pf-m-1-col-on-2xl"> <div
class="pf-c-card pf-l-grid__item pf-m-12-col pf-m-2-col-on-xl pf-m-1-col-on-2xl"
>
<div class="pf-c-card__title">${t`Related`}</div> <div class="pf-c-card__title">${t`Related`}</div>
<div class="pf-c-card__body"> <div class="pf-c-card__body">
<dl class="pf-c-description-list"> <dl class="pf-c-description-list">
@ -198,9 +191,7 @@ export class ApplicationViewPage extends LitElement {
</ak-charts-application-authorize>`} </ak-charts-application-authorize>`}
</div> </div>
</div> </div>
<div <div class="pf-c-card pf-l-grid__item pf-m-12-col">
class="pf-c-card pf-l-grid__item pf-m-12-col"
>
<div class="pf-c-card__title">${t`Changelog`}</div> <div class="pf-c-card__title">${t`Changelog`}</div>
<div class="pf-c-card__body"> <div class="pf-c-card__body">
<ak-object-changelog <ak-object-changelog

View File

@ -105,13 +105,13 @@ export class RuleListPage extends TablePage<NotificationRule> {
renderExpanded(item: NotificationRule): TemplateResult { renderExpanded(item: NotificationRule): TemplateResult {
return html` <td role="cell" colspan="4"> return html` <td role="cell" colspan="4">
<div class="pf-c-table__expandable-row-content"> <div class="pf-c-table__expandable-row-content">
<p> <p>
${t`These bindings control upon which events this rule triggers. Bindings to ${t`These bindings control upon which events this rule triggers. Bindings to
groups/users are checked against the user of the event.`} groups/users are checked against the user of the event.`}
</p> </p>
<ak-bound-policies-list .target=${item.pk}> </ak-bound-policies-list> <ak-bound-policies-list .target=${item.pk}> </ak-bound-policies-list>
</div> </div>
</td>`; </td>`;
} }
} }

View File

@ -89,10 +89,10 @@ export class TransportListPage extends TablePage<NotificationTransport> {
<ak-action-button <ak-action-button
class="pf-m-plain" class="pf-m-plain"
.apiRequest=${() => { .apiRequest=${() => {
return new EventsApi(DEFAULT_CONFIG).eventsTransportsTestCreate({ return new EventsApi(DEFAULT_CONFIG).eventsTransportsTestCreate({
uuid: item.pk || "", uuid: item.pk || "",
}); });
}} }}
> >
<i class="fas fa-vial" aria-hidden="true"></i> <i class="fas fa-vial" aria-hidden="true"></i>
</ak-action-button>`, </ak-action-button>`,

View File

@ -30,7 +30,6 @@ import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList
@customElement("ak-flow-view") @customElement("ak-flow-view")
export class FlowViewPage extends LitElement { export class FlowViewPage extends LitElement {
@property() @property()
set flowSlug(value: string) { set flowSlug(value: string) {
new FlowsApi(DEFAULT_CONFIG) new FlowsApi(DEFAULT_CONFIG)
@ -46,7 +45,16 @@ export class FlowViewPage extends LitElement {
flow!: Flow; flow!: Flow;
static get styles(): CSSResult[] { static get styles(): CSSResult[] {
return [PFBase, PFPage, PFDescriptionList, PFButton, PFCard, PFContent, PFGrid, AKGlobal].concat( return [
PFBase,
PFPage,
PFDescriptionList,
PFButton,
PFCard,
PFContent,
PFGrid,
AKGlobal,
].concat(
css` css`
img.pf-icon { img.pf-icon {
max-height: 24px; max-height: 24px;
@ -75,7 +83,9 @@ export class FlowViewPage extends LitElement {
class="pf-c-page__main-section pf-m-no-padding-mobile" class="pf-c-page__main-section pf-m-no-padding-mobile"
> >
<div class="pf-l-grid pf-m-gutter"> <div class="pf-l-grid pf-m-gutter">
<div class="pf-c-card pf-l-grid__item pf-m-12-col pf-m-2-col-on-xl pf-m-1-col-on-2xl"> <div
class="pf-c-card pf-l-grid__item pf-m-12-col pf-m-2-col-on-xl pf-m-1-col-on-2xl"
>
<div class="pf-c-card__title">${t`Related`}</div> <div class="pf-c-card__title">${t`Related`}</div>
<div class="pf-c-card__body"> <div class="pf-c-card__body">
<dl class="pf-c-description-list"> <dl class="pf-c-description-list">

View File

@ -95,7 +95,9 @@ export class UserViewPage extends LitElement {
class="pf-c-page__main-section pf-m-no-padding-mobile" class="pf-c-page__main-section pf-m-no-padding-mobile"
> >
<div class="pf-l-grid pf-m-gutter"> <div class="pf-l-grid pf-m-gutter">
<div class="pf-c-card pf-l-grid__item pf-m-12-col pf-m-2-col-on-xl pf-m-1-col-on-2xl"> <div
class="pf-c-card pf-l-grid__item pf-m-12-col pf-m-2-col-on-xl pf-m-1-col-on-2xl"
>
<div class="pf-c-card__title">${t`User Info`}</div> <div class="pf-c-card__title">${t`User Info`}</div>
<div class="pf-c-card__body"> <div class="pf-c-card__body">
<dl class="pf-c-description-list"> <dl class="pf-c-description-list">