From a25df9aadcc3bdfd7b2170027afc3b091340149c Mon Sep 17 00:00:00 2001 From: Ken Sternberg Date: Thu, 21 Sep 2023 14:51:14 -0700 Subject: [PATCH] web: updating with forms and fixes for eslint complaints. --- .../ak-application-wizard-commit-application.ts | 10 +++++----- ...ation-wizard-authentication-by-saml-import.ts | 16 ++++++++++------ web/src/admin/applications/wizard/types.ts | 2 +- .../admin/common/ak-flow-search/FlowSearch.ts | 1 - .../admin/providers/oauth2/OAuth2ProviderForm.ts | 5 ----- web/src/components/ak-file-input.ts | 2 +- .../components/ak-wizard-main/ak-wizard-main.ts | 7 +++++-- web/src/elements/forms/SearchSelect.ts | 6 +++--- web/src/user/LibraryPage/LibraryPageImpl.ts | 4 ++-- 9 files changed, 27 insertions(+), 26 deletions(-) diff --git a/web/src/admin/applications/wizard/commit/ak-application-wizard-commit-application.ts b/web/src/admin/applications/wizard/commit/ak-application-wizard-commit-application.ts index f42e403f3..7bade4ca3 100644 --- a/web/src/admin/applications/wizard/commit/ak-application-wizard-commit-application.ts +++ b/web/src/admin/applications/wizard/commit/ak-application-wizard-commit-application.ts @@ -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 { this.errors = []; @@ -153,7 +153,7 @@ export class ApplicationWizardCommitApplication extends BasePanel { ${this.errors.length > 0 ? html`` : nothing} diff --git a/web/src/admin/applications/wizard/methods/saml/ak-application-wizard-authentication-by-saml-import.ts b/web/src/admin/applications/wizard/methods/saml/ak-application-wizard-authentication-by-saml-import.ts index e7bd80e31..924aead76 100644 --- a/web/src/admin/applications/wizard/methods/saml/ak-application-wizard-authentication-by-saml-import.ts +++ b/web/src/admin/applications/wizard/methods/saml/ak-application-wizard-authentication-by-saml-import.ts @@ -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`
{ >>>>>> main >

${msg("Key used to sign the tokens.")}

diff --git a/web/src/components/ak-file-input.ts b/web/src/components/ak-file-input.ts index e4d81e013..1fe2117a8 100644 --- a/web/src/components/ak-file-input.ts +++ b/web/src/components/ak-file-input.ts @@ -42,7 +42,7 @@ export class AkFileInput extends AKElement { @query('input[type="file"]') input!: HTMLInputElement; - + get files() { return this.input.files; } diff --git a/web/src/components/ak-wizard-main/ak-wizard-main.ts b/web/src/components/ak-wizard-main/ak-wizard-main.ts index 9db54cf43..bb6296a5e 100644 --- a/web/src/components/ak-wizard-main/ak-wizard-main.ts +++ b/web/src/components/ak-wizard-main/ak-wizard-main.ts @@ -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"); } } } diff --git a/web/src/elements/forms/SearchSelect.ts b/web/src/elements/forms/SearchSelect.ts index 0ba66650e..6c8865ca1 100644 --- a/web/src/elements/forms/SearchSelect.ts +++ b/web/src/elements/forms/SearchSelect.ts @@ -83,7 +83,7 @@ export class SearchSelect extends CustomEmitterElement(AKElement) { this.open = false; this.shadowRoot ?.querySelectorAll( - ".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 extends CustomEmitterElement(AKElement) { `, this.dropdownContainer, - { host: this } + { host: this }, ); } @@ -306,7 +306,7 @@ export class SearchSelect 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; diff --git a/web/src/user/LibraryPage/LibraryPageImpl.ts b/web/src/user/LibraryPage/LibraryPageImpl.ts index 2f54bedd0..79fc8d609 100644 --- a/web/src/user/LibraryPage/LibraryPageImpl.ts +++ b/web/src/user/LibraryPage/LibraryPageImpl.ts @@ -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()}`, )} `;