web: use full import paths for dynamic imports

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-07-01 16:56:23 +02:00
parent e758c434ea
commit c72d56d02d
3 changed files with 49 additions and 41 deletions

View File

@ -299,19 +299,19 @@ export class FlowExecutor extends LitElement implements StageHost {
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-captcha>`; ></ak-stage-captcha>`;
case "ak-stage-consent": case "ak-stage-consent":
await import("./stages/consent/ConsentStage"); await import("@goauthentik/web/flows/stages/consent/ConsentStage");
return html`<ak-stage-consent return html`<ak-stage-consent
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-consent>`; ></ak-stage-consent>`;
case "ak-stage-dummy": case "ak-stage-dummy":
await import("./stages/dummy/DummyStage"); await import("@goauthentik/web/flows/stages/dummy/DummyStage");
return html`<ak-stage-dummy return html`<ak-stage-dummy
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-dummy>`; ></ak-stage-dummy>`;
case "ak-stage-email": case "ak-stage-email":
await import("./stages/email/EmailStage"); await import("@goauthentik/web/flows/stages/email/EmailStage");
return html`<ak-stage-email return html`<ak-stage-email
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
@ -323,25 +323,31 @@ export class FlowExecutor extends LitElement implements StageHost {
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-autosubmit>`; ></ak-stage-autosubmit>`;
case "ak-stage-prompt": case "ak-stage-prompt":
await import("./stages/prompt/PromptStage"); await import("@goauthentik/web/flows/stages/prompt/PromptStage");
return html`<ak-stage-prompt return html`<ak-stage-prompt
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-prompt>`; ></ak-stage-prompt>`;
case "ak-stage-authenticator-totp": case "ak-stage-authenticator-totp":
await import("./stages/authenticator_totp/AuthenticatorTOTPStage"); await import(
"@goauthentik/web/flows/stages/authenticator_totp/AuthenticatorTOTPStage"
);
return html`<ak-stage-authenticator-totp return html`<ak-stage-authenticator-totp
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-authenticator-totp>`; ></ak-stage-authenticator-totp>`;
case "ak-stage-authenticator-duo": case "ak-stage-authenticator-duo":
await import("./stages/authenticator_duo/AuthenticatorDuoStage"); await import(
"@goauthentik/web/flows/stages/authenticator_duo/AuthenticatorDuoStage"
);
return html`<ak-stage-authenticator-duo return html`<ak-stage-authenticator-duo
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-authenticator-duo>`; ></ak-stage-authenticator-duo>`;
case "ak-stage-authenticator-static": case "ak-stage-authenticator-static":
await import("./stages/authenticator_static/AuthenticatorStaticStage"); await import(
"@goauthentik/web/flows/stages/authenticator_static/AuthenticatorStaticStage"
);
return html`<ak-stage-authenticator-static return html`<ak-stage-authenticator-static
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
@ -352,7 +358,9 @@ export class FlowExecutor extends LitElement implements StageHost {
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-authenticator-webauthn>`; ></ak-stage-authenticator-webauthn>`;
case "ak-stage-authenticator-sms": case "ak-stage-authenticator-sms":
await import("./stages/authenticator_sms/AuthenticatorSMSStage"); await import(
"@goauthentik/web/flows/stages/authenticator_sms/AuthenticatorSMSStage"
);
return html`<ak-stage-authenticator-sms return html`<ak-stage-authenticator-sms
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
@ -363,13 +371,13 @@ export class FlowExecutor extends LitElement implements StageHost {
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-authenticator-validate>`; ></ak-stage-authenticator-validate>`;
case "ak-flow-sources-plex": case "ak-flow-sources-plex":
await import("./sources/plex/PlexLoginInit"); await import("@goauthentik/web/flows/sources/plex/PlexLoginInit");
return html`<ak-flow-sources-plex return html`<ak-flow-sources-plex
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-flow-sources-plex>`; ></ak-flow-sources-plex>`;
case "ak-flow-sources-oauth-apple": case "ak-flow-sources-oauth-apple":
await import("./sources/apple/AppleLoginInit"); await import("@goauthentik/web/flows/sources/apple/AppleLoginInit");
return html`<ak-flow-sources-oauth-apple return html`<ak-flow-sources-oauth-apple
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
@ -420,7 +428,7 @@ export class FlowExecutor extends LitElement implements StageHost {
if (!this.inspectorOpen) { if (!this.inspectorOpen) {
return html``; return html``;
} }
await import("./FlowInspector"); await import("@goauthentik/web/flows/FlowInspector");
return html`<ak-flow-inspector return html`<ak-flow-inspector
class="pf-c-drawer__panel pf-m-width-33" class="pf-c-drawer__panel pf-m-width-33"
></ak-flow-inspector>`; ></ak-flow-inspector>`;

View File

@ -14,119 +14,119 @@ export const ROUTES: Route[] = [
return html`<ak-admin-overview></ak-admin-overview>`; return html`<ak-admin-overview></ak-admin-overview>`;
}), }),
new Route(new RegExp("^/administration/dashboard/users$"), async () => { new Route(new RegExp("^/administration/dashboard/users$"), async () => {
await import("./pages/admin-overview/DashboardUserPage"); await import("@goauthentik/web/pages/admin-overview/DashboardUserPage");
return html`<ak-admin-dashboard-users></ak-admin-dashboard-users>`; return html`<ak-admin-dashboard-users></ak-admin-dashboard-users>`;
}), }),
new Route(new RegExp("^/administration/system-tasks$"), async () => { new Route(new RegExp("^/administration/system-tasks$"), async () => {
await import("./pages/system-tasks/SystemTaskListPage"); await import("@goauthentik/web/pages/system-tasks/SystemTaskListPage");
return html`<ak-system-task-list></ak-system-task-list>`; return html`<ak-system-task-list></ak-system-task-list>`;
}), }),
new Route(new RegExp("^/core/providers$"), async () => { new Route(new RegExp("^/core/providers$"), async () => {
await import("./pages/providers/ProviderListPage"); await import("@goauthentik/web/pages/providers/ProviderListPage");
return html`<ak-provider-list></ak-provider-list>`; return html`<ak-provider-list></ak-provider-list>`;
}), }),
new Route(new RegExp(`^/core/providers/(?<id>${ID_REGEX})$`), async (args) => { new Route(new RegExp(`^/core/providers/(?<id>${ID_REGEX})$`), async (args) => {
await import("./pages/providers/ProviderViewPage"); await import("@goauthentik/web/pages/providers/ProviderViewPage");
return html`<ak-provider-view .providerID=${parseInt(args.id, 10)}></ak-provider-view>`; return html`<ak-provider-view .providerID=${parseInt(args.id, 10)}></ak-provider-view>`;
}), }),
new Route(new RegExp("^/core/applications$"), async () => { new Route(new RegExp("^/core/applications$"), async () => {
await import("./pages/applications/ApplicationListPage"); await import("@goauthentik/web/pages/applications/ApplicationListPage");
return html`<ak-application-list></ak-application-list>`; return html`<ak-application-list></ak-application-list>`;
}), }),
new Route(new RegExp(`^/core/applications/(?<slug>${SLUG_REGEX})$`), async (args) => { new Route(new RegExp(`^/core/applications/(?<slug>${SLUG_REGEX})$`), async (args) => {
await import("./pages/applications/ApplicationViewPage"); await import("@goauthentik/web/pages/applications/ApplicationViewPage");
return html`<ak-application-view .applicationSlug=${args.slug}></ak-application-view>`; return html`<ak-application-view .applicationSlug=${args.slug}></ak-application-view>`;
}), }),
new Route(new RegExp("^/core/sources$"), async () => { new Route(new RegExp("^/core/sources$"), async () => {
await import("./pages/sources/SourceListPage"); await import("@goauthentik/web/pages/sources/SourceListPage");
return html`<ak-source-list></ak-source-list>`; return html`<ak-source-list></ak-source-list>`;
}), }),
new Route(new RegExp(`^/core/sources/(?<slug>${SLUG_REGEX})$`), async (args) => { new Route(new RegExp(`^/core/sources/(?<slug>${SLUG_REGEX})$`), async (args) => {
await import("./pages/sources/SourceViewPage"); await import("@goauthentik/web/pages/sources/SourceViewPage");
return html`<ak-source-view .sourceSlug=${args.slug}></ak-source-view>`; return html`<ak-source-view .sourceSlug=${args.slug}></ak-source-view>`;
}), }),
new Route(new RegExp("^/core/property-mappings$"), async () => { new Route(new RegExp("^/core/property-mappings$"), async () => {
await import("./pages/property-mappings/PropertyMappingListPage"); await import("@goauthentik/web/pages/property-mappings/PropertyMappingListPage");
return html`<ak-property-mapping-list></ak-property-mapping-list>`; return html`<ak-property-mapping-list></ak-property-mapping-list>`;
}), }),
new Route(new RegExp("^/core/tokens$"), async () => { new Route(new RegExp("^/core/tokens$"), async () => {
await import("./pages/tokens/TokenListPage"); await import("@goauthentik/web/pages/tokens/TokenListPage");
return html`<ak-token-list></ak-token-list>`; return html`<ak-token-list></ak-token-list>`;
}), }),
new Route(new RegExp("^/core/tenants$"), async () => { new Route(new RegExp("^/core/tenants$"), async () => {
await import("./pages/tenants/TenantListPage"); await import("@goauthentik/web/pages/tenants/TenantListPage");
return html`<ak-tenant-list></ak-tenant-list>`; return html`<ak-tenant-list></ak-tenant-list>`;
}), }),
new Route(new RegExp("^/policy/policies$"), async () => { new Route(new RegExp("^/policy/policies$"), async () => {
await import("./pages/policies/PolicyListPage"); await import("@goauthentik/web/pages/policies/PolicyListPage");
return html`<ak-policy-list></ak-policy-list>`; return html`<ak-policy-list></ak-policy-list>`;
}), }),
new Route(new RegExp("^/policy/reputation$"), async () => { new Route(new RegExp("^/policy/reputation$"), async () => {
await import("./pages/policies/reputation/ReputationListPage"); await import("@goauthentik/web/pages/policies/reputation/ReputationListPage");
return html`<ak-policy-reputation-list></ak-policy-reputation-list>`; return html`<ak-policy-reputation-list></ak-policy-reputation-list>`;
}), }),
new Route(new RegExp("^/identity/groups$"), async () => { new Route(new RegExp("^/identity/groups$"), async () => {
await import("./pages/groups/GroupListPage"); await import("@goauthentik/web/pages/groups/GroupListPage");
return html`<ak-group-list></ak-group-list>`; return html`<ak-group-list></ak-group-list>`;
}), }),
new Route(new RegExp(`^/identity/groups/(?<uuid>${UUID_REGEX})$`), async (args) => { new Route(new RegExp(`^/identity/groups/(?<uuid>${UUID_REGEX})$`), async (args) => {
await import("./pages/groups/GroupViewPage"); await import("@goauthentik/web/pages/groups/GroupViewPage");
return html`<ak-group-view .groupId=${args.uuid}></ak-group-view>`; return html`<ak-group-view .groupId=${args.uuid}></ak-group-view>`;
}), }),
new Route(new RegExp("^/identity/users$"), async () => { new Route(new RegExp("^/identity/users$"), async () => {
await import("./pages/users/UserListPage"); await import("@goauthentik/web/pages/users/UserListPage");
return html`<ak-user-list></ak-user-list>`; return html`<ak-user-list></ak-user-list>`;
}), }),
new Route(new RegExp(`^/identity/users/(?<id>${ID_REGEX})$`), async (args) => { new Route(new RegExp(`^/identity/users/(?<id>${ID_REGEX})$`), async (args) => {
await import("./pages/users/UserViewPage"); await import("@goauthentik/web/pages/users/UserViewPage");
return html`<ak-user-view .userId=${parseInt(args.id, 10)}></ak-user-view>`; return html`<ak-user-view .userId=${parseInt(args.id, 10)}></ak-user-view>`;
}), }),
new Route(new RegExp("^/flow/stages/invitations$"), async () => { new Route(new RegExp("^/flow/stages/invitations$"), async () => {
await import("./pages/stages/invitation/InvitationListPage"); await import("@goauthentik/web/pages/stages/invitation/InvitationListPage");
return html`<ak-stage-invitation-list></ak-stage-invitation-list>`; return html`<ak-stage-invitation-list></ak-stage-invitation-list>`;
}), }),
new Route(new RegExp("^/flow/stages/prompts$"), async () => { new Route(new RegExp("^/flow/stages/prompts$"), async () => {
await import("./pages/stages/prompt/PromptListPage"); await import("@goauthentik/web/pages/stages/prompt/PromptListPage");
return html`<ak-stage-prompt-list></ak-stage-prompt-list>`; return html`<ak-stage-prompt-list></ak-stage-prompt-list>`;
}), }),
new Route(new RegExp("^/flow/stages$"), async () => { new Route(new RegExp("^/flow/stages$"), async () => {
await import("./pages/stages/StageListPage"); await import("@goauthentik/web/pages/stages/StageListPage");
return html`<ak-stage-list></ak-stage-list>`; return html`<ak-stage-list></ak-stage-list>`;
}), }),
new Route(new RegExp("^/flow/flows$"), async () => { new Route(new RegExp("^/flow/flows$"), async () => {
await import("./pages/flows/FlowListPage"); await import("@goauthentik/web/pages/flows/FlowListPage");
return html`<ak-flow-list></ak-flow-list>`; return html`<ak-flow-list></ak-flow-list>`;
}), }),
new Route(new RegExp(`^/flow/flows/(?<slug>${SLUG_REGEX})$`), async (args) => { new Route(new RegExp(`^/flow/flows/(?<slug>${SLUG_REGEX})$`), async (args) => {
await import("./pages/flows/FlowViewPage"); await import("@goauthentik/web/pages/flows/FlowViewPage");
return html`<ak-flow-view .flowSlug=${args.slug}></ak-flow-view>`; return html`<ak-flow-view .flowSlug=${args.slug}></ak-flow-view>`;
}), }),
new Route(new RegExp("^/events/log$"), async () => { new Route(new RegExp("^/events/log$"), async () => {
await import("./pages/events/EventListPage"); await import("@goauthentik/web/pages/events/EventListPage");
return html`<ak-event-list></ak-event-list>`; return html`<ak-event-list></ak-event-list>`;
}), }),
new Route(new RegExp(`^/events/log/(?<id>${UUID_REGEX})$`), async (args) => { new Route(new RegExp(`^/events/log/(?<id>${UUID_REGEX})$`), async (args) => {
await import("./pages/events/EventInfoPage"); await import("@goauthentik/web/pages/events/EventInfoPage");
return html`<ak-event-info-page .eventID=${args.id}></ak-event-info-page>`; return html`<ak-event-info-page .eventID=${args.id}></ak-event-info-page>`;
}), }),
new Route(new RegExp("^/events/transports$"), async () => { new Route(new RegExp("^/events/transports$"), async () => {
await import("./pages/events/TransportListPage"); await import("@goauthentik/web/pages/events/TransportListPage");
return html`<ak-event-transport-list></ak-event-transport-list>`; return html`<ak-event-transport-list></ak-event-transport-list>`;
}), }),
new Route(new RegExp("^/events/rules$"), async () => { new Route(new RegExp("^/events/rules$"), async () => {
await import("./pages/events/RuleListPage"); await import("@goauthentik/web/pages/events/RuleListPage");
return html`<ak-event-rule-list></ak-event-rule-list>`; return html`<ak-event-rule-list></ak-event-rule-list>`;
}), }),
new Route(new RegExp("^/outpost/outposts$"), async () => { new Route(new RegExp("^/outpost/outposts$"), async () => {
await import("./pages/outposts/OutpostListPage"); await import("@goauthentik/web/pages/outposts/OutpostListPage");
return html`<ak-outpost-list></ak-outpost-list>`; return html`<ak-outpost-list></ak-outpost-list>`;
}), }),
new Route(new RegExp("^/outpost/integrations$"), async () => { new Route(new RegExp("^/outpost/integrations$"), async () => {
await import("./pages/outposts/ServiceConnectionListPage"); await import("@goauthentik/web/pages/outposts/ServiceConnectionListPage");
return html`<ak-outpost-service-connection-list></ak-outpost-service-connection-list>`; return html`<ak-outpost-service-connection-list></ak-outpost-service-connection-list>`;
}), }),
new Route(new RegExp("^/crypto/certificates$"), async () => { new Route(new RegExp("^/crypto/certificates$"), async () => {
await import("./pages/crypto/CertificateKeyPairListPage"); await import("@goauthentik/web/pages/crypto/CertificateKeyPairListPage");
return html`<ak-crypto-certificate-list></ak-crypto-certificate-list>`; return html`<ak-crypto-certificate-list></ak-crypto-certificate-list>`;
}), }),
]; ];

View File

@ -9,7 +9,7 @@ export const ROUTES: Route[] = [
new Route(new RegExp("^#.*")).redirect("/library"), new Route(new RegExp("^#.*")).redirect("/library"),
new Route(new RegExp("^/library$"), async () => html`<ak-library></ak-library>`), new Route(new RegExp("^/library$"), async () => html`<ak-library></ak-library>`),
new Route(new RegExp("^/settings$"), async () => { new Route(new RegExp("^/settings$"), async () => {
await import("./user/user-settings/UserSettingsPage"); await import("@goauthentik/web/user/user-settings/UserSettingsPage");
return html`<ak-user-settings></ak-user-settings>`; return html`<ak-user-settings></ak-user-settings>`;
}), }),
]; ];