From 2b9dc4ccd81108e9b526ff6c4ae2ff14cf9d1184 Mon Sep 17 00:00:00 2001 From: Jens L Date: Sun, 3 Sep 2023 03:12:20 +0200 Subject: [PATCH] web/admin: fix circular dependency (#6740) Signed-off-by: Jens Langhammer --- web/src/elements/forms/Form.ts | 9 +-------- web/src/elements/forms/SearchSelect.ts | 2 +- web/src/elements/forms/helpers.ts | 9 +++++++++ 3 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 web/src/elements/forms/helpers.ts diff --git a/web/src/elements/forms/Form.ts b/web/src/elements/forms/Form.ts index c3f3f4b7a..3685084ae 100644 --- a/web/src/elements/forms/Form.ts +++ b/web/src/elements/forms/Form.ts @@ -1,4 +1,5 @@ import { FlowSearch } from "@goauthentik/admin/common/ak-flow-search/FlowSearch"; +import { PreventFormSubmit } from "@goauthentik/app/elements/forms/helpers"; import { EVENT_REFRESH } from "@goauthentik/common/constants"; import { MessageLevel } from "@goauthentik/common/messages"; import { camelToSnake, convertToSlug } from "@goauthentik/common/utils"; @@ -21,14 +22,6 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css"; import { ResponseError, ValidationError, ValidationErrorFromJSON } from "@goauthentik/api"; -export class PreventFormSubmit { - // Stub class which can be returned by form elements to prevent the form from submitting - constructor( - public message: string, - public element?: HorizontalFormElement, - ) {} -} - export class APIError extends Error { constructor(public response: ValidationError) { super(); diff --git a/web/src/elements/forms/SearchSelect.ts b/web/src/elements/forms/SearchSelect.ts index 0aba008ee..6305c8521 100644 --- a/web/src/elements/forms/SearchSelect.ts +++ b/web/src/elements/forms/SearchSelect.ts @@ -1,8 +1,8 @@ +import { PreventFormSubmit } from "@goauthentik/app/elements/forms/helpers"; import { EVENT_REFRESH } from "@goauthentik/common/constants"; import { ascii_letters, digits, groupBy, randomString } from "@goauthentik/common/utils"; import { adaptCSS } from "@goauthentik/common/utils"; import { AKElement } from "@goauthentik/elements/Base"; -import { PreventFormSubmit } from "@goauthentik/elements/forms/Form"; import { CustomEmitterElement } from "@goauthentik/elements/utils/eventEmitter"; import { msg } from "@lit/localize"; diff --git a/web/src/elements/forms/helpers.ts b/web/src/elements/forms/helpers.ts new file mode 100644 index 000000000..50a4c3002 --- /dev/null +++ b/web/src/elements/forms/helpers.ts @@ -0,0 +1,9 @@ +import { HorizontalFormElement } from "@goauthentik/app/elements/forms/HorizontalFormElement"; + +export class PreventFormSubmit { + // Stub class which can be returned by form elements to prevent the form from submitting + constructor( + public message: string, + public element?: HorizontalFormElement, + ) {} +}