web: fix colourstyles not being included in common_styles

This commit is contained in:
Jens Langhammer 2021-02-27 17:26:20 +01:00
parent 1a052913e9
commit 5b4e75000b
7 changed files with 31 additions and 35 deletions

View File

@ -10,7 +10,7 @@ from authentik.lib.config import CONFIG
def get_geoip_reader() -> Optional[Reader]: def get_geoip_reader() -> Optional[Reader]:
"""Get GeoIP Reader, if configured, otherwise none""" """Get GeoIP Reader, if configured, otherwise none"""
path = CONFIG.y("authentik.geoip") path = CONFIG.y("authentik.geoip")
if path == "": if path == "" or not path:
return None return None
return Reader(path) return Reader(path)

View File

@ -1,3 +1,4 @@
import { css, CSSResult } from "lit-element";
// @ts-ignore // @ts-ignore
import PF from "@patternfly/patternfly/patternfly.css"; import PF from "@patternfly/patternfly/patternfly.css";
// @ts-ignore // @ts-ignore
@ -6,10 +7,31 @@ import PFAddons from "@patternfly/patternfly/patternfly-addons.css";
import FA from "@fortawesome/fontawesome-free/css/fontawesome.css"; import FA from "@fortawesome/fontawesome-free/css/fontawesome.css";
// @ts-ignore // @ts-ignore
import AKGlobal from "../authentik.css"; import AKGlobal from "../authentik.css";
import { CSSResult } from "lit-element";
// @ts-ignore // @ts-ignore
import CodeMirrorStyle from "codemirror/lib/codemirror.css"; import CodeMirrorStyle from "codemirror/lib/codemirror.css";
// @ts-ignore // @ts-ignore
import CodeMirrorTheme from "codemirror/theme/monokai.css"; import CodeMirrorTheme from "codemirror/theme/monokai.css";
export const ColorStyles = css`
export const COMMON_STYLES: CSSResult[] = [PF, PFAddons, FA, AKGlobal, CodeMirrorStyle, CodeMirrorTheme]; .pf-m-success {
color: var(--pf-global--success-color--100);
}
.pf-c-button.pf-m-success {
color: var(--pf-c-button--m-primary--Color);
background-color: var(--pf-global--success-color--100);
}
.pf-m-warning {
color: var(--pf-global--warning-color--100);
}
.pf-c-button.pf-m-warning {
color: var(--pf-c-button--m-primary--Color);
background-color: var(--pf-global--warning-color--100);
}
.pf-m-danger {
color: var(--pf-global--danger-color--100);
}
.pf-c-button.pf-m-danger {
color: var(--pf-c-button--m-primary--Color);
background-color: var(--pf-global--danger-color--100);
}
`;
export const COMMON_STYLES: CSSResult[] = [PF, PFAddons, FA, AKGlobal, CodeMirrorStyle, CodeMirrorTheme, ColorStyles];

View File

@ -1,31 +1,6 @@
import { css } from "lit-element";
export const PRIMARY_CLASS = "pf-m-primary"; export const PRIMARY_CLASS = "pf-m-primary";
export const SUCCESS_CLASS = "pf-m-success"; export const SUCCESS_CLASS = "pf-m-success";
export const ERROR_CLASS = "pf-m-danger"; export const ERROR_CLASS = "pf-m-danger";
export const PROGRESS_CLASS = "pf-m-in-progress"; export const PROGRESS_CLASS = "pf-m-in-progress";
export const CURRENT_CLASS = "pf-m-current"; export const CURRENT_CLASS = "pf-m-current";
export const ColorStyles = css`
.pf-m-success {
color: var(--pf-global--success-color--100);
}
.pf-c-button.pf-m-success {
color: var(--pf-c-button--m-primary--Color);
background-color: var(--pf-global--success-color--100);
}
.pf-m-warning {
color: var(--pf-global--warning-color--100);
}
.pf-c-button.pf-m-warning {
color: var(--pf-c-button--m-primary--Color);
background-color: var(--pf-global--warning-color--100);
}
.pf-m-danger {
color: var(--pf-global--danger-color--100);
}
.pf-c-button.pf-m-danger {
color: var(--pf-c-button--m-primary--Color);
background-color: var(--pf-global--danger-color--100);
}
`;
export const VERSION = "2021.2.5-stable"; export const VERSION = "2021.2.5-stable";

View File

@ -5,7 +5,8 @@ import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css";
import ButtonStyle from "@patternfly/patternfly/components/Button/button.css"; import ButtonStyle from "@patternfly/patternfly/components/Button/button.css";
// @ts-ignore // @ts-ignore
import SpinnerStyle from "@patternfly/patternfly/components/Spinner/spinner.css"; import SpinnerStyle from "@patternfly/patternfly/components/Spinner/spinner.css";
import { ColorStyles, PRIMARY_CLASS, PROGRESS_CLASS } from "../../constants"; import { PRIMARY_CLASS, PROGRESS_CLASS } from "../../constants";
import { ColorStyles } from "../../common/styles";
@customElement("ak-spinner-button") @customElement("ak-spinner-button")
export class SpinnerButton extends LitElement { export class SpinnerButton extends LitElement {

View File

@ -4,7 +4,8 @@ import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css";
// @ts-ignore // @ts-ignore
import ButtonStyle from "@patternfly/patternfly/components/Button/button.css"; import ButtonStyle from "@patternfly/patternfly/components/Button/button.css";
import { Token } from "../../api/Tokens"; import { Token } from "../../api/Tokens";
import { ColorStyles, ERROR_CLASS, PRIMARY_CLASS, SUCCESS_CLASS } from "../../constants"; import { ERROR_CLASS, PRIMARY_CLASS, SUCCESS_CLASS } from "../../constants";
import { ColorStyles } from "../../common/styles";
@customElement("ak-token-copy-button") @customElement("ak-token-copy-button")
export class TokenCopyButton extends LitElement { export class TokenCopyButton extends LitElement {

View File

@ -2,7 +2,6 @@ import { gettext } from "django";
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { ifDefined } from "lit-html/directives/if-defined"; import { ifDefined } from "lit-html/directives/if-defined";
import { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
import { ColorStyles } from "../../constants";
@customElement("ak-aggregate-card") @customElement("ak-aggregate-card")
export class AggregateCard extends LitElement { export class AggregateCard extends LitElement {
@ -25,7 +24,7 @@ export class AggregateCard extends LitElement {
text-align: center; text-align: center;
color: var(--pf-global--Color--100); color: var(--pf-global--Color--100);
} }
`, ColorStyles]); `]);
} }
renderInner(): TemplateResult { renderInner(): TemplateResult {

View File

@ -3,7 +3,6 @@ import { css, CSSResult, customElement, html, LitElement, property, TemplateResu
import CodeMirrorStyle from "codemirror/lib/codemirror.css"; import CodeMirrorStyle from "codemirror/lib/codemirror.css";
// @ts-ignore // @ts-ignore
import CodeMirrorTheme from "codemirror/theme/monokai.css"; import CodeMirrorTheme from "codemirror/theme/monokai.css";
import { ColorStyles } from "../../constants";
import { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
import { Route } from "./Route"; import { Route } from "./Route";
import { ROUTES } from "../../routes"; import { ROUTES } from "../../routes";
@ -24,7 +23,6 @@ export class RouterOutlet extends LitElement {
return [ return [
CodeMirrorStyle, CodeMirrorStyle,
CodeMirrorTheme, CodeMirrorTheme,
ColorStyles,
css` css`
:host { :host {
height: 100vh; height: 100vh;