web: updating with forms and fixes for eslint complaints.

This commit is contained in:
Ken Sternberg 2023-09-21 14:51:14 -07:00
parent 0a43ea286e
commit a25df9aadc
9 changed files with 27 additions and 26 deletions

View file

@ -93,15 +93,15 @@ export class ApplicationWizardCommitApplication extends BasePanel {
this.response = undefined;
this.commitState = runningState;
const provider = providerModelsList.find(
({ formName }) => formName === this.wizard.providerModel
({ formName }) => formName === this.wizard.providerModel,
);
if (!provider) {
throw new Error(
`Could not determine provider model from user request: ${JSON.stringify(
this.wizard,
null,
2
)}`
2,
)}`,
);
}
@ -117,7 +117,7 @@ export class ApplicationWizardCommitApplication extends BasePanel {
}
async send(
data: TransactionApplicationRequest
data: TransactionApplicationRequest,
): Promise<TransactionApplicationResponse | void> {
this.errors = [];
@ -153,7 +153,7 @@ export class ApplicationWizardCommitApplication extends BasePanel {
${this.errors.length > 0
? html`<ul>
${this.errors.map(
(msg) => html`<li><code>${msg}</code></li>`
(msg) => html`<li><code>${msg}</code></li>`,
)}
</ul>`
: nothing}

View file

@ -1,22 +1,24 @@
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search-no-default";
import "@goauthentik/components/ak-file-input";
import { AkFileInput } from "@goauthentik/components/ak-file-input";
import "@goauthentik/components/ak-text-input";
import "@goauthentik/elements/forms/HorizontalFormElement";
import { msg } from "@lit/localize";
import { customElement } from "@lit/reactive-element/decorators/custom-element.js";
import { html } from "lit";
import { query } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js";
import { FlowsInstancesListDesignationEnum, ProvidersSamlImportMetadataCreateRequest } from "@goauthentik/api";
import {
FlowsInstancesListDesignationEnum,
ProvidersSamlImportMetadataCreateRequest,
} from "@goauthentik/api";
import BaseProviderPanel from "../BaseProviderPanel";
import { query } from "lit/decorators.js";
import { AkFileInput } from "@goauthentik/components/ak-file-input";
@customElement("ak-application-wizard-authentication-by-saml-import")
export class ApplicationWizardProviderSamlImport extends BaseProviderPanel {
@query('ak-file-input[name="metadata"]')
fileInput!: AkFileInput;
@ -32,7 +34,7 @@ export class ApplicationWizardProviderSamlImport extends BaseProviderPanel {
this.dispatchWizardUpdate({
update: {
provider: {
file
file,
},
},
status: this.form.checkValidity() ? "valid" : "invalid",
@ -44,7 +46,9 @@ export class ApplicationWizardProviderSamlImport extends BaseProviderPanel {
}
render() {
const provider = this.wizard.provider as ProvidersSamlImportMetadataCreateRequest | undefined;
const provider = this.wizard.provider as
| ProvidersSamlImportMetadataCreateRequest
| undefined;
return html` <form class="pf-c-form pf-m-horizontal" @input=${this.handleChange}>
<ak-text-input

View file

@ -2,11 +2,11 @@ import {
ApplicationRequest,
LDAPProviderRequest,
OAuth2ProviderRequest,
ProvidersSamlImportMetadataCreateRequest,
ProxyProviderRequest,
RadiusProviderRequest,
SAMLProviderRequest,
SCIMProviderRequest,
ProvidersSamlImportMetadataCreateRequest,
} from "@goauthentik/api";
export type OneOfProvider =

View file

@ -7,7 +7,6 @@ import { CustomListenerElement } from "@goauthentik/elements/utils/eventEmitter"
import { html } from "lit";
import { property, query } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js";
import { FlowsApi, FlowsInstancesListDesignationEnum } from "@goauthentik/api";
import type { Flow, FlowsInstancesListRequest } from "@goauthentik/api";

View file

@ -248,13 +248,8 @@ export class OAuth2ProviderFormPage extends ModelForm<OAuth2Provider, number> {
<ak-form-element-horizontal label=${msg("Signing Key")} name="signingKey">
<!-- NOTE: 'null' cast to 'undefined' on signingKey to satisfy Lit requirements -->
<ak-crypto-certificate-search
<<<<<<< HEAD
certificate=${ifDefined(this.instance?.signingKey ?? undefined)}
singleton
=======
certificate=${ifDefined(this.instance?.signingKey || "")}
?singleton=${!this.instance}
>>>>>>> main
></ak-crypto-certificate-search>
<p class="pf-c-form__helper-text">${msg("Key used to sign the tokens.")}</p>
</ak-form-element-horizontal>

View file

@ -42,7 +42,7 @@ export class AkFileInput extends AKElement {
@query('input[type="file"]')
input!: HTMLInputElement;
get files() {
return this.input.files;
}

View file

@ -1,5 +1,8 @@
import { AKElement } from "@goauthentik/elements/Base";
import { CustomEmitterElement, CustomListenerElement } from "@goauthentik/elements/utils/eventEmitter";
import {
CustomEmitterElement,
CustomListenerElement,
} from "@goauthentik/elements/utils/eventEmitter";
import { html } from "lit";
import { customElement, property, query, state } from "lit/decorators.js";
@ -167,7 +170,7 @@ export class AkWizardMain extends CustomEmitterElement(CustomListenerElement(AKE
case "close": {
this.currentStep = 0;
this.frame.open = false;
this.dispatchCustomEvent('ak-wizard-closed');
this.dispatchCustomEvent("ak-wizard-closed");
}
}
}

View file

@ -83,7 +83,7 @@ export class SearchSelect<T> extends CustomEmitterElement(AKElement) {
this.open = false;
this.shadowRoot
?.querySelectorAll<HTMLInputElement>(
".pf-c-form-control.pf-c-select__toggle-typeahead"
".pf-c-form-control.pf-c-select__toggle-typeahead",
)
.forEach((input) => {
input.blur();
@ -264,7 +264,7 @@ export class SearchSelect<T> extends CustomEmitterElement(AKElement) {
</ul>
</div>`,
this.dropdownContainer,
{ host: this }
{ host: this },
);
}
@ -306,7 +306,7 @@ export class SearchSelect<T> extends CustomEmitterElement(AKElement) {
// Check if we're losing focus to one of our dropdown items, and if such don't blur
if (ev.relatedTarget instanceof HTMLButtonElement) {
const parentMenu = ev.relatedTarget.closest(
"ul.pf-c-dropdown__menu.pf-m-static"
"ul.pf-c-dropdown__menu.pf-m-static",
);
if (parentMenu && parentMenu.id === this.dropdownUID) {
return;

View file

@ -67,7 +67,7 @@ export class LibraryPage extends AKElement {
this.filteredApps = this.apps?.results;
if (this.filteredApps === undefined) {
throw new Error(
"Application.results should never be undefined when passed to the Library Page."
"Application.results should never be undefined when passed to the Library Page.",
);
}
this.addEventListener(SEARCH_UPDATED, this.searchUpdated);
@ -146,7 +146,7 @@ export class LibraryPage extends AKElement {
this.apps,
html`${this.filteredApps.find(appHasLaunchUrl)
? this.renderApps()
: this.renderEmptyState()}`
: this.renderEmptyState()}`,
)}
</section>
</main>`;