web: migrate checkbox to switch (#4409)
* start migrating to switch Signed-off-by: Jens Langhammer <jens@goauthentik.io> * general cleanup Signed-off-by: Jens Langhammer <jens@goauthentik.io> * remove broken Create provider Signed-off-by: Jens Langhammer <jens@goauthentik.io> * migrate all Signed-off-by: Jens Langhammer <jens@goauthentik.io> * migrate table selectors, fix dark theme Signed-off-by: Jens Langhammer <jens@goauthentik.io> Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		@ -205,14 +205,19 @@ export class FlowForm extends ModelForm<Flow, string> {
 | 
			
		||||
                <span slot="header"> ${t`Behavior settings`} </span>
 | 
			
		||||
                <div slot="body" class="pf-c-form">
 | 
			
		||||
                    <ak-form-element-horizontal name="compatibilityMode">
 | 
			
		||||
                        <div class="pf-c-check">
 | 
			
		||||
                        <label class="pf-c-switch">
 | 
			
		||||
                            <input
 | 
			
		||||
                                class="pf-c-switch__input"
 | 
			
		||||
                                type="checkbox"
 | 
			
		||||
                                class="pf-c-check__input"
 | 
			
		||||
                                ?checked=${first(this.instance?.compatibilityMode, false)}
 | 
			
		||||
                            />
 | 
			
		||||
                            <label class="pf-c-check__label"> ${t`Compatibility mode`} </label>
 | 
			
		||||
                        </div>
 | 
			
		||||
                            <span class="pf-c-switch__toggle">
 | 
			
		||||
                                <span class="pf-c-switch__toggle-icon">
 | 
			
		||||
                                    <i class="fas fa-check" aria-hidden="true"></i>
 | 
			
		||||
                                </span>
 | 
			
		||||
                            </span>
 | 
			
		||||
                            <span class="pf-c-switch__label">${t`Compatibility mode`}</span>
 | 
			
		||||
                        </label>
 | 
			
		||||
                        <p class="pf-c-form__helper-text">
 | 
			
		||||
                            ${t`Increases compatibility with password managers and mobile devices.`}
 | 
			
		||||
                        </p>
 | 
			
		||||
@ -333,20 +338,28 @@ export class FlowForm extends ModelForm<Flow, string> {
 | 
			
		||||
                                    ${this.instance?.background
 | 
			
		||||
                                        ? html`
 | 
			
		||||
                                              <ak-form-element-horizontal>
 | 
			
		||||
                                                  <div class="pf-c-check">
 | 
			
		||||
                                                  <label class="pf-c-switch">
 | 
			
		||||
                                                      <input
 | 
			
		||||
                                                          class="pf-c-switch__input"
 | 
			
		||||
                                                          type="checkbox"
 | 
			
		||||
                                                          class="pf-c-check__input"
 | 
			
		||||
                                                          @change=${(ev: Event) => {
 | 
			
		||||
                                                              const target =
 | 
			
		||||
                                                                  ev.target as HTMLInputElement;
 | 
			
		||||
                                                              this.clearBackground = target.checked;
 | 
			
		||||
                                                          }}
 | 
			
		||||
                                                      />
 | 
			
		||||
                                                      <label class="pf-c-check__label">
 | 
			
		||||
                                                          ${t`Clear background image`}
 | 
			
		||||
                                                      </label>
 | 
			
		||||
                                                  </div>
 | 
			
		||||
                                                      <span class="pf-c-switch__toggle">
 | 
			
		||||
                                                          <span class="pf-c-switch__toggle-icon">
 | 
			
		||||
                                                              <i
 | 
			
		||||
                                                                  class="fas fa-check"
 | 
			
		||||
                                                                  aria-hidden="true"
 | 
			
		||||
                                                              ></i>
 | 
			
		||||
                                                          </span>
 | 
			
		||||
                                                      </span>
 | 
			
		||||
                                                      <span class="pf-c-switch__label">
 | 
			
		||||
                                                          ${t`Clear icon`}
 | 
			
		||||
                                                      </span>
 | 
			
		||||
                                                  </label>
 | 
			
		||||
                                                  <p class="pf-c-form__helper-text">
 | 
			
		||||
                                                      ${t`Delete currently set background image.`}
 | 
			
		||||
                                                  </p>
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,7 @@ import "@goauthentik/elements/forms/SearchSelect";
 | 
			
		||||
import { t } from "@lingui/macro";
 | 
			
		||||
 | 
			
		||||
import { TemplateResult, html } from "lit";
 | 
			
		||||
import { customElement, property } from "lit/decorators.js";
 | 
			
		||||
import { customElement, property, state } from "lit/decorators.js";
 | 
			
		||||
import { ifDefined } from "lit/directives/if-defined.js";
 | 
			
		||||
import { until } from "lit/directives/until.js";
 | 
			
		||||
 | 
			
		||||
@ -24,15 +24,20 @@ import {
 | 
			
		||||
 | 
			
		||||
@customElement("ak-stage-binding-form")
 | 
			
		||||
export class StageBindingForm extends ModelForm<FlowStageBinding, string> {
 | 
			
		||||
    loadInstance(pk: string): Promise<FlowStageBinding> {
 | 
			
		||||
        return new FlowsApi(DEFAULT_CONFIG).flowsBindingsRetrieve({
 | 
			
		||||
    async loadInstance(pk: string): Promise<FlowStageBinding> {
 | 
			
		||||
        const binding = await new FlowsApi(DEFAULT_CONFIG).flowsBindingsRetrieve({
 | 
			
		||||
            fsbUuid: pk,
 | 
			
		||||
        });
 | 
			
		||||
        this.defaultOrder = await this.getOrder();
 | 
			
		||||
        return binding;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @property()
 | 
			
		||||
    targetPk?: string;
 | 
			
		||||
 | 
			
		||||
    @state()
 | 
			
		||||
    defaultOrder = 0;
 | 
			
		||||
 | 
			
		||||
    getSuccessMessage(): string {
 | 
			
		||||
        if (this.instance?.pk) {
 | 
			
		||||
            return t`Successfully updated binding.`;
 | 
			
		||||
@ -131,36 +136,45 @@ export class StageBindingForm extends ModelForm<FlowStageBinding, string> {
 | 
			
		||||
                </ak-search-select>
 | 
			
		||||
            </ak-form-element-horizontal>
 | 
			
		||||
            <ak-form-element-horizontal label=${t`Order`} ?required=${true} name="order">
 | 
			
		||||
                <!-- @ts-ignore -->
 | 
			
		||||
                <input
 | 
			
		||||
                    type="number"
 | 
			
		||||
                    value="${until(this.getOrder())}"
 | 
			
		||||
                    value="${first(this.instance?.order, this.defaultOrder)}"
 | 
			
		||||
                    class="pf-c-form-control"
 | 
			
		||||
                    required
 | 
			
		||||
                />
 | 
			
		||||
            </ak-form-element-horizontal>
 | 
			
		||||
            <ak-form-element-horizontal name="evaluateOnPlan">
 | 
			
		||||
                <div class="pf-c-check">
 | 
			
		||||
                <label class="pf-c-switch">
 | 
			
		||||
                    <input
 | 
			
		||||
                        class="pf-c-switch__input"
 | 
			
		||||
                        type="checkbox"
 | 
			
		||||
                        class="pf-c-check__input"
 | 
			
		||||
                        ?checked=${first(this.instance?.evaluateOnPlan, true)}
 | 
			
		||||
                    />
 | 
			
		||||
                    <label class="pf-c-check__label"> ${t`Evaluate on plan`} </label>
 | 
			
		||||
                </div>
 | 
			
		||||
                    <span class="pf-c-switch__toggle">
 | 
			
		||||
                        <span class="pf-c-switch__toggle-icon">
 | 
			
		||||
                            <i class="fas fa-check" aria-hidden="true"></i>
 | 
			
		||||
                        </span>
 | 
			
		||||
                    </span>
 | 
			
		||||
                    <span class="pf-c-switch__label">${t`Evaluate on plan`}</span>
 | 
			
		||||
                </label>
 | 
			
		||||
                <p class="pf-c-form__helper-text">
 | 
			
		||||
                    ${t`Evaluate policies during the Flow planning process. Disable this for input-based policies. Should be used in conjunction with 'Re-evaluate policies', as with both options disabled, policies are **not** evaluated.`}
 | 
			
		||||
                </p>
 | 
			
		||||
            </ak-form-element-horizontal>
 | 
			
		||||
            <ak-form-element-horizontal name="reEvaluatePolicies">
 | 
			
		||||
                <div class="pf-c-check">
 | 
			
		||||
                <label class="pf-c-switch">
 | 
			
		||||
                    <input
 | 
			
		||||
                        class="pf-c-switch__input"
 | 
			
		||||
                        type="checkbox"
 | 
			
		||||
                        class="pf-c-check__input"
 | 
			
		||||
                        ?checked=${first(this.instance?.reEvaluatePolicies, false)}
 | 
			
		||||
                    />
 | 
			
		||||
                    <label class="pf-c-check__label"> ${t`Re-evaluate policies`} </label>
 | 
			
		||||
                </div>
 | 
			
		||||
                    <span class="pf-c-switch__toggle">
 | 
			
		||||
                        <span class="pf-c-switch__toggle-icon">
 | 
			
		||||
                            <i class="fas fa-check" aria-hidden="true"></i>
 | 
			
		||||
                        </span>
 | 
			
		||||
                    </span>
 | 
			
		||||
                    <span class="pf-c-switch__label">${t`Re-evaluate policies`}</span>
 | 
			
		||||
                </label>
 | 
			
		||||
                <p class="pf-c-form__helper-text">
 | 
			
		||||
                    ${t`Evaluate policies before the Stage is present to the user.`}
 | 
			
		||||
                </p>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user