From 75d67e0e05bc9a3d1e3ab33953f5bdf776b4992f Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 2 Apr 2021 11:27:49 +0200 Subject: [PATCH] web/elements: add formgroup Signed-off-by: Jens Langhammer --- .github/codecov.yml | 3 ++ web/src/elements/forms/FormGroup.ts | 51 +++++++++++++++++++ web/src/pages/sources/SourceViewPage.ts | 6 +-- .../sources/{ => ldap}/LDAPSourceViewPage.ts | 22 ++++---- .../{ => oauth}/OAuthSourceViewPage.ts | 20 ++++---- .../sources/{ => saml}/SAMLSourceViewPage.ts | 20 ++++---- 6 files changed, 88 insertions(+), 34 deletions(-) create mode 100644 .github/codecov.yml create mode 100644 web/src/elements/forms/FormGroup.ts rename web/src/pages/sources/{ => ldap}/LDAPSourceViewPage.ts (93%) rename web/src/pages/sources/{ => oauth}/OAuthSourceViewPage.ts (94%) rename web/src/pages/sources/{ => saml}/SAMLSourceViewPage.ts (94%) diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000..2d176f2bc --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,3 @@ +coverage: + precision: 2 + round: up diff --git a/web/src/elements/forms/FormGroup.ts b/web/src/elements/forms/FormGroup.ts new file mode 100644 index 000000000..0109be284 --- /dev/null +++ b/web/src/elements/forms/FormGroup.ts @@ -0,0 +1,51 @@ +import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; +import PFBase from "@patternfly/patternfly/patternfly-base.css"; +import PFForm from "@patternfly/patternfly/components/Form/form.css"; +import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css"; +import AKGlobal from "../../authentik.css"; +import PFButton from "@patternfly/patternfly/components/Button/button.css"; + +@customElement("ak-form-group") +export class FormGroup extends LitElement { + + @property({ type: Boolean }) + expanded = false; + + static get styles(): CSSResult[] { + return [PFBase, PFForm, PFButton, PFFormControl, AKGlobal, css` + slot[name=body][hidden] { + display: none !important; + } + `]; + } + + render(): TemplateResult { + return html`
+
+
+ +
+
+
+
+
+
+ +
+
+
+ +
+
+
+ +
`; + } + +} diff --git a/web/src/pages/sources/SourceViewPage.ts b/web/src/pages/sources/SourceViewPage.ts index 3a157492f..b365d8762 100644 --- a/web/src/pages/sources/SourceViewPage.ts +++ b/web/src/pages/sources/SourceViewPage.ts @@ -6,9 +6,9 @@ import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import "../../elements/EmptyState"; -import "./LDAPSourceViewPage"; -import "./OAuthSourceViewPage"; -import "./SAMLSourceViewPage"; +import "./ldap/LDAPSourceViewPage"; +import "./oauth/OAuthSourceViewPage"; +import "./saml/SAMLSourceViewPage"; @customElement("ak-source-view") export class SourceViewPage extends LitElement { diff --git a/web/src/pages/sources/LDAPSourceViewPage.ts b/web/src/pages/sources/ldap/LDAPSourceViewPage.ts similarity index 93% rename from web/src/pages/sources/LDAPSourceViewPage.ts rename to web/src/pages/sources/ldap/LDAPSourceViewPage.ts index fcb7d7584..d261a3a68 100644 --- a/web/src/pages/sources/LDAPSourceViewPage.ts +++ b/web/src/pages/sources/ldap/LDAPSourceViewPage.ts @@ -9,21 +9,21 @@ import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList import PFSizing from "@patternfly/patternfly/utilities/Sizing/sizing.css"; import PFFlex from "@patternfly/patternfly/utilities/Flex/flex.css"; import PFDisplay from "@patternfly/patternfly/utilities/Display/display.css"; -import AKGlobal from "../../authentik.css"; +import AKGlobal from "../../../authentik.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; -import "../../elements/buttons/ModalButton"; -import "../../elements/buttons/SpinnerButton"; -import "../../elements/buttons/ActionButton"; -import "../../elements/CodeMirror"; -import "../../elements/Tabs"; -import "../../elements/events/ObjectChangelog"; -import { Page } from "../../elements/Page"; +import "../../../elements/buttons/ModalButton"; +import "../../../elements/buttons/SpinnerButton"; +import "../../../elements/buttons/ActionButton"; +import "../../../elements/CodeMirror"; +import "../../../elements/Tabs"; +import "../../../elements/events/ObjectChangelog"; +import { Page } from "../../../elements/Page"; import { until } from "lit-html/directives/until"; import { LDAPSource, SourcesApi } from "authentik-api"; -import { DEFAULT_CONFIG } from "../../api/Config"; -import { AdminURLManager } from "../../api/legacy"; -import { EVENT_REFRESH } from "../../constants"; +import { DEFAULT_CONFIG } from "../../../api/Config"; +import { AdminURLManager } from "../../../api/legacy"; +import { EVENT_REFRESH } from "../../../constants"; @customElement("ak-source-ldap-view") export class LDAPSourceViewPage extends Page { diff --git a/web/src/pages/sources/OAuthSourceViewPage.ts b/web/src/pages/sources/oauth/OAuthSourceViewPage.ts similarity index 94% rename from web/src/pages/sources/OAuthSourceViewPage.ts rename to web/src/pages/sources/oauth/OAuthSourceViewPage.ts index 5173d4d62..88bda19a5 100644 --- a/web/src/pages/sources/OAuthSourceViewPage.ts +++ b/web/src/pages/sources/oauth/OAuthSourceViewPage.ts @@ -9,19 +9,19 @@ import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList import PFSizing from "@patternfly/patternfly/utilities/Sizing/sizing.css"; import PFFlex from "@patternfly/patternfly/utilities/Flex/flex.css"; import PFDisplay from "@patternfly/patternfly/utilities/Display/display.css"; -import AKGlobal from "../../authentik.css"; +import AKGlobal from "../../../authentik.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; -import "../../elements/buttons/ModalButton"; -import "../../elements/buttons/SpinnerButton"; -import "../../elements/CodeMirror"; -import "../../elements/Tabs"; -import "../../elements/events/ObjectChangelog"; -import { Page } from "../../elements/Page"; +import "../../../elements/buttons/ModalButton"; +import "../../../elements/buttons/SpinnerButton"; +import "../../../elements/CodeMirror"; +import "../../../elements/Tabs"; +import "../../../elements/events/ObjectChangelog"; +import { Page } from "../../../elements/Page"; import { OAuthSource, SourcesApi } from "authentik-api"; -import { DEFAULT_CONFIG } from "../../api/Config"; -import { AdminURLManager } from "../../api/legacy"; -import { EVENT_REFRESH } from "../../constants"; +import { DEFAULT_CONFIG } from "../../../api/Config"; +import { AdminURLManager } from "../../../api/legacy"; +import { EVENT_REFRESH } from "../../../constants"; @customElement("ak-source-oauth-view") export class OAuthSourceViewPage extends Page { diff --git a/web/src/pages/sources/SAMLSourceViewPage.ts b/web/src/pages/sources/saml/SAMLSourceViewPage.ts similarity index 94% rename from web/src/pages/sources/SAMLSourceViewPage.ts rename to web/src/pages/sources/saml/SAMLSourceViewPage.ts index d3e87052c..de6b650c3 100644 --- a/web/src/pages/sources/SAMLSourceViewPage.ts +++ b/web/src/pages/sources/saml/SAMLSourceViewPage.ts @@ -10,19 +10,19 @@ import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList import PFSizing from "@patternfly/patternfly/utilities/Sizing/sizing.css"; import PFFlex from "@patternfly/patternfly/utilities/Flex/flex.css"; import PFDisplay from "@patternfly/patternfly/utilities/Display/display.css"; -import AKGlobal from "../../authentik.css"; +import AKGlobal from "../../../authentik.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; -import "../../elements/buttons/ModalButton"; -import "../../elements/buttons/SpinnerButton"; -import "../../elements/CodeMirror"; -import "../../elements/Tabs"; -import "../../elements/events/ObjectChangelog"; -import { Page } from "../../elements/Page"; +import "../../../elements/buttons/ModalButton"; +import "../../../elements/buttons/SpinnerButton"; +import "../../../elements/CodeMirror"; +import "../../../elements/Tabs"; +import "../../../elements/events/ObjectChangelog"; +import { Page } from "../../../elements/Page"; import { SAMLSource, SourcesApi } from "authentik-api"; -import { DEFAULT_CONFIG } from "../../api/Config"; -import { AdminURLManager, AppURLManager } from "../../api/legacy"; -import { EVENT_REFRESH } from "../../constants"; +import { DEFAULT_CONFIG } from "../../../api/Config"; +import { AdminURLManager, AppURLManager } from "../../../api/legacy"; +import { EVENT_REFRESH } from "../../../constants"; import { ifDefined } from "lit-html/directives/if-defined"; @customElement("ak-source-saml-view")